summaryrefslogtreecommitdiff
path: root/ext/url
diff options
context:
space:
mode:
Diffstat (limited to 'ext/url')
-rw-r--r--ext/url/00_url.js30
-rw-r--r--ext/url/01_urlpattern.js20
2 files changed, 31 insertions, 19 deletions
diff --git a/ext/url/00_url.js b/ext/url/00_url.js
index 65a45dca1..f200d3b11 100644
--- a/ext/url/00_url.js
+++ b/ext/url/00_url.js
@@ -6,9 +6,14 @@
/// <reference path="../webidl/internal.d.ts" />
import { core, primordials } from "ext:core/mod.js";
-const ops = core.ops;
-import * as webidl from "ext:deno_webidl/00_webidl.js";
-import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
+const {
+ op_url_get_serialization,
+ op_url_parse,
+ op_url_parse_search_params,
+ op_url_parse_with_base,
+ op_url_reparse,
+ op_url_stringify_search_params,
+} = core.ensureFastOps();
const {
ArrayIsArray,
ArrayPrototypeMap,
@@ -28,6 +33,9 @@ const {
Uint32Array,
} = primordials;
+import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
+
const _list = Symbol("list");
const _urlObject = Symbol("url object");
@@ -50,7 +58,7 @@ const SET_USERNAME = 8;
* @returns {string}
*/
function opUrlReparse(href, setter, value) {
- const status = ops.op_url_reparse(
+ const status = op_url_reparse(
href,
setter,
value,
@@ -66,9 +74,9 @@ function opUrlReparse(href, setter, value) {
*/
function opUrlParse(href, maybeBase) {
if (maybeBase === undefined) {
- return ops.op_url_parse(href, componentsBuf);
+ return op_url_parse(href, componentsBuf);
}
- return ops.op_url_parse_with_base(
+ return op_url_parse_with_base(
href,
maybeBase,
componentsBuf,
@@ -85,7 +93,7 @@ function getSerialization(status, href, maybeBase) {
if (status === 0) {
return href;
} else if (status === 1) {
- return ops.op_url_get_serialization();
+ return op_url_get_serialization();
} else {
throw new TypeError(
`Invalid URL: '${href}'` +
@@ -123,7 +131,7 @@ class URLSearchParams {
if (init[0] == "?") {
init = StringPrototypeSlice(init, 1);
}
- this[_list] = ops.op_url_parse_search_params(init);
+ this[_list] = op_url_parse_search_params(init);
} else if (ArrayIsArray(init)) {
// Overload: sequence<sequence<USVString>>
this[_list] = ArrayPrototypeMap(init, (pair, i) => {
@@ -314,7 +322,7 @@ class URLSearchParams {
*/
toString() {
webidl.assertBranded(this, URLSearchParamsPrototype);
- return ops.op_url_stringify_search_params(this[_list]);
+ return op_url_stringify_search_params(this[_list]);
}
get size() {
@@ -436,7 +444,7 @@ class URL {
#updateSearchParams() {
if (this.#queryObject !== null) {
const params = this.#queryObject[_list];
- const newParams = ops.op_url_parse_search_params(
+ const newParams = op_url_parse_search_params(
StringPrototypeSlice(this.search, 1),
);
ArrayPrototypeSplice(
@@ -823,7 +831,7 @@ const URLPrototype = URL.prototype;
* @returns {[string, string][]}
*/
function parseUrlEncoded(bytes) {
- return ops.op_url_parse_search_params(null, bytes);
+ return op_url_parse_search_params(null, bytes);
}
webidl
diff --git a/ext/url/01_urlpattern.js b/ext/url/01_urlpattern.js
index f39028520..586465459 100644
--- a/ext/url/01_urlpattern.js
+++ b/ext/url/01_urlpattern.js
@@ -8,9 +8,10 @@
/// <reference path="./lib.deno_url.d.ts" />
import { core, primordials } from "ext:core/mod.js";
-const ops = core.ops;
-import * as webidl from "ext:deno_webidl/00_webidl.js";
-import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
+const {
+ op_urlpattern_parse,
+ op_urlpattern_process_match_input,
+} = core.ensureFastOps();
const {
ArrayPrototypePush,
MathRandom,
@@ -26,6 +27,9 @@ const {
TypeError,
} = primordials;
+import * as webidl from "ext:deno_webidl/00_webidl.js";
+import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
+
const _components = Symbol("components");
/**
@@ -152,7 +156,7 @@ class URLPattern {
baseURL = webidl.converters.USVString(baseURL, prefix, "Argument 2");
}
- const components = ops.op_urlpattern_parse(input, baseURL);
+ const components = op_urlpattern_parse(input, baseURL);
for (let i = 0; i < COMPONENTS_KEYS.length; ++i) {
const key = COMPONENTS_KEYS[i];
@@ -225,9 +229,9 @@ class URLPattern {
const res = baseURL === undefined
? matchInputCache.getOrInsert(
input,
- ops.op_urlpattern_process_match_input,
+ op_urlpattern_process_match_input,
)
- : ops.op_urlpattern_process_match_input(input, baseURL);
+ : op_urlpattern_process_match_input(input, baseURL);
if (res === null) return false;
const values = res[0];
@@ -267,9 +271,9 @@ class URLPattern {
const res = baseURL === undefined
? matchInputCache.getOrInsert(
input,
- ops.op_urlpattern_process_match_input,
+ op_urlpattern_process_match_input,
)
- : ops.op_urlpattern_process_match_input(input, baseURL);
+ : op_urlpattern_process_match_input(input, baseURL);
if (res === null) {
return null;
}