2023-01-02 16:00:42 -05:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2021-07-02 08:08:28 -04:00
|
|
|
|
|
|
|
// @ts-check
|
|
|
|
/// <reference path="../../core/internal.d.ts" />
|
|
|
|
/// <reference path="../../core/lib.deno_core.d.ts" />
|
|
|
|
/// <reference path="../webidl/internal.d.ts" />
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
const core = globalThis.Deno.core;
|
|
|
|
const ops = core.ops;
|
2023-03-08 06:44:54 -05:00
|
|
|
import * as webidl from "ext:deno_webidl/00_webidl.js";
|
2023-02-07 14:22:46 -05:00
|
|
|
const primordials = globalThis.__bootstrap.primordials;
|
|
|
|
const {
|
|
|
|
ArrayIsArray,
|
|
|
|
ArrayPrototypeMap,
|
|
|
|
ArrayPrototypePush,
|
|
|
|
ArrayPrototypeSome,
|
|
|
|
ArrayPrototypeSort,
|
|
|
|
ArrayPrototypeSplice,
|
|
|
|
ObjectKeys,
|
|
|
|
SafeArrayIterator,
|
|
|
|
StringPrototypeSlice,
|
2023-05-01 09:30:02 -04:00
|
|
|
StringPrototypeStartsWith,
|
2023-02-07 14:22:46 -05:00
|
|
|
Symbol,
|
|
|
|
SymbolFor,
|
|
|
|
SymbolIterator,
|
|
|
|
TypeError,
|
2023-05-01 09:30:02 -04:00
|
|
|
Uint32Array,
|
2023-02-07 14:22:46 -05:00
|
|
|
} = primordials;
|
|
|
|
|
|
|
|
const _list = Symbol("list");
|
|
|
|
const _urlObject = Symbol("url object");
|
|
|
|
|
|
|
|
// WARNING: must match rust code's UrlSetter::*
|
|
|
|
const SET_HASH = 0;
|
|
|
|
const SET_HOST = 1;
|
|
|
|
const SET_HOSTNAME = 2;
|
|
|
|
const SET_PASSWORD = 3;
|
|
|
|
const SET_PATHNAME = 4;
|
|
|
|
const SET_PORT = 5;
|
|
|
|
const SET_PROTOCOL = 6;
|
|
|
|
const SET_SEARCH = 7;
|
|
|
|
const SET_USERNAME = 8;
|
|
|
|
|
|
|
|
// Helper functions
|
2023-04-04 07:34:12 -04:00
|
|
|
/**
|
|
|
|
* @param {string} href
|
|
|
|
* @param {number} setter
|
|
|
|
* @param {string} value
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2023-02-07 14:22:46 -05:00
|
|
|
function opUrlReparse(href, setter, value) {
|
|
|
|
const status = ops.op_url_reparse(
|
|
|
|
href,
|
|
|
|
setter,
|
|
|
|
value,
|
2023-03-03 08:34:10 -05:00
|
|
|
componentsBuf,
|
2023-02-07 14:22:46 -05:00
|
|
|
);
|
|
|
|
return getSerialization(status, href);
|
|
|
|
}
|
|
|
|
|
2023-04-04 07:34:12 -04:00
|
|
|
/**
|
|
|
|
* @param {string} href
|
|
|
|
* @param {string} [maybeBase]
|
|
|
|
* @returns {number}
|
|
|
|
*/
|
2023-02-07 14:22:46 -05:00
|
|
|
function opUrlParse(href, maybeBase) {
|
|
|
|
if (maybeBase === undefined) {
|
2023-04-04 07:34:12 -04:00
|
|
|
return ops.op_url_parse(href, componentsBuf);
|
2021-08-19 07:41:47 -04:00
|
|
|
}
|
2023-04-04 07:34:12 -04:00
|
|
|
return ops.op_url_parse_with_base(
|
|
|
|
href,
|
|
|
|
maybeBase,
|
|
|
|
componentsBuf,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
|
|
|
|
2023-04-04 07:34:12 -04:00
|
|
|
/**
|
|
|
|
* @param {number} status
|
|
|
|
* @param {string} href
|
|
|
|
* @param {string} [maybeBase]
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2023-02-07 14:22:46 -05:00
|
|
|
function getSerialization(status, href, maybeBase) {
|
|
|
|
if (status === 0) {
|
|
|
|
return href;
|
|
|
|
} else if (status === 1) {
|
|
|
|
return ops.op_url_get_serialization();
|
|
|
|
} else {
|
|
|
|
throw new TypeError(
|
|
|
|
`Invalid URL: '${href}'` +
|
|
|
|
(maybeBase ? ` with base '${maybeBase}'` : ""),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2022-09-09 23:45:16 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
class URLSearchParams {
|
|
|
|
[_list];
|
|
|
|
[_urlObject] = null;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string | [string][] | Record<string, string>} init
|
|
|
|
*/
|
|
|
|
constructor(init = "") {
|
|
|
|
const prefix = "Failed to construct 'URL'";
|
|
|
|
init = webidl.converters
|
|
|
|
["sequence<sequence<USVString>> or record<USVString, USVString> or USVString"](
|
|
|
|
init,
|
2023-05-01 06:47:13 -04:00
|
|
|
prefix,
|
|
|
|
"Argument 1",
|
2023-02-07 14:22:46 -05:00
|
|
|
);
|
|
|
|
this[webidl.brand] = webidl.brand;
|
|
|
|
if (!init) {
|
|
|
|
// if there is no query string, return early
|
|
|
|
this[_list] = [];
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof init === "string") {
|
|
|
|
// Overload: USVString
|
|
|
|
// If init is a string and starts with U+003F (?),
|
|
|
|
// remove the first code point from init.
|
|
|
|
if (init[0] == "?") {
|
|
|
|
init = StringPrototypeSlice(init, 1);
|
|
|
|
}
|
|
|
|
this[_list] = ops.op_url_parse_search_params(init);
|
|
|
|
} else if (ArrayIsArray(init)) {
|
|
|
|
// Overload: sequence<sequence<USVString>>
|
|
|
|
this[_list] = ArrayPrototypeMap(init, (pair, i) => {
|
|
|
|
if (pair.length !== 2) {
|
|
|
|
throw new TypeError(
|
|
|
|
`${prefix}: Item ${
|
|
|
|
i + 0
|
|
|
|
} in the parameter list does have length 2 exactly.`,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return [pair[0], pair[1]];
|
|
|
|
});
|
2022-09-09 23:45:16 -04:00
|
|
|
} else {
|
2023-02-07 14:22:46 -05:00
|
|
|
// Overload: record<USVString, USVString>
|
|
|
|
this[_list] = ArrayPrototypeMap(
|
|
|
|
ObjectKeys(init),
|
|
|
|
(key) => [key, init[key]],
|
2022-09-09 23:45:16 -04:00
|
|
|
);
|
|
|
|
}
|
2021-08-19 07:41:47 -04:00
|
|
|
}
|
2022-09-09 23:45:16 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
#updateUrlSearch() {
|
|
|
|
const url = this[_urlObject];
|
|
|
|
if (url === null) {
|
|
|
|
return;
|
2022-09-09 23:45:16 -04:00
|
|
|
}
|
2023-06-05 15:57:01 -04:00
|
|
|
// deno-lint-ignore prefer-primordials
|
2023-02-07 14:22:46 -05:00
|
|
|
url[_updateUrlSearch](this.toString());
|
2021-08-18 17:21:33 -04:00
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @param {string} value
|
|
|
|
*/
|
|
|
|
append(name, value) {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
const prefix = "Failed to execute 'append' on 'URLSearchParams'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 2, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
name = webidl.converters.USVString(name, prefix, "Argument 1");
|
|
|
|
value = webidl.converters.USVString(value, prefix, "Argument 2");
|
2023-02-07 14:22:46 -05:00
|
|
|
ArrayPrototypePush(this[_list], [name, value]);
|
|
|
|
this.#updateUrlSearch();
|
|
|
|
}
|
2021-06-16 12:40:35 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
2023-07-02 11:26:48 -04:00
|
|
|
* @param {string} [value]
|
2023-02-07 14:22:46 -05:00
|
|
|
*/
|
2023-07-02 11:26:48 -04:00
|
|
|
delete(name, value = undefined) {
|
2023-02-07 14:22:46 -05:00
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
const prefix = "Failed to execute 'append' on 'URLSearchParams'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
name = webidl.converters.USVString(name, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
const list = this[_list];
|
|
|
|
let i = 0;
|
2023-07-02 11:26:48 -04:00
|
|
|
if (value === undefined) {
|
|
|
|
while (i < list.length) {
|
|
|
|
if (list[i][0] === name) {
|
|
|
|
ArrayPrototypeSplice(list, i, 1);
|
|
|
|
} else {
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
value = webidl.converters.USVString(value, prefix, "Argument 2");
|
|
|
|
while (i < list.length) {
|
|
|
|
if (list[i][0] === name && list[i][1] === value) {
|
|
|
|
ArrayPrototypeSplice(list, i, 1);
|
|
|
|
} else {
|
|
|
|
i++;
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#updateUrlSearch();
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @returns {string[]}
|
|
|
|
*/
|
|
|
|
getAll(name) {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
const prefix = "Failed to execute 'getAll' on 'URLSearchParams'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
name = webidl.converters.USVString(name, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
const values = [];
|
|
|
|
const entries = this[_list];
|
|
|
|
for (let i = 0; i < entries.length; ++i) {
|
|
|
|
const entry = entries[i];
|
|
|
|
if (entry[0] === name) {
|
|
|
|
ArrayPrototypePush(values, entry[1]);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2021-05-27 19:33:11 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
return values;
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @return {string | null}
|
|
|
|
*/
|
|
|
|
get(name) {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
const prefix = "Failed to execute 'get' on 'URLSearchParams'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
name = webidl.converters.USVString(name, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
const entries = this[_list];
|
|
|
|
for (let i = 0; i < entries.length; ++i) {
|
|
|
|
const entry = entries[i];
|
|
|
|
if (entry[0] === name) {
|
|
|
|
return entry[1];
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
return null;
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/**
|
|
|
|
* @param {string} name
|
2023-07-02 11:26:48 -04:00
|
|
|
* @param {string} [value]
|
2023-02-07 14:22:46 -05:00
|
|
|
* @return {boolean}
|
|
|
|
*/
|
2023-07-02 11:26:48 -04:00
|
|
|
has(name, value = undefined) {
|
2023-02-07 14:22:46 -05:00
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
const prefix = "Failed to execute 'has' on 'URLSearchParams'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
name = webidl.converters.USVString(name, prefix, "Argument 1");
|
2023-07-02 11:26:48 -04:00
|
|
|
if (value !== undefined) {
|
|
|
|
value = webidl.converters.USVString(value, prefix, "Argument 2");
|
|
|
|
return ArrayPrototypeSome(
|
|
|
|
this[_list],
|
|
|
|
(entry) => entry[0] === name && entry[1] === value,
|
|
|
|
);
|
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
return ArrayPrototypeSome(this[_list], (entry) => entry[0] === name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @param {string} value
|
|
|
|
*/
|
|
|
|
set(name, value) {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
const prefix = "Failed to execute 'set' on 'URLSearchParams'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 2, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
name = webidl.converters.USVString(name, prefix, "Argument 1");
|
|
|
|
value = webidl.converters.USVString(value, prefix, "Argument 2");
|
2023-02-07 14:22:46 -05:00
|
|
|
|
|
|
|
const list = this[_list];
|
|
|
|
|
|
|
|
// If there are any name-value pairs whose name is name, in list,
|
|
|
|
// set the value of the first such name-value pair to value
|
|
|
|
// and remove the others.
|
|
|
|
let found = false;
|
|
|
|
let i = 0;
|
|
|
|
while (i < list.length) {
|
|
|
|
if (list[i][0] === name) {
|
|
|
|
if (!found) {
|
|
|
|
list[i][1] = value;
|
|
|
|
found = true;
|
2020-07-19 13:49:44 -04:00
|
|
|
i++;
|
2023-02-07 14:22:46 -05:00
|
|
|
} else {
|
|
|
|
ArrayPrototypeSplice(list, i, 1);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
} else {
|
|
|
|
i++;
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
// Otherwise, append a new name-value pair whose name is name
|
|
|
|
// and value is value, to list.
|
|
|
|
if (!found) {
|
|
|
|
ArrayPrototypePush(list, [name, value]);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#updateUrlSearch();
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
sort() {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
ArrayPrototypeSort(
|
|
|
|
this[_list],
|
|
|
|
(a, b) => (a[0] === b[0] ? 0 : a[0] > b[0] ? 1 : -1),
|
|
|
|
);
|
|
|
|
this.#updateUrlSearch();
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/**
|
|
|
|
* @return {string}
|
|
|
|
*/
|
|
|
|
toString() {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
return ops.op_url_stringify_search_params(this[_list]);
|
|
|
|
}
|
2023-03-14 16:28:33 -04:00
|
|
|
|
|
|
|
get size() {
|
|
|
|
webidl.assertBranded(this, URLSearchParamsPrototype);
|
|
|
|
return this[_list].length;
|
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1);
|
|
|
|
|
|
|
|
webidl.configurePrototype(URLSearchParams);
|
|
|
|
const URLSearchParamsPrototype = URLSearchParams.prototype;
|
|
|
|
|
|
|
|
webidl.converters["URLSearchParams"] = webidl.createInterfaceConverter(
|
|
|
|
"URLSearchParams",
|
|
|
|
URLSearchParamsPrototype,
|
|
|
|
);
|
|
|
|
|
|
|
|
const _updateUrlSearch = Symbol("updateUrlSearch");
|
|
|
|
|
|
|
|
function trim(s) {
|
|
|
|
if (s.length === 1) return "";
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2023-03-22 21:34:14 -04:00
|
|
|
// Represents a "no port" value. A port in URL cannot be greater than 2^16 - 1
|
2023-02-07 14:22:46 -05:00
|
|
|
const NO_PORT = 65536;
|
|
|
|
|
|
|
|
const componentsBuf = new Uint32Array(8);
|
|
|
|
class URL {
|
|
|
|
#queryObject = null;
|
|
|
|
#serialization;
|
|
|
|
#schemeEnd;
|
|
|
|
#usernameEnd;
|
|
|
|
#hostStart;
|
|
|
|
#hostEnd;
|
|
|
|
#port;
|
|
|
|
#pathStart;
|
|
|
|
#queryStart;
|
|
|
|
#fragmentStart;
|
|
|
|
|
|
|
|
[_updateUrlSearch](value) {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_SEARCH,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} url
|
2023-04-04 07:34:12 -04:00
|
|
|
* @param {string} [base]
|
2023-02-07 14:22:46 -05:00
|
|
|
*/
|
|
|
|
constructor(url, base = undefined) {
|
|
|
|
const prefix = "Failed to construct 'URL'";
|
2023-04-30 06:24:34 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
url = webidl.converters.DOMString(url, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
if (base !== undefined) {
|
2023-05-01 06:47:13 -04:00
|
|
|
base = webidl.converters.DOMString(base, prefix, "Argument 2");
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
|
|
|
this[webidl.brand] = webidl.brand;
|
2023-04-04 07:34:12 -04:00
|
|
|
const status = opUrlParse(url, base);
|
|
|
|
this.#serialization = getSerialization(status, url, base);
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#updateComponents();
|
|
|
|
}
|
2021-06-16 12:40:35 -04:00
|
|
|
|
2023-04-04 07:34:12 -04:00
|
|
|
/**
|
|
|
|
* @param {string} url
|
|
|
|
* @param {string} [base]
|
|
|
|
*/
|
|
|
|
static canParse(url, base = undefined) {
|
|
|
|
const prefix = "Failed to call 'URL.canParse'";
|
2023-04-30 06:24:34 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
url = webidl.converters.DOMString(url, prefix, "Argument 1");
|
2023-04-04 07:34:12 -04:00
|
|
|
if (base !== undefined) {
|
2023-05-01 06:47:13 -04:00
|
|
|
base = webidl.converters.DOMString(base, prefix, "Argument 2");
|
2023-04-04 07:34:12 -04:00
|
|
|
}
|
|
|
|
const status = opUrlParse(url, base);
|
|
|
|
return status === 0 || status === 1;
|
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
#updateComponents() {
|
|
|
|
({
|
|
|
|
0: this.#schemeEnd,
|
|
|
|
1: this.#usernameEnd,
|
|
|
|
2: this.#hostStart,
|
|
|
|
3: this.#hostEnd,
|
|
|
|
4: this.#port,
|
|
|
|
5: this.#pathStart,
|
|
|
|
6: this.#queryStart,
|
|
|
|
7: this.#fragmentStart,
|
|
|
|
} = componentsBuf);
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
[SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) {
|
|
|
|
const object = {
|
|
|
|
href: this.href,
|
|
|
|
origin: this.origin,
|
|
|
|
protocol: this.protocol,
|
|
|
|
username: this.username,
|
|
|
|
password: this.password,
|
|
|
|
host: this.host,
|
|
|
|
hostname: this.hostname,
|
|
|
|
port: this.port,
|
|
|
|
pathname: this.pathname,
|
|
|
|
hash: this.hash,
|
|
|
|
search: this.search,
|
|
|
|
};
|
|
|
|
return `${this.constructor.name} ${inspect(object, inspectOptions)}`;
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
#updateSearchParams() {
|
|
|
|
if (this.#queryObject !== null) {
|
|
|
|
const params = this.#queryObject[_list];
|
|
|
|
const newParams = ops.op_url_parse_search_params(
|
|
|
|
StringPrototypeSlice(this.search, 1),
|
|
|
|
);
|
|
|
|
ArrayPrototypeSplice(
|
|
|
|
params,
|
|
|
|
0,
|
|
|
|
params.length,
|
|
|
|
...new SafeArrayIterator(newParams),
|
2021-07-02 08:08:28 -04:00
|
|
|
);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
#hasAuthority() {
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/lib.rs#L824
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeStartsWith(
|
|
|
|
StringPrototypeSlice(this.#serialization, this.#schemeEnd),
|
|
|
|
"://",
|
|
|
|
);
|
2022-09-09 23:45:16 -04:00
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get hash() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/quirks.rs#L263
|
|
|
|
return this.#fragmentStart
|
2023-05-01 09:30:02 -04:00
|
|
|
? trim(StringPrototypeSlice(this.#serialization, this.#fragmentStart))
|
2023-02-07 14:22:46 -05:00
|
|
|
: "";
|
|
|
|
}
|
2022-09-09 23:45:16 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set hash(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'hash' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
2022-09-09 23:45:16 -04:00
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
2023-02-07 14:22:46 -05:00
|
|
|
SET_HASH,
|
2022-09-09 23:45:16 -04:00
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
2023-02-07 14:22:46 -05:00
|
|
|
} catch {
|
|
|
|
/* pass */
|
2022-09-09 23:45:16 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2021-06-16 12:40:35 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get host() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/quirks.rs#L101
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
|
|
|
this.#hostStart,
|
|
|
|
this.#pathStart,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/** @param {string} value */
|
|
|
|
set host(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'host' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_HOST,
|
|
|
|
value,
|
|
|
|
);
|
2022-09-09 23:45:16 -04:00
|
|
|
this.#updateComponents();
|
2023-02-07 14:22:46 -05:00
|
|
|
} catch {
|
|
|
|
/* pass */
|
2022-09-09 23:45:16 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2022-09-09 23:45:16 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get hostname() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/lib.rs#L988
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
|
|
|
this.#hostStart,
|
|
|
|
this.#hostEnd,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set hostname(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'hostname' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_HOSTNAME,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get href() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
return this.#serialization;
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set href(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'href' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-04-04 07:34:12 -04:00
|
|
|
const status = opUrlParse(value);
|
|
|
|
this.#serialization = getSerialization(status, value);
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#updateComponents();
|
|
|
|
this.#updateSearchParams();
|
|
|
|
}
|
2022-09-09 23:45:16 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get origin() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/origin.rs#L14
|
2023-05-01 09:30:02 -04:00
|
|
|
const scheme = StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
|
|
|
0,
|
|
|
|
this.#schemeEnd,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
if (
|
|
|
|
scheme === "http" || scheme === "https" || scheme === "ftp" ||
|
|
|
|
scheme === "ws" || scheme === "wss"
|
|
|
|
) {
|
|
|
|
return `${scheme}://${this.host}`;
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
if (scheme === "blob") {
|
|
|
|
// TODO(@littledivy): Fast path.
|
2021-03-01 20:30:24 -05:00
|
|
|
try {
|
2023-02-07 14:22:46 -05:00
|
|
|
return new URL(this.pathname).origin;
|
2021-03-01 20:30:24 -05:00
|
|
|
} catch {
|
2023-02-07 14:22:46 -05:00
|
|
|
return "null";
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
return "null";
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get password() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/lib.rs#L914
|
|
|
|
if (
|
|
|
|
this.#hasAuthority() &&
|
|
|
|
this.#usernameEnd !== this.#serialization.length &&
|
|
|
|
this.#serialization[this.#usernameEnd] === ":"
|
|
|
|
) {
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#usernameEnd + 1,
|
|
|
|
this.#hostStart - 1,
|
|
|
|
);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
return "";
|
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set password(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'password' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_PASSWORD,
|
|
|
|
value,
|
|
|
|
);
|
2022-09-09 23:45:16 -04:00
|
|
|
this.#updateComponents();
|
2023-02-07 14:22:46 -05:00
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get pathname() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/lib.rs#L1203
|
|
|
|
if (!this.#queryStart && !this.#fragmentStart) {
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(this.#serialization, this.#pathStart);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
const nextComponentStart = this.#queryStart || this.#fragmentStart;
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
|
|
|
this.#pathStart,
|
|
|
|
nextComponentStart,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set pathname(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'pathname' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_PATHNAME,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get port() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/quirks.rs#L196
|
|
|
|
if (this.#port === NO_PORT) {
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
|
|
|
this.#hostEnd,
|
|
|
|
this.#pathStart,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
} else {
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#hostEnd + 1, /* : */
|
|
|
|
this.#pathStart,
|
|
|
|
);
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set port(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'port' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_PORT,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get protocol() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/quirks.rs#L56
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
|
|
|
0,
|
|
|
|
this.#schemeEnd + 1, /* : */
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set protocol(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'protocol' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_PROTOCOL,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get search() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/quirks.rs#L249
|
|
|
|
const afterPath = this.#queryStart || this.#fragmentStart ||
|
|
|
|
this.#serialization.length;
|
|
|
|
const afterQuery = this.#fragmentStart || this.#serialization.length;
|
2023-05-01 09:30:02 -04:00
|
|
|
return trim(
|
|
|
|
StringPrototypeSlice(this.#serialization, afterPath, afterQuery),
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set search(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'search' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_SEARCH,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
this.#updateSearchParams();
|
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get username() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
// https://github.com/servo/rust-url/blob/1d307ae51a28fecc630ecec03380788bfb03a643/url/src/lib.rs#L881
|
2023-06-26 09:10:27 -04:00
|
|
|
const schemeSeparatorLen = 3; /* :// */
|
2023-02-07 14:22:46 -05:00
|
|
|
if (
|
|
|
|
this.#hasAuthority() &&
|
2023-06-26 09:10:27 -04:00
|
|
|
this.#usernameEnd > this.#schemeEnd + schemeSeparatorLen
|
2023-02-07 14:22:46 -05:00
|
|
|
) {
|
2023-05-01 09:30:02 -04:00
|
|
|
return StringPrototypeSlice(
|
|
|
|
this.#serialization,
|
2023-06-26 09:10:27 -04:00
|
|
|
this.#schemeEnd + schemeSeparatorLen,
|
2023-02-07 14:22:46 -05:00
|
|
|
this.#usernameEnd,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return "";
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @param {string} value */
|
|
|
|
set username(value) {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
const prefix = "Failed to set 'username' on 'URL'";
|
2023-04-12 15:58:57 -04:00
|
|
|
webidl.requiredArguments(arguments.length, 1, prefix);
|
2023-05-01 06:47:13 -04:00
|
|
|
value = webidl.converters.DOMString(value, prefix, "Argument 1");
|
2023-02-07 14:22:46 -05:00
|
|
|
try {
|
|
|
|
this.#serialization = opUrlReparse(
|
|
|
|
this.#serialization,
|
|
|
|
SET_USERNAME,
|
|
|
|
value,
|
|
|
|
);
|
|
|
|
this.#updateComponents();
|
|
|
|
} catch {
|
|
|
|
/* pass */
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2020-07-19 13:49:44 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
get searchParams() {
|
|
|
|
if (this.#queryObject == null) {
|
|
|
|
this.#queryObject = new URLSearchParams(this.search);
|
|
|
|
this.#queryObject[_urlObject] = this;
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
2023-02-07 14:22:46 -05:00
|
|
|
return this.#queryObject;
|
2020-07-19 13:49:44 -04:00
|
|
|
}
|
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
toString() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
return this.#serialization;
|
|
|
|
}
|
2021-06-16 12:40:35 -04:00
|
|
|
|
2023-02-07 14:22:46 -05:00
|
|
|
/** @return {string} */
|
|
|
|
toJSON() {
|
|
|
|
webidl.assertBranded(this, URLPrototype);
|
|
|
|
return this.#serialization;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
webidl.configurePrototype(URL);
|
|
|
|
const URLPrototype = URL.prototype;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function implements application/x-www-form-urlencoded parsing.
|
|
|
|
* https://url.spec.whatwg.org/#concept-urlencoded-parser
|
|
|
|
* @param {Uint8Array} bytes
|
|
|
|
* @returns {[string, string][]}
|
|
|
|
*/
|
|
|
|
function parseUrlEncoded(bytes) {
|
|
|
|
return ops.op_url_parse_search_params(null, bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
webidl
|
|
|
|
.converters[
|
|
|
|
"sequence<sequence<USVString>> or record<USVString, USVString> or USVString"
|
2023-05-01 06:47:13 -04:00
|
|
|
] = (V, prefix, context, opts) => {
|
2023-02-07 14:22:46 -05:00
|
|
|
// Union for (sequence<sequence<USVString>> or record<USVString, USVString> or USVString)
|
|
|
|
if (webidl.type(V) === "Object" && V !== null) {
|
|
|
|
if (V[SymbolIterator] !== undefined) {
|
2023-05-01 06:47:13 -04:00
|
|
|
return webidl.converters["sequence<sequence<USVString>>"](
|
|
|
|
V,
|
|
|
|
prefix,
|
|
|
|
context,
|
|
|
|
opts,
|
|
|
|
);
|
2021-06-16 12:40:35 -04:00
|
|
|
}
|
2023-05-01 06:47:13 -04:00
|
|
|
return webidl.converters["record<USVString, USVString>"](
|
|
|
|
V,
|
|
|
|
prefix,
|
|
|
|
context,
|
|
|
|
opts,
|
|
|
|
);
|
2023-02-07 14:22:46 -05:00
|
|
|
}
|
2023-05-01 06:47:13 -04:00
|
|
|
return webidl.converters.USVString(V, prefix, context, opts);
|
2020-07-19 13:49:44 -04:00
|
|
|
};
|
2023-02-07 14:22:46 -05:00
|
|
|
|
|
|
|
export {
|
|
|
|
parseUrlEncoded,
|
|
|
|
URL,
|
|
|
|
URLPrototype,
|
|
|
|
URLSearchParams,
|
|
|
|
URLSearchParamsPrototype,
|
|
|
|
};
|