diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-02-01 18:06:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 18:06:11 +0100 |
commit | 8176a4d1663529fb8aeebf7734c4994fa1d583f4 (patch) | |
tree | 94c7d6eb2679e641f59cf78640340f5b7af0022e /ext/url/00_url.js | |
parent | abf89f8c4675ed78c992fafd6d758bf4bfca8a1a (diff) |
refactor: primordials for instanceof (#13527)
Diffstat (limited to 'ext/url/00_url.js')
-rw-r--r-- | ext/url/00_url.js | 66 |
1 files changed, 35 insertions, 31 deletions
diff --git a/ext/url/00_url.js b/ext/url/00_url.js index 4bba06ce1..110890b7f 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -134,7 +134,7 @@ * @param {string} value */ append(name, value) { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); const prefix = "Failed to execute 'append' on 'URLSearchParams'"; webidl.requiredArguments(arguments.length, 2, { prefix }); name = webidl.converters.USVString(name, { @@ -153,7 +153,7 @@ * @param {string} name */ delete(name) { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); const prefix = "Failed to execute 'append' on 'URLSearchParams'"; webidl.requiredArguments(arguments.length, 1, { prefix }); name = webidl.converters.USVString(name, { @@ -177,7 +177,7 @@ * @returns {string[]} */ getAll(name) { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); const prefix = "Failed to execute 'getAll' on 'URLSearchParams'"; webidl.requiredArguments(arguments.length, 1, { prefix }); name = webidl.converters.USVString(name, { @@ -198,7 +198,7 @@ * @return {string | null} */ get(name) { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); const prefix = "Failed to execute 'get' on 'URLSearchParams'"; webidl.requiredArguments(arguments.length, 1, { prefix }); name = webidl.converters.USVString(name, { @@ -218,7 +218,7 @@ * @return {boolean} */ has(name) { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); const prefix = "Failed to execute 'has' on 'URLSearchParams'"; webidl.requiredArguments(arguments.length, 1, { prefix }); name = webidl.converters.USVString(name, { @@ -233,7 +233,7 @@ * @param {string} value */ set(name, value) { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); const prefix = "Failed to execute 'set' on 'URLSearchParams'"; webidl.requiredArguments(arguments.length, 2, { prefix }); name = webidl.converters.USVString(name, { @@ -276,7 +276,7 @@ } sort() { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); ArrayPrototypeSort( this[_list], (a, b) => (a[0] === b[0] ? 0 : a[0] > b[0] ? 1 : -1), @@ -288,7 +288,7 @@ * @return {string} */ toString() { - webidl.assertBranded(this, URLSearchParams); + webidl.assertBranded(this, URLSearchParamsPrototype); return core.opSync("op_url_stringify_search_params", this[_list]); } } @@ -296,6 +296,7 @@ webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1); webidl.configurePrototype(URLSearchParams); + const URLSearchParamsPrototype = URLSearchParams.prototype; const _url = Symbol("url"); @@ -350,13 +351,13 @@ /** @return {string} */ get hash() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].hash; } /** @param {string} value */ set hash(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'hash' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -372,13 +373,13 @@ /** @return {string} */ get host() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].host; } /** @param {string} value */ set host(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'host' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -394,13 +395,13 @@ /** @return {string} */ get hostname() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].hostname; } /** @param {string} value */ set hostname(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'hostname' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -416,13 +417,13 @@ /** @return {string} */ get href() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].href; } /** @param {string} value */ set href(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'href' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -435,19 +436,19 @@ /** @return {string} */ get origin() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].origin; } /** @return {string} */ get password() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].password; } /** @param {string} value */ set password(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'password' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -463,13 +464,13 @@ /** @return {string} */ get pathname() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].pathname; } /** @param {string} value */ set pathname(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'pathname' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -485,13 +486,13 @@ /** @return {string} */ get port() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].port; } /** @param {string} value */ set port(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'port' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -507,13 +508,13 @@ /** @return {string} */ get protocol() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].protocol; } /** @param {string} value */ set protocol(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'protocol' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -529,13 +530,13 @@ /** @return {string} */ get search() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].search; } /** @param {string} value */ set search(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'search' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -552,13 +553,13 @@ /** @return {string} */ get username() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].username; } /** @param {string} value */ set username(value) { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); const prefix = "Failed to set 'username' on 'URL'"; webidl.requiredArguments(arguments.length, 1, { prefix }); value = webidl.converters.DOMString(value, { @@ -583,18 +584,19 @@ /** @return {string} */ toString() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].href; } /** @return {string} */ toJSON() { - webidl.assertBranded(this, URL); + webidl.assertBranded(this, URLPrototype); return this[_url].href; } } webidl.configurePrototype(URL); + const URLPrototype = URL.prototype; /** * This function implements application/x-www-form-urlencoded parsing. @@ -622,7 +624,9 @@ window.__bootstrap.url = { URL, + URLPrototype, URLSearchParams, + URLSearchParamsPrototype, parseUrlEncoded, }; })(this); |