diff --git a/README.md b/README.md index c8182c17..b23dc2bd 100644 --- a/README.md +++ b/README.md @@ -258,7 +258,7 @@ Returns a boolean indicating whether _value_ is an instance of the wrapper class This is useful in other parts of your program that are not implementation class files, but instead receive wrapper classes from client code. -#### `convert(value, { context })` +#### `convert(globalObject, value, { context })` Performs the Web IDL conversion algorithm for this interface, converting _value_ into the correct representation of the interface type suitable for consumption by implementation classes: the corresponding impl. @@ -296,13 +296,13 @@ jsdom does this for `Window`, which is written in custom, non-webidl2js-generate ### For callback interfaces -#### `convert(value, { context })` +#### `convert(globalObject, value, { context })` -Performs the Web IDL conversion algorithm for this callback interface, converting _value_ into a function that performs [call a user object's operation](https://heycam.github.io/webidl/#call-a-user-objects-operation) when called, with _thisArg_ being the `this` value of the converted function. +Performs the Web IDL conversion algorithm for this callback interface, converting `value` into a function that performs [call a user object's operation](https://heycam.github.io/webidl/#call-a-user-objects-operation) when called, with _thisArg_ being the `this` value of the converted function. `globalObject` is used to ensure error cases result in `Error` or `Promise` objects from the correct realm. -The resulting function has an _objectReference_ property, which is the same object as _value_ and can be used to perform identity checks, as `convert` returns a new function object every time. +The resulting function has an `objectReference` property, which is the same object as `value` and can be used to perform identity checks, as `convert` returns a new function object every time. -If any part of the conversion fails, _context_ can be used to describe the provided value in any resulting error message. +If any part of the conversion fails, `context` can be used to describe the provided value in any resulting error message. #### `install(globalObject, globalNames)` @@ -312,11 +312,11 @@ The second argument `globalNames` is the same as for [the `install()` export for ### For dictionaries -#### `convert(value, { context })` +#### `convert(globalObject, value, { context })` -Performs the Web IDL conversion algorithm for this dictionary, converting _value_ into the correct representation of the dictionary type suitable for consumption by implementation classes: a `null`-[[Prototype]] object with its properties properly converted. +Performs the Web IDL conversion algorithm for this dictionary, converting `value` into the correct representation of the dictionary type suitable for consumption by implementation classes: a `null`-[[Prototype]] object with its properties properly converted. `globalObject` is used to ensure error cases result in `Error` or `Promise` objects from the correct realm. -If any part of the conversion fails, _context_ can be used to describe the provided value in any resulting error message. +If any part of the conversion fails, `context` can be used to describe the provided value in any resulting error message. ### Other requirements diff --git a/lib/constructs/async-iterable.js b/lib/constructs/async-iterable.js index 7ba3cefa..db7b1c82 100644 --- a/lib/constructs/async-iterable.js +++ b/lib/constructs/async-iterable.js @@ -38,7 +38,7 @@ class AsyncIterable { this.interface.addMethod(this.interface.defaultWhence, key, [], ` if (!exports.is(this)) { - throw new TypeError("'${key}' called on an object that is not a valid instance of ${this.interface.name}."); + throw new globalObject.TypeError("'${key}' called on an object that is not a valid instance of ${this.interface.name}."); } ${conv.body} diff --git a/lib/constructs/attribute.js b/lib/constructs/attribute.js index b209ffe2..b96afc39 100644 --- a/lib/constructs/attribute.js +++ b/lib/constructs/attribute.js @@ -35,11 +35,11 @@ class Attribute { const async = this.idl.idlType.generic === "Promise"; const promiseHandlingBefore = async ? `try {` : ``; - const promiseHandlingAfter = async ? `} catch (e) { return Promise.reject(e); }` : ``; + const promiseHandlingAfter = async ? `} catch (e) { return globalObject.Promise.reject(e); }` : ``; let brandCheck = ` if (!exports.is(esValue)) { - throw new TypeError("'$KEYWORD$ ${this.idl.name}' called on an object that is not a valid instance of ${this.interface.name}."); + throw new globalObject.TypeError("'$KEYWORD$ ${this.idl.name}' called on an object that is not a valid instance of ${this.interface.name}."); } `; let getterBody = `return utils.tryWrapperForImpl(esValue[implSymbol]["${this.idl.name}"]);`; @@ -150,7 +150,7 @@ class Attribute { setterBody = ` const Q = esValue["${this.idl.name}"]; if (!utils.isObject(Q)) { - throw new TypeError("Property '${this.idl.name}' is not an object"); + throw new globalObject.TypeError("Property '${this.idl.name}' is not an object"); } `; @@ -180,7 +180,7 @@ class Attribute { addMethod("toString", [], ` const esValue = this; if (!exports.is(esValue)) { - throw new TypeError("'toString' called on an object that is not a valid instance of ${this.interface.name}."); + throw new globalObject.TypeError("'toString' called on an object that is not a valid instance of ${this.interface.name}."); } ${getterBody} diff --git a/lib/constructs/callback-function.js b/lib/constructs/callback-function.js index 06394485..33370848 100644 --- a/lib/constructs/callback-function.js +++ b/lib/constructs/callback-function.js @@ -25,7 +25,7 @@ class CallbackFunction { "" : ` if (typeof value !== "function") { - throw new TypeError(context + " is not a function"); + throw new globalObject.TypeError(context + " is not a function"); } `; @@ -109,7 +109,7 @@ class CallbackFunction { } this.str += ` - exports.convert = (value, { context = "The provided value" } = {}) => { + exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { ${assertCallable} function invokeTheCallbackFunction(${inputArgs}) { const thisArg = utils.tryWrapperForImpl(this); @@ -144,7 +144,7 @@ class CallbackFunction { if (isAsync) { this.str += ` } catch (err) { - return Promise.reject(err); + return globalObject.Promise.reject(err); } `; } diff --git a/lib/constructs/callback-interface.js b/lib/constructs/callback-interface.js index 1e39c00c..263746fa 100644 --- a/lib/constructs/callback-interface.js +++ b/lib/constructs/callback-interface.js @@ -94,9 +94,9 @@ class CallbackInterface { } this.str += ` - exports.convert = function convert(value, { context = "The provided value" } = {}) { + exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation(${argNames.join(", ")}) { @@ -115,7 +115,7 @@ class CallbackInterface { if (typeof O !== "function") { X = O[${utils.stringifyPropertyName(opName)}]; if (typeof X !== "function") { - throw new TypeError(\`\${context} does not correctly implement ${name}.\`) + throw new globalObject.TypeError(\`\${context} does not correctly implement ${name}.\`) } thisArg = O; } @@ -151,7 +151,7 @@ class CallbackInterface { if (isAsync) { this.str += ` } catch (err) { - return Promise.reject(err); + return globalObject.Promise.reject(err); } `; } @@ -215,8 +215,9 @@ class CallbackInterface { return; } + const ctorRegistry = utils.initCtorRegistry(globalObject); const ${name} = () => { - throw new TypeError("Illegal invocation"); + throw new globalObject.TypeError("Illegal invocation"); }; `; diff --git a/lib/constructs/dictionary.js b/lib/constructs/dictionary.js index 1db90c05..95dd62ae 100644 --- a/lib/constructs/dictionary.js +++ b/lib/constructs/dictionary.js @@ -55,7 +55,7 @@ class Dictionary { if (field.required) { str += ` else { - throw new TypeError("${field.name} is required in '${this.name}'"); + throw new globalObject.TypeError("${field.name} is required in '${this.name}'"); } `; } else if (field.default) { @@ -76,12 +76,12 @@ class Dictionary { generate() { this.str += ` - exports._convertInherit = (obj, ret, { context = "The provided value" } = {}) => { + exports._convertInherit = (globalObject, obj, ret, { context = "The provided value" } = {}) => { `; if (this.idl.inheritance) { this.str += ` - ${this.idl.inheritance}._convertInherit(obj, ret, { context }); + ${this.idl.inheritance}._convertInherit(globalObject, obj, ret, { context }); `; } @@ -89,13 +89,13 @@ class Dictionary { ${this._generateConversions()} }; - exports.convert = function convert(obj, { context = "The provided value" } = {}) { + exports.convert = (globalObject, obj, { context = "The provided value" } = {}) => { if (obj !== undefined && typeof obj !== "object" && typeof obj !== "function") { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } const ret = Object.create(null); - exports._convertInherit(obj, ret, { context }); + exports._convertInherit(globalObject, obj, ret, { context }); return ret; }; `; diff --git a/lib/constructs/enumeration.js b/lib/constructs/enumeration.js index 20e13af0..a92aa050 100644 --- a/lib/constructs/enumeration.js +++ b/lib/constructs/enumeration.js @@ -18,10 +18,10 @@ class Enumeration { const enumerationValues = new Set(${JSON.stringify([...values])}); exports.enumerationValues = enumerationValues; - exports.convert = function convert(value, { context = "The provided value" } = {}) { + exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { const string = \`\${value}\`; if (!enumerationValues.has(string)) { - throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for ${this.name}\`); + throw new globalObject.TypeError(\`\${context} '\${string}' is not a valid enumeration value for ${this.name}\`); } return string; }; diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js index 8526b883..a32990d4 100644 --- a/lib/constructs/interface.js +++ b/lib/constructs/interface.js @@ -53,7 +53,6 @@ class Interface { this.namedSetter = null; this.namedDeleter = null; this.stringifier = null; - this.needsPerGlobalProxyHandler = false; this.iterable = null; this._analyzed = false; @@ -237,17 +236,11 @@ class Interface { throw new Error(`${msg}duplicated indexed setter`); } this.indexedSetter = member; - if (utils.hasCEReactions(member)) { - this.needsPerGlobalProxyHandler = true; - } } else if (isNamed(member)) { if (this.namedSetter) { throw new Error(`${msg}duplicated named setter`); } this.namedSetter = member; - if (utils.hasCEReactions(member)) { - this.needsPerGlobalProxyHandler = true; - } } else { throw new Error(`${msg}setter is neither indexed nor named`); } @@ -267,9 +260,6 @@ class Interface { throw new Error(`${msg}duplicated named deleter`); } this.namedDeleter = member; - if (utils.hasCEReactions(member)) { - this.needsPerGlobalProxyHandler = true; - } } else { throw new Error(`${msg}deleter is not named`); } @@ -437,12 +427,12 @@ class Interface { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject(new TypeError("next() called on a value that is not a ${this.name} async iterator object")); + return globalObject.Promise.reject(new globalObject.TypeError("next() called on a value that is not a ${this.name} async iterator object")); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -484,12 +474,12 @@ class Interface { return(value) { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject(new TypeError("return() called on a value that is not a ${this.name} async iterator object")); + return globalObject.Promise.reject(new globalObject.TypeError("return() called on a value that is not a ${this.name} async iterator object")); } const returnSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value, done: true })); } internal.isFinished = true; @@ -522,7 +512,7 @@ class Interface { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - throw new TypeError("next() called on a value that is not a ${this.name} iterator object"); + throw new globalObject.TypeError("next() called on a value that is not a ${this.name} iterator object"); } const { target, kind, index } = internal; @@ -606,11 +596,11 @@ class Interface { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; - exports.convert = (value, { context = "The provided value" } = {}) => { + exports.convert = (globalObject, value, { context = "The provided value" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type '${this.name}'.\`); + throw new globalObject.TypeError(\`\${context} is not of type '${this.name}'.\`); }; `; @@ -780,21 +770,13 @@ class Interface { return prolog + invocation; }; - let sep = ""; - if (this.needsPerGlobalProxyHandler) { - this.str += ` - const proxyHandlerCache = new WeakMap(); - class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - `; - } else { - this.str += ` - const proxyHandler = { - `; - sep = ","; - } + this.str += ` + const proxyHandlerCache = new WeakMap(); + class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + `; // [[Get]] (necessary because of proxy semantics) this.str += ` @@ -818,7 +800,7 @@ class Interface { return undefined; } return Reflect.apply(getter, receiver, []); - }${sep} + } `; // [[HasProperty]] (necessary because of proxy semantics) @@ -836,7 +818,7 @@ class Interface { return Reflect.has(parent, P); } return false; - }${sep} + } `; // [[OwnPropertyKeys]] @@ -867,7 +849,7 @@ class Interface { keys.add(key); } return [...keys]; - }${sep} + } `; // [[GetOwnProperty]] @@ -941,7 +923,7 @@ class Interface { } this.str += ` return Reflect.getOwnPropertyDescriptor(target, P); - }${sep} + } `; // [[Set]] @@ -955,11 +937,9 @@ class Interface { if (target[implSymbol][utils.wrapperSymbol] === receiver) { `; - if (this.needsPerGlobalProxyHandler) { - this.str += ` - const globalObject = this._globalObject; - `; - } + this.str += ` + const globalObject = this._globalObject; + `; if (this.supportsIndexedProperties && hasIndexedSetter) { this.str += ` @@ -1043,7 +1023,7 @@ class Interface { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }${sep} + } `; // [[DefineOwnProperty]] @@ -1054,11 +1034,9 @@ class Interface { } `; - if (this.needsPerGlobalProxyHandler) { - this.str += ` - const globalObject = this._globalObject; - `; - } + this.str += ` + const globalObject = this._globalObject; + `; if (this.supportsIndexedProperties) { this.str += ` @@ -1138,7 +1116,7 @@ class Interface { `; } this.str += ` - }${sep} + } `; // [[Delete]] @@ -1149,11 +1127,9 @@ class Interface { } `; - if (this.needsPerGlobalProxyHandler) { - this.str += ` - const globalObject = this._globalObject; - `; - } + this.str += ` + const globalObject = this._globalObject; + `; if (this.supportsIndexedProperties) { this.str += ` @@ -1200,7 +1176,7 @@ class Interface { } this.str += ` return Reflect.deleteProperty(target, P); - }${sep} + } `; // [[PreventExtensions]] @@ -1235,24 +1211,19 @@ class Interface { let setWrapperToProxy = ``; if (this.isLegacyPlatformObj) { - setWrapperToProxy = ` - wrapper = new Proxy(wrapper, proxyHandler);`; - - if (this.needsPerGlobalProxyHandler) { - this.str += ` - function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); + this.str += ` + function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); } - `; + return new Proxy(wrapper, proxyHandler); + } + `; - setWrapperToProxy = ` - wrapper = makeProxy(wrapper, globalObject);`; - } + setWrapperToProxy = ` + wrapper = makeProxy(wrapper, globalObject);`; } this.str += ` @@ -1364,7 +1335,7 @@ class Interface { `; } else { body = ` - throw new TypeError("Illegal constructor"); + throw new globalObject.TypeError("Illegal constructor"); `; } @@ -1386,7 +1357,7 @@ class Interface { // Don't bother checking "length" attribute as interfaces that support indexed properties must implement one. // "Has value iterator" implies "supports indexed properties". if (this.supportsIndexedProperties) { - this.addProperty(this.defaultWhence, Symbol.iterator, 'ctorRegistry["%Array%"].prototype[Symbol.iterator]'); + this.addProperty(this.defaultWhence, Symbol.iterator, "globalObject.Array.prototype[Symbol.iterator]"); } } diff --git a/lib/constructs/iterable.js b/lib/constructs/iterable.js index 6cddb05e..ff3a9206 100644 --- a/lib/constructs/iterable.js +++ b/lib/constructs/iterable.js @@ -25,7 +25,7 @@ class Iterable { generateFunction(key, kind) { this.interface.addMethod(this.interface.defaultWhence, key, [], ` if (!exports.is(this)) { - throw new TypeError("'${key}' called on an object that is not a valid instance of ${this.interface.name}."); + throw new globalObject.TypeError("'${key}' called on an object that is not a valid instance of ${this.interface.name}."); } return exports.createDefaultIterator(globalObject, this, "${kind}"); `); @@ -42,13 +42,12 @@ class Iterable { this.interface.addProperty(whence, Symbol.iterator, `${this.interface.name}.prototype.entries`); this.interface.addMethod(whence, "forEach", ["callback"], ` if (!exports.is(this)) { - throw new TypeError("'forEach' called on an object that is not a valid instance of ${this.interface.name}."); + throw new globalObject.TypeError("'forEach' called on an object that is not a valid instance of ${this.interface.name}."); } if (arguments.length < 1) { - throw new TypeError("Failed to execute 'forEach' on '${this.name}': 1 argument required, " + - "but only 0 present."); + throw new globalObject.TypeError("Failed to execute 'forEach' on '${this.name}': 1 argument required, but only 0 present."); } - callback = ${requires.addRelative("Function")}.convert(callback, { + callback = ${requires.addRelative("Function")}.convert(globalObject, callback, { context: "Failed to execute 'forEach' on '${this.name}': The callback provided as parameter 1" }); const thisArg = arguments[1]; @@ -62,10 +61,10 @@ class Iterable { } `); } else { - this.interface.addProperty(whence, "keys", 'ctorRegistry["%Array%"].prototype.keys'); - this.interface.addProperty(whence, "values", 'ctorRegistry["%Array%"].prototype.values'); - this.interface.addProperty(whence, "entries", 'ctorRegistry["%Array%"].prototype.entries'); - this.interface.addProperty(whence, "forEach", 'ctorRegistry["%Array%"].prototype.forEach'); + this.interface.addProperty(whence, "keys", "globalObject.Array.prototype.keys"); + this.interface.addProperty(whence, "values", "globalObject.Array.prototype.values"); + this.interface.addProperty(whence, "entries", "globalObject.Array.prototype.entries"); + this.interface.addProperty(whence, "forEach", "globalObject.Array.prototype.forEach"); // @@iterator is added in Interface class. } diff --git a/lib/constructs/operation.js b/lib/constructs/operation.js index 56b613be..8fe867ba 100644 --- a/lib/constructs/operation.js +++ b/lib/constructs/operation.js @@ -97,7 +97,7 @@ class Operation { const whence = this.getWhence(); const async = this.isAsync(); const promiseHandlingBefore = async ? `try {` : ``; - const promiseHandlingAfter = async ? `} catch (e) { return Promise.reject(e); }` : ``; + const promiseHandlingAfter = async ? `} catch (e) { return globalObject.Promise.reject(e); }` : ``; const hasCallWithGlobal = this.hasCallWithGlobal(); const type = this.static ? "static operation" : "regular operation"; @@ -115,7 +115,7 @@ class Operation { str += ` const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError("'${this.name}' called on an object that is not a valid instance of ${this.interface.name}."); + throw new globalObject.TypeError("'${this.name}' called on an object that is not a valid instance of ${this.interface.name}."); } `; } diff --git a/lib/output/utils.js b/lib/output/utils.js index dbfe68ff..3af17706 100644 --- a/lib/output/utils.js +++ b/lib/output/utils.js @@ -29,10 +29,7 @@ function newObjectInRealm(globalObject, object) { const wrapperSymbol = Symbol("wrapper"); const implSymbol = Symbol("impl"); const sameObjectCaches = Symbol("SameObject caches"); -const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry"); - -// This only contains the intrinsic names that are referenced from the `ctorRegistry`: -const intrinsicConstructors = ["Array"]; +const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry"); const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(async function* () {}).prototype); @@ -42,13 +39,13 @@ function initCtorRegistry(globalObject) { } const ctorRegistry = Object.create(null); - for (const intrinsic of intrinsicConstructors) { - ctorRegistry[`%${intrinsic}%`] = globalObject[intrinsic]; - } + // In addition to registering all the WebIDL2JS-generated types in the constructor registry, + // we also register a few intrinsics that we make use of in generated code, since they are not + // easy to grab from the globalObject variable. ctorRegistry["%Object.prototype%"] = globalObject.Object.prototype; ctorRegistry["%IteratorPrototype%"] = Object.getPrototypeOf( - Object.getPrototypeOf(new ctorRegistry["%Array%"]()[Symbol.iterator]()) + Object.getPrototypeOf(new globalObject.Array()[Symbol.iterator]()) ); try { diff --git a/lib/parameters.js b/lib/parameters.js index 0197441f..ca525259 100644 --- a/lib/parameters.js +++ b/lib/parameters.js @@ -113,8 +113,7 @@ module.exports.generateOverloadConversions = function (ctx, typeOfOp, name, pare const plural = minArgs > 1 ? "s" : ""; str += ` if (arguments.length < ${minArgs}) { - throw new TypeError("${errPrefix}${minArgs} argument${plural} required, but only " + arguments.length + - " present."); + throw new globalObject.TypeError(\`${errPrefix}${minArgs} argument${plural} required, but only \${arguments.length} present.\`); } `; } @@ -127,7 +126,7 @@ module.exports.generateOverloadConversions = function (ctx, typeOfOp, name, pare .filter(o => o.typeList.length === numArgs); if (S.length === 0) { switchCases.push(` - throw new TypeError("${errPrefix}only " + arguments.length + " arguments present."); + throw new globalObject.TypeError(\`${errPrefix}only \${arguments.length} arguments present.\`); `); continue; } @@ -303,7 +302,7 @@ module.exports.generateOverloadConversions = function (ctx, typeOfOp, name, pare } else if (any.length) { possibilities.push(`{ ${continued(any[0], i)} }`); } else { - possibilities.push(`throw new TypeError("${errPrefix}No such overload");`); + possibilities.push(`throw new globalObject.TypeError("${errPrefix}No such overload");`); } caseSrc += possibilities.join(" else "); diff --git a/lib/types.js b/lib/types.js index 04d0cbc3..a58a7a5a 100644 --- a/lib/types.js +++ b/lib/types.js @@ -142,7 +142,7 @@ function generateTypeConversion( generateFrozenArray(); } else if (conversions[idlType.idlType]) { // string or number type compatible with webidl-conversions - generateGeneric(`conversions["${idlType.idlType}"]`); + generateWebIDLConversions(`conversions["${idlType.idlType}"]`); } else if (resolvedTypes.has(ctx.typeOf(idlType.idlType))) { // callback functions, callback interfaces, dictionaries, enumerations, and interfaces let fn; @@ -153,7 +153,7 @@ function generateTypeConversion( } else { fn = `exports.convert`; } - generateGeneric(fn); + generateWebIDL2JS(fn); } else { // unknown // Try to get the impl anyway. @@ -332,7 +332,7 @@ function generateTypeConversion( code += conv.body; requires.merge(conv.requires); } else { - code += `throw new TypeError(${errPrefix} + " is not of any supported type.")`; + code += `throw new globalObject.TypeError(${errPrefix} + " is not of any supported type.")`; } code += "}"; output.push(code); @@ -354,7 +354,7 @@ function generateTypeConversion( str += ` if (!utils.isObject(${name})) { - throw new TypeError(${errPrefix} + " is not an iterable object."); + throw new globalObject.TypeError(${errPrefix} + " is not an iterable object."); } else { const V = []; const tmp = ${name}; @@ -389,7 +389,7 @@ function generateTypeConversion( str += ` if (!utils.isObject(${name})) { - throw new TypeError(${errPrefix} + " is not an object."); + throw new globalObject.TypeError(${errPrefix} + " is not an object."); } else { const result = Object.create(null); for (const key of Reflect.ownKeys(${name})) { @@ -409,7 +409,7 @@ function generateTypeConversion( } function generatePromise() { - str += `${name} = new Promise(resolve => resolve(${name}));`; + str += `${name} = new globalObject.Promise(resolve => resolve(${name}));`; } function generateFrozenArray() { @@ -417,12 +417,12 @@ function generateTypeConversion( str += `${name} = Object.freeze(${name});`; } - function generateGeneric(conversionFn) { + function generateWebIDLConversions(conversionFn) { const enforceRange = utils.getExtAttr(extAttrs, "EnforceRange"); const clamp = utils.getExtAttr(extAttrs, "Clamp"); const nullToEmptyString = utils.getExtAttr(extAttrs, "LegacyNullToEmptyString"); - let optString = `context: ${errPrefix},`; + let optString = `context: ${errPrefix}, globals: globalObject,`; if (clamp) { optString += "clamp: true,"; } @@ -444,6 +444,22 @@ function generateTypeConversion( `; } } + + function generateWebIDL2JS(conversionFn) { + const optString = `context: ${errPrefix}`; + + if (idlType.array) { + str += ` + for (let i = 0; i < ${name}.length; ++i) { + ${name}[i] = ${conversionFn}(globalObject, ${name}[i], { ${optString} }); + } + `; + } else { + str += ` + ${name} = ${conversionFn}(globalObject, ${name}, { ${optString} }); + `; + } + } } // Condense the member types of a union to a more consumable structured object. At the same time, check for the validity diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap index ad9e5754..6fb2534f 100644 --- a/test/__snapshots__/test.js.snap +++ b/test/__snapshots__/test.js.snap @@ -6,9 +6,9 @@ exports[`generation built-in types Function 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (typeof value !== \\"function\\") { - throw new TypeError(context + \\" is not a function\\"); + throw new globalObject.TypeError(context + \\" is not a function\\"); } function invokeTheCallbackFunction(...args) { @@ -21,7 +21,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { callResult = Reflect.apply(value, thisArg, args); - callResult = conversions[\\"any\\"](callResult, { context: context }); + callResult = conversions[\\"any\\"](callResult, { context: context, globals: globalObject }); return callResult; } @@ -33,7 +33,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { let callResult = Reflect.construct(value, args); - callResult = conversions[\\"any\\"](callResult, { context: context }); + callResult = conversions[\\"any\\"](callResult, { context: context, globals: globalObject }); return callResult; }; @@ -52,9 +52,9 @@ exports[`generation built-in types VoidFunction 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (typeof value !== \\"function\\") { - throw new TypeError(context + \\" is not a function\\"); + throw new globalObject.TypeError(context + \\" is not a function\\"); } function invokeTheCallbackFunction() { @@ -82,9 +82,9 @@ exports[`generation with processors AsyncCallbackFunction.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (typeof value !== \\"function\\") { - throw new TypeError(context + \\" is not a function\\"); + throw new globalObject.TypeError(context + \\" is not a function\\"); } function invokeTheCallbackFunction() { @@ -94,17 +94,17 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { try { callResult = Reflect.apply(value, thisArg, []); - callResult = new Promise(resolve => resolve(callResult)); + callResult = new globalObject.Promise(resolve => resolve(callResult)); return callResult; } catch (err) { - return Promise.reject(err); + return globalObject.Promise.reject(err); } } invokeTheCallbackFunction.construct = () => { let callResult = Reflect.construct(value, []); - callResult = new Promise(resolve => resolve(callResult)); + callResult = new globalObject.Promise(resolve => resolve(callResult)); return callResult; }; @@ -122,9 +122,9 @@ exports[`generation with processors AsyncCallbackInterface.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation() { @@ -136,17 +136,17 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } if (typeof O !== \\"function\\") { X = O[\\"asyncMethod\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement AsyncCallbackInterface.\`); + throw new globalObject.TypeError(\`\${context} does not correctly implement AsyncCallbackInterface.\`); } thisArg = O; } let callResult = Reflect.apply(X, thisArg, []); - callResult = new Promise(resolve => resolve(callResult)); + callResult = new globalObject.Promise(resolve => resolve(callResult)); return callResult; } catch (err) { - return Promise.reject(err); + return globalObject.Promise.reject(err); } } @@ -179,11 +179,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterablePairArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterablePairArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -264,19 +264,22 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterablePairArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } keys() { if (!exports.is(this)) { - throw new TypeError(\\"'keys' called on an object that is not a valid instance of AsyncIterablePairArgs.\\"); + throw new globalObject.TypeError( + \\"'keys' called on an object that is not a valid instance of AsyncIterablePairArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; args[0] = conversions[\\"boolean\\"](args[0], { - context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 1\\" + context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 1\\", + globals: globalObject }); } else { args[0] = false; @@ -285,13 +288,14 @@ exports.install = (globalObject, globalNames) => { if (arguments[1] !== undefined) { args[1] = arguments[1]; args[1] = conversions[\\"DOMString\\"](args[1], { - context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 2\\" + context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 2\\", + globals: globalObject }); } else { args[1] = undefined; } args[2] = arguments[2]; - args[2] = Dictionary.convert(args[2], { + args[2] = Dictionary.convert(globalObject, args[2], { context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 3\\" }); @@ -304,14 +308,17 @@ exports.install = (globalObject, globalNames) => { values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterablePairArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterablePairArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; args[0] = conversions[\\"boolean\\"](args[0], { - context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 1\\" + context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 1\\", + globals: globalObject }); } else { args[0] = false; @@ -320,13 +327,14 @@ exports.install = (globalObject, globalNames) => { if (arguments[1] !== undefined) { args[1] = arguments[1]; args[1] = conversions[\\"DOMString\\"](args[1], { - context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 2\\" + context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 2\\", + globals: globalObject }); } else { args[1] = undefined; } args[2] = arguments[2]; - args[2] = Dictionary.convert(args[2], { + args[2] = Dictionary.convert(globalObject, args[2], { context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 3\\" }); @@ -339,14 +347,17 @@ exports.install = (globalObject, globalNames) => { entries() { if (!exports.is(this)) { - throw new TypeError(\\"'entries' called on an object that is not a valid instance of AsyncIterablePairArgs.\\"); + throw new globalObject.TypeError( + \\"'entries' called on an object that is not a valid instance of AsyncIterablePairArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; args[0] = conversions[\\"boolean\\"](args[0], { - context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 1\\" + context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 1\\", + globals: globalObject }); } else { args[0] = false; @@ -355,13 +366,14 @@ exports.install = (globalObject, globalNames) => { if (arguments[1] !== undefined) { args[1] = arguments[1]; args[1] = conversions[\\"DOMString\\"](args[1], { - context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 2\\" + context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 2\\", + globals: globalObject }); } else { args[1] = undefined; } args[2] = arguments[2]; - args[2] = Dictionary.convert(args[2], { + args[2] = Dictionary.convert(globalObject, args[2], { context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 3\\" }); @@ -391,14 +403,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterablePairArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterablePairArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -455,11 +469,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterablePairNoArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterablePairNoArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -540,12 +554,14 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterablePairNoArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } keys() { if (!exports.is(this)) { - throw new TypeError(\\"'keys' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\"); + throw new globalObject.TypeError( + \\"'keys' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\" + ); } const args = []; @@ -559,7 +575,9 @@ exports.install = (globalObject, globalNames) => { values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\" + ); } const args = []; @@ -573,7 +591,9 @@ exports.install = (globalObject, globalNames) => { entries() { if (!exports.is(this)) { - throw new TypeError(\\"'entries' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\"); + throw new globalObject.TypeError( + \\"'entries' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\" + ); } const args = []; @@ -604,14 +624,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterablePairNoArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterablePairNoArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -669,11 +691,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterableValueArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterableValueArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -754,18 +776,20 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterableValueArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterableValueArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterableValueArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; - args[0] = URL.convert(args[0], { + args[0] = URL.convert(globalObject, args[0], { context: \\"Failed to execute 'values' on 'AsyncIterableValueArgs': parameter 1\\" }); } else { @@ -796,14 +820,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterableValueArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterableValueArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -860,11 +886,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterableValueNoArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterableValueNoArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -945,12 +971,14 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterableValueNoArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterableValueNoArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterableValueNoArgs.\\" + ); } const args = []; @@ -979,14 +1007,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterableValueNoArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterableValueNoArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -1044,11 +1074,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterableWithReturn'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterableWithReturn'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -1129,17 +1159,19 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterableWithReturn { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterableWithReturn.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterableWithReturn.\\" + ); } const args = []; args[0] = arguments[0]; - args[0] = Dictionary.convert(args[0], { + args[0] = Dictionary.convert(globalObject, args[0], { context: \\"Failed to execute 'values' on 'AsyncIterableWithReturn': parameter 1\\" }); @@ -1167,14 +1199,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterableWithReturn async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterableWithReturn async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -1204,14 +1238,16 @@ exports.install = (globalObject, globalNames) => { return(value) { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"return() called on a value that is not a AsyncIterableWithReturn async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"return() called on a value that is not a AsyncIterableWithReturn async iterator object\\" + ) ); } const returnSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value, done: true })); } internal.isFinished = true; @@ -1253,11 +1289,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'BufferSourceTypes'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'BufferSourceTypes'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -1327,20 +1363,18 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class BufferSourceTypes { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } bs(source) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'bs' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError(\\"'bs' called on an object that is not a valid instance of BufferSourceTypes.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'bs' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'bs' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -1349,7 +1383,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'bs' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" ); } @@ -1361,21 +1395,20 @@ exports.install = (globalObject, globalNames) => { ab(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'ab' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError(\\"'ab' called on an object that is not a valid instance of BufferSourceTypes.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'ab' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'ab' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"ArrayBuffer\\"](curArg, { - context: \\"Failed to execute 'ab' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'ab' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -1385,14 +1418,14 @@ exports.install = (globalObject, globalNames) => { abv(abv) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'abv' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'abv' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'abv' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'abv' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -1400,7 +1433,7 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'abv' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" ); } @@ -1412,21 +1445,22 @@ exports.install = (globalObject, globalNames) => { u8a(u8) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'u8a' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'u8a' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'u8a' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'u8a' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"Uint8Array\\"](curArg, { - context: \\"Failed to execute 'u8a' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'u8a' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -1436,14 +1470,14 @@ exports.install = (globalObject, globalNames) => { abUnion(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'abUnion' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'abUnion' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'abUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'abUnion' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -1452,7 +1486,8 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'abUnion' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'abUnion' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -1463,14 +1498,14 @@ exports.install = (globalObject, globalNames) => { u8aUnion(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'u8aUnion' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'u8aUnion' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'u8aUnion' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -1479,7 +1514,8 @@ exports.install = (globalObject, globalNames) => { if (ArrayBuffer.isView(curArg) && curArg.constructor.name === \\"Uint8Array\\") { } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -1527,11 +1563,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'CEReactions'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'CEReactions'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -1614,13 +1650,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class CEReactions { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } method() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'method' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError(\\"'method' called on an object that is not a valid instance of CEReactions.\\"); } CEReactions.preSteps(globalObject); @@ -1635,7 +1671,9 @@ exports.install = (globalObject, globalNames) => { try { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'promiseOperation' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError( + \\"'promiseOperation' called on an object that is not a valid instance of CEReactions.\\" + ); } CEReactions.preSteps(globalObject); @@ -1645,7 +1683,7 @@ exports.install = (globalObject, globalNames) => { CEReactions.postSteps(globalObject); } } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -1653,7 +1691,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError(\\"'get attr' called on an object that is not a valid instance of CEReactions.\\"); } CEReactions.preSteps(globalObject); @@ -1668,11 +1706,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set attr' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError(\\"'set attr' called on an object that is not a valid instance of CEReactions.\\"); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'attr' property on 'CEReactions': The provided value\\" + context: \\"Failed to set the 'attr' property on 'CEReactions': The provided value\\", + globals: globalObject }); CEReactions.preSteps(globalObject); @@ -1688,7 +1727,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get promiseAttribute' called on an object that is not a valid instance of CEReactions.\\" ); } @@ -1700,7 +1739,7 @@ exports.install = (globalObject, globalNames) => { CEReactions.postSteps(globalObject); } } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } } @@ -1811,7 +1850,8 @@ class ProxyHandler { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\", + globals: globalObject }); CEReactions.preSteps(globalObject); @@ -1877,7 +1917,8 @@ class ProxyHandler { let namedValue = desc.value; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\", + globals: globalObject }); CEReactions.preSteps(globalObject); @@ -1937,12 +1978,12 @@ const URLCallback = require(\\"./URLCallback.js\\"); const URLHandlerNonNull = require(\\"./URLHandlerNonNull.js\\"); const VoidFunction = require(\\"./VoidFunction.js\\"); -exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {}) => { +exports._convertInherit = (globalObject, obj, ret, { context = \\"The provided value\\" } = {}) => { { const key = \\"function\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = Function.convert(value, { context: context + \\" has member 'function' that\\" }); + value = Function.convert(globalObject, value, { context: context + \\" has member 'function' that\\" }); ret[key] = value; } @@ -1952,7 +1993,7 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"urlCallback\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = URLCallback.convert(value, { context: context + \\" has member 'urlCallback' that\\" }); + value = URLCallback.convert(globalObject, value, { context: context + \\" has member 'urlCallback' that\\" }); ret[key] = value; } @@ -1965,7 +2006,7 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} if (!utils.isObject(value)) { value = null; } else { - value = URLHandlerNonNull.convert(value, { context: context + \\" has member 'urlHandler' that\\" }); + value = URLHandlerNonNull.convert(globalObject, value, { context: context + \\" has member 'urlHandler' that\\" }); } ret[key] = value; } @@ -1975,7 +2016,9 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"urlHandlerNonNull\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = URLHandlerNonNull.convert(value, { context: context + \\" has member 'urlHandlerNonNull' that\\" }); + value = URLHandlerNonNull.convert(globalObject, value, { + context: context + \\" has member 'urlHandlerNonNull' that\\" + }); ret[key] = value; } @@ -1985,20 +2028,20 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"voidFunction\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = VoidFunction.convert(value, { context: context + \\" has member 'voidFunction' that\\" }); + value = VoidFunction.convert(globalObject, value, { context: context + \\" has member 'voidFunction' that\\" }); ret[key] = value; } } }; -exports.convert = function convert(obj, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, obj, { context = \\"The provided value\\" } = {}) => { if (obj !== undefined && typeof obj !== \\"object\\" && typeof obj !== \\"function\\") { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } const ret = Object.create(null); - exports._convertInherit(obj, ret, { context }); + exports._convertInherit(globalObject, obj, ret, { context }); return ret; }; " @@ -2021,11 +2064,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DOMImplementation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'DOMImplementation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -2095,43 +2138,44 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class DOMImplementation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } createDocumentType(qualifiedName, publicId, systemId) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'createDocumentType' called on an object that is not a valid instance of DOMImplementation.\\" ); } if (arguments.length < 3) { - throw new TypeError( - \\"Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 1\\" + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2\\" + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[2]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\" + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\", + globals: globalObject }); args.push(curArg); } @@ -2141,14 +2185,14 @@ exports.install = (globalObject, globalNames) => { createDocument(namespace, qualifiedName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'createDocument' called on an object that is not a valid instance of DOMImplementation.\\"); + throw new globalObject.TypeError( + \\"'createDocument' called on an object that is not a valid instance of DOMImplementation.\\" + ); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; @@ -2158,7 +2202,8 @@ exports.install = (globalObject, globalNames) => { curArg = null; } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 1\\" + context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -2167,6 +2212,7 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 2\\", + globals: globalObject, treatNullAsEmptyString: true }); args.push(curArg); @@ -2190,7 +2236,7 @@ exports.install = (globalObject, globalNames) => { createHTMLDocument() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'createHTMLDocument' called on an object that is not a valid instance of DOMImplementation.\\" ); } @@ -2199,7 +2245,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\" + context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -2210,7 +2257,9 @@ exports.install = (globalObject, globalNames) => { hasFeature() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'hasFeature' called on an object that is not a valid instance of DOMImplementation.\\"); + throw new globalObject.TypeError( + \\"'hasFeature' called on an object that is not a valid instance of DOMImplementation.\\" + ); } return esValue[implSymbol].hasFeature(); @@ -2254,11 +2303,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DOMRect'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'DOMRect'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -2333,7 +2382,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 1\\" + context: \\"Failed to construct 'DOMRect': parameter 1\\", + globals: globalObject }); } else { curArg = 0; @@ -2344,7 +2394,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[1]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 2\\" + context: \\"Failed to construct 'DOMRect': parameter 2\\", + globals: globalObject }); } else { curArg = 0; @@ -2355,7 +2406,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[2]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 3\\" + context: \\"Failed to construct 'DOMRect': parameter 3\\", + globals: globalObject }); } else { curArg = 0; @@ -2366,7 +2418,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[3]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 4\\" + context: \\"Failed to construct 'DOMRect': parameter 4\\", + globals: globalObject }); } else { curArg = 0; @@ -2380,7 +2433,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get x' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get x' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"x\\"]; @@ -2390,11 +2443,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set x' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set x' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'x' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'x' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"x\\"] = V; @@ -2404,7 +2458,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get y' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get y' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"y\\"]; @@ -2414,11 +2468,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set y' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set y' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'y' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'y' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"y\\"] = V; @@ -2428,7 +2483,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get width' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get width' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"width\\"]; @@ -2438,11 +2493,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set width' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set width' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'width' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'width' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"width\\"] = V; @@ -2452,7 +2508,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get height' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get height' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"height\\"]; @@ -2462,11 +2518,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set height' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set height' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'height' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'height' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"height\\"] = V; @@ -2476,7 +2533,9 @@ exports.install = (globalObject, globalNames) => { const args = []; { let curArg = arguments[0]; - curArg = Dictionary.convert(curArg, { context: \\"Failed to execute 'fromRect' on 'DOMRect': parameter 1\\" }); + curArg = Dictionary.convert(globalObject, curArg, { + context: \\"Failed to execute 'fromRect' on 'DOMRect': parameter 1\\" + }); args.push(curArg); } return utils.tryWrapperForImpl(Impl.implementation.fromRect(globalObject, ...args)); @@ -2520,12 +2579,15 @@ const utils = require(\\"./utils.js\\"); const URL = require(\\"./URL.js\\"); const URLSearchParams = require(\\"./URLSearchParams.js\\"); -exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {}) => { +exports._convertInherit = (globalObject, obj, ret, { context = \\"The provided value\\" } = {}) => { { const key = \\"boolWithDefault\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = conversions[\\"boolean\\"](value, { context: context + \\" has member 'boolWithDefault' that\\" }); + value = conversions[\\"boolean\\"](value, { + context: context + \\" has member 'boolWithDefault' that\\", + globals: globalObject + }); ret[key] = value; } else { @@ -2537,11 +2599,11 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"requiredInterface\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = URL.convert(value, { context: context + \\" has member 'requiredInterface' that\\" }); + value = URL.convert(globalObject, value, { context: context + \\" has member 'requiredInterface' that\\" }); ret[key] = value; } else { - throw new TypeError(\\"requiredInterface is required in 'Dictionary'\\"); + throw new globalObject.TypeError(\\"requiredInterface is required in 'Dictionary'\\"); } } @@ -2550,12 +2612,14 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { if (!utils.isObject(value)) { - throw new TypeError(context + \\" has member 'seq' that\\" + \\" is not an iterable object.\\"); + throw new globalObject.TypeError(context + \\" has member 'seq' that\\" + \\" is not an iterable object.\\"); } else { const V = []; const tmp = value; for (let nextItem of tmp) { - nextItem = URLSearchParams.convert(nextItem, { context: context + \\" has member 'seq' that\\" + \\"'s element\\" }); + nextItem = URLSearchParams.convert(globalObject, nextItem, { + context: context + \\" has member 'seq' that\\" + \\"'s element\\" + }); V.push(nextItem); } @@ -2570,20 +2634,23 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"vanillaString\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = conversions[\\"DOMString\\"](value, { context: context + \\" has member 'vanillaString' that\\" }); + value = conversions[\\"DOMString\\"](value, { + context: context + \\" has member 'vanillaString' that\\", + globals: globalObject + }); ret[key] = value; } } }; -exports.convert = function convert(obj, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, obj, { context = \\"The provided value\\" } = {}) => { if (obj !== undefined && typeof obj !== \\"object\\" && typeof obj !== \\"function\\") { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } const ret = Object.create(null); - exports._convertInherit(obj, ret, { context }); + exports._convertInherit(globalObject, obj, ret, { context }); return ret; }; " @@ -2607,11 +2674,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DictionaryConvert'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'DictionaryConvert'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -2681,27 +2748,30 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class DictionaryConvert { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } op() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'op' called on an object that is not a valid instance of DictionaryConvert.\\"); + throw new globalObject.TypeError(\\"'op' called on an object that is not a valid instance of DictionaryConvert.\\"); } const args = []; { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 1\\" + context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 1\\", + globals: globalObject }); } args.push(curArg); } { let curArg = arguments[1]; - curArg = Dictionary.convert(curArg, { context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" }); + curArg = Dictionary.convert(globalObject, curArg, { + context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" + }); args.push(curArg); } return esValue[implSymbol].op(...args); @@ -2742,11 +2812,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Enum'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Enum'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -2816,24 +2886,26 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Enum { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } op(destination) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'op' called on an object that is not a valid instance of Enum.\\"); + throw new globalObject.TypeError(\\"'op' called on an object that is not a valid instance of Enum.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'op' on 'Enum': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'op' on 'Enum': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = RequestDestination.convert(curArg, { context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" }); + curArg = RequestDestination.convert(globalObject, curArg, { + context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" + }); args.push(curArg); } return esValue[implSymbol].op(...args); @@ -2843,7 +2915,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of Enum.\\"); + throw new globalObject.TypeError(\\"'get attr' called on an object that is not a valid instance of Enum.\\"); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"attr\\"]); @@ -2853,7 +2925,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set attr' called on an object that is not a valid instance of Enum.\\"); + throw new globalObject.TypeError(\\"'set attr' called on an object that is not a valid instance of Enum.\\"); } V = \`\${V}\`; @@ -2888,9 +2960,9 @@ exports[`generation with processors EventListener.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation(event) { @@ -2901,7 +2973,7 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } if (typeof O !== \\"function\\") { X = O[\\"handleEvent\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement EventListener.\`); + throw new globalObject.TypeError(\`\${context} does not correctly implement EventListener.\`); } thisArg = O; } @@ -2939,11 +3011,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'EventTarget'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'EventTarget'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3019,21 +3091,22 @@ exports.install = (globalObject, globalNames) => { addEventListener(type, callback) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'addEventListener' called on an object that is not a valid instance of EventTarget.\\"); + throw new globalObject.TypeError( + \\"'addEventListener' called on an object that is not a valid instance of EventTarget.\\" + ); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 1\\" + context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -3042,7 +3115,7 @@ exports.install = (globalObject, globalNames) => { if (curArg === null || curArg === undefined) { curArg = null; } else { - curArg = EventListener.convert(curArg, { + curArg = EventListener.convert(globalObject, curArg, { context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 2\\" }); } @@ -3085,11 +3158,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Global'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Global'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3120,7 +3193,7 @@ exports._internalSetup = (wrapper, globalObject) => { op() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'op' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'op' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol].op(); @@ -3128,7 +3201,7 @@ exports._internalSetup = (wrapper, globalObject) => { unforgeableOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'unforgeableOp' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'unforgeableOp' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol].unforgeableOp(); @@ -3137,7 +3210,7 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'get attr' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol][\\"attr\\"]; @@ -3146,10 +3219,13 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set attr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'set attr' called on an object that is not a valid instance of Global.\\"); } - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'attr' property on 'Global': The provided value\\" }); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'attr' property on 'Global': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"attr\\"] = V; }, @@ -3157,7 +3233,9 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get unforgeableAttr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError( + \\"'get unforgeableAttr' called on an object that is not a valid instance of Global.\\" + ); } return esValue[implSymbol][\\"unforgeableAttr\\"]; @@ -3166,11 +3244,14 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set unforgeableAttr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError( + \\"'set unforgeableAttr' called on an object that is not a valid instance of Global.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'unforgeableAttr' property on 'Global': The provided value\\" + context: \\"Failed to set the 'unforgeableAttr' property on 'Global': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"unforgeableAttr\\"] = V; @@ -3179,7 +3260,7 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get length' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'get length' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol][\\"length\\"]; @@ -3188,20 +3269,21 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set length' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'set length' called on an object that is not a valid instance of Global.\\"); } V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'length' property on 'Global': The provided value\\" + context: \\"Failed to set the 'length' property on 'Global': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"length\\"] = V; }, - [Symbol.iterator]: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], - keys: ctorRegistry[\\"%Array%\\"].prototype.keys, - values: ctorRegistry[\\"%Array%\\"].prototype.values, - entries: ctorRegistry[\\"%Array%\\"].prototype.entries, - forEach: ctorRegistry[\\"%Array%\\"].prototype.forEach + [Symbol.iterator]: globalObject.Array.prototype[Symbol.iterator], + keys: globalObject.Array.prototype.keys, + values: globalObject.Array.prototype.values, + entries: globalObject.Array.prototype.entries, + forEach: globalObject.Array.prototype.forEach }); Object.defineProperties(wrapper, { @@ -3253,7 +3335,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Global { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } static staticOp() { @@ -3270,7 +3352,8 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'staticAttr' property on 'Global': The provided value\\" + context: \\"Failed to set the 'staticAttr' property on 'Global': The provided value\\", + globals: globalObject }); Impl.implementation[\\"staticAttr\\"] = V; @@ -3309,11 +3392,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'HTMLConstructor'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'HTMLConstructor'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3419,11 +3502,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyLenientAttributes'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyLenientAttributes'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3493,14 +3576,14 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyLenientAttributes { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get lenientSetter() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get lenientSetter' called on an object that is not a valid instance of LegacyLenientAttributes.\\" ); } @@ -3512,7 +3595,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'set lenientSetter' called on an object that is not a valid instance of LegacyLenientAttributes.\\" ); } @@ -3548,7 +3631,8 @@ exports.install = (globalObject, globalNames) => { } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'lenientThis' property on 'LegacyLenientAttributes': The provided value\\" + context: \\"Failed to set the 'lenientThis' property on 'LegacyLenientAttributes': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"lenientThis\\"] = V; @@ -3623,11 +3707,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyNoInterfaceObject'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyNoInterfaceObject'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3697,13 +3781,15 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyNoInterfaceObject { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } def() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'def' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\"); + throw new globalObject.TypeError( + \\"'def' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\" + ); } return esValue[implSymbol].def(); @@ -3713,7 +3799,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\"); + throw new globalObject.TypeError( + \\"'get abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\" + ); } return esValue[implSymbol][\\"abc\\"]; @@ -3723,11 +3811,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\"); + throw new globalObject.TypeError( + \\"'set abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'abc' property on 'LegacyNoInterfaceObject': The provided value\\" + context: \\"Failed to set the 'abc' property on 'LegacyNoInterfaceObject': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"abc\\"] = V; @@ -3763,11 +3854,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyUnforgeable'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyUnforgeable'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3801,21 +3892,22 @@ function getUnforgeables(globalObject) { assign(url) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'assign' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'assign' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'assign' on 'LegacyUnforgeable': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'assign' on 'LegacyUnforgeable': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'assign' on 'LegacyUnforgeable': parameter 1\\" + context: \\"Failed to execute 'assign' on 'LegacyUnforgeable': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -3825,7 +3917,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get href' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'get href' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"href\\"]; @@ -3834,11 +3928,14 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set href' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'set href' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'href' property on 'LegacyUnforgeable': The provided value\\" + context: \\"Failed to set the 'href' property on 'LegacyUnforgeable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"href\\"] = V; @@ -3846,7 +3943,9 @@ function getUnforgeables(globalObject) { toString() { const esValue = this; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"href\\"]; @@ -3855,7 +3954,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get origin' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'get origin' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"origin\\"]; @@ -3864,7 +3965,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'get protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"protocol\\"]; @@ -3873,11 +3976,14 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'set protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'LegacyUnforgeable': The provided value\\" + context: \\"Failed to set the 'protocol' property on 'LegacyUnforgeable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"protocol\\"] = V; @@ -3942,7 +4048,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyUnforgeable { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(LegacyUnforgeable.prototype, { @@ -3978,11 +4084,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyUnforgeableMap'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyUnforgeableMap'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -3998,6 +4104,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -4017,7 +4132,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get a' called on an object that is not a valid instance of LegacyUnforgeableMap.\\"); + throw new globalObject.TypeError( + \\"'get a' called on an object that is not a valid instance of LegacyUnforgeableMap.\\" + ); } return esValue[implSymbol][\\"a\\"]; @@ -4044,7 +4161,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -4062,7 +4179,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -4082,7 +4199,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyUnforgeableMap { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(LegacyUnforgeableMap.prototype, { @@ -4097,7 +4214,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -4118,7 +4240,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -4133,7 +4255,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -4148,7 +4270,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -4168,7 +4290,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -4177,11 +4299,14 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; + if (typeof P === \\"string\\") { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\", + globals: globalObject }); const creating = !target[implSymbol][utils.supportsPropertyName](P); @@ -4226,12 +4351,14 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + + const globalObject = this._globalObject; if (![\\"a\\"].includes(P)) { if (!utils.hasOwn(target, P)) { if (desc.get || desc.set) { @@ -4241,7 +4368,8 @@ const proxyHandler = { let namedValue = desc.value; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\", + globals: globalObject }); const creating = !target[implSymbol][utils.supportsPropertyName](P); @@ -4255,24 +4383,26 @@ const proxyHandler = { } } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { return false; } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/LegacyUnforgeableMap.js\\"); " @@ -4295,11 +4425,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'MixedIn'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'MixedIn'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -4369,13 +4499,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class MixedIn { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } mixedInOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'mixedInOp' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError(\\"'mixedInOp' called on an object that is not a valid instance of MixedIn.\\"); } return esValue[implSymbol].mixedInOp(); @@ -4384,7 +4514,7 @@ exports.install = (globalObject, globalNames) => { ifaceMixinOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'ifaceMixinOp' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError(\\"'ifaceMixinOp' called on an object that is not a valid instance of MixedIn.\\"); } return esValue[implSymbol].ifaceMixinOp(); @@ -4394,7 +4524,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get mixedInAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'get mixedInAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } return esValue[implSymbol][\\"mixedInAttr\\"]; @@ -4404,11 +4536,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set mixedInAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'set mixedInAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\" + context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"mixedInAttr\\"] = V; @@ -4418,7 +4553,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'get ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } return esValue[implSymbol][\\"ifaceMixinAttr\\"]; @@ -4428,11 +4565,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'set ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\" + context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"ifaceMixinAttr\\"] = V; @@ -4470,9 +4610,9 @@ exports[`generation with processors NodeFilter.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation(node) { @@ -4483,7 +4623,7 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } if (typeof O !== \\"function\\") { X = O[\\"acceptNode\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement NodeFilter.\`); + throw new globalObject.TypeError(\`\${context} does not correctly implement NodeFilter.\`); } thisArg = O; } @@ -4492,7 +4632,7 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } let callResult = Reflect.apply(X, thisArg, [node]); - callResult = conversions[\\"unsigned short\\"](callResult, { context: context }); + callResult = conversions[\\"unsigned short\\"](callResult, { context: context, globals: globalObject }); return callResult; } @@ -4510,8 +4650,9 @@ exports.install = (globalObject, globalNames) => { return; } + const ctorRegistry = utils.initCtorRegistry(globalObject); const NodeFilter = () => { - throw new TypeError(\\"Illegal invocation\\"); + throw new globalObject.TypeError(\\"Illegal invocation\\"); }; Object.defineProperties(NodeFilter, { @@ -4560,11 +4701,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Overloads'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Overloads'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -4643,13 +4784,16 @@ exports.install = (globalObject, globalNames) => { if (URL.is(curArg)) { { let curArg = arguments[0]; - curArg = URL.convert(curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" }); + curArg = URL.convert(globalObject, curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" }); args.push(curArg); } } else { { let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to construct 'Overloads': parameter 1\\", + globals: globalObject + }); args.push(curArg); } } @@ -4661,14 +4805,12 @@ exports.install = (globalObject, globalNames) => { compatible(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'compatible' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError(\\"'compatible' called on an object that is not a valid instance of Overloads.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'compatible' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'compatible' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -4677,7 +4819,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -4686,14 +4829,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -4702,14 +4847,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -4717,7 +4864,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[2]; if (curArg !== undefined) { curArg = conversions[\\"long\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 3\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 3\\", + globals: globalObject }); } else { curArg = 0; @@ -4731,14 +4879,14 @@ exports.install = (globalObject, globalNames) => { incompatible1(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'incompatible1' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError( + \\"'incompatible1' called on an object that is not a valid instance of Overloads.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'incompatible1' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible1' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -4748,7 +4896,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"long\\"](curArg, { - context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -4756,7 +4905,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -4768,14 +4918,14 @@ exports.install = (globalObject, globalNames) => { incompatible2(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'incompatible2' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError( + \\"'incompatible2' called on an object that is not a valid instance of Overloads.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -4784,7 +4934,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -4793,14 +4944,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -4811,14 +4964,14 @@ exports.install = (globalObject, globalNames) => { incompatible3(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'incompatible3' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError( + \\"'incompatible3' called on an object that is not a valid instance of Overloads.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -4827,7 +4980,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -4836,7 +4990,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -4846,7 +5001,7 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[1]; if (curArg !== undefined) { - curArg = URL.convert(curArg, { + curArg = URL.convert(globalObject, curArg, { context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" }); } @@ -4856,7 +5011,7 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[1]; if (curArg !== undefined) { - curArg = URL.convert(curArg, { + curArg = URL.convert(globalObject, curArg, { context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" }); } @@ -4868,7 +5023,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\" ); } @@ -4880,7 +5035,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\" ); } @@ -4890,7 +5045,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -4898,22 +5054,24 @@ exports.install = (globalObject, globalNames) => { } break; case 3: - throw new TypeError( - \\"Failed to execute 'incompatible3' on 'Overloads': only \\" + arguments.length + \\" arguments present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible3' on 'Overloads': only \${arguments.length} arguments present.\` ); break; default: { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"long\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -4922,7 +5080,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 3\\" + \\" is not of any supported type.\\" ); } @@ -4933,7 +5091,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 4\\" + \\" is not of any supported type.\\" ); } @@ -4980,11 +5138,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'PromiseTypes'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -5019,14 +5177,14 @@ function getUnforgeables(globalObject) { try { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'unforgeablePromiseOperation' called on an object that is not a valid instance of PromiseTypes.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol].unforgeablePromiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } }, get unforgeablePromiseAttribute() { @@ -5034,14 +5192,14 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get unforgeablePromiseAttribute' called on an object that is not a valid instance of PromiseTypes.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"unforgeablePromiseAttribute\\"]); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } }); @@ -5101,26 +5259,26 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class PromiseTypes { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } voidPromiseConsumer(p) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'voidPromiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\"); + throw new globalObject.TypeError( + \\"'voidPromiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'voidPromiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'voidPromiseConsumer' on 'PromiseTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = new Promise(resolve => resolve(curArg)); + curArg = new globalObject.Promise(resolve => resolve(curArg)); args.push(curArg); } return esValue[implSymbol].voidPromiseConsumer(...args); @@ -5129,20 +5287,20 @@ exports.install = (globalObject, globalNames) => { promiseConsumer(p) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'promiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\"); + throw new globalObject.TypeError( + \\"'promiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'promiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'promiseConsumer' on 'PromiseTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = new Promise(resolve => resolve(curArg)); + curArg = new globalObject.Promise(resolve => resolve(curArg)); args.push(curArg); } return esValue[implSymbol].promiseConsumer(...args); @@ -5152,12 +5310,14 @@ exports.install = (globalObject, globalNames) => { try { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'promiseOperation' called on an object that is not a valid instance of PromiseTypes.\\"); + throw new globalObject.TypeError( + \\"'promiseOperation' called on an object that is not a valid instance of PromiseTypes.\\" + ); } return utils.tryWrapperForImpl(esValue[implSymbol].promiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -5166,14 +5326,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get promiseAttribute' called on an object that is not a valid instance of PromiseTypes.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"promiseAttribute\\"]); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -5181,7 +5341,7 @@ exports.install = (globalObject, globalNames) => { try { return utils.tryWrapperForImpl(Impl.implementation.staticPromiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -5191,7 +5351,7 @@ exports.install = (globalObject, globalNames) => { return Impl.implementation[\\"staticPromiseAttribute\\"]; } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } } @@ -5237,11 +5397,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Reflect'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Reflect'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -5311,14 +5471,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Reflect { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get reflectedBoolean() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedBoolean' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedBoolean' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol].hasAttributeNS(null, \\"reflectedboolean\\"); @@ -5328,11 +5490,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedBoolean' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedBoolean' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\", + globals: globalObject }); if (V) { @@ -5346,7 +5511,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedDOMString' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedDOMString' called on an object that is not a valid instance of Reflect.\\" + ); } const value = esValue[implSymbol].getAttributeNS(null, \\"reflecteddomstring\\"); @@ -5357,11 +5524,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedDOMString' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedDOMString' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol].setAttributeNS(null, \\"reflecteddomstring\\", V); @@ -5371,7 +5541,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedLong' called on an object that is not a valid instance of Reflect.\\" + ); } const value = parseInt(esValue[implSymbol].getAttributeNS(null, \\"reflectedlong\\")); @@ -5382,11 +5554,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedLong' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"long\\"](V, { - context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol].setAttributeNS(null, \\"reflectedlong\\", String(V)); @@ -5396,7 +5571,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\" + ); } const value = parseInt(esValue[implSymbol].getAttributeNS(null, \\"reflectedunsignedlong\\")); @@ -5407,11 +5584,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol].setAttributeNS(null, \\"reflectedunsignedlong\\", String(V > 2147483647 ? 0 : V)); @@ -5421,7 +5601,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\" + ); } const value = esValue[implSymbol].getAttributeNS(null, \\"reflectedusvstringurl\\"); @@ -5436,11 +5618,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol].setAttributeNS(null, \\"reflectedusvstringurl\\", V); @@ -5450,7 +5635,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectionTest' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectionTest' called on an object that is not a valid instance of Reflect.\\" + ); } const value = esValue[implSymbol].getAttributeNS(null, \\"reflection\\"); @@ -5461,11 +5648,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectionTest' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectionTest' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol].setAttributeNS(null, \\"reflection\\", V); @@ -5475,7 +5665,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get withUnderscore' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get withUnderscore' called on an object that is not a valid instance of Reflect.\\" + ); } const value = esValue[implSymbol].getAttributeNS(null, \\"with-underscore\\"); @@ -5486,11 +5678,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set withUnderscore' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set withUnderscore' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol].setAttributeNS(null, \\"with-underscore\\", V); @@ -5536,11 +5731,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Replaceable'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Replaceable'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -5610,14 +5805,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Replaceable { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get replaceable() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get replaceable' called on an object that is not a valid instance of Replaceable.\\"); + throw new globalObject.TypeError( + \\"'get replaceable' called on an object that is not a valid instance of Replaceable.\\" + ); } return esValue[implSymbol][\\"replaceable\\"]; @@ -5627,7 +5824,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set replaceable' called on an object that is not a valid instance of Replaceable.\\"); + throw new globalObject.TypeError( + \\"'set replaceable' called on an object that is not a valid instance of Replaceable.\\" + ); } Object.defineProperty(esValue, \\"replaceable\\", { @@ -5678,10 +5877,10 @@ const enumerationValues = new Set([ ]); exports.enumerationValues = enumerationValues; -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { const string = \`\${value}\`; if (!enumerationValues.has(string)) { - throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); + throw new globalObject.TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); } return string; }; @@ -5706,11 +5905,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'SeqAndRec'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -5786,21 +5985,23 @@ exports.install = (globalObject, globalNames) => { recordConsumer(rec) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'recordConsumer' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'recordConsumer' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'recordConsumer' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'recordConsumer' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError(\\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\"); + throw new globalObject.TypeError( + \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\" + ); } else { const result = Object.create(null); for (const key of Reflect.ownKeys(curArg)) { @@ -5809,13 +6010,15 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; typedValue = conversions[\\"double\\"](typedValue, { - context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" + context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\", + globals: globalObject }); result[typedKey] = typedValue; @@ -5831,21 +6034,23 @@ exports.install = (globalObject, globalNames) => { recordConsumer2(rec) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'recordConsumer2' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'recordConsumer2' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'recordConsumer2' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError(\\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\"); + throw new globalObject.TypeError( + \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\" + ); } else { const result = Object.create(null); for (const key of Reflect.ownKeys(curArg)) { @@ -5854,12 +6059,13 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" }); @@ -5876,21 +6082,21 @@ exports.install = (globalObject, globalNames) => { sequenceConsumer(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'sequenceConsumer' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'sequenceConsumer' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'sequenceConsumer' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -5898,7 +6104,8 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { nextItem = conversions[\\"USVString\\"](nextItem, { - context: \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\" + context: \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -5913,21 +6120,21 @@ exports.install = (globalObject, globalNames) => { sequenceConsumer2(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'sequenceConsumer2' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'sequenceConsumer2' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'sequenceConsumer2' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -5948,21 +6155,21 @@ exports.install = (globalObject, globalNames) => { frozenArrayConsumer(arr) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'frozenArrayConsumer' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'frozenArrayConsumer' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -5970,7 +6177,8 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { nextItem = conversions[\\"double\\"](nextItem, { - context: \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\" + context: \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -6021,11 +6229,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Static'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Static'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -6095,13 +6303,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Static { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } def() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'def' called on an object that is not a valid instance of Static.\\"); + throw new globalObject.TypeError(\\"'def' called on an object that is not a valid instance of Static.\\"); } return esValue[implSymbol].def(); @@ -6111,7 +6319,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get abc' called on an object that is not a valid instance of Static.\\"); + throw new globalObject.TypeError(\\"'get abc' called on an object that is not a valid instance of Static.\\"); } return esValue[implSymbol][\\"abc\\"]; @@ -6121,10 +6329,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set abc' called on an object that is not a valid instance of Static.\\"); + throw new globalObject.TypeError(\\"'set abc' called on an object that is not a valid instance of Static.\\"); } - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'abc' property on 'Static': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"abc\\"] = V; } @@ -6142,7 +6353,10 @@ exports.install = (globalObject, globalNames) => { static set abc(V) { const esValue = this !== null && this !== undefined ? this : globalObject; - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'abc' property on 'Static': The provided value\\", + globals: globalObject + }); Impl.implementation[\\"abc\\"] = V; } @@ -6183,11 +6397,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Storage'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Storage'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -6203,6 +6417,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -6224,7 +6447,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -6242,7 +6465,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -6261,24 +6484,27 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Storage { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } key(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'key' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'key' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'key' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'key' on 'Storage': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"unsigned long\\"](curArg, { context: \\"Failed to execute 'key' on 'Storage': parameter 1\\" }); + curArg = conversions[\\"unsigned long\\"](curArg, { + context: \\"Failed to execute 'key' on 'Storage': parameter 1\\", + globals: globalObject + }); args.push(curArg); } return esValue[implSymbol].key(...args); @@ -6287,18 +6513,21 @@ exports.install = (globalObject, globalNames) => { getItem(key) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'getItem' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'getItem' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'getItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'getItem' on 'Storage': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'getItem' on 'Storage': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'getItem' on 'Storage': parameter 1\\", + globals: globalObject + }); args.push(curArg); } return esValue[implSymbol].getItem(...args); @@ -6307,23 +6536,29 @@ exports.install = (globalObject, globalNames) => { setItem(key, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'setItem' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'setItem' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'setItem' on 'Storage': 2 arguments required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'setItem' on 'Storage': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'setItem' on 'Storage': parameter 1\\", + globals: globalObject + }); args.push(curArg); } { let curArg = arguments[1]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\", + globals: globalObject + }); args.push(curArg); } return esValue[implSymbol].setItem(...args); @@ -6332,19 +6567,20 @@ exports.install = (globalObject, globalNames) => { removeItem(key) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'removeItem' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'removeItem' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'removeItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'removeItem' on 'Storage': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'removeItem' on 'Storage': parameter 1\\" + context: \\"Failed to execute 'removeItem' on 'Storage': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -6354,7 +6590,7 @@ exports.install = (globalObject, globalNames) => { clear() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'clear' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'clear' called on an object that is not a valid instance of Storage.\\"); } return esValue[implSymbol].clear(); @@ -6364,7 +6600,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get length' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'get length' called on an object that is not a valid instance of Storage.\\"); } return esValue[implSymbol][\\"length\\"]; @@ -6388,7 +6624,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -6409,7 +6650,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -6424,7 +6665,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -6439,7 +6680,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -6459,7 +6700,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -6468,11 +6709,14 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; + if (typeof P === \\"string\\") { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\", + globals: globalObject }); target[implSymbol].setItem(P, namedValue); @@ -6512,12 +6756,14 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + + const globalObject = this._globalObject; if (!utils.hasOwn(target, P)) { if (desc.get || desc.set) { return false; @@ -6526,7 +6772,8 @@ const proxyHandler = { let namedValue = desc.value; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\", + globals: globalObject }); target[implSymbol].setItem(P, namedValue); @@ -6534,25 +6781,27 @@ const proxyHandler = { return true; } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { target[implSymbol].removeItem(P); return true; } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/Storage.js\\"); " @@ -6575,11 +6824,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -6649,14 +6898,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierAttribute { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get attr() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of StringifierAttribute.\\"); + throw new globalObject.TypeError( + \\"'get attr' called on an object that is not a valid instance of StringifierAttribute.\\" + ); } return esValue[implSymbol][\\"attr\\"]; @@ -6665,7 +6916,9 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of StringifierAttribute.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of StringifierAttribute.\\" + ); } return esValue[implSymbol][\\"attr\\"]; @@ -6706,11 +6959,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -6780,13 +7033,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierDefaultOperation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'toString' called on an object that is not a valid instance of StringifierDefaultOperation.\\" ); } @@ -6828,11 +7081,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -6902,13 +7155,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierNamedOperation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } operation() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'operation' called on an object that is not a valid instance of StringifierNamedOperation.\\" ); } @@ -6919,7 +7172,7 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'toString' called on an object that is not a valid instance of StringifierNamedOperation.\\" ); } @@ -6962,11 +7215,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierOperation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -7036,13 +7289,15 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierOperation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of StringifierOperation.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of StringifierOperation.\\" + ); } return esValue[implSymbol].toString(); @@ -7084,11 +7339,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -7158,22 +7413,20 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class TypedefsAndUnions { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } numOrStrConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrStrConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7182,11 +7435,13 @@ exports.install = (globalObject, globalNames) => { if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, clamp: true }); } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\" + context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -7197,16 +7452,14 @@ exports.install = (globalObject, globalNames) => { numOrEnumConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrEnumConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7217,10 +7470,11 @@ exports.install = (globalObject, globalNames) => { } else { if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { - context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" + context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject }); } else { - curArg = RequestDestination.convert(curArg, { + curArg = RequestDestination.convert(globalObject, curArg, { context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" }); } @@ -7233,16 +7487,14 @@ exports.install = (globalObject, globalNames) => { numOrStrOrNullConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrStrOrNullConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7254,12 +7506,14 @@ exports.install = (globalObject, globalNames) => { if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, clamp: true, enforceRange: true }); } else { curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, enforceRange: true }); } @@ -7272,16 +7526,14 @@ exports.install = (globalObject, globalNames) => { numOrStrOrURLOrNullConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrStrOrURLOrNullConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7295,12 +7547,14 @@ exports.install = (globalObject, globalNames) => { } else if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, clamp: true, enforceRange: true }); } else { curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, enforceRange: true }); } @@ -7313,23 +7567,21 @@ exports.install = (globalObject, globalNames) => { urlMapInnerConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'urlMapInnerConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\" ); } else { @@ -7340,12 +7592,13 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" }); @@ -7362,14 +7615,14 @@ exports.install = (globalObject, globalNames) => { urlMapConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'urlMapConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'urlMapConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7379,7 +7632,7 @@ exports.install = (globalObject, globalNames) => { curArg = null; } else { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\" ); } else { @@ -7390,12 +7643,13 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" }); @@ -7413,16 +7667,14 @@ exports.install = (globalObject, globalNames) => { bufferSourceOrURLConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'bufferSourceOrURLConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7433,7 +7685,7 @@ exports.install = (globalObject, globalNames) => { } else if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not of any supported type.\\" ); @@ -7446,16 +7698,14 @@ exports.install = (globalObject, globalNames) => { arrayBufferViewOrURLMapConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'arrayBufferViewOrURLMapConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7467,7 +7717,7 @@ exports.install = (globalObject, globalNames) => { if (ArrayBuffer.isView(curArg)) { } else if (utils.isObject(curArg)) { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" record\\" + \\" is not an object.\\" @@ -7483,12 +7733,13 @@ exports.install = (globalObject, globalNames) => { context: \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" record\\" + - \\"'s key\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" record\\" + @@ -7501,7 +7752,7 @@ exports.install = (globalObject, globalNames) => { curArg = result; } } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not of any supported type.\\" ); @@ -7515,16 +7766,14 @@ exports.install = (globalObject, globalNames) => { arrayBufferViewDupConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'arrayBufferViewDupConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -7532,7 +7781,7 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not of any supported type.\\" ); @@ -7546,7 +7795,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get buf' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'get buf' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"buf\\"]); @@ -7556,7 +7807,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set buf' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'set buf' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } if (utils.isArrayBuffer(V)) { @@ -7565,7 +7818,7 @@ exports.install = (globalObject, globalNames) => { (V.constructor.name === \\"Uint8Array\\" || V.constructor.name === \\"Uint16Array\\") ) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + \\" is not of any supported type.\\" ); @@ -7577,7 +7830,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get time' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'get time' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } return esValue[implSymbol][\\"time\\"]; @@ -7587,11 +7842,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set time' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'set time' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } V = conversions[\\"unsigned long long\\"](V, { - context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\" + context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"time\\"] = V; @@ -7641,11 +7899,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URL'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URL'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -7716,20 +7974,26 @@ exports.install = (globalObject, globalNames) => { class URL { constructor(url) { if (arguments.length < 1) { - throw new TypeError( - \\"Failed to construct 'URL': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to construct 'URL': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 1\\" }); + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to construct 'URL': parameter 1\\", + globals: globalObject + }); args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { - curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" }); + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to construct 'URL': parameter 2\\", + globals: globalObject + }); } args.push(curArg); } @@ -7739,7 +8003,7 @@ exports.install = (globalObject, globalNames) => { toJSON() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'toJSON' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'toJSON' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol].toJSON(); @@ -7749,7 +8013,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get href' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get href' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"href\\"]; @@ -7759,10 +8023,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set href' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set href' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'href' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"href\\"] = V; } @@ -7770,7 +8037,7 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'toString' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"href\\"]; @@ -7780,7 +8047,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get origin' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get origin' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"origin\\"]; @@ -7790,7 +8057,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get protocol' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get protocol' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"protocol\\"]; @@ -7800,11 +8067,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set protocol' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set protocol' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" + context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"protocol\\"] = V; @@ -7814,7 +8082,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get username' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get username' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"username\\"]; @@ -7824,11 +8092,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set username' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set username' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'username' property on 'URL': The provided value\\" + context: \\"Failed to set the 'username' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"username\\"] = V; @@ -7838,7 +8107,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get password' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get password' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"password\\"]; @@ -7848,11 +8117,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set password' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set password' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'password' property on 'URL': The provided value\\" + context: \\"Failed to set the 'password' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"password\\"] = V; @@ -7862,7 +8132,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get host' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get host' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"host\\"]; @@ -7872,10 +8142,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set host' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set host' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'host' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"host\\"] = V; } @@ -7884,7 +8157,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get hostname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get hostname' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"hostname\\"]; @@ -7894,11 +8167,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set hostname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set hostname' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" + context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"hostname\\"] = V; @@ -7908,7 +8182,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get port' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get port' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"port\\"]; @@ -7918,10 +8192,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set port' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set port' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'port' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"port\\"] = V; } @@ -7930,7 +8207,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get pathname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get pathname' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"pathname\\"]; @@ -7940,11 +8217,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set pathname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set pathname' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" + context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"pathname\\"] = V; @@ -7954,7 +8232,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get search' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get search' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"search\\"]; @@ -7964,10 +8242,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set search' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set search' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'search' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"search\\"] = V; } @@ -7976,7 +8257,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get searchParams' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get searchParams' called on an object that is not a valid instance of URL.\\"); } return utils.getSameObject(this, \\"searchParams\\", () => { @@ -7988,7 +8269,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get hash' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get hash' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"hash\\"]; @@ -7998,10 +8279,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set hash' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set hash' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'hash' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"hash\\"] = V; } @@ -8052,9 +8336,9 @@ const utils = require(\\"./utils.js\\"); const URL = require(\\"./URL.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (typeof value !== \\"function\\") { - throw new TypeError(context + \\" is not a function\\"); + throw new globalObject.TypeError(context + \\" is not a function\\"); } function invokeTheCallbackFunction(url, string) { @@ -8065,7 +8349,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { callResult = Reflect.apply(value, thisArg, [url, string]); - callResult = URL.convert(callResult, { context: context }); + callResult = URL.convert(globalObject, callResult, { context: context }); return callResult; } @@ -8075,7 +8359,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { let callResult = Reflect.construct(value, [url, string]); - callResult = URL.convert(callResult, { context: context }); + callResult = URL.convert(globalObject, callResult, { context: context }); return callResult; }; @@ -8094,7 +8378,7 @@ exports[`generation with processors URLHandlerNonNull.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { function invokeTheCallbackFunction(url) { const thisArg = utils.tryWrapperForImpl(this); let callResult; @@ -8105,7 +8389,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { callResult = Reflect.apply(value, thisArg, [url]); } - callResult = conversions[\\"any\\"](callResult, { context: context }); + callResult = conversions[\\"any\\"](callResult, { context: context, globals: globalObject }); return callResult; } @@ -8115,7 +8399,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { let callResult = Reflect.construct(value, [url]); - callResult = conversions[\\"any\\"](callResult, { context: context }); + callResult = conversions[\\"any\\"](callResult, { context: context, globals: globalObject }); return callResult; }; @@ -8145,11 +8429,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLList'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLList'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -8165,6 +8449,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -8186,7 +8479,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -8204,7 +8497,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -8223,25 +8516,26 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class URLList { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } item(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'item' called on an object that is not a valid instance of URLList.\\"); + throw new globalObject.TypeError(\\"'item' called on an object that is not a valid instance of URLList.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'item' on 'URLList': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'item' on 'URLList': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'item' on 'URLList': parameter 1\\" + context: \\"Failed to execute 'item' on 'URLList': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -8252,7 +8546,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get length' called on an object that is not a valid instance of URLList.\\"); + throw new globalObject.TypeError(\\"'get length' called on an object that is not a valid instance of URLList.\\"); } return esValue[implSymbol][\\"length\\"]; @@ -8262,15 +8556,11 @@ exports.install = (globalObject, globalNames) => { item: { enumerable: true }, length: { enumerable: true }, [Symbol.toStringTag]: { value: \\"URLList\\", configurable: true }, - [Symbol.iterator]: { - value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], - configurable: true, - writable: true - }, - keys: { value: ctorRegistry[\\"%Array%\\"].prototype.keys, configurable: true, enumerable: true, writable: true }, - values: { value: ctorRegistry[\\"%Array%\\"].prototype.values, configurable: true, enumerable: true, writable: true }, - entries: { value: ctorRegistry[\\"%Array%\\"].prototype.entries, configurable: true, enumerable: true, writable: true }, - forEach: { value: ctorRegistry[\\"%Array%\\"].prototype.forEach, configurable: true, enumerable: true, writable: true } + [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true }, + keys: { value: globalObject.Array.prototype.keys, configurable: true, enumerable: true, writable: true }, + values: { value: globalObject.Array.prototype.values, configurable: true, enumerable: true, writable: true }, + entries: { value: globalObject.Array.prototype.entries, configurable: true, enumerable: true, writable: true }, + forEach: { value: globalObject.Array.prototype.forEach, configurable: true, enumerable: true, writable: true } }); ctorRegistry[interfaceName] = URLList; @@ -8281,7 +8571,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -8302,7 +8597,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -8317,7 +8612,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -8330,7 +8625,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -8354,7 +8649,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -8363,6 +8658,7 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; } let ownDesc; @@ -8410,37 +8706,41 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { return false; } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; return !target[implSymbol][utils.supportsPropertyIndex](index); } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/URLList.js\\"); " @@ -8465,11 +8765,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParams'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLSearchParams'.\`); }; exports.createDefaultIterator = (globalObject, target, kind) => { @@ -8557,7 +8857,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isObject(curArg)) { if (curArg[Symbol.iterator] !== undefined) { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\" is not an iterable object.\\" ); } else { @@ -8565,7 +8865,7 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { if (!utils.isObject(nextItem)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\"'s element\\" + @@ -8580,7 +8880,8 @@ exports.install = (globalObject, globalNames) => { \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\"'s element\\" + - \\"'s element\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -8594,7 +8895,7 @@ exports.install = (globalObject, globalNames) => { } } else { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\" is not an object.\\" ); } else { @@ -8605,13 +8906,15 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\" + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; typedValue = conversions[\\"USVString\\"](typedValue, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\" + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\", + globals: globalObject }); result[typedKey] = typedValue; @@ -8622,7 +8925,8 @@ exports.install = (globalObject, globalNames) => { } } else { curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + context: \\"Failed to construct 'URLSearchParams': parameter 1\\", + globals: globalObject }); } } else { @@ -8636,28 +8940,30 @@ exports.install = (globalObject, globalNames) => { append(name, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'append' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'append' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 2\\" + context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -8667,21 +8973,22 @@ exports.install = (globalObject, globalNames) => { delete(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'delete' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'delete' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'delete' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'delete' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -8691,21 +8998,20 @@ exports.install = (globalObject, globalNames) => { get(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'get' called on an object that is not a valid instance of URLSearchParams.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'get' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'get' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -8715,21 +9021,22 @@ exports.install = (globalObject, globalNames) => { getAll(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'getAll' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'getAll' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'getAll' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'getAll' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -8739,21 +9046,20 @@ exports.install = (globalObject, globalNames) => { has(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'has' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'has' called on an object that is not a valid instance of URLSearchParams.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'has' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'has' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -8763,28 +9069,28 @@ exports.install = (globalObject, globalNames) => { set(name, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'set' called on an object that is not a valid instance of URLSearchParams.\\"); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\" + context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -8794,7 +9100,7 @@ exports.install = (globalObject, globalNames) => { sort() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'sort' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'sort' called on an object that is not a valid instance of URLSearchParams.\\"); } return esValue[implSymbol].sort(); @@ -8803,7 +9109,9 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of URLSearchParams.\\" + ); } return esValue[implSymbol].toString(); @@ -8811,33 +9119,41 @@ exports.install = (globalObject, globalNames) => { keys() { if (!exports.is(this)) { - throw new TypeError(\\"'keys' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'keys' called on an object that is not a valid instance of URLSearchParams.\\"); } return exports.createDefaultIterator(globalObject, this, \\"key\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of URLSearchParams.\\" + ); } return exports.createDefaultIterator(globalObject, this, \\"value\\"); } entries() { if (!exports.is(this)) { - throw new TypeError(\\"'entries' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'entries' called on an object that is not a valid instance of URLSearchParams.\\" + ); } return exports.createDefaultIterator(globalObject, this, \\"key+value\\"); } forEach(callback) { if (!exports.is(this)) { - throw new TypeError(\\"'forEach' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'forEach' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 1) { - throw new TypeError(\\"Failed to execute 'forEach' on 'iterable': 1 argument required, \\" + \\"but only 0 present.\\"); + throw new globalObject.TypeError( + \\"Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.\\" + ); } - callback = Function.convert(callback, { + callback = Function.convert(globalObject, callback, { context: \\"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1\\" }); const thisArg = arguments[1]; @@ -8879,7 +9195,7 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - throw new TypeError(\\"next() called on a value that is not a URLSearchParams iterator object\\"); + throw new globalObject.TypeError(\\"next() called on a value that is not a URLSearchParams iterator object\\"); } const { target, kind, index } = internal; @@ -8923,11 +9239,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -8943,6 +9259,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -8964,7 +9289,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -8982,7 +9307,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -9001,27 +9326,28 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class URLSearchParamsCollection { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } item(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'item' called on an object that is not a valid instance of URLSearchParamsCollection.\\"); + throw new globalObject.TypeError( + \\"'item' called on an object that is not a valid instance of URLSearchParamsCollection.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'item' on 'URLSearchParamsCollection': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'item' on 'URLSearchParamsCollection': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'item' on 'URLSearchParamsCollection': parameter 1\\" + context: \\"Failed to execute 'item' on 'URLSearchParamsCollection': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -9031,23 +9357,22 @@ exports.install = (globalObject, globalNames) => { namedItem(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'namedItem' called on an object that is not a valid instance of URLSearchParamsCollection.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'namedItem' on 'URLSearchParamsCollection': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': parameter 1\\" + context: \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -9058,7 +9383,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get length' called on an object that is not a valid instance of URLSearchParamsCollection.\\" ); } @@ -9071,7 +9396,7 @@ exports.install = (globalObject, globalNames) => { namedItem: { enumerable: true }, length: { enumerable: true }, [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection\\", configurable: true }, - [Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true } + [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } }); ctorRegistry[interfaceName] = URLSearchParamsCollection; @@ -9082,7 +9407,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -9103,7 +9433,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -9118,7 +9448,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -9137,7 +9467,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -9171,7 +9501,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -9180,6 +9510,7 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; } let ownDesc; @@ -9226,13 +9557,15 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { return false; } @@ -9243,13 +9576,15 @@ const proxyHandler = { } } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; return !(target[implSymbol].item(index) !== undefined); @@ -9260,12 +9595,12 @@ const proxyHandler = { } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/URLSearchParamsCollection.js\\"); " @@ -9290,11 +9625,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -9310,14 +9645,23 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; + +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); }; exports._internalSetup = (wrapper, globalObject) => { @@ -9333,7 +9677,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -9351,7 +9695,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -9370,12 +9714,12 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(URLSearchParamsCollection2.prototype, { [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true }, - [Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true } + [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } }); ctorRegistry[interfaceName] = URLSearchParamsCollection2; @@ -9386,7 +9730,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -9407,7 +9756,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -9422,7 +9771,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -9441,7 +9790,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -9475,7 +9824,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -9484,10 +9833,12 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; + if (typeof P === \\"string\\") { let namedValue = V; - namedValue = URL.convert(namedValue, { + namedValue = URL.convert(globalObject, namedValue, { context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" }); @@ -9546,13 +9897,15 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { return false; } @@ -9563,7 +9916,7 @@ const proxyHandler = { let namedValue = desc.value; - namedValue = URL.convert(namedValue, { + namedValue = URL.convert(globalObject, namedValue, { context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" }); @@ -9577,13 +9930,15 @@ const proxyHandler = { return true; } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; return !(target[implSymbol].item(index) !== undefined); @@ -9594,12 +9949,12 @@ const proxyHandler = { } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\"); " @@ -9622,11 +9977,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -9696,27 +10051,27 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class UnderscoredProperties { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } operation(sequence) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'operation' called on an object that is not a valid instance of UnderscoredProperties.\\"); + throw new globalObject.TypeError( + \\"'operation' called on an object that is not a valid instance of UnderscoredProperties.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'operation' on 'UnderscoredProperties': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'operation' on 'UnderscoredProperties': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -9724,7 +10079,8 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { nextItem = conversions[\\"DOMString\\"](nextItem, { - context: \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\"'s element\\" + context: \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -9740,7 +10096,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get attribute' called on an object that is not a valid instance of UnderscoredProperties.\\" ); } @@ -9752,13 +10108,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'set attribute' called on an object that is not a valid instance of UnderscoredProperties.\\" ); } V = conversions[\\"byte\\"](V, { - context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\" + context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"attribute\\"] = V; @@ -9766,17 +10123,16 @@ exports.install = (globalObject, globalNames) => { static static(void_) { if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'static' on 'UnderscoredProperties': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'static' on 'UnderscoredProperties': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'static' on 'UnderscoredProperties': parameter 1\\" + context: \\"Failed to execute 'static' on 'UnderscoredProperties': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -9823,11 +10179,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Unscopable'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Unscopable'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -9897,14 +10253,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Unscopable { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get unscopableTest() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get unscopableTest' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'get unscopableTest' called on an object that is not a valid instance of Unscopable.\\" + ); } return esValue[implSymbol][\\"unscopableTest\\"]; @@ -9914,11 +10272,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set unscopableTest' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'set unscopableTest' called on an object that is not a valid instance of Unscopable.\\" + ); } V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\" + context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"unscopableTest\\"] = V; @@ -9928,7 +10289,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get unscopableMixin' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'get unscopableMixin' called on an object that is not a valid instance of Unscopable.\\" + ); } return esValue[implSymbol][\\"unscopableMixin\\"]; @@ -9938,11 +10301,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set unscopableMixin' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'set unscopableMixin' called on an object that is not a valid instance of Unscopable.\\" + ); } V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\" + context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"unscopableMixin\\"] = V; @@ -9988,11 +10354,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Variadic'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Variadic'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -10062,19 +10428,20 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Variadic { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } simple1() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'simple1' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'simple1' called on an object that is not a valid instance of Variadic.\\"); } const args = []; for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'simple1' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'simple1' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -10084,25 +10451,28 @@ exports.install = (globalObject, globalNames) => { simple2(first) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'simple2' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'simple2' called on an object that is not a valid instance of Variadic.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'simple2' on 'Variadic': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'simple2' on 'Variadic': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'simple2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'simple2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } for (let i = 1; i < arguments.length; i++) { let curArg = arguments[i]; - curArg = URL.convert(curArg, { context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) }); + curArg = URL.convert(globalObject, curArg, { + context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) + }); args.push(curArg); } return esValue[implSymbol].simple2(...args); @@ -10111,7 +10481,7 @@ exports.install = (globalObject, globalNames) => { overloaded1() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'overloaded1' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'overloaded1' called on an object that is not a valid instance of Variadic.\\"); } const args = []; switch (arguments.length) { @@ -10123,7 +10493,8 @@ exports.install = (globalObject, globalNames) => { for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -10131,7 +10502,8 @@ exports.install = (globalObject, globalNames) => { for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -10144,14 +10516,12 @@ exports.install = (globalObject, globalNames) => { overloaded2(first) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'overloaded2' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'overloaded2' called on an object that is not a valid instance of Variadic.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -10163,7 +10533,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -10171,7 +10542,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -10184,14 +10556,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } for (let i = 1; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -10199,14 +10573,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } for (let i = 1; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -10253,11 +10629,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -10352,9 +10728,9 @@ exports[`generation without processors AsyncCallbackFunction.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (typeof value !== \\"function\\") { - throw new TypeError(context + \\" is not a function\\"); + throw new globalObject.TypeError(context + \\" is not a function\\"); } function invokeTheCallbackFunction() { @@ -10364,17 +10740,17 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { try { callResult = Reflect.apply(value, thisArg, []); - callResult = new Promise(resolve => resolve(callResult)); + callResult = new globalObject.Promise(resolve => resolve(callResult)); return callResult; } catch (err) { - return Promise.reject(err); + return globalObject.Promise.reject(err); } } invokeTheCallbackFunction.construct = () => { let callResult = Reflect.construct(value, []); - callResult = new Promise(resolve => resolve(callResult)); + callResult = new globalObject.Promise(resolve => resolve(callResult)); return callResult; }; @@ -10392,9 +10768,9 @@ exports[`generation without processors AsyncCallbackInterface.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation() { @@ -10406,17 +10782,17 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } if (typeof O !== \\"function\\") { X = O[\\"asyncMethod\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement AsyncCallbackInterface.\`); + throw new globalObject.TypeError(\`\${context} does not correctly implement AsyncCallbackInterface.\`); } thisArg = O; } let callResult = Reflect.apply(X, thisArg, []); - callResult = new Promise(resolve => resolve(callResult)); + callResult = new globalObject.Promise(resolve => resolve(callResult)); return callResult; } catch (err) { - return Promise.reject(err); + return globalObject.Promise.reject(err); } } @@ -10449,11 +10825,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterablePairArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterablePairArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -10534,19 +10910,22 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterablePairArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } keys() { if (!exports.is(this)) { - throw new TypeError(\\"'keys' called on an object that is not a valid instance of AsyncIterablePairArgs.\\"); + throw new globalObject.TypeError( + \\"'keys' called on an object that is not a valid instance of AsyncIterablePairArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; args[0] = conversions[\\"boolean\\"](args[0], { - context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 1\\" + context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 1\\", + globals: globalObject }); } else { args[0] = false; @@ -10555,13 +10934,14 @@ exports.install = (globalObject, globalNames) => { if (arguments[1] !== undefined) { args[1] = arguments[1]; args[1] = conversions[\\"DOMString\\"](args[1], { - context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 2\\" + context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 2\\", + globals: globalObject }); } else { args[1] = undefined; } args[2] = arguments[2]; - args[2] = Dictionary.convert(args[2], { + args[2] = Dictionary.convert(globalObject, args[2], { context: \\"Failed to execute 'keys' on 'AsyncIterablePairArgs': parameter 3\\" }); @@ -10574,14 +10954,17 @@ exports.install = (globalObject, globalNames) => { values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterablePairArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterablePairArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; args[0] = conversions[\\"boolean\\"](args[0], { - context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 1\\" + context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 1\\", + globals: globalObject }); } else { args[0] = false; @@ -10590,13 +10973,14 @@ exports.install = (globalObject, globalNames) => { if (arguments[1] !== undefined) { args[1] = arguments[1]; args[1] = conversions[\\"DOMString\\"](args[1], { - context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 2\\" + context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 2\\", + globals: globalObject }); } else { args[1] = undefined; } args[2] = arguments[2]; - args[2] = Dictionary.convert(args[2], { + args[2] = Dictionary.convert(globalObject, args[2], { context: \\"Failed to execute 'values' on 'AsyncIterablePairArgs': parameter 3\\" }); @@ -10609,14 +10993,17 @@ exports.install = (globalObject, globalNames) => { entries() { if (!exports.is(this)) { - throw new TypeError(\\"'entries' called on an object that is not a valid instance of AsyncIterablePairArgs.\\"); + throw new globalObject.TypeError( + \\"'entries' called on an object that is not a valid instance of AsyncIterablePairArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; args[0] = conversions[\\"boolean\\"](args[0], { - context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 1\\" + context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 1\\", + globals: globalObject }); } else { args[0] = false; @@ -10625,13 +11012,14 @@ exports.install = (globalObject, globalNames) => { if (arguments[1] !== undefined) { args[1] = arguments[1]; args[1] = conversions[\\"DOMString\\"](args[1], { - context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 2\\" + context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 2\\", + globals: globalObject }); } else { args[1] = undefined; } args[2] = arguments[2]; - args[2] = Dictionary.convert(args[2], { + args[2] = Dictionary.convert(globalObject, args[2], { context: \\"Failed to execute 'entries' on 'AsyncIterablePairArgs': parameter 3\\" }); @@ -10661,14 +11049,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterablePairArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterablePairArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -10725,11 +11115,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterablePairNoArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterablePairNoArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -10810,12 +11200,14 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterablePairNoArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } keys() { if (!exports.is(this)) { - throw new TypeError(\\"'keys' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\"); + throw new globalObject.TypeError( + \\"'keys' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\" + ); } const args = []; @@ -10829,7 +11221,9 @@ exports.install = (globalObject, globalNames) => { values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\" + ); } const args = []; @@ -10843,7 +11237,9 @@ exports.install = (globalObject, globalNames) => { entries() { if (!exports.is(this)) { - throw new TypeError(\\"'entries' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\"); + throw new globalObject.TypeError( + \\"'entries' called on an object that is not a valid instance of AsyncIterablePairNoArgs.\\" + ); } const args = []; @@ -10874,14 +11270,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterablePairNoArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterablePairNoArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -10939,11 +11337,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterableValueArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterableValueArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -11024,18 +11422,20 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterableValueArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterableValueArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterableValueArgs.\\" + ); } const args = []; if (arguments[0] !== undefined) { args[0] = arguments[0]; - args[0] = URL.convert(args[0], { + args[0] = URL.convert(globalObject, args[0], { context: \\"Failed to execute 'values' on 'AsyncIterableValueArgs': parameter 1\\" }); } else { @@ -11066,14 +11466,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterableValueArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterableValueArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -11130,11 +11532,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterableValueNoArgs'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterableValueNoArgs'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -11215,12 +11617,14 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterableValueNoArgs { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterableValueNoArgs.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterableValueNoArgs.\\" + ); } const args = []; @@ -11249,14 +11653,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterableValueNoArgs async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterableValueNoArgs async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -11314,11 +11720,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'AsyncIterableWithReturn'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'AsyncIterableWithReturn'.\`); }; exports.createDefaultAsyncIterator = (globalObject, target, kind) => { @@ -11399,17 +11805,19 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class AsyncIterableWithReturn { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of AsyncIterableWithReturn.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of AsyncIterableWithReturn.\\" + ); } const args = []; args[0] = arguments[0]; - args[0] = Dictionary.convert(args[0], { + args[0] = Dictionary.convert(globalObject, args[0], { context: \\"Failed to execute 'values' on 'AsyncIterableWithReturn': parameter 1\\" }); @@ -11437,14 +11845,16 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"next() called on a value that is not a AsyncIterableWithReturn async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"next() called on a value that is not a AsyncIterableWithReturn async iterator object\\" + ) ); } const nextSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value: undefined, done: true })); } const nextPromise = internal.target[implSymbol][utils.asyncIteratorNext](this); @@ -11474,14 +11884,16 @@ exports.install = (globalObject, globalNames) => { return(value) { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - return Promise.reject( - new TypeError(\\"return() called on a value that is not a AsyncIterableWithReturn async iterator object\\") + return globalObject.Promise.reject( + new globalObject.TypeError( + \\"return() called on a value that is not a AsyncIterableWithReturn async iterator object\\" + ) ); } const returnSteps = () => { if (internal.isFinished) { - return Promise.resolve(newObjectInRealm(globalObject, { value, done: true })); + return globalObject.Promise.resolve(newObjectInRealm(globalObject, { value, done: true })); } internal.isFinished = true; @@ -11523,11 +11935,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'BufferSourceTypes'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'BufferSourceTypes'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -11597,20 +12009,18 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class BufferSourceTypes { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } bs(source) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'bs' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError(\\"'bs' called on an object that is not a valid instance of BufferSourceTypes.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'bs' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'bs' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -11619,7 +12029,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'bs' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" ); } @@ -11631,21 +12041,20 @@ exports.install = (globalObject, globalNames) => { ab(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'ab' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError(\\"'ab' called on an object that is not a valid instance of BufferSourceTypes.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'ab' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'ab' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"ArrayBuffer\\"](curArg, { - context: \\"Failed to execute 'ab' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'ab' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -11655,14 +12064,14 @@ exports.install = (globalObject, globalNames) => { abv(abv) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'abv' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'abv' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'abv' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'abv' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -11670,7 +12079,7 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'abv' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" ); } @@ -11682,21 +12091,22 @@ exports.install = (globalObject, globalNames) => { u8a(u8) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'u8a' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'u8a' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'u8a' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'u8a' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"Uint8Array\\"](curArg, { - context: \\"Failed to execute 'u8a' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'u8a' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -11706,14 +12116,14 @@ exports.install = (globalObject, globalNames) => { abUnion(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'abUnion' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'abUnion' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'abUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'abUnion' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -11722,7 +12132,8 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'abUnion' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'abUnion' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -11733,14 +12144,14 @@ exports.install = (globalObject, globalNames) => { u8aUnion(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'u8aUnion' called on an object that is not a valid instance of BufferSourceTypes.\\"); + throw new globalObject.TypeError( + \\"'u8aUnion' called on an object that is not a valid instance of BufferSourceTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'u8aUnion' on 'BufferSourceTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -11749,7 +12160,8 @@ exports.install = (globalObject, globalNames) => { if (ArrayBuffer.isView(curArg) && curArg.constructor.name === \\"Uint8Array\\") { } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': parameter 1\\" + context: \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -11796,11 +12208,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'CEReactions'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'CEReactions'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -11883,13 +12295,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class CEReactions { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } method() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'method' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError(\\"'method' called on an object that is not a valid instance of CEReactions.\\"); } return esValue[implSymbol].method(); @@ -11899,12 +12311,14 @@ exports.install = (globalObject, globalNames) => { try { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'promiseOperation' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError( + \\"'promiseOperation' called on an object that is not a valid instance of CEReactions.\\" + ); } return utils.tryWrapperForImpl(esValue[implSymbol].promiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -11912,7 +12326,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError(\\"'get attr' called on an object that is not a valid instance of CEReactions.\\"); } return esValue[implSymbol][\\"attr\\"]; @@ -11922,11 +12336,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set attr' called on an object that is not a valid instance of CEReactions.\\"); + throw new globalObject.TypeError(\\"'set attr' called on an object that is not a valid instance of CEReactions.\\"); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'attr' property on 'CEReactions': The provided value\\" + context: \\"Failed to set the 'attr' property on 'CEReactions': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"attr\\"] = V; @@ -11937,14 +12352,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get promiseAttribute' called on an object that is not a valid instance of CEReactions.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"promiseAttribute\\"]); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } } @@ -12055,7 +12470,8 @@ class ProxyHandler { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\", + globals: globalObject }); const creating = !target[implSymbol][utils.supportsPropertyName](P); @@ -12116,7 +12532,8 @@ class ProxyHandler { let namedValue = desc.value; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\", + globals: globalObject }); const creating = !target[implSymbol][utils.supportsPropertyName](P); @@ -12166,12 +12583,12 @@ const URLCallback = require(\\"./URLCallback.js\\"); const URLHandlerNonNull = require(\\"./URLHandlerNonNull.js\\"); const VoidFunction = require(\\"./VoidFunction.js\\"); -exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {}) => { +exports._convertInherit = (globalObject, obj, ret, { context = \\"The provided value\\" } = {}) => { { const key = \\"function\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = Function.convert(value, { context: context + \\" has member 'function' that\\" }); + value = Function.convert(globalObject, value, { context: context + \\" has member 'function' that\\" }); ret[key] = value; } @@ -12181,7 +12598,7 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"urlCallback\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = URLCallback.convert(value, { context: context + \\" has member 'urlCallback' that\\" }); + value = URLCallback.convert(globalObject, value, { context: context + \\" has member 'urlCallback' that\\" }); ret[key] = value; } @@ -12194,7 +12611,7 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} if (!utils.isObject(value)) { value = null; } else { - value = URLHandlerNonNull.convert(value, { context: context + \\" has member 'urlHandler' that\\" }); + value = URLHandlerNonNull.convert(globalObject, value, { context: context + \\" has member 'urlHandler' that\\" }); } ret[key] = value; } @@ -12204,7 +12621,9 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"urlHandlerNonNull\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = URLHandlerNonNull.convert(value, { context: context + \\" has member 'urlHandlerNonNull' that\\" }); + value = URLHandlerNonNull.convert(globalObject, value, { + context: context + \\" has member 'urlHandlerNonNull' that\\" + }); ret[key] = value; } @@ -12214,20 +12633,20 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"voidFunction\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = VoidFunction.convert(value, { context: context + \\" has member 'voidFunction' that\\" }); + value = VoidFunction.convert(globalObject, value, { context: context + \\" has member 'voidFunction' that\\" }); ret[key] = value; } } }; -exports.convert = function convert(obj, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, obj, { context = \\"The provided value\\" } = {}) => { if (obj !== undefined && typeof obj !== \\"object\\" && typeof obj !== \\"function\\") { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } const ret = Object.create(null); - exports._convertInherit(obj, ret, { context }); + exports._convertInherit(globalObject, obj, ret, { context }); return ret; }; " @@ -12250,11 +12669,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DOMImplementation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'DOMImplementation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -12324,43 +12743,44 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class DOMImplementation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } createDocumentType(qualifiedName, publicId, systemId) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'createDocumentType' called on an object that is not a valid instance of DOMImplementation.\\" ); } if (arguments.length < 3) { - throw new TypeError( - \\"Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 1\\" + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2\\" + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[2]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\" + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\", + globals: globalObject }); args.push(curArg); } @@ -12370,14 +12790,14 @@ exports.install = (globalObject, globalNames) => { createDocument(namespace, qualifiedName) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'createDocument' called on an object that is not a valid instance of DOMImplementation.\\"); + throw new globalObject.TypeError( + \\"'createDocument' called on an object that is not a valid instance of DOMImplementation.\\" + ); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; @@ -12387,7 +12807,8 @@ exports.install = (globalObject, globalNames) => { curArg = null; } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 1\\" + context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -12396,6 +12817,7 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 2\\", + globals: globalObject, treatNullAsEmptyString: true }); args.push(curArg); @@ -12419,7 +12841,7 @@ exports.install = (globalObject, globalNames) => { createHTMLDocument() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'createHTMLDocument' called on an object that is not a valid instance of DOMImplementation.\\" ); } @@ -12428,7 +12850,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\" + context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -12439,7 +12862,9 @@ exports.install = (globalObject, globalNames) => { hasFeature() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'hasFeature' called on an object that is not a valid instance of DOMImplementation.\\"); + throw new globalObject.TypeError( + \\"'hasFeature' called on an object that is not a valid instance of DOMImplementation.\\" + ); } return esValue[implSymbol].hasFeature(); @@ -12483,11 +12908,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DOMRect'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'DOMRect'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -12562,7 +12987,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 1\\" + context: \\"Failed to construct 'DOMRect': parameter 1\\", + globals: globalObject }); } else { curArg = 0; @@ -12573,7 +12999,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[1]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 2\\" + context: \\"Failed to construct 'DOMRect': parameter 2\\", + globals: globalObject }); } else { curArg = 0; @@ -12584,7 +13011,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[2]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 3\\" + context: \\"Failed to construct 'DOMRect': parameter 3\\", + globals: globalObject }); } else { curArg = 0; @@ -12595,7 +13023,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[3]; if (curArg !== undefined) { curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 4\\" + context: \\"Failed to construct 'DOMRect': parameter 4\\", + globals: globalObject }); } else { curArg = 0; @@ -12609,7 +13038,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get x' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get x' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"x\\"]; @@ -12619,11 +13048,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set x' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set x' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'x' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'x' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"x\\"] = V; @@ -12633,7 +13063,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get y' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get y' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"y\\"]; @@ -12643,11 +13073,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set y' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set y' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'y' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'y' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"y\\"] = V; @@ -12657,7 +13088,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get width' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get width' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"width\\"]; @@ -12667,11 +13098,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set width' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set width' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'width' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'width' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"width\\"] = V; @@ -12681,7 +13113,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get height' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'get height' called on an object that is not a valid instance of DOMRect.\\"); } return esValue[implSymbol][\\"height\\"]; @@ -12691,11 +13123,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set height' called on an object that is not a valid instance of DOMRect.\\"); + throw new globalObject.TypeError(\\"'set height' called on an object that is not a valid instance of DOMRect.\\"); } V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'height' property on 'DOMRect': The provided value\\" + context: \\"Failed to set the 'height' property on 'DOMRect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"height\\"] = V; @@ -12705,7 +13138,9 @@ exports.install = (globalObject, globalNames) => { const args = []; { let curArg = arguments[0]; - curArg = Dictionary.convert(curArg, { context: \\"Failed to execute 'fromRect' on 'DOMRect': parameter 1\\" }); + curArg = Dictionary.convert(globalObject, curArg, { + context: \\"Failed to execute 'fromRect' on 'DOMRect': parameter 1\\" + }); args.push(curArg); } return utils.tryWrapperForImpl(Impl.implementation.fromRect(globalObject, ...args)); @@ -12749,12 +13184,15 @@ const utils = require(\\"./utils.js\\"); const URL = require(\\"./URL.js\\"); const URLSearchParams = require(\\"./URLSearchParams.js\\"); -exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {}) => { +exports._convertInherit = (globalObject, obj, ret, { context = \\"The provided value\\" } = {}) => { { const key = \\"boolWithDefault\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = conversions[\\"boolean\\"](value, { context: context + \\" has member 'boolWithDefault' that\\" }); + value = conversions[\\"boolean\\"](value, { + context: context + \\" has member 'boolWithDefault' that\\", + globals: globalObject + }); ret[key] = value; } else { @@ -12766,11 +13204,11 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"requiredInterface\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = URL.convert(value, { context: context + \\" has member 'requiredInterface' that\\" }); + value = URL.convert(globalObject, value, { context: context + \\" has member 'requiredInterface' that\\" }); ret[key] = value; } else { - throw new TypeError(\\"requiredInterface is required in 'Dictionary'\\"); + throw new globalObject.TypeError(\\"requiredInterface is required in 'Dictionary'\\"); } } @@ -12779,12 +13217,14 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { if (!utils.isObject(value)) { - throw new TypeError(context + \\" has member 'seq' that\\" + \\" is not an iterable object.\\"); + throw new globalObject.TypeError(context + \\" has member 'seq' that\\" + \\" is not an iterable object.\\"); } else { const V = []; const tmp = value; for (let nextItem of tmp) { - nextItem = URLSearchParams.convert(nextItem, { context: context + \\" has member 'seq' that\\" + \\"'s element\\" }); + nextItem = URLSearchParams.convert(globalObject, nextItem, { + context: context + \\" has member 'seq' that\\" + \\"'s element\\" + }); V.push(nextItem); } @@ -12799,20 +13239,23 @@ exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {} const key = \\"vanillaString\\"; let value = obj === undefined || obj === null ? undefined : obj[key]; if (value !== undefined) { - value = conversions[\\"DOMString\\"](value, { context: context + \\" has member 'vanillaString' that\\" }); + value = conversions[\\"DOMString\\"](value, { + context: context + \\" has member 'vanillaString' that\\", + globals: globalObject + }); ret[key] = value; } } }; -exports.convert = function convert(obj, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, obj, { context = \\"The provided value\\" } = {}) => { if (obj !== undefined && typeof obj !== \\"object\\" && typeof obj !== \\"function\\") { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } const ret = Object.create(null); - exports._convertInherit(obj, ret, { context }); + exports._convertInherit(globalObject, obj, ret, { context }); return ret; }; " @@ -12836,11 +13279,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DictionaryConvert'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'DictionaryConvert'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -12910,27 +13353,30 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class DictionaryConvert { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } op() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'op' called on an object that is not a valid instance of DictionaryConvert.\\"); + throw new globalObject.TypeError(\\"'op' called on an object that is not a valid instance of DictionaryConvert.\\"); } const args = []; { let curArg = arguments[0]; if (curArg !== undefined) { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 1\\" + context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 1\\", + globals: globalObject }); } args.push(curArg); } { let curArg = arguments[1]; - curArg = Dictionary.convert(curArg, { context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" }); + curArg = Dictionary.convert(globalObject, curArg, { + context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" + }); args.push(curArg); } return esValue[implSymbol].op(...args); @@ -12971,11 +13417,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Enum'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Enum'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -13045,24 +13491,26 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Enum { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } op(destination) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'op' called on an object that is not a valid instance of Enum.\\"); + throw new globalObject.TypeError(\\"'op' called on an object that is not a valid instance of Enum.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'op' on 'Enum': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'op' on 'Enum': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = RequestDestination.convert(curArg, { context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" }); + curArg = RequestDestination.convert(globalObject, curArg, { + context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" + }); args.push(curArg); } return esValue[implSymbol].op(...args); @@ -13072,7 +13520,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of Enum.\\"); + throw new globalObject.TypeError(\\"'get attr' called on an object that is not a valid instance of Enum.\\"); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"attr\\"]); @@ -13082,7 +13530,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set attr' called on an object that is not a valid instance of Enum.\\"); + throw new globalObject.TypeError(\\"'set attr' called on an object that is not a valid instance of Enum.\\"); } V = \`\${V}\`; @@ -13117,9 +13565,9 @@ exports[`generation without processors EventListener.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation(event) { @@ -13130,7 +13578,7 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } if (typeof O !== \\"function\\") { X = O[\\"handleEvent\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement EventListener.\`); + throw new globalObject.TypeError(\`\${context} does not correctly implement EventListener.\`); } thisArg = O; } @@ -13168,11 +13616,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'EventTarget'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'EventTarget'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -13248,21 +13696,22 @@ exports.install = (globalObject, globalNames) => { addEventListener(type, callback) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'addEventListener' called on an object that is not a valid instance of EventTarget.\\"); + throw new globalObject.TypeError( + \\"'addEventListener' called on an object that is not a valid instance of EventTarget.\\" + ); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 1\\" + context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -13271,7 +13720,7 @@ exports.install = (globalObject, globalNames) => { if (curArg === null || curArg === undefined) { curArg = null; } else { - curArg = EventListener.convert(curArg, { + curArg = EventListener.convert(globalObject, curArg, { context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 2\\" }); } @@ -13314,11 +13763,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Global'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Global'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -13349,7 +13798,7 @@ exports._internalSetup = (wrapper, globalObject) => { op() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'op' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'op' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol].op(); @@ -13357,7 +13806,7 @@ exports._internalSetup = (wrapper, globalObject) => { unforgeableOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'unforgeableOp' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'unforgeableOp' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol].unforgeableOp(); @@ -13366,7 +13815,7 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'get attr' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol][\\"attr\\"]; @@ -13375,10 +13824,13 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set attr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'set attr' called on an object that is not a valid instance of Global.\\"); } - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'attr' property on 'Global': The provided value\\" }); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'attr' property on 'Global': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"attr\\"] = V; }, @@ -13386,7 +13838,9 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get unforgeableAttr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError( + \\"'get unforgeableAttr' called on an object that is not a valid instance of Global.\\" + ); } return esValue[implSymbol][\\"unforgeableAttr\\"]; @@ -13395,11 +13849,14 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set unforgeableAttr' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError( + \\"'set unforgeableAttr' called on an object that is not a valid instance of Global.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'unforgeableAttr' property on 'Global': The provided value\\" + context: \\"Failed to set the 'unforgeableAttr' property on 'Global': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"unforgeableAttr\\"] = V; @@ -13408,7 +13865,7 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get length' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'get length' called on an object that is not a valid instance of Global.\\"); } return esValue[implSymbol][\\"length\\"]; @@ -13417,20 +13874,21 @@ exports._internalSetup = (wrapper, globalObject) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set length' called on an object that is not a valid instance of Global.\\"); + throw new globalObject.TypeError(\\"'set length' called on an object that is not a valid instance of Global.\\"); } V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'length' property on 'Global': The provided value\\" + context: \\"Failed to set the 'length' property on 'Global': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"length\\"] = V; }, - [Symbol.iterator]: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], - keys: ctorRegistry[\\"%Array%\\"].prototype.keys, - values: ctorRegistry[\\"%Array%\\"].prototype.values, - entries: ctorRegistry[\\"%Array%\\"].prototype.entries, - forEach: ctorRegistry[\\"%Array%\\"].prototype.forEach + [Symbol.iterator]: globalObject.Array.prototype[Symbol.iterator], + keys: globalObject.Array.prototype.keys, + values: globalObject.Array.prototype.values, + entries: globalObject.Array.prototype.entries, + forEach: globalObject.Array.prototype.forEach }); Object.defineProperties(wrapper, { @@ -13482,7 +13940,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Global { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } static staticOp() { @@ -13499,7 +13957,8 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'staticAttr' property on 'Global': The provided value\\" + context: \\"Failed to set the 'staticAttr' property on 'Global': The provided value\\", + globals: globalObject }); Impl.implementation[\\"staticAttr\\"] = V; @@ -13537,11 +13996,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'HTMLConstructor'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'HTMLConstructor'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -13611,7 +14070,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class HTMLConstructor { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(HTMLConstructor.prototype, { @@ -13647,11 +14106,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyLenientAttributes'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyLenientAttributes'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -13721,14 +14180,14 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyLenientAttributes { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get lenientSetter() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get lenientSetter' called on an object that is not a valid instance of LegacyLenientAttributes.\\" ); } @@ -13740,7 +14199,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'set lenientSetter' called on an object that is not a valid instance of LegacyLenientAttributes.\\" ); } @@ -13776,7 +14235,8 @@ exports.install = (globalObject, globalNames) => { } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'lenientThis' property on 'LegacyLenientAttributes': The provided value\\" + context: \\"Failed to set the 'lenientThis' property on 'LegacyLenientAttributes': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"lenientThis\\"] = V; @@ -13851,11 +14311,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyNoInterfaceObject'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyNoInterfaceObject'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -13925,13 +14385,15 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyNoInterfaceObject { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } def() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'def' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\"); + throw new globalObject.TypeError( + \\"'def' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\" + ); } return esValue[implSymbol].def(); @@ -13941,7 +14403,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\"); + throw new globalObject.TypeError( + \\"'get abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\" + ); } return esValue[implSymbol][\\"abc\\"]; @@ -13951,11 +14415,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\"); + throw new globalObject.TypeError( + \\"'set abc' called on an object that is not a valid instance of LegacyNoInterfaceObject.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'abc' property on 'LegacyNoInterfaceObject': The provided value\\" + context: \\"Failed to set the 'abc' property on 'LegacyNoInterfaceObject': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"abc\\"] = V; @@ -13991,11 +14458,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyUnforgeable'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyUnforgeable'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -14029,21 +14496,22 @@ function getUnforgeables(globalObject) { assign(url) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'assign' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'assign' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'assign' on 'LegacyUnforgeable': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'assign' on 'LegacyUnforgeable': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'assign' on 'LegacyUnforgeable': parameter 1\\" + context: \\"Failed to execute 'assign' on 'LegacyUnforgeable': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -14053,7 +14521,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get href' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'get href' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"href\\"]; @@ -14062,11 +14532,14 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set href' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'set href' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'href' property on 'LegacyUnforgeable': The provided value\\" + context: \\"Failed to set the 'href' property on 'LegacyUnforgeable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"href\\"] = V; @@ -14074,7 +14547,9 @@ function getUnforgeables(globalObject) { toString() { const esValue = this; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"href\\"]; @@ -14083,7 +14558,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get origin' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'get origin' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"origin\\"]; @@ -14092,7 +14569,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'get protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } return esValue[implSymbol][\\"protocol\\"]; @@ -14101,11 +14580,14 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\"); + throw new globalObject.TypeError( + \\"'set protocol' called on an object that is not a valid instance of LegacyUnforgeable.\\" + ); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'LegacyUnforgeable': The provided value\\" + context: \\"Failed to set the 'protocol' property on 'LegacyUnforgeable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"protocol\\"] = V; @@ -14170,7 +14652,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyUnforgeable { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(LegacyUnforgeable.prototype, { @@ -14206,11 +14688,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'LegacyUnforgeableMap'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'LegacyUnforgeableMap'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -14226,6 +14708,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -14245,7 +14736,9 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get a' called on an object that is not a valid instance of LegacyUnforgeableMap.\\"); + throw new globalObject.TypeError( + \\"'get a' called on an object that is not a valid instance of LegacyUnforgeableMap.\\" + ); } return esValue[implSymbol][\\"a\\"]; @@ -14272,7 +14765,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -14290,7 +14783,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -14310,7 +14803,7 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class LegacyUnforgeableMap { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(LegacyUnforgeableMap.prototype, { @@ -14325,7 +14818,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -14346,7 +14844,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -14361,7 +14859,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -14376,7 +14874,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -14396,7 +14894,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -14405,11 +14903,14 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; + if (typeof P === \\"string\\") { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\", + globals: globalObject }); const creating = !target[implSymbol][utils.supportsPropertyName](P); @@ -14454,12 +14955,14 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + + const globalObject = this._globalObject; if (![\\"a\\"].includes(P)) { if (!utils.hasOwn(target, P)) { if (desc.get || desc.set) { @@ -14469,7 +14972,8 @@ const proxyHandler = { let namedValue = desc.value; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\", + globals: globalObject }); const creating = !target[implSymbol][utils.supportsPropertyName](P); @@ -14483,24 +14987,26 @@ const proxyHandler = { } } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { return false; } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/LegacyUnforgeableMap.js\\"); " @@ -14523,11 +15029,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'MixedIn'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'MixedIn'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -14597,13 +15103,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class MixedIn { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } mixedInOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'mixedInOp' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError(\\"'mixedInOp' called on an object that is not a valid instance of MixedIn.\\"); } return esValue[implSymbol].mixedInOp(); @@ -14612,7 +15118,7 @@ exports.install = (globalObject, globalNames) => { ifaceMixinOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'ifaceMixinOp' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError(\\"'ifaceMixinOp' called on an object that is not a valid instance of MixedIn.\\"); } return esValue[implSymbol].ifaceMixinOp(); @@ -14622,7 +15128,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get mixedInAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'get mixedInAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } return esValue[implSymbol][\\"mixedInAttr\\"]; @@ -14632,11 +15140,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set mixedInAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'set mixedInAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\" + context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"mixedInAttr\\"] = V; @@ -14646,7 +15157,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'get ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } return esValue[implSymbol][\\"ifaceMixinAttr\\"]; @@ -14656,11 +15169,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\"); + throw new globalObject.TypeError( + \\"'set ifaceMixinAttr' called on an object that is not a valid instance of MixedIn.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\" + context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"ifaceMixinAttr\\"] = V; @@ -14698,9 +15214,9 @@ exports[`generation without processors NodeFilter.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); + throw new globalObject.TypeError(\`\${context} is not an object.\`); } function callTheUserObjectsOperation(node) { @@ -14711,7 +15227,7 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } if (typeof O !== \\"function\\") { X = O[\\"acceptNode\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement NodeFilter.\`); + throw new globalObject.TypeError(\`\${context} does not correctly implement NodeFilter.\`); } thisArg = O; } @@ -14720,7 +15236,7 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } let callResult = Reflect.apply(X, thisArg, [node]); - callResult = conversions[\\"unsigned short\\"](callResult, { context: context }); + callResult = conversions[\\"unsigned short\\"](callResult, { context: context, globals: globalObject }); return callResult; } @@ -14738,8 +15254,9 @@ exports.install = (globalObject, globalNames) => { return; } + const ctorRegistry = utils.initCtorRegistry(globalObject); const NodeFilter = () => { - throw new TypeError(\\"Illegal invocation\\"); + throw new globalObject.TypeError(\\"Illegal invocation\\"); }; Object.defineProperties(NodeFilter, { @@ -14788,11 +15305,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Overloads'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Overloads'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -14871,13 +15388,16 @@ exports.install = (globalObject, globalNames) => { if (URL.is(curArg)) { { let curArg = arguments[0]; - curArg = URL.convert(curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" }); + curArg = URL.convert(globalObject, curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" }); args.push(curArg); } } else { { let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to construct 'Overloads': parameter 1\\", + globals: globalObject + }); args.push(curArg); } } @@ -14889,14 +15409,12 @@ exports.install = (globalObject, globalNames) => { compatible(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'compatible' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError(\\"'compatible' called on an object that is not a valid instance of Overloads.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'compatible' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'compatible' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -14905,7 +15423,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -14914,14 +15433,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -14930,14 +15451,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -14945,7 +15468,8 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[2]; if (curArg !== undefined) { curArg = conversions[\\"long\\"](curArg, { - context: \\"Failed to execute 'compatible' on 'Overloads': parameter 3\\" + context: \\"Failed to execute 'compatible' on 'Overloads': parameter 3\\", + globals: globalObject }); } else { curArg = 0; @@ -14959,14 +15483,14 @@ exports.install = (globalObject, globalNames) => { incompatible1(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'incompatible1' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError( + \\"'incompatible1' called on an object that is not a valid instance of Overloads.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'incompatible1' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible1' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -14976,7 +15500,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"long\\"](curArg, { - context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -14984,7 +15509,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -14996,14 +15522,14 @@ exports.install = (globalObject, globalNames) => { incompatible2(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'incompatible2' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError( + \\"'incompatible2' called on an object that is not a valid instance of Overloads.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -15012,7 +15538,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -15021,14 +15548,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -15039,14 +15568,14 @@ exports.install = (globalObject, globalNames) => { incompatible3(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'incompatible3' called on an object that is not a valid instance of Overloads.\\"); + throw new globalObject.TypeError( + \\"'incompatible3' called on an object that is not a valid instance of Overloads.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -15055,7 +15584,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -15064,7 +15594,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -15074,7 +15605,7 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[1]; if (curArg !== undefined) { - curArg = URL.convert(curArg, { + curArg = URL.convert(globalObject, curArg, { context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" }); } @@ -15084,7 +15615,7 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[1]; if (curArg !== undefined) { - curArg = URL.convert(curArg, { + curArg = URL.convert(globalObject, curArg, { context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" }); } @@ -15096,7 +15627,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\" ); } @@ -15108,7 +15639,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\" ); } @@ -15118,7 +15649,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[1]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -15126,22 +15658,24 @@ exports.install = (globalObject, globalNames) => { } break; case 3: - throw new TypeError( - \\"Failed to execute 'incompatible3' on 'Overloads': only \\" + arguments.length + \\" arguments present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'incompatible3' on 'Overloads': only \${arguments.length} arguments present.\` ); break; default: { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"long\\"](curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -15150,7 +15684,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 3\\" + \\" is not of any supported type.\\" ); } @@ -15161,7 +15695,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'incompatible3' on 'Overloads': parameter 4\\" + \\" is not of any supported type.\\" ); } @@ -15208,11 +15742,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'PromiseTypes'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -15247,14 +15781,14 @@ function getUnforgeables(globalObject) { try { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'unforgeablePromiseOperation' called on an object that is not a valid instance of PromiseTypes.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol].unforgeablePromiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } }, get unforgeablePromiseAttribute() { @@ -15262,14 +15796,14 @@ function getUnforgeables(globalObject) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get unforgeablePromiseAttribute' called on an object that is not a valid instance of PromiseTypes.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"unforgeablePromiseAttribute\\"]); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } }); @@ -15329,26 +15863,26 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class PromiseTypes { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } voidPromiseConsumer(p) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'voidPromiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\"); + throw new globalObject.TypeError( + \\"'voidPromiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'voidPromiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'voidPromiseConsumer' on 'PromiseTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = new Promise(resolve => resolve(curArg)); + curArg = new globalObject.Promise(resolve => resolve(curArg)); args.push(curArg); } return esValue[implSymbol].voidPromiseConsumer(...args); @@ -15357,20 +15891,20 @@ exports.install = (globalObject, globalNames) => { promiseConsumer(p) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'promiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\"); + throw new globalObject.TypeError( + \\"'promiseConsumer' called on an object that is not a valid instance of PromiseTypes.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'promiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'promiseConsumer' on 'PromiseTypes': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = new Promise(resolve => resolve(curArg)); + curArg = new globalObject.Promise(resolve => resolve(curArg)); args.push(curArg); } return esValue[implSymbol].promiseConsumer(...args); @@ -15380,12 +15914,14 @@ exports.install = (globalObject, globalNames) => { try { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'promiseOperation' called on an object that is not a valid instance of PromiseTypes.\\"); + throw new globalObject.TypeError( + \\"'promiseOperation' called on an object that is not a valid instance of PromiseTypes.\\" + ); } return utils.tryWrapperForImpl(esValue[implSymbol].promiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -15394,14 +15930,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get promiseAttribute' called on an object that is not a valid instance of PromiseTypes.\\" ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"promiseAttribute\\"]); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -15409,7 +15945,7 @@ exports.install = (globalObject, globalNames) => { try { return utils.tryWrapperForImpl(Impl.implementation.staticPromiseOperation()); } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } @@ -15419,7 +15955,7 @@ exports.install = (globalObject, globalNames) => { return Impl.implementation[\\"staticPromiseAttribute\\"]; } catch (e) { - return Promise.reject(e); + return globalObject.Promise.reject(e); } } } @@ -15464,11 +16000,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Reflect'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Reflect'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -15538,14 +16074,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Reflect { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get reflectedBoolean() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedBoolean' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedBoolean' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"reflectedBoolean\\"]; @@ -15555,11 +16093,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedBoolean' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedBoolean' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"reflectedBoolean\\"] = V; @@ -15569,7 +16110,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedDOMString' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedDOMString' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"reflectedDOMString\\"]; @@ -15579,11 +16122,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedDOMString' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedDOMString' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"reflectedDOMString\\"] = V; @@ -15593,7 +16139,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedLong' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"reflectedLong\\"]; @@ -15603,11 +16151,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedLong' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"long\\"](V, { - context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"reflectedLong\\"] = V; @@ -15617,7 +16168,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"reflectedUnsignedLong\\"]; @@ -15627,11 +16180,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedUnsignedLong' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"reflectedUnsignedLong\\"] = V; @@ -15641,7 +16197,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"reflectedUSVStringURL\\"]; @@ -15651,11 +16209,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectedUSVStringURL' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"reflectedUSVStringURL\\"] = V; @@ -15665,7 +16226,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get reflectionTest' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get reflectionTest' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"reflectionTest\\"]; @@ -15675,11 +16238,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set reflectionTest' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set reflectionTest' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"reflectionTest\\"] = V; @@ -15689,7 +16255,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get withUnderscore' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'get withUnderscore' called on an object that is not a valid instance of Reflect.\\" + ); } return esValue[implSymbol][\\"withUnderscore\\"]; @@ -15699,11 +16267,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set withUnderscore' called on an object that is not a valid instance of Reflect.\\"); + throw new globalObject.TypeError( + \\"'set withUnderscore' called on an object that is not a valid instance of Reflect.\\" + ); } V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\" + context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"withUnderscore\\"] = V; @@ -15749,11 +16320,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Replaceable'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Replaceable'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -15823,14 +16394,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Replaceable { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get replaceable() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get replaceable' called on an object that is not a valid instance of Replaceable.\\"); + throw new globalObject.TypeError( + \\"'get replaceable' called on an object that is not a valid instance of Replaceable.\\" + ); } return esValue[implSymbol][\\"replaceable\\"]; @@ -15840,7 +16413,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set replaceable' called on an object that is not a valid instance of Replaceable.\\"); + throw new globalObject.TypeError( + \\"'set replaceable' called on an object that is not a valid instance of Replaceable.\\" + ); } Object.defineProperty(esValue, \\"replaceable\\", { @@ -15891,10 +16466,10 @@ const enumerationValues = new Set([ ]); exports.enumerationValues = enumerationValues; -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { const string = \`\${value}\`; if (!enumerationValues.has(string)) { - throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); + throw new globalObject.TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); } return string; }; @@ -15919,11 +16494,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'SeqAndRec'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -15999,21 +16574,23 @@ exports.install = (globalObject, globalNames) => { recordConsumer(rec) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'recordConsumer' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'recordConsumer' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'recordConsumer' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'recordConsumer' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError(\\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\"); + throw new globalObject.TypeError( + \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\" + ); } else { const result = Object.create(null); for (const key of Reflect.ownKeys(curArg)) { @@ -16022,13 +16599,15 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; typedValue = conversions[\\"double\\"](typedValue, { - context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" + context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\", + globals: globalObject }); result[typedKey] = typedValue; @@ -16044,21 +16623,23 @@ exports.install = (globalObject, globalNames) => { recordConsumer2(rec) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'recordConsumer2' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'recordConsumer2' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'recordConsumer2' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError(\\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\"); + throw new globalObject.TypeError( + \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an object.\\" + ); } else { const result = Object.create(null); for (const key of Reflect.ownKeys(curArg)) { @@ -16067,12 +16648,13 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" }); @@ -16089,21 +16671,21 @@ exports.install = (globalObject, globalNames) => { sequenceConsumer(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'sequenceConsumer' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'sequenceConsumer' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'sequenceConsumer' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -16111,7 +16693,8 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { nextItem = conversions[\\"USVString\\"](nextItem, { - context: \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\" + context: \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -16126,21 +16709,21 @@ exports.install = (globalObject, globalNames) => { sequenceConsumer2(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'sequenceConsumer2' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'sequenceConsumer2' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'sequenceConsumer2' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -16161,21 +16744,21 @@ exports.install = (globalObject, globalNames) => { frozenArrayConsumer(arr) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'frozenArrayConsumer' called on an object that is not a valid instance of SeqAndRec.\\"); + throw new globalObject.TypeError( + \\"'frozenArrayConsumer' called on an object that is not a valid instance of SeqAndRec.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -16183,7 +16766,8 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { nextItem = conversions[\\"double\\"](nextItem, { - context: \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\" + context: \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -16234,11 +16818,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Static'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Static'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -16308,13 +16892,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Static { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } def() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'def' called on an object that is not a valid instance of Static.\\"); + throw new globalObject.TypeError(\\"'def' called on an object that is not a valid instance of Static.\\"); } return esValue[implSymbol].def(); @@ -16324,7 +16908,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get abc' called on an object that is not a valid instance of Static.\\"); + throw new globalObject.TypeError(\\"'get abc' called on an object that is not a valid instance of Static.\\"); } return esValue[implSymbol][\\"abc\\"]; @@ -16334,10 +16918,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set abc' called on an object that is not a valid instance of Static.\\"); + throw new globalObject.TypeError(\\"'set abc' called on an object that is not a valid instance of Static.\\"); } - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'abc' property on 'Static': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"abc\\"] = V; } @@ -16355,7 +16942,10 @@ exports.install = (globalObject, globalNames) => { static set abc(V) { const esValue = this !== null && this !== undefined ? this : globalObject; - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'abc' property on 'Static': The provided value\\", + globals: globalObject + }); Impl.implementation[\\"abc\\"] = V; } @@ -16396,11 +16986,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Storage'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Storage'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -16416,6 +17006,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -16437,7 +17036,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -16455,7 +17054,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -16474,24 +17073,27 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Storage { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } key(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'key' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'key' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'key' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'key' on 'Storage': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"unsigned long\\"](curArg, { context: \\"Failed to execute 'key' on 'Storage': parameter 1\\" }); + curArg = conversions[\\"unsigned long\\"](curArg, { + context: \\"Failed to execute 'key' on 'Storage': parameter 1\\", + globals: globalObject + }); args.push(curArg); } return esValue[implSymbol].key(...args); @@ -16500,18 +17102,21 @@ exports.install = (globalObject, globalNames) => { getItem(key) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'getItem' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'getItem' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'getItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'getItem' on 'Storage': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'getItem' on 'Storage': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'getItem' on 'Storage': parameter 1\\", + globals: globalObject + }); args.push(curArg); } return esValue[implSymbol].getItem(...args); @@ -16520,23 +17125,29 @@ exports.install = (globalObject, globalNames) => { setItem(key, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'setItem' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'setItem' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'setItem' on 'Storage': 2 arguments required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'setItem' on 'Storage': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'setItem' on 'Storage': parameter 1\\", + globals: globalObject + }); args.push(curArg); } { let curArg = arguments[1]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\", + globals: globalObject + }); args.push(curArg); } return esValue[implSymbol].setItem(...args); @@ -16545,19 +17156,20 @@ exports.install = (globalObject, globalNames) => { removeItem(key) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'removeItem' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'removeItem' called on an object that is not a valid instance of Storage.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'removeItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'removeItem' on 'Storage': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'removeItem' on 'Storage': parameter 1\\" + context: \\"Failed to execute 'removeItem' on 'Storage': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -16567,7 +17179,7 @@ exports.install = (globalObject, globalNames) => { clear() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'clear' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'clear' called on an object that is not a valid instance of Storage.\\"); } return esValue[implSymbol].clear(); @@ -16577,7 +17189,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get length' called on an object that is not a valid instance of Storage.\\"); + throw new globalObject.TypeError(\\"'get length' called on an object that is not a valid instance of Storage.\\"); } return esValue[implSymbol][\\"length\\"]; @@ -16601,7 +17213,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -16622,7 +17239,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -16637,7 +17254,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -16652,7 +17269,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -16672,7 +17289,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -16681,11 +17298,14 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; + if (typeof P === \\"string\\") { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\", + globals: globalObject }); target[implSymbol].setItem(P, namedValue); @@ -16725,12 +17345,14 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + + const globalObject = this._globalObject; if (!utils.hasOwn(target, P)) { if (desc.get || desc.set) { return false; @@ -16739,7 +17361,8 @@ const proxyHandler = { let namedValue = desc.value; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\", + globals: globalObject }); target[implSymbol].setItem(P, namedValue); @@ -16747,25 +17370,27 @@ const proxyHandler = { return true; } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { target[implSymbol].removeItem(P); return true; } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/Storage.js\\"); " @@ -16788,11 +17413,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -16862,14 +17487,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierAttribute { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get attr() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get attr' called on an object that is not a valid instance of StringifierAttribute.\\"); + throw new globalObject.TypeError( + \\"'get attr' called on an object that is not a valid instance of StringifierAttribute.\\" + ); } return esValue[implSymbol][\\"attr\\"]; @@ -16878,7 +17505,9 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of StringifierAttribute.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of StringifierAttribute.\\" + ); } return esValue[implSymbol][\\"attr\\"]; @@ -16919,11 +17548,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -16993,13 +17622,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierDefaultOperation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'toString' called on an object that is not a valid instance of StringifierDefaultOperation.\\" ); } @@ -17041,11 +17670,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -17115,13 +17744,13 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierNamedOperation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } operation() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'operation' called on an object that is not a valid instance of StringifierNamedOperation.\\" ); } @@ -17132,7 +17761,7 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'toString' called on an object that is not a valid instance of StringifierNamedOperation.\\" ); } @@ -17175,11 +17804,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'StringifierOperation'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -17249,13 +17878,15 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class StringifierOperation { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of StringifierOperation.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of StringifierOperation.\\" + ); } return esValue[implSymbol].toString(); @@ -17297,11 +17928,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -17371,22 +18002,20 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class TypedefsAndUnions { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } numOrStrConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrStrConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17395,11 +18024,13 @@ exports.install = (globalObject, globalNames) => { if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, clamp: true }); } else { curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\" + context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject }); } args.push(curArg); @@ -17410,16 +18041,14 @@ exports.install = (globalObject, globalNames) => { numOrEnumConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrEnumConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17430,10 +18059,11 @@ exports.install = (globalObject, globalNames) => { } else { if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { - context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" + context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject }); } else { - curArg = RequestDestination.convert(curArg, { + curArg = RequestDestination.convert(globalObject, curArg, { context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" }); } @@ -17446,16 +18076,14 @@ exports.install = (globalObject, globalNames) => { numOrStrOrNullConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrStrOrNullConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17467,12 +18095,14 @@ exports.install = (globalObject, globalNames) => { if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, clamp: true, enforceRange: true }); } else { curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, enforceRange: true }); } @@ -17485,16 +18115,14 @@ exports.install = (globalObject, globalNames) => { numOrStrOrURLOrNullConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'numOrStrOrURLOrNullConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17508,12 +18136,14 @@ exports.install = (globalObject, globalNames) => { } else if (typeof curArg === \\"number\\") { curArg = conversions[\\"double\\"](curArg, { context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, clamp: true, enforceRange: true }); } else { curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\", + globals: globalObject, enforceRange: true }); } @@ -17526,23 +18156,21 @@ exports.install = (globalObject, globalNames) => { urlMapInnerConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'urlMapInnerConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\" ); } else { @@ -17553,12 +18181,13 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" }); @@ -17575,14 +18204,14 @@ exports.install = (globalObject, globalNames) => { urlMapConsumer(a) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'urlMapConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'urlMapConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17592,7 +18221,7 @@ exports.install = (globalObject, globalNames) => { curArg = null; } else { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\" ); } else { @@ -17603,12 +18232,13 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" + context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" }); @@ -17626,16 +18256,14 @@ exports.install = (globalObject, globalNames) => { bufferSourceOrURLConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'bufferSourceOrURLConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17646,7 +18274,7 @@ exports.install = (globalObject, globalNames) => { } else if (utils.isArrayBuffer(curArg)) { } else if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not of any supported type.\\" ); @@ -17659,16 +18287,14 @@ exports.install = (globalObject, globalNames) => { arrayBufferViewOrURLMapConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'arrayBufferViewOrURLMapConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17680,7 +18306,7 @@ exports.install = (globalObject, globalNames) => { if (ArrayBuffer.isView(curArg)) { } else if (utils.isObject(curArg)) { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" record\\" + \\" is not an object.\\" @@ -17696,12 +18322,13 @@ exports.install = (globalObject, globalNames) => { context: \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" record\\" + - \\"'s key\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; - typedValue = URL.convert(typedValue, { + typedValue = URL.convert(globalObject, typedValue, { context: \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" record\\" + @@ -17714,7 +18341,7 @@ exports.install = (globalObject, globalNames) => { curArg = result; } } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not of any supported type.\\" ); @@ -17728,16 +18355,14 @@ exports.install = (globalObject, globalNames) => { arrayBufferViewDupConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'arrayBufferViewDupConsumer' called on an object that is not a valid instance of TypedefsAndUnions.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -17745,7 +18370,7 @@ exports.install = (globalObject, globalNames) => { let curArg = arguments[0]; if (ArrayBuffer.isView(curArg)) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not of any supported type.\\" ); @@ -17759,7 +18384,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get buf' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'get buf' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } return utils.tryWrapperForImpl(esValue[implSymbol][\\"buf\\"]); @@ -17769,7 +18396,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set buf' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'set buf' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } if (utils.isArrayBuffer(V)) { @@ -17778,7 +18407,7 @@ exports.install = (globalObject, globalNames) => { (V.constructor.name === \\"Uint8Array\\" || V.constructor.name === \\"Uint16Array\\") ) { } else { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + \\" is not of any supported type.\\" ); @@ -17790,7 +18419,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get time' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'get time' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } return esValue[implSymbol][\\"time\\"]; @@ -17800,11 +18431,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set time' called on an object that is not a valid instance of TypedefsAndUnions.\\"); + throw new globalObject.TypeError( + \\"'set time' called on an object that is not a valid instance of TypedefsAndUnions.\\" + ); } V = conversions[\\"unsigned long long\\"](V, { - context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\" + context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"time\\"] = V; @@ -17854,11 +18488,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URL'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URL'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -17929,20 +18563,26 @@ exports.install = (globalObject, globalNames) => { class URL { constructor(url) { if (arguments.length < 1) { - throw new TypeError( - \\"Failed to construct 'URL': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to construct 'URL': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 1\\" }); + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to construct 'URL': parameter 1\\", + globals: globalObject + }); args.push(curArg); } { let curArg = arguments[1]; if (curArg !== undefined) { - curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" }); + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to construct 'URL': parameter 2\\", + globals: globalObject + }); } args.push(curArg); } @@ -17952,7 +18592,7 @@ exports.install = (globalObject, globalNames) => { toJSON() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'toJSON' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'toJSON' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol].toJSON(); @@ -17962,7 +18602,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get href' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get href' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"href\\"]; @@ -17972,10 +18612,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set href' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set href' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'href' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"href\\"] = V; } @@ -17983,7 +18626,7 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'toString' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"href\\"]; @@ -17993,7 +18636,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get origin' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get origin' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"origin\\"]; @@ -18003,7 +18646,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get protocol' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get protocol' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"protocol\\"]; @@ -18013,11 +18656,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set protocol' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set protocol' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" + context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"protocol\\"] = V; @@ -18027,7 +18671,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get username' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get username' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"username\\"]; @@ -18037,11 +18681,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set username' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set username' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'username' property on 'URL': The provided value\\" + context: \\"Failed to set the 'username' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"username\\"] = V; @@ -18051,7 +18696,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get password' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get password' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"password\\"]; @@ -18061,11 +18706,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set password' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set password' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'password' property on 'URL': The provided value\\" + context: \\"Failed to set the 'password' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"password\\"] = V; @@ -18075,7 +18721,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get host' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get host' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"host\\"]; @@ -18085,10 +18731,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set host' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set host' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'host' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"host\\"] = V; } @@ -18097,7 +18746,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get hostname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get hostname' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"hostname\\"]; @@ -18107,11 +18756,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set hostname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set hostname' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" + context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"hostname\\"] = V; @@ -18121,7 +18771,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get port' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get port' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"port\\"]; @@ -18131,10 +18781,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set port' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set port' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'port' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"port\\"] = V; } @@ -18143,7 +18796,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get pathname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get pathname' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"pathname\\"]; @@ -18153,11 +18806,12 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set pathname' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set pathname' called on an object that is not a valid instance of URL.\\"); } V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" + context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"pathname\\"] = V; @@ -18167,7 +18821,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get search' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get search' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"search\\"]; @@ -18177,10 +18831,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set search' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set search' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'search' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"search\\"] = V; } @@ -18189,7 +18846,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get searchParams' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get searchParams' called on an object that is not a valid instance of URL.\\"); } return utils.getSameObject(this, \\"searchParams\\", () => { @@ -18201,7 +18858,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get hash' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'get hash' called on an object that is not a valid instance of URL.\\"); } return esValue[implSymbol][\\"hash\\"]; @@ -18211,10 +18868,13 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set hash' called on an object that is not a valid instance of URL.\\"); + throw new globalObject.TypeError(\\"'set hash' called on an object that is not a valid instance of URL.\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'hash' property on 'URL': The provided value\\", + globals: globalObject + }); esValue[implSymbol][\\"hash\\"] = V; } @@ -18265,9 +18925,9 @@ const utils = require(\\"./utils.js\\"); const URL = require(\\"./URL.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (typeof value !== \\"function\\") { - throw new TypeError(context + \\" is not a function\\"); + throw new globalObject.TypeError(context + \\" is not a function\\"); } function invokeTheCallbackFunction(url, string) { @@ -18278,7 +18938,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { callResult = Reflect.apply(value, thisArg, [url, string]); - callResult = URL.convert(callResult, { context: context }); + callResult = URL.convert(globalObject, callResult, { context: context }); return callResult; } @@ -18288,7 +18948,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { let callResult = Reflect.construct(value, [url, string]); - callResult = URL.convert(callResult, { context: context }); + callResult = URL.convert(globalObject, callResult, { context: context }); return callResult; }; @@ -18307,7 +18967,7 @@ exports[`generation without processors URLHandlerNonNull.webidl 1`] = ` const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { function invokeTheCallbackFunction(url) { const thisArg = utils.tryWrapperForImpl(this); let callResult; @@ -18318,7 +18978,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { callResult = Reflect.apply(value, thisArg, [url]); } - callResult = conversions[\\"any\\"](callResult, { context: context }); + callResult = conversions[\\"any\\"](callResult, { context: context, globals: globalObject }); return callResult; } @@ -18328,7 +18988,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { let callResult = Reflect.construct(value, [url]); - callResult = conversions[\\"any\\"](callResult, { context: context }); + callResult = conversions[\\"any\\"](callResult, { context: context, globals: globalObject }); return callResult; }; @@ -18358,11 +19018,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLList'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLList'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -18378,6 +19038,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -18399,7 +19068,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -18417,7 +19086,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -18436,25 +19105,26 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class URLList { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } item(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'item' called on an object that is not a valid instance of URLList.\\"); + throw new globalObject.TypeError(\\"'item' called on an object that is not a valid instance of URLList.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'item' on 'URLList': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'item' on 'URLList': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'item' on 'URLList': parameter 1\\" + context: \\"Failed to execute 'item' on 'URLList': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -18465,7 +19135,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get length' called on an object that is not a valid instance of URLList.\\"); + throw new globalObject.TypeError(\\"'get length' called on an object that is not a valid instance of URLList.\\"); } return esValue[implSymbol][\\"length\\"]; @@ -18475,15 +19145,11 @@ exports.install = (globalObject, globalNames) => { item: { enumerable: true }, length: { enumerable: true }, [Symbol.toStringTag]: { value: \\"URLList\\", configurable: true }, - [Symbol.iterator]: { - value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], - configurable: true, - writable: true - }, - keys: { value: ctorRegistry[\\"%Array%\\"].prototype.keys, configurable: true, enumerable: true, writable: true }, - values: { value: ctorRegistry[\\"%Array%\\"].prototype.values, configurable: true, enumerable: true, writable: true }, - entries: { value: ctorRegistry[\\"%Array%\\"].prototype.entries, configurable: true, enumerable: true, writable: true }, - forEach: { value: ctorRegistry[\\"%Array%\\"].prototype.forEach, configurable: true, enumerable: true, writable: true } + [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true }, + keys: { value: globalObject.Array.prototype.keys, configurable: true, enumerable: true, writable: true }, + values: { value: globalObject.Array.prototype.values, configurable: true, enumerable: true, writable: true }, + entries: { value: globalObject.Array.prototype.entries, configurable: true, enumerable: true, writable: true }, + forEach: { value: globalObject.Array.prototype.forEach, configurable: true, enumerable: true, writable: true } }); ctorRegistry[interfaceName] = URLList; @@ -18494,7 +19160,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -18515,7 +19186,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -18530,7 +19201,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -18543,7 +19214,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -18567,7 +19238,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -18576,6 +19247,7 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; } let ownDesc; @@ -18623,37 +19295,41 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { return false; } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; return !target[implSymbol][utils.supportsPropertyIndex](index); } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/URLList.js\\"); " @@ -18678,11 +19354,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParams'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLSearchParams'.\`); }; exports.createDefaultIterator = (globalObject, target, kind) => { @@ -18770,7 +19446,7 @@ exports.install = (globalObject, globalNames) => { if (utils.isObject(curArg)) { if (curArg[Symbol.iterator] !== undefined) { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\" is not an iterable object.\\" ); } else { @@ -18778,7 +19454,7 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { if (!utils.isObject(nextItem)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\"'s element\\" + @@ -18793,7 +19469,8 @@ exports.install = (globalObject, globalNames) => { \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\"'s element\\" + - \\"'s element\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -18807,7 +19484,7 @@ exports.install = (globalObject, globalNames) => { } } else { if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\" is not an object.\\" ); } else { @@ -18818,13 +19495,15 @@ exports.install = (globalObject, globalNames) => { let typedKey = key; typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\" + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\", + globals: globalObject }); let typedValue = curArg[key]; typedValue = conversions[\\"USVString\\"](typedValue, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\" + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\", + globals: globalObject }); result[typedKey] = typedValue; @@ -18835,7 +19514,8 @@ exports.install = (globalObject, globalNames) => { } } else { curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + context: \\"Failed to construct 'URLSearchParams': parameter 1\\", + globals: globalObject }); } } else { @@ -18849,28 +19529,30 @@ exports.install = (globalObject, globalNames) => { append(name, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'append' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'append' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'append' on 'URLSearchParams': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 2\\" + context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -18880,21 +19562,22 @@ exports.install = (globalObject, globalNames) => { delete(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'delete' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'delete' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'delete' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'delete' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'delete' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -18904,21 +19587,20 @@ exports.install = (globalObject, globalNames) => { get(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'get' called on an object that is not a valid instance of URLSearchParams.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'get' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'get' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'get' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -18928,21 +19610,22 @@ exports.install = (globalObject, globalNames) => { getAll(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'getAll' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'getAll' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'getAll' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'getAll' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'getAll' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -18952,21 +19635,20 @@ exports.install = (globalObject, globalNames) => { has(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'has' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'has' called on an object that is not a valid instance of URLSearchParams.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'has' on 'URLSearchParams': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'has' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'has' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -18976,28 +19658,28 @@ exports.install = (globalObject, globalNames) => { set(name, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'set' called on an object that is not a valid instance of URLSearchParams.\\"); } if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 1\\" + context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 1\\", + globals: globalObject }); args.push(curArg); } { let curArg = arguments[1]; curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\" + context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\", + globals: globalObject }); args.push(curArg); } @@ -19007,7 +19689,7 @@ exports.install = (globalObject, globalNames) => { sort() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'sort' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'sort' called on an object that is not a valid instance of URLSearchParams.\\"); } return esValue[implSymbol].sort(); @@ -19016,7 +19698,9 @@ exports.install = (globalObject, globalNames) => { toString() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'toString' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'toString' called on an object that is not a valid instance of URLSearchParams.\\" + ); } return esValue[implSymbol].toString(); @@ -19024,33 +19708,41 @@ exports.install = (globalObject, globalNames) => { keys() { if (!exports.is(this)) { - throw new TypeError(\\"'keys' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError(\\"'keys' called on an object that is not a valid instance of URLSearchParams.\\"); } return exports.createDefaultIterator(globalObject, this, \\"key\\"); } values() { if (!exports.is(this)) { - throw new TypeError(\\"'values' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'values' called on an object that is not a valid instance of URLSearchParams.\\" + ); } return exports.createDefaultIterator(globalObject, this, \\"value\\"); } entries() { if (!exports.is(this)) { - throw new TypeError(\\"'entries' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'entries' called on an object that is not a valid instance of URLSearchParams.\\" + ); } return exports.createDefaultIterator(globalObject, this, \\"key+value\\"); } forEach(callback) { if (!exports.is(this)) { - throw new TypeError(\\"'forEach' called on an object that is not a valid instance of URLSearchParams.\\"); + throw new globalObject.TypeError( + \\"'forEach' called on an object that is not a valid instance of URLSearchParams.\\" + ); } if (arguments.length < 1) { - throw new TypeError(\\"Failed to execute 'forEach' on 'iterable': 1 argument required, \\" + \\"but only 0 present.\\"); + throw new globalObject.TypeError( + \\"Failed to execute 'forEach' on 'iterable': 1 argument required, but only 0 present.\\" + ); } - callback = Function.convert(callback, { + callback = Function.convert(globalObject, callback, { context: \\"Failed to execute 'forEach' on 'iterable': The callback provided as parameter 1\\" }); const thisArg = arguments[1]; @@ -19092,7 +19784,7 @@ exports.install = (globalObject, globalNames) => { next() { const internal = this && this[utils.iterInternalSymbol]; if (!internal) { - throw new TypeError(\\"next() called on a value that is not a URLSearchParams iterator object\\"); + throw new globalObject.TypeError(\\"next() called on a value that is not a URLSearchParams iterator object\\"); } const { target, kind, index } = internal; @@ -19136,11 +19828,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -19156,6 +19848,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -19177,7 +19878,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -19195,7 +19896,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -19214,27 +19915,28 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class URLSearchParamsCollection { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } item(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'item' called on an object that is not a valid instance of URLSearchParamsCollection.\\"); + throw new globalObject.TypeError( + \\"'item' called on an object that is not a valid instance of URLSearchParamsCollection.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'item' on 'URLSearchParamsCollection': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'item' on 'URLSearchParamsCollection': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'item' on 'URLSearchParamsCollection': parameter 1\\" + context: \\"Failed to execute 'item' on 'URLSearchParamsCollection': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -19244,23 +19946,22 @@ exports.install = (globalObject, globalNames) => { namedItem(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'namedItem' called on an object that is not a valid instance of URLSearchParamsCollection.\\" ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'namedItem' on 'URLSearchParamsCollection': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': parameter 1\\" + context: \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -19271,7 +19972,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get length' called on an object that is not a valid instance of URLSearchParamsCollection.\\" ); } @@ -19284,7 +19985,7 @@ exports.install = (globalObject, globalNames) => { namedItem: { enumerable: true }, length: { enumerable: true }, [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection\\", configurable: true }, - [Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true } + [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } }); ctorRegistry[interfaceName] = URLSearchParamsCollection; @@ -19295,7 +19996,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -19316,7 +20022,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -19331,7 +20037,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -19350,7 +20056,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -19384,7 +20090,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -19393,6 +20099,7 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; } let ownDesc; @@ -19439,13 +20146,15 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { return false; } @@ -19456,13 +20165,15 @@ const proxyHandler = { } } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; return !(target[implSymbol].item(index) !== undefined); @@ -19473,12 +20184,12 @@ const proxyHandler = { } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/URLSearchParamsCollection.js\\"); " @@ -19503,11 +20214,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -19523,6 +20234,15 @@ function makeWrapper(globalObject, newTarget) { return Object.create(proto); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -19546,7 +20266,7 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -19564,7 +20284,7 @@ exports.new = (globalObject, newTarget) => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); + wrapper = makeProxy(wrapper, globalObject); wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { @@ -19583,12 +20303,12 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } } Object.defineProperties(URLSearchParamsCollection2.prototype, { [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true }, - [Symbol.iterator]: { value: ctorRegistry[\\"%Array%\\"].prototype[Symbol.iterator], configurable: true, writable: true } + [Symbol.iterator]: { value: globalObject.Array.prototype[Symbol.iterator], configurable: true, writable: true } }); ctorRegistry[interfaceName] = URLSearchParamsCollection2; @@ -19599,7 +20319,12 @@ exports.install = (globalObject, globalNames) => { }); }; -const proxyHandler = { +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + get(target, P, receiver) { if (typeof P === \\"symbol\\") { return Reflect.get(target, P, receiver); @@ -19620,7 +20345,7 @@ const proxyHandler = { return undefined; } return Reflect.apply(getter, receiver, []); - }, + } has(target, P) { if (typeof P === \\"symbol\\") { @@ -19635,7 +20360,7 @@ const proxyHandler = { return Reflect.has(parent, P); } return false; - }, + } ownKeys(target) { const keys = new Set(); @@ -19654,7 +20379,7 @@ const proxyHandler = { keys.add(key); } return [...keys]; - }, + } getOwnPropertyDescriptor(target, P) { if (typeof P === \\"symbol\\") { @@ -19688,7 +20413,7 @@ const proxyHandler = { } return Reflect.getOwnPropertyDescriptor(target, P); - }, + } set(target, P, V, receiver) { if (typeof P === \\"symbol\\") { @@ -19697,10 +20422,12 @@ const proxyHandler = { // The \`receiver\` argument refers to the Proxy exotic object or an object // that inherits from it, whereas \`target\` refers to the Proxy target: if (target[implSymbol][utils.wrapperSymbol] === receiver) { + const globalObject = this._globalObject; + if (typeof P === \\"string\\") { let namedValue = V; - namedValue = URL.convert(namedValue, { + namedValue = URL.convert(globalObject, namedValue, { context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" }); @@ -19759,13 +20486,15 @@ const proxyHandler = { valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } return Reflect.defineProperty(receiver, P, valueDesc); - }, + } defineProperty(target, P, desc) { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { return false; } @@ -19776,7 +20505,7 @@ const proxyHandler = { let namedValue = desc.value; - namedValue = URL.convert(namedValue, { + namedValue = URL.convert(globalObject, namedValue, { context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" }); @@ -19790,13 +20519,15 @@ const proxyHandler = { return true; } return Reflect.defineProperty(target, P, desc); - }, + } deleteProperty(target, P) { if (typeof P === \\"symbol\\") { return Reflect.deleteProperty(target, P); } + const globalObject = this._globalObject; + if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; return !(target[implSymbol].item(index) !== undefined); @@ -19807,12 +20538,12 @@ const proxyHandler = { } return Reflect.deleteProperty(target, P); - }, + } preventExtensions() { return false; } -}; +} const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\"); " @@ -19835,11 +20566,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -19909,27 +20640,27 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class UnderscoredProperties { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } operation(sequence) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'operation' called on an object that is not a valid instance of UnderscoredProperties.\\"); + throw new globalObject.TypeError( + \\"'operation' called on an object that is not a valid instance of UnderscoredProperties.\\" + ); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'operation' on 'UnderscoredProperties': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'operation' on 'UnderscoredProperties': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; if (!utils.isObject(curArg)) { - throw new TypeError( + throw new globalObject.TypeError( \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\" is not an iterable object.\\" ); } else { @@ -19937,7 +20668,8 @@ exports.install = (globalObject, globalNames) => { const tmp = curArg; for (let nextItem of tmp) { nextItem = conversions[\\"DOMString\\"](nextItem, { - context: \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\"'s element\\" + context: \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\"'s element\\", + globals: globalObject }); V.push(nextItem); @@ -19953,7 +20685,7 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'get attribute' called on an object that is not a valid instance of UnderscoredProperties.\\" ); } @@ -19965,13 +20697,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError( + throw new globalObject.TypeError( \\"'set attribute' called on an object that is not a valid instance of UnderscoredProperties.\\" ); } V = conversions[\\"byte\\"](V, { - context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\" + context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"attribute\\"] = V; @@ -19979,17 +20712,16 @@ exports.install = (globalObject, globalNames) => { static static(void_) { if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'static' on 'UnderscoredProperties': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'static' on 'UnderscoredProperties': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'static' on 'UnderscoredProperties': parameter 1\\" + context: \\"Failed to execute 'static' on 'UnderscoredProperties': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -20036,11 +20768,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Unscopable'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Unscopable'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -20110,14 +20842,16 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Unscopable { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } get unscopableTest() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get unscopableTest' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'get unscopableTest' called on an object that is not a valid instance of Unscopable.\\" + ); } return esValue[implSymbol][\\"unscopableTest\\"]; @@ -20127,11 +20861,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set unscopableTest' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'set unscopableTest' called on an object that is not a valid instance of Unscopable.\\" + ); } V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\" + context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"unscopableTest\\"] = V; @@ -20141,7 +20878,9 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'get unscopableMixin' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'get unscopableMixin' called on an object that is not a valid instance of Unscopable.\\" + ); } return esValue[implSymbol][\\"unscopableMixin\\"]; @@ -20151,11 +20890,14 @@ exports.install = (globalObject, globalNames) => { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'set unscopableMixin' called on an object that is not a valid instance of Unscopable.\\"); + throw new globalObject.TypeError( + \\"'set unscopableMixin' called on an object that is not a valid instance of Unscopable.\\" + ); } V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\" + context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\", + globals: globalObject }); esValue[implSymbol][\\"unscopableMixin\\"] = V; @@ -20201,11 +20943,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Variadic'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'Variadic'.\`); }; function makeWrapper(globalObject, newTarget) { @@ -20275,19 +21017,20 @@ exports.install = (globalObject, globalNames) => { const ctorRegistry = utils.initCtorRegistry(globalObject); class Variadic { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + throw new globalObject.TypeError(\\"Illegal constructor\\"); } simple1() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'simple1' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'simple1' called on an object that is not a valid instance of Variadic.\\"); } const args = []; for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'simple1' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'simple1' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -20297,25 +21040,28 @@ exports.install = (globalObject, globalNames) => { simple2(first) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'simple2' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'simple2' called on an object that is not a valid instance of Variadic.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'simple2' on 'Variadic': 1 argument required, but only \\" + arguments.length + \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'simple2' on 'Variadic': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'simple2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'simple2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } for (let i = 1; i < arguments.length; i++) { let curArg = arguments[i]; - curArg = URL.convert(curArg, { context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) }); + curArg = URL.convert(globalObject, curArg, { + context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) + }); args.push(curArg); } return esValue[implSymbol].simple2(...args); @@ -20324,7 +21070,7 @@ exports.install = (globalObject, globalNames) => { overloaded1() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'overloaded1' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'overloaded1' called on an object that is not a valid instance of Variadic.\\"); } const args = []; switch (arguments.length) { @@ -20336,7 +21082,8 @@ exports.install = (globalObject, globalNames) => { for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -20344,7 +21091,8 @@ exports.install = (globalObject, globalNames) => { for (let i = 0; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded1' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -20357,14 +21105,12 @@ exports.install = (globalObject, globalNames) => { overloaded2(first) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { - throw new TypeError(\\"'overloaded2' called on an object that is not a valid instance of Variadic.\\"); + throw new globalObject.TypeError(\\"'overloaded2' called on an object that is not a valid instance of Variadic.\\"); } if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + throw new globalObject.TypeError( + \`Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \${arguments.length} present.\` ); } const args = []; @@ -20376,7 +21122,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -20384,7 +21131,8 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } @@ -20397,14 +21145,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"unsigned long\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } for (let i = 1; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -20412,14 +21162,16 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\", + globals: globalObject }); args.push(curArg); } for (let i = 1; i < arguments.length; i++) { let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1) + context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter \\" + (i + 1), + globals: globalObject }); args.push(curArg); } @@ -20466,11 +21218,11 @@ exports.is = value => { exports.isImpl = value => { return utils.isObject(value) && value instanceof Impl.implementation; }; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { +exports.convert = (globalObject, value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`); + throw new globalObject.TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`); }; function makeWrapper(globalObject, newTarget) {