From f0cf0538470fd9eafcdbf76a0bc92477e9bae8b3 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Tue, 15 Oct 2019 07:25:59 +0200
Subject: [PATCH 1/8] constructor & prototype reform
---
README.md | 8 +-
lib/constructs/interface.js | 168 ++-
lib/output/utils.js | 2 +
test/__snapshots__/test.js.snap | 1761 +++++++++++++++++++++++++------
test/cases/Factory.webidl | 6 -
5 files changed, 1582 insertions(+), 363 deletions(-)
delete mode 100644 test/cases/Factory.webidl
diff --git a/README.md b/README.md
index 523bc26a..dbb74eeb 100644
--- a/README.md
+++ b/README.md
@@ -247,7 +247,7 @@ Note that for IDL attributes that are `readonly`, these properties do not need t
#### Static attributes
-Just like static operations, static attributes are defined as properties on the constructor of the implementation class. And just like other attributes, the attribute can either be implemented as an accessor attribute or (if it is readonly) a data attribute. Note that, unless the `[WebIDL2JSFactory]` extended attribute is specified on the interface, any mutations to writable static attributes of the class will reflect on other places that use the same interface.
+Just like static operations, static attributes are defined as properties on the constructor of the implementation class. And just like other attributes, the attribute can either be implemented as an accessor attribute or (if it is readonly) a data attribute.
### toString method implementing IDL stringifier
@@ -386,12 +386,6 @@ Note that only the basics of the reflect algorithm are implemented so far: `bool
In the future we may move this extended attribute out into some sort of plugin, since it is more related to HTML than to Web IDL.
-### `[WebIDL2JSFactory]`
-
-This extended attribute can be applied to interfaces to cause them to generate a factory that generates wrapper classes, instead of generating a single wrapper class.
-
-It is currently used by [jsdom](https://github.com/tmpvar/jsdom) for classes which need to specialize their behavior per `Window` object; by default [jsdom shares classes across all `Window`s](https://github.com/tmpvar/jsdom#shared-constructors-and-prototypes), but with `[WebIDL2JSFactory]`, an exception can be made for certain classes that need it.
-
### `[WebIDL2JSValueAsUnsupported=value]`
This extended attribute can be applied to named or indexed getters or setters. It says that whether the interface supports a given property name/index can be automatically derived by looking at the return value of its indexed getter/setter: whenever `value` is returned, the name/index is unsupported. Typically, `value` is either `undefined` or `_null`.
diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js
index 7e100670..1f28e750 100644
--- a/lib/constructs/interface.js
+++ b/lib/constructs/interface.js
@@ -66,7 +66,6 @@ class Interface {
this.ctx = ctx;
this.idl = idl;
this.name = idl.name;
- this.factory = Boolean(utils.getExtAttr(this.idl.extAttrs, "WebIDL2JSFactory"));
for (const member of this.idl.members) {
member.definingInterface = this.name;
}
@@ -496,6 +495,7 @@ class Interface {
generateRequires() {
this.requires.addRaw("impl", "utils.implSymbol");
+ this.requires.addRaw("ctorRegistry", "utils.ctorRegistrySymbol");
if (this.idl.inheritance !== null) {
this.requires.add(this.idl.inheritance);
@@ -1119,14 +1119,22 @@ class Interface {
}
this.str += `
- create(constructorArgs, privateData) {
- let obj = Object.create(${this.name}.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError('Invalid global object');
+ }
+
+ const ctor = globalObject[ctorRegistry]["${this.name}"];
+ if (ctor === undefined) {
+ throw new TypeError('Constructor ${this.name} is not installed on the passed global object');
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(${this.name}.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
@@ -1146,16 +1154,6 @@ class Interface {
if (!privateData) privateData = {};
`;
- if (this.factory) {
- this.str += `
- for (var prop in defaultPrivateData) {
- if (!(prop in privateData)) {
- privateData[prop] = defaultPrivateData[prop];
- }
- }
- `;
- }
-
this.str += `
privateData.wrapper = obj;
@@ -1180,11 +1178,11 @@ class Interface {
interface: ${this.name},
expose: {
${exposers.join(",\n ")}
- }
+ },
`;
}
- addConstructor() {
+ getConstructor(privateData) {
const overloads = Overloads.getEffectiveOverloads("constructor", this.name, 0, this);
let body;
@@ -1203,10 +1201,15 @@ class Interface {
this.ctx, "constructor", this.name, this, `Failed to construct '${this.name}': `);
this.requires.merge(conversions.requires);
- const passArgs = conversions.hasArgs ? ", args" : "";
+ const setupArgs = [
+ "Object.create(new.target.prototype)",
+ conversions.hasArgs ? "args" : "undefined",
+ privateData ? privateData : "undefined"
+ ];
+
body = `
${conversions.body}
- return iface.setup(Object.create(new.target.prototype)${passArgs});
+ return iface.setup(${formatArgs(setupArgs)});
`;
} else {
body = `
@@ -1214,6 +1217,11 @@ class Interface {
`;
}
+ return { body, argNames };
+ }
+
+ addConstructor() {
+ const { body, argNames } = this.getConstructor();
this.addMethod("prototype", "constructor", argNames, body, "regular", { enumerable: false });
}
@@ -1436,16 +1444,97 @@ class Interface {
}
}
- generate() {
- this.generateIterator();
+ generateInstall() {
+ const { idl, name } = this;
- if (this.factory) {
+ this.str += `
+ install(globalObject) {
+ `;
+
+ const ctor = this.getConstructor("{ globalObject }");
+ this.str += `
+ const ${name} = function(${formatArgs(ctor.argNames)}) {
+ ${ctor.body}
+ };
+ `;
+
+ const staticPropertyNames = [
+ ...this._outputStaticProperties.keys(),
+ ...this._outputStaticMethods.keys()
+ ];
+ if (staticPropertyNames.length) {
this.str += `
- module.exports = {
- createInterface: function (defaultPrivateData = {}) {
+ Object.defineProperties(${name}, {
+ `;
+
+ for (const staticProperty of staticPropertyNames) {
+ // TODO: Improve this code. It's a really bad hack.
+ const propertyKey = utils.stringifyPropertyName(staticProperty);
+ const propertyValue = propertyKey.startsWith("[") && propertyKey.endsWith("]") ?
+ propertyKey.replace("[", "").replace("]", "") :
+ `"${propertyKey}"`;
+
+ this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(iface.interface, ${propertyValue}),\n`;
+ }
+
+ this.str += `
+ });
`;
}
+ if (idl.inheritance) {
+ // If the interface inherits from another one add a check to make sure that the parent interface is installed
+ // before on the global object.
+ this.str += `
+ if (globalObject.${idl.inheritance} === undefined) {
+ throw new Error('Evaluation order error. Attempting to evaluate ${name} before ${idl.inheritance}');
+ }
+
+ const proto = Object.create(globalObject.${idl.inheritance}.prototype);
+ `;
+ } else {
+ this.str += `
+ const proto = {};
+ `;
+ }
+
+ // Assign the shared prototype descriptors to brand new one. Once the prototype chain is ready, attach it to the
+ // newly created constructor.
+ this.str += `
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: ${name}
+ }
+ });
+ Object.defineProperty(${name}, "prototype", {
+ writable: false,
+ value: proto
+ });
+ `;
+
+ // Add the newly create constructor to the constructor registry attached to the global object (this this will be
+ // used when invoking interface.create, and interface.creatImpl). And also attach it to the global object.
+ this.str += `
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry]["${name}"] = ${name};
+
+ Object.defineProperty(globalObject, "${name}", {
+ configurable: true,
+ writable: true,
+ value: ${name}
+ });
+ },
+ `;
+ }
+
+ generate() {
+ this.generateIterator();
+
const ext = this.idl.inheritance ? ` extends ${this.idl.inheritance}.interface` : "";
this.str += `class ${this.name}${ext} {`;
@@ -1459,25 +1548,14 @@ class Interface {
const iface = {
`;
- if (this.factory) {
- this.generateIface();
- this.str += `
- }; // iface
- return iface;
- }, // createInterface
- `;
- this.generateExport();
- this.str += `
- }; // module.exports
- `;
- } else {
- this.generateExport();
- this.generateIface();
- this.str += `
- }; // iface
- module.exports = iface;
- `;
- }
+ this.generateExport();
+ this.generateIface();
+ this.generateInstall();
+
+ this.str += `
+ }; // iface
+ module.exports = iface;
+ `;
this.generateMixins();
this.generateRequires();
diff --git a/lib/output/utils.js b/lib/output/utils.js
index 0b0b0d49..c02838f6 100644
--- a/lib/output/utils.js
+++ b/lib/output/utils.js
@@ -12,6 +12,7 @@ function hasOwn(obj, prop) {
const wrapperSymbol = Symbol("wrapper");
const implSymbol = Symbol("impl");
const sameObjectCaches = Symbol("SameObject caches");
+const ctorRegistrySymbol = Symbol.for("constructor registry");
function getSameObject(wrapper, prop, creator) {
if (!wrapper[sameObjectCaches]) {
@@ -80,6 +81,7 @@ module.exports = exports = {
wrapperSymbol,
implSymbol,
getSameObject,
+ ctorRegistrySymbol,
wrapperForImpl,
implForWrapper,
tryWrapperForImpl,
diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap
index 8f0bf689..415f6b56 100644
--- a/test/__snapshots__/test.js.snap
+++ b/test/__snapshots__/test.js.snap
@@ -7,6 +7,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class DOMImplementation {
constructor() {
@@ -170,14 +171,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'DOMImplementation'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(DOMImplementation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"DOMImplementation\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor DOMImplementation is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(DOMImplementation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -201,6 +210,38 @@ const iface = {
interface: DOMImplementation,
expose: {
Window: { DOMImplementation }
+ },
+
+ install(globalObject) {
+ const DOMImplementation = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: DOMImplementation
+ }
+ });
+ Object.defineProperty(DOMImplementation, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"DOMImplementation\\"] = DOMImplementation;
+
+ Object.defineProperty(globalObject, \\"DOMImplementation\\", {
+ configurable: true,
+ writable: true,
+ value: DOMImplementation
+ });
}
}; // iface
module.exports = iface;
@@ -297,6 +338,7 @@ const utils = require(\\"./utils.js\\");
const convertDictionary = require(\\"./Dictionary.js\\").convert;
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class DictionaryConvert {
constructor() {
@@ -369,14 +411,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'DictionaryConvert'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(DictionaryConvert.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"DictionaryConvert\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor DictionaryConvert is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(DictionaryConvert.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -400,6 +450,38 @@ const iface = {
interface: DictionaryConvert,
expose: {
Window: { DictionaryConvert }
+ },
+
+ install(globalObject) {
+ const DictionaryConvert = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: DictionaryConvert
+ }
+ });
+ Object.defineProperty(DictionaryConvert, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"DictionaryConvert\\"] = DictionaryConvert;
+
+ Object.defineProperty(globalObject, \\"DictionaryConvert\\", {
+ configurable: true,
+ writable: true,
+ value: DictionaryConvert
+ });
}
}; // iface
module.exports = iface;
@@ -417,6 +499,7 @@ const utils = require(\\"./utils.js\\");
const convertRequestDestination = require(\\"./RequestDestination.js\\").convert;
const RequestDestination = require(\\"./RequestDestination.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Enum {
constructor() {
@@ -508,14 +591,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Enum'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Enum.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Enum\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Enum is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Enum.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -539,148 +630,43 @@ const iface = {
interface: Enum,
expose: {
Window: { Enum }
- }
-}; // iface
-module.exports = iface;
-
-const Impl = require(\\"../implementations/Enum.js\\");
-"
-`;
-
-exports[`Factory.webidl 1`] = `
-"\\"use strict\\";
-
-const conversions = require(\\"webidl-conversions\\");
-const utils = require(\\"./utils.js\\");
-
-const impl = utils.implSymbol;
-
-module.exports = {
- createInterface: function(defaultPrivateData = {}) {
- class Factory {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
- method() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].method();
- }
+ },
- get attribute() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ install(globalObject) {
+ const Enum = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
- return this[impl][\\"attribute\\"];
- }
-
- set attribute(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ const proto = {};
- V = conversions[\\"double\\"](V, {
- context: \\"Failed to set the 'attribute' property on 'Factory': The provided value\\"
- });
-
- this[impl][\\"attribute\\"] = V;
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Enum
}
- }
- Object.defineProperties(Factory.prototype, {
- method: { enumerable: true },
- attribute: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Factory\\", configurable: true },
- constant: { value: 42, enumerable: true }
});
- Object.defineProperties(Factory, { constant: { value: 42, enumerable: true } });
- const iface = {
- create(constructorArgs, privateData) {
- let obj = Object.create(Factory.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
- return obj;
- },
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Factory.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
- return utils.implForWrapper(obj);
- },
- _internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
- for (var prop in defaultPrivateData) {
- if (!(prop in privateData)) {
- privateData[prop] = defaultPrivateData[prop];
- }
- }
-
- privateData.wrapper = obj;
-
- this._internalSetup(obj);
- Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
- configurable: true
- });
-
- obj[impl][utils.wrapperSymbol] = obj;
- if (Impl.init) {
- Impl.init(obj[impl], privateData);
- }
- return obj;
- },
- interface: Factory,
- expose: {
- Window: { Factory }
- }
- }; // iface
- return iface;
- }, // createInterface
+ Object.defineProperty(Enum, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
- // When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
- // method into this array. It allows objects that directly implements *those* interfaces to be recognized as
- // implementing this mixin interface.
- _mixedIntoPredicates: [],
- is(obj) {
- if (obj) {
- if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
- return true;
- }
- for (const isMixedInto of module.exports._mixedIntoPredicates) {
- if (isMixedInto(obj)) {
- return true;
- }
- }
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
}
- return false;
- },
- isImpl(obj) {
- if (obj) {
- if (obj instanceof Impl.implementation) {
- return true;
- }
+ globalObject[ctorRegistry][\\"Enum\\"] = Enum;
- const wrapper = utils.wrapperForImpl(obj);
- for (const isMixedInto of module.exports._mixedIntoPredicates) {
- if (isMixedInto(wrapper)) {
- return true;
- }
- }
- }
- return false;
- },
- convert(obj, { context = \\"The provided value\\" } = {}) {
- if (module.exports.is(obj)) {
- return utils.implForWrapper(obj);
- }
- throw new TypeError(\`\${context} is not of type 'Factory'.\`);
+ Object.defineProperty(globalObject, \\"Enum\\", {
+ configurable: true,
+ writable: true,
+ value: Enum
+ });
}
-}; // module.exports
+}; // iface
+module.exports = iface;
-const Impl = require(\\"../implementations/Factory.js\\");
+const Impl = require(\\"../implementations/Enum.js\\");
"
`;
@@ -691,6 +677,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Global {
constructor() {
@@ -738,14 +725,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Global'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Global.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Global\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Global is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Global.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
@@ -854,6 +849,38 @@ const iface = {
interface: Global,
expose: {
Window: { Global }
+ },
+
+ install(globalObject) {
+ const Global = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Global
+ }
+ });
+ Object.defineProperty(Global, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Global\\"] = Global;
+
+ Object.defineProperty(globalObject, \\"Global\\", {
+ configurable: true,
+ writable: true,
+ value: Global
+ });
}
}; // iface
module.exports = iface;
@@ -869,6 +896,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class LegacyArrayClass {
constructor() {
@@ -928,14 +956,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'LegacyArrayClass'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(LegacyArrayClass.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"LegacyArrayClass\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor LegacyArrayClass is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(LegacyArrayClass.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -959,6 +995,38 @@ const iface = {
interface: LegacyArrayClass,
expose: {
Window: { LegacyArrayClass }
+ },
+
+ install(globalObject) {
+ const LegacyArrayClass = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: LegacyArrayClass
+ }
+ });
+ Object.defineProperty(LegacyArrayClass, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"LegacyArrayClass\\"] = LegacyArrayClass;
+
+ Object.defineProperty(globalObject, \\"LegacyArrayClass\\", {
+ configurable: true,
+ writable: true,
+ value: LegacyArrayClass
+ });
}
}; // iface
module.exports = iface;
@@ -974,6 +1042,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class MixedIn {
constructor() {
@@ -1089,14 +1158,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'MixedIn'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(MixedIn.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"MixedIn\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor MixedIn is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(MixedIn.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -1120,6 +1197,43 @@ const iface = {
interface: MixedIn,
expose: {
Window: { MixedIn }
+ },
+
+ install(globalObject) {
+ const MixedIn = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ Object.defineProperties(MixedIn, {
+ mixedInConst: Object.getOwnPropertyDescriptor(iface.interface, \\"mixedInConst\\"),
+ ifaceMixinConst: Object.getOwnPropertyDescriptor(iface.interface, \\"ifaceMixinConst\\")
+ });
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: MixedIn
+ }
+ });
+ Object.defineProperty(MixedIn, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"MixedIn\\"] = MixedIn;
+
+ Object.defineProperty(globalObject, \\"MixedIn\\", {
+ configurable: true,
+ writable: true,
+ value: MixedIn
+ });
}
}; // iface
module.exports = iface;
@@ -1137,6 +1251,7 @@ const utils = require(\\"./utils.js\\");
const isURL = require(\\"./URL.js\\").is;
const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Overloads {
constructor() {
@@ -1161,7 +1276,7 @@ class Overloads {
}
}
}
- return iface.setup(Object.create(new.target.prototype), args);
+ return iface.setup(Object.create(new.target.prototype), args, undefined);
}
compatible(arg1) {
@@ -1493,14 +1608,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Overloads'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Overloads.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Overloads\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Overloads is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Overloads.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -1524,6 +1647,59 @@ const iface = {
interface: Overloads,
expose: {
Window: { Overloads }
+ },
+
+ install(globalObject) {
+ const Overloads = function() {
+ const args = [];
+ switch (arguments.length) {
+ case 0:
+ break;
+ default: {
+ let curArg = arguments[0];
+ if (isURL(curArg)) {
+ {
+ let curArg = arguments[0];
+ curArg = convertURL(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\\" });
+ args.push(curArg);
+ }
+ }
+ }
+ }
+ return iface.setup(Object.create(new.target.prototype), args, { globalObject });
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Overloads
+ }
+ });
+ Object.defineProperty(Overloads, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Overloads\\"] = Overloads;
+
+ Object.defineProperty(globalObject, \\"Overloads\\", {
+ configurable: true,
+ writable: true,
+ value: Overloads
+ });
}
}; // iface
module.exports = iface;
@@ -1539,6 +1715,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class PromiseTypes {
constructor() {
@@ -1641,14 +1818,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(PromiseTypes.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"PromiseTypes\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor PromiseTypes is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(PromiseTypes.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -1672,6 +1857,38 @@ const iface = {
interface: PromiseTypes,
expose: {
Window: { PromiseTypes }
+ },
+
+ install(globalObject) {
+ const PromiseTypes = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: PromiseTypes
+ }
+ });
+ Object.defineProperty(PromiseTypes, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"PromiseTypes\\"] = PromiseTypes;
+
+ Object.defineProperty(globalObject, \\"PromiseTypes\\", {
+ configurable: true,
+ writable: true,
+ value: PromiseTypes
+ });
}
}; // iface
module.exports = iface;
@@ -1687,6 +1904,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Reflect {
constructor() {
@@ -1871,14 +2089,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Reflect'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Reflect.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Reflect\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Reflect is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Reflect.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -1902,6 +2128,38 @@ const iface = {
interface: Reflect,
expose: {
Window: { Reflect }
+ },
+
+ install(globalObject) {
+ const Reflect = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Reflect
+ }
+ });
+ Object.defineProperty(Reflect, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Reflect\\"] = Reflect;
+
+ Object.defineProperty(globalObject, \\"Reflect\\", {
+ configurable: true,
+ writable: true,
+ value: Reflect
+ });
}
}; // iface
module.exports = iface;
@@ -1952,10 +2210,11 @@ const utils = require(\\"./utils.js\\");
const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class SeqAndRec {
constructor() {
- return iface.setup(Object.create(new.target.prototype));
+ return iface.setup(Object.create(new.target.prototype), undefined, undefined);
}
recordConsumer(rec) {
@@ -2201,14 +2460,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(SeqAndRec.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"SeqAndRec\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor SeqAndRec is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(SeqAndRec.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -2232,6 +2499,38 @@ const iface = {
interface: SeqAndRec,
expose: {
Window: { SeqAndRec }
+ },
+
+ install(globalObject) {
+ const SeqAndRec = function() {
+ return iface.setup(Object.create(new.target.prototype), undefined, { globalObject });
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: SeqAndRec
+ }
+ });
+ Object.defineProperty(SeqAndRec, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"SeqAndRec\\"] = SeqAndRec;
+
+ Object.defineProperty(globalObject, \\"SeqAndRec\\", {
+ configurable: true,
+ writable: true,
+ value: SeqAndRec
+ });
}
}; // iface
module.exports = iface;
@@ -2247,6 +2546,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Static {
constructor() {
@@ -2337,14 +2637,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Static'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Static.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Static\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Static is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Static.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -2368,6 +2676,43 @@ const iface = {
interface: Static,
expose: {
Window: { Static }
+ },
+
+ install(globalObject) {
+ const Static = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ Object.defineProperties(Static, {
+ def: Object.getOwnPropertyDescriptor(iface.interface, \\"def\\"),
+ abc: Object.getOwnPropertyDescriptor(iface.interface, \\"abc\\")
+ });
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Static
+ }
+ });
+ Object.defineProperty(Static, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Static\\"] = Static;
+
+ Object.defineProperty(globalObject, \\"Static\\", {
+ configurable: true,
+ writable: true,
+ value: Static
+ });
}
}; // iface
module.exports = iface;
@@ -2383,6 +2728,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Storage {
constructor() {
@@ -2537,14 +2883,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Storage'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Storage.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Storage\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Storage is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Storage.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -2732,6 +3086,38 @@ const iface = {
interface: Storage,
expose: {
Window: { Storage }
+ },
+
+ install(globalObject) {
+ const Storage = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Storage
+ }
+ });
+ Object.defineProperty(Storage, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Storage\\"] = Storage;
+
+ Object.defineProperty(globalObject, \\"Storage\\", {
+ configurable: true,
+ writable: true,
+ value: Storage
+ });
}
}; // iface
module.exports = iface;
@@ -2747,6 +3133,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class StringifierAttribute {
constructor() {
@@ -2813,14 +3200,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(StringifierAttribute.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"StringifierAttribute\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor StringifierAttribute is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(StringifierAttribute.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -2844,6 +3239,38 @@ const iface = {
interface: StringifierAttribute,
expose: {
Window: { StringifierAttribute }
+ },
+
+ install(globalObject) {
+ const StringifierAttribute = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: StringifierAttribute
+ }
+ });
+ Object.defineProperty(StringifierAttribute, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"StringifierAttribute\\"] = StringifierAttribute;
+
+ Object.defineProperty(globalObject, \\"StringifierAttribute\\", {
+ configurable: true,
+ writable: true,
+ value: StringifierAttribute
+ });
}
}; // iface
module.exports = iface;
@@ -2859,6 +3286,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class StringifierDefaultOperation {
constructor() {
@@ -2917,14 +3345,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(StringifierDefaultOperation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor StringifierDefaultOperation is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(StringifierDefaultOperation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -2948,6 +3384,38 @@ const iface = {
interface: StringifierDefaultOperation,
expose: {
Window: { StringifierDefaultOperation }
+ },
+
+ install(globalObject) {
+ const StringifierDefaultOperation = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: StringifierDefaultOperation
+ }
+ });
+ Object.defineProperty(StringifierDefaultOperation, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"] = StringifierDefaultOperation;
+
+ Object.defineProperty(globalObject, \\"StringifierDefaultOperation\\", {
+ configurable: true,
+ writable: true,
+ value: StringifierDefaultOperation
+ });
}
}; // iface
module.exports = iface;
@@ -2963,6 +3431,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class StringifierNamedOperation {
constructor() {
@@ -3030,14 +3499,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(StringifierNamedOperation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"StringifierNamedOperation\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor StringifierNamedOperation is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(StringifierNamedOperation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -3061,6 +3538,38 @@ const iface = {
interface: StringifierNamedOperation,
expose: {
Window: { StringifierNamedOperation }
+ },
+
+ install(globalObject) {
+ const StringifierNamedOperation = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: StringifierNamedOperation
+ }
+ });
+ Object.defineProperty(StringifierNamedOperation, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"StringifierNamedOperation\\"] = StringifierNamedOperation;
+
+ Object.defineProperty(globalObject, \\"StringifierNamedOperation\\", {
+ configurable: true,
+ writable: true,
+ value: StringifierNamedOperation
+ });
}
}; // iface
module.exports = iface;
@@ -3076,6 +3585,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class StringifierOperation {
constructor() {
@@ -3134,14 +3644,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(StringifierOperation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"StringifierOperation\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor StringifierOperation is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(StringifierOperation.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -3165,6 +3683,38 @@ const iface = {
interface: StringifierOperation,
expose: {
Window: { StringifierOperation }
+ },
+
+ install(globalObject) {
+ const StringifierOperation = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: StringifierOperation
+ }
+ });
+ Object.defineProperty(StringifierOperation, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"StringifierOperation\\"] = StringifierOperation;
+
+ Object.defineProperty(globalObject, \\"StringifierOperation\\", {
+ configurable: true,
+ writable: true,
+ value: StringifierOperation
+ });
}
}; // iface
module.exports = iface;
@@ -3183,6 +3733,7 @@ const convertRequestDestination = require(\\"./RequestDestination.js\\").convert
const isURL = require(\\"./URL.js\\").is;
const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class TypedefsAndUnions {
constructor() {
@@ -3642,14 +4193,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(TypedefsAndUnions.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"TypedefsAndUnions\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor TypedefsAndUnions is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(TypedefsAndUnions.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -3673,6 +4232,38 @@ const iface = {
interface: TypedefsAndUnions,
expose: {
Window: { TypedefsAndUnions }
+ },
+
+ install(globalObject) {
+ const TypedefsAndUnions = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: TypedefsAndUnions
+ }
+ });
+ Object.defineProperty(TypedefsAndUnions, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"TypedefsAndUnions\\"] = TypedefsAndUnions;
+
+ Object.defineProperty(globalObject, \\"TypedefsAndUnions\\", {
+ configurable: true,
+ writable: true,
+ value: TypedefsAndUnions
+ });
}
}; // iface
module.exports = iface;
@@ -3688,6 +4279,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class URL {
constructor(url) {
@@ -3707,7 +4299,7 @@ class URL {
}
args.push(curArg);
}
- return iface.setup(Object.create(new.target.prototype), args);
+ return iface.setup(Object.create(new.target.prototype), args, undefined);
}
toJSON() {
@@ -3980,14 +4572,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'URL'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(URL.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"URL\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor URL is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(URL.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -4012,6 +4612,56 @@ const iface = {
expose: {
Window: { URL },
Worker: { URL }
+ },
+
+ install(globalObject) {
+ const URL = function(url) {
+ if (arguments.length < 1) {
+ throw new 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\\" });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ if (curArg !== undefined) {
+ curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" });
+ }
+ args.push(curArg);
+ }
+ return iface.setup(Object.create(new.target.prototype), args, { globalObject });
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: URL
+ }
+ });
+ Object.defineProperty(URL, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"URL\\"] = URL;
+
+ Object.defineProperty(globalObject, \\"URL\\", {
+ configurable: true,
+ writable: true,
+ value: URL
+ });
}
}; // iface
module.exports = iface;
@@ -4027,6 +4677,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class URLList {
constructor() {
@@ -4110,14 +4761,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'URLList'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(URLList.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"URLList\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor URLList is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(URLList.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -4301,6 +4960,38 @@ const iface = {
interface: URLList,
expose: {
Window: { URLList }
+ },
+
+ install(globalObject) {
+ const URLList = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: URLList
+ }
+ });
+ Object.defineProperty(URLList, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"URLList\\"] = URLList;
+
+ Object.defineProperty(globalObject, \\"URLList\\", {
+ configurable: true,
+ writable: true,
+ value: URLList
+ });
}
}; // iface
module.exports = iface;
@@ -4316,6 +5007,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
const IteratorPrototype = Object.create(utils.IteratorPrototype, {
next: {
@@ -4432,7 +5124,7 @@ class URLSearchParams {
}
args.push(curArg);
}
- return iface.setup(Object.create(new.target.prototype), args);
+ return iface.setup(Object.create(new.target.prototype), args, undefined);
}
append(name, value) {
@@ -4706,14 +5398,22 @@ const iface = {
return iterator;
},
- create(constructorArgs, privateData) {
- let obj = Object.create(URLSearchParams.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"URLSearchParams\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor URLSearchParams is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(URLSearchParams.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -4738,6 +5438,118 @@ const iface = {
expose: {
Window: { URLSearchParams },
Worker: { URLSearchParams }
+ },
+
+ install(globalObject) {
+ const URLSearchParams = function() {
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg !== undefined) {
+ if (utils.isObject(curArg)) {
+ if (curArg[Symbol.iterator] !== undefined) {
+ if (!utils.isObject(curArg)) {
+ throw new TypeError(
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = curArg;
+ for (let nextItem of tmp) {
+ if (!utils.isObject(nextItem)) {
+ throw new TypeError(
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" +
+ \\" sequence\\" +
+ \\"'s element\\" +
+ \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = nextItem;
+ for (let nextItem of tmp) {
+ nextItem = conversions[\\"USVString\\"](nextItem, {
+ context:
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" +
+ \\" sequence\\" +
+ \\"'s element\\" +
+ \\"'s element\\"
+ });
+
+ V.push(nextItem);
+ }
+ nextItem = V;
+ }
+
+ V.push(nextItem);
+ }
+ curArg = V;
+ }
+ } else {
+ if (!utils.isObject(curArg)) {
+ throw new TypeError(
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\" is not an object.\\"
+ );
+ } else {
+ const result = Object.create(null);
+ for (const key of Reflect.ownKeys(curArg)) {
+ const desc = Object.getOwnPropertyDescriptor(curArg, key);
+ if (desc && desc.enumerable) {
+ let typedKey = key;
+
+ typedKey = conversions[\\"USVString\\"](typedKey, {
+ context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\"
+ });
+
+ let typedValue = curArg[key];
+
+ typedValue = conversions[\\"USVString\\"](typedValue, {
+ context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\"
+ });
+
+ result[typedKey] = typedValue;
+ }
+ }
+ curArg = result;
+ }
+ }
+ } else {
+ curArg = conversions[\\"USVString\\"](curArg, {
+ context: \\"Failed to construct 'URLSearchParams': parameter 1\\"
+ });
+ }
+ } else {
+ curArg = \\"\\";
+ }
+ args.push(curArg);
+ }
+ return iface.setup(Object.create(new.target.prototype), args, { globalObject });
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: URLSearchParams
+ }
+ });
+ Object.defineProperty(URLSearchParams, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"URLSearchParams\\"] = URLSearchParams;
+
+ Object.defineProperty(globalObject, \\"URLSearchParams\\", {
+ configurable: true,
+ writable: true,
+ value: URLSearchParams
+ });
}
}; // iface
module.exports = iface;
@@ -4753,6 +5565,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class URLSearchParamsCollection {
constructor() {
@@ -4860,14 +5673,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(URLSearchParamsCollection.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor URLSearchParamsCollection is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(URLSearchParamsCollection.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -5077,6 +5898,38 @@ const iface = {
interface: URLSearchParamsCollection,
expose: {
Window: { URLSearchParamsCollection }
+ },
+
+ install(globalObject) {
+ const URLSearchParamsCollection = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: URLSearchParamsCollection
+ }
+ });
+ Object.defineProperty(URLSearchParamsCollection, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"] = URLSearchParamsCollection;
+
+ Object.defineProperty(globalObject, \\"URLSearchParamsCollection\\", {
+ configurable: true,
+ writable: true,
+ value: URLSearchParamsCollection
+ });
}
}; // iface
module.exports = iface;
@@ -5093,6 +5946,7 @@ const utils = require(\\"./utils.js\\");
const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\");
class URLSearchParamsCollection2 extends URLSearchParamsCollection.interface {
@@ -5144,14 +5998,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(URLSearchParamsCollection2.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor URLSearchParamsCollection2 is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(URLSearchParamsCollection2.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
@@ -5392,6 +6254,44 @@ const iface = {
interface: URLSearchParamsCollection2,
expose: {
Window: { URLSearchParamsCollection2 }
+ },
+
+ install(globalObject) {
+ const URLSearchParamsCollection2 = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ if (globalObject.URLSearchParamsCollection === undefined) {
+ throw new Error(
+ \\"Evaluation order error. Attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\"
+ );
+ }
+
+ const proto = Object.create(globalObject.URLSearchParamsCollection.prototype);
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: URLSearchParamsCollection2
+ }
+ });
+ Object.defineProperty(URLSearchParamsCollection2, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"] = URLSearchParamsCollection2;
+
+ Object.defineProperty(globalObject, \\"URLSearchParamsCollection2\\", {
+ configurable: true,
+ writable: true,
+ value: URLSearchParamsCollection2
+ });
}
}; // iface
module.exports = iface;
@@ -5407,6 +6307,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class UnderscoredProperties {
constructor() {
@@ -5538,14 +6439,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(UnderscoredProperties.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"UnderscoredProperties\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor UnderscoredProperties is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(UnderscoredProperties.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -5569,6 +6478,43 @@ const iface = {
interface: UnderscoredProperties,
expose: {
Window: { UnderscoredProperties }
+ },
+
+ install(globalObject) {
+ const UnderscoredProperties = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ Object.defineProperties(UnderscoredProperties, {
+ const: Object.getOwnPropertyDescriptor(iface.interface, \\"const\\"),
+ static: Object.getOwnPropertyDescriptor(iface.interface, \\"static\\")
+ });
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: UnderscoredProperties
+ }
+ });
+ Object.defineProperty(UnderscoredProperties, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"UnderscoredProperties\\"] = UnderscoredProperties;
+
+ Object.defineProperty(globalObject, \\"UnderscoredProperties\\", {
+ configurable: true,
+ writable: true,
+ value: UnderscoredProperties
+ });
}
}; // iface
module.exports = iface;
@@ -5584,6 +6530,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Unforgeable {
constructor() {
@@ -5631,14 +6578,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Unforgeable'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Unforgeable.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Unforgeable\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Unforgeable is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Unforgeable.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
@@ -5747,6 +6702,38 @@ const iface = {
interface: Unforgeable,
expose: {
Window: { Unforgeable }
+ },
+
+ install(globalObject) {
+ const Unforgeable = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Unforgeable
+ }
+ });
+ Object.defineProperty(Unforgeable, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Unforgeable\\"] = Unforgeable;
+
+ Object.defineProperty(globalObject, \\"Unforgeable\\", {
+ configurable: true,
+ writable: true,
+ value: Unforgeable
+ });
}
}; // iface
module.exports = iface;
@@ -5762,6 +6749,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class UnforgeableMap {
constructor() {
@@ -5811,14 +6799,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'UnforgeableMap'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(UnforgeableMap.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"UnforgeableMap\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor UnforgeableMap is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(UnforgeableMap.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {
@@ -6032,6 +7028,38 @@ const iface = {
interface: UnforgeableMap,
expose: {
Window: { UnforgeableMap }
+ },
+
+ install(globalObject) {
+ const UnforgeableMap = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: UnforgeableMap
+ }
+ });
+ Object.defineProperty(UnforgeableMap, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"UnforgeableMap\\"] = UnforgeableMap;
+
+ Object.defineProperty(globalObject, \\"UnforgeableMap\\", {
+ configurable: true,
+ writable: true,
+ value: UnforgeableMap
+ });
}
}; // iface
module.exports = iface;
@@ -6047,6 +7075,7 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Unscopable {
constructor() {
@@ -6139,14 +7168,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Unscopable'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Unscopable.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Unscopable\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Unscopable is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Unscopable.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -6170,6 +7207,38 @@ const iface = {
interface: Unscopable,
expose: {
Window: { Unscopable }
+ },
+
+ install(globalObject) {
+ const Unscopable = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Unscopable
+ }
+ });
+ Object.defineProperty(Unscopable, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Unscopable\\"] = Unscopable;
+
+ Object.defineProperty(globalObject, \\"Unscopable\\", {
+ configurable: true,
+ writable: true,
+ value: Unscopable
+ });
}
}; // iface
module.exports = iface;
@@ -6186,6 +7255,7 @@ const utils = require(\\"./utils.js\\");
const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class Variadic {
constructor() {
@@ -6382,14 +7452,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'Variadic'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(Variadic.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"Variadic\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor Variadic is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(Variadic.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -6413,6 +7491,38 @@ const iface = {
interface: Variadic,
expose: {
Window: { Variadic }
+ },
+
+ install(globalObject) {
+ const Variadic = function() {
+ throw new TypeError(\\"Illegal constructor\\");
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: Variadic
+ }
+ });
+ Object.defineProperty(Variadic, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"Variadic\\"] = Variadic;
+
+ Object.defineProperty(globalObject, \\"Variadic\\", {
+ configurable: true,
+ writable: true,
+ value: Variadic
+ });
}
}; // iface
module.exports = iface;
@@ -6428,10 +7538,11 @@ const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
class ZeroArgConstructor {
constructor() {
- return iface.setup(Object.create(new.target.prototype));
+ return iface.setup(Object.create(new.target.prototype), undefined, undefined);
}
}
Object.defineProperties(ZeroArgConstructor.prototype, {
@@ -6477,14 +7588,22 @@ const iface = {
throw new TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`);
},
- create(constructorArgs, privateData) {
- let obj = Object.create(ZeroArgConstructor.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new TypeError(\\"Invalid global object\\");
+ }
+
+ const ctor = globalObject[ctorRegistry][\\"ZeroArgConstructor\\"];
+ if (ctor === undefined) {
+ throw new TypeError(\\"Constructor ZeroArgConstructor is not installed on the passed global object\\");
+ }
+
+ let obj = Object.create(ctor.prototype);
+ obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
return obj;
},
- createImpl(constructorArgs, privateData) {
- let obj = Object.create(ZeroArgConstructor.prototype);
- obj = this.setup(obj, constructorArgs, privateData);
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
@@ -6508,6 +7627,38 @@ const iface = {
interface: ZeroArgConstructor,
expose: {
Window: { ZeroArgConstructor }
+ },
+
+ install(globalObject) {
+ const ZeroArgConstructor = function() {
+ return iface.setup(Object.create(new.target.prototype), undefined, { globalObject });
+ };
+
+ const proto = {};
+
+ Object.defineProperties(proto, {
+ ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ constructor: {
+ writable: true,
+ configurable: true,
+ value: ZeroArgConstructor
+ }
+ });
+ Object.defineProperty(ZeroArgConstructor, \\"prototype\\", {
+ writable: false,
+ value: proto
+ });
+
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = {};
+ }
+ globalObject[ctorRegistry][\\"ZeroArgConstructor\\"] = ZeroArgConstructor;
+
+ Object.defineProperty(globalObject, \\"ZeroArgConstructor\\", {
+ configurable: true,
+ writable: true,
+ value: ZeroArgConstructor
+ });
}
}; // iface
module.exports = iface;
diff --git a/test/cases/Factory.webidl b/test/cases/Factory.webidl
deleted file mode 100644
index 3fae11b5..00000000
--- a/test/cases/Factory.webidl
+++ /dev/null
@@ -1,6 +0,0 @@
-[WebIDL2JSFactory,Exposed=Window]
-interface Factory {
- DOMString method();
- attribute double _attribute;
- const unsigned short constant = 42;
-};
From 904ff14cf465f842f662cc45f60454782f0df997 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Mon, 21 Oct 2019 07:30:51 +0200
Subject: [PATCH 2/8] reflect proposed APIs and feedback
---
README.md | 49 +-
lib/constructs/interface.js | 69 +--
test/__snapshots__/test.js.snap | 818 +++++++++-----------------------
3 files changed, 247 insertions(+), 689 deletions(-)
diff --git a/README.md b/README.md
index dbb74eeb..1f466c2e 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@ will generate a JavaScript wrapper class file roughly like this:
```js
const conversions = require("webidl-conversions");
const impl = require("./utils.js").implSymbol;
+const ctorRegistry = require("./utils.js").ctorRegistrySymbol;
const Impl = require("./SomeInterface-impl.js").implementation;
@@ -64,10 +65,9 @@ Object.defineProperties(SomeInterface.prototype, {
[Symbol.toStringTag]: { value: "SomeInterface", configurable: true }
});
-exports.interface = SomeInterface;
-
-exports.create = (constructorArgs = [], privateData = {}) => {
- const obj = Object.create(SomeInterface.prototype);
+exports.create = (globalObject, constructorArgs = [], privateData = {}) => {
+ const ctor = globalObject[ctorRegistry].SomeInterface;
+ const obj = Object.create(ctor.prototype);
obj[impl] = new Impl(constructorArgs, privateData);
return obj;
};
@@ -151,46 +151,28 @@ Performs the Web IDL conversion algorithm for this interface, converting _value_
In practice, this means doing a type-check equivalent to `is(value)`, and if it passes, returns the corresponding impl. If the type-check fails, it throws an informative exception. _context_ can be used to describe the provided value in any resulting error message.
-#### `create(constructorArgs, privateData)`
+#### `install(globalObject)`
+
+This method creates a brand new wrapper constructor and prototype and attach it to the passed `globalObject`. It also attaches the created constructor on the passed `globalObject` for it to be reused when creating new wrapper instances on the same `globalObject`. It is important to invoke `install` before invoking `create`, `createImpl` or `setup` otherwise they will throw.
+
+#### `create(globalObject, constructorArgs, privateData)`
-Creates a new instance of the wrapper class and corresponding implementation class, passing in the `constructorArgs` array and `privateData` object to the implementation class constructor. Then returns the wrapper class.
+Creates a new instance of the wrapper class and corresponding implementation class, passing in the `globalObject`, the `constructorArgs` array and `privateData` object to the implementation class constructor. Then returns the wrapper class.
This is useful in other parts of your program that are not implementation class files, but instead want to interface with them from the outside. It's also mostly useful when creating instances of classes that do not have a `[Constructor]`, i.e. are not constructible via their wrapper class constructor.
-#### `createImpl(constructorArgs, privateData)`
+#### `createImpl(globalObject, constructorArgs, privateData)`
-Creates a new instance of the wrapper class and corresponding implementation class, passing in the `constructorArgs` array and `privateData` object to the implementation class constructor. Then returns the implementation class.
+Creates a new instance of the wrapper class and corresponding implementation class, passing in the `globalObject`, the `constructorArgs` array and `privateData` object to the implementation class constructor. Then returns the implementation class.
This is useful inside implementation class files, where it is easiest to only deal with impls, not wrappers.
-#### `setup(obj, constructorArgs, privateData)`
+#### `setup(obj, globalObject, constructorArgs, privateData)`
-This function is mostly used internally, and almost never should be called by your code. The one exception is if you need to inherit from a wrapper class corresponding to an interface without a `[Constructor]`, from a non-webidl2js-generated class. Then, you can call `SuperClass.setup(this, [], privateData)` as a substitute for doing `super()` (which would throw).
+This function is mostly used internally, and almost never should be called by your code. The one exception is if you need to inherit from a wrapper class corresponding to an interface without a `[Constructor]`, from a non-webidl2js-generated class. Then, you can call `SuperClass.setup(this, globalObject, [], privateData)` as a substitute for doing `super()` (which would throw).
jsdom does this for `Window`, which is written in custom, non-webidl2js-generated code, but inherits from `EventTarget`, which is generated by webidl2js.
-#### `interface`
-
-This export is the wrapper class interface, suitable for example for putting on a global scope or exporting to module consumers who don't know anything about webidl2js.
-
-#### `expose`
-
-This export contains information about where an interface is supposed to be exposed as a property. It takes into account the Web IDL extended attribute `[Exposed]` to generate a data structure of the form:
-
-```js
-{
- nameOfGlobal1: {
- nameOfInterface: InterfaceClass
- },
- nameOfGlobal2: {
- nameOfInterface: InterfaceClass
- },
- // etc.
-}
-```
-
-This format may seem a bit verbose, but eventually when we support `[NamedConstructor]`, there will be potentially more than one key/value pair per global, and it will show its worth.
-
### For dictionaries
#### `convert(value, { context })`
@@ -207,9 +189,10 @@ Implementation class files contain a single export, `implementation`, whose valu
### The constructor
-A constructor for your implementation class, with signature `(constructorArgs, privateData)` can serve several purposes:
+A constructor for your implementation class, with signature `(globalObject, constructorArgs, privateData)` can serve several purposes:
- Setting up initial state that will always be used, such as caches or default values
+- Keep a reference to the relevant `globalObject` for later consumption.
- Processing constructor arguments `constructorArgs` passed to the wrapper class constructor, if the interface in question has a `[Constructor]` extended attribute.
- Processing any private data `privateData` which is provided when other parts of your program use the generated `create()` or `createImpl()` exports of the wrapper class file. This is useful for constructing instances with specific state that cannot be constructed via the wrapper class constructor.
diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js
index 1f28e750..bc937b2f 100644
--- a/lib/constructs/interface.js
+++ b/lib/constructs/interface.js
@@ -66,6 +66,8 @@ class Interface {
this.ctx = ctx;
this.idl = idl;
this.name = idl.name;
+ this.sharedConstructorName = `Shared${this.name}`;
+
for (const member of this.idl.members) {
member.definingInterface = this.name;
}
@@ -1093,44 +1095,19 @@ class Interface {
}
generateIface() {
- const exposedAttrs = this.idl.extAttrs
- .filter(attr => attr.name === "Exposed");
- if (exposedAttrs.length === 0) {
- throw new Error(`Missing [Exposed] extended attribute on ${this.name}`);
- }
- if (exposedAttrs.length > 1) {
- throw new Error(`Too many [Exposed] extended attributes on ${this.name}`);
- }
-
- const rhs = exposedAttrs[0].rhs.value;
- const exposedOn = typeof rhs === "string" ? [rhs] : rhs.map(arg => arg.value);
-
- const exposedMap = {};
- for (let i = 0; i < exposedOn.length; ++i) {
- if (!exposedMap[exposedOn[i]]) {
- exposedMap[exposedOn[i]] = [];
- }
- exposedMap[exposedOn[i]].push(this.name);
- }
-
- const exposers = [];
- for (let keys = Object.keys(exposedMap), i = 0; i < keys.length; ++i) {
- exposers.push(keys[i] + ": { " + exposedMap[keys[i]].join(", ") + " }");
- }
-
this.str += `
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError('Invalid global object');
+ throw new Error('Internal error: invalid global object');
}
const ctor = globalObject[ctorRegistry]["${this.name}"];
if (ctor === undefined) {
- throw new TypeError('Constructor ${this.name} is not installed on the passed global object');
+ throw new Error('Internal error: constructor ${this.name} is not installed on the passed global object');
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1150,16 +1127,12 @@ class Interface {
this.str += `
},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
- `;
-
- this.str += `
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
`;
@@ -1175,14 +1148,10 @@ class Interface {
}
return obj;
},
- interface: ${this.name},
- expose: {
- ${exposers.join(",\n ")}
- },
`;
}
- getConstructor(privateData) {
+ getConstructor() {
const overloads = Overloads.getEffectiveOverloads("constructor", this.name, 0, this);
let body;
@@ -1203,8 +1172,8 @@ class Interface {
const setupArgs = [
"Object.create(new.target.prototype)",
- conversions.hasArgs ? "args" : "undefined",
- privateData ? privateData : "undefined"
+ "globalObject",
+ conversions.hasArgs ? "args" : "undefined"
];
body = `
@@ -1220,11 +1189,6 @@ class Interface {
return { body, argNames };
}
- addConstructor() {
- const { body, argNames } = this.getConstructor();
- this.addMethod("prototype", "constructor", argNames, body, "regular", { enumerable: false });
- }
-
get defaultWhence() {
return this.isGlobal ? "instance" : "prototype";
}
@@ -1239,8 +1203,6 @@ class Interface {
}
addAllMethodsProperties() {
- this.addConstructor();
-
this.addProperty("prototype", Symbol.toStringTag, JSON.stringify(this.name), {
writable: false
});
@@ -1445,13 +1407,13 @@ class Interface {
}
generateInstall() {
- const { idl, name } = this;
+ const { idl, name, sharedConstructorName } = this;
this.str += `
install(globalObject) {
`;
- const ctor = this.getConstructor("{ globalObject }");
+ const ctor = this.getConstructor();
this.str += `
const ${name} = function(${formatArgs(ctor.argNames)}) {
${ctor.body}
@@ -1474,7 +1436,7 @@ class Interface {
propertyKey.replace("[", "").replace("]", "") :
`"${propertyKey}"`;
- this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(iface.interface, ${propertyValue}),\n`;
+ this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(${sharedConstructorName}, ${propertyValue}),\n`;
}
this.str += `
@@ -1502,7 +1464,7 @@ class Interface {
// newly created constructor.
this.str += `
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(${sharedConstructorName}.prototype),
constructor: {
writable: true,
configurable: true,
@@ -1535,8 +1497,7 @@ class Interface {
generate() {
this.generateIterator();
- const ext = this.idl.inheritance ? ` extends ${this.idl.inheritance}.interface` : "";
- this.str += `class ${this.name}${ext} {`;
+ this.str += `class ${this.sharedConstructorName} {`;
this.generateOffInstanceMethods();
diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap
index 415f6b56..c8b46fa3 100644
--- a/test/__snapshots__/test.js.snap
+++ b/test/__snapshots__/test.js.snap
@@ -9,11 +9,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class DOMImplementation {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedDOMImplementation {
createDocumentType(qualifiedName, publicId, systemId) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -173,16 +169,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"DOMImplementation\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor DOMImplementation is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor DOMImplementation is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -190,14 +186,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -207,10 +201,6 @@ const iface = {
}
return obj;
},
- interface: DOMImplementation,
- expose: {
- Window: { DOMImplementation }
- },
install(globalObject) {
const DOMImplementation = function() {
@@ -220,7 +210,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedDOMImplementation.prototype),
constructor: {
writable: true,
configurable: true,
@@ -340,11 +330,7 @@ const convertDictionary = require(\\"./Dictionary.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class DictionaryConvert {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedDictionaryConvert {
op() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -413,16 +399,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"DictionaryConvert\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor DictionaryConvert is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor DictionaryConvert is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -430,14 +416,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -447,10 +431,6 @@ const iface = {
}
return obj;
},
- interface: DictionaryConvert,
- expose: {
- Window: { DictionaryConvert }
- },
install(globalObject) {
const DictionaryConvert = function() {
@@ -460,7 +440,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedDictionaryConvert.prototype),
constructor: {
writable: true,
configurable: true,
@@ -501,11 +481,7 @@ const RequestDestination = require(\\"./RequestDestination.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Enum {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedEnum {
op(destination) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -593,16 +569,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Enum\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Enum is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Enum is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -610,14 +586,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -627,10 +601,6 @@ const iface = {
}
return obj;
},
- interface: Enum,
- expose: {
- Window: { Enum }
- },
install(globalObject) {
const Enum = function() {
@@ -640,7 +610,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedEnum.prototype),
constructor: {
writable: true,
configurable: true,
@@ -679,11 +649,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Global {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-}
+class SharedGlobal {}
Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
@@ -727,16 +693,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Global\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Global is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Global is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -829,14 +795,12 @@ const iface = {
[Symbol.iterator]: { enumerable: false }
});
},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -846,10 +810,6 @@ const iface = {
}
return obj;
},
- interface: Global,
- expose: {
- Window: { Global }
- },
install(globalObject) {
const Global = function() {
@@ -859,7 +819,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedGlobal.prototype),
constructor: {
writable: true,
configurable: true,
@@ -898,11 +858,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class LegacyArrayClass {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedLegacyArrayClass {
get length() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -958,16 +914,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"LegacyArrayClass\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor LegacyArrayClass is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor LegacyArrayClass is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -975,14 +931,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -992,10 +946,6 @@ const iface = {
}
return obj;
},
- interface: LegacyArrayClass,
- expose: {
- Window: { LegacyArrayClass }
- },
install(globalObject) {
const LegacyArrayClass = function() {
@@ -1005,7 +955,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedLegacyArrayClass.prototype),
constructor: {
writable: true,
configurable: true,
@@ -1044,11 +994,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class MixedIn {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedMixedIn {
mixedInOp() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -1160,16 +1106,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"MixedIn\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor MixedIn is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor MixedIn is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1177,14 +1123,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -1194,10 +1138,6 @@ const iface = {
}
return obj;
},
- interface: MixedIn,
- expose: {
- Window: { MixedIn }
- },
install(globalObject) {
const MixedIn = function() {
@@ -1205,14 +1145,14 @@ const iface = {
};
Object.defineProperties(MixedIn, {
- mixedInConst: Object.getOwnPropertyDescriptor(iface.interface, \\"mixedInConst\\"),
- ifaceMixinConst: Object.getOwnPropertyDescriptor(iface.interface, \\"ifaceMixinConst\\")
+ mixedInConst: Object.getOwnPropertyDescriptor(SharedMixedIn, \\"mixedInConst\\"),
+ ifaceMixinConst: Object.getOwnPropertyDescriptor(SharedMixedIn, \\"ifaceMixinConst\\")
});
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedMixedIn.prototype),
constructor: {
writable: true,
configurable: true,
@@ -1248,37 +1188,12 @@ exports[`Overloads.webidl 1`] = `
const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
-const isURL = require(\\"./URL.js\\").is;
const convertURL = require(\\"./URL.js\\").convert;
+const isURL = require(\\"./URL.js\\").is;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Overloads {
- constructor() {
- const args = [];
- switch (arguments.length) {
- case 0:
- break;
- default: {
- let curArg = arguments[0];
- if (isURL(curArg)) {
- {
- let curArg = arguments[0];
- curArg = convertURL(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\\" });
- args.push(curArg);
- }
- }
- }
- }
- return iface.setup(Object.create(new.target.prototype), args, undefined);
- }
-
+class SharedOverloads {
compatible(arg1) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -1610,16 +1525,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Overloads\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Overloads is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Overloads is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1627,14 +1542,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -1644,10 +1557,6 @@ const iface = {
}
return obj;
},
- interface: Overloads,
- expose: {
- Window: { Overloads }
- },
install(globalObject) {
const Overloads = function() {
@@ -1672,13 +1581,13 @@ const iface = {
}
}
}
- return iface.setup(Object.create(new.target.prototype), args, { globalObject });
+ return iface.setup(Object.create(new.target.prototype), globalObject, args);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedOverloads.prototype),
constructor: {
writable: true,
configurable: true,
@@ -1717,11 +1626,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class PromiseTypes {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedPromiseTypes {
voidPromiseConsumer(p) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -1820,16 +1725,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"PromiseTypes\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor PromiseTypes is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor PromiseTypes is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1837,14 +1742,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -1854,10 +1757,6 @@ const iface = {
}
return obj;
},
- interface: PromiseTypes,
- expose: {
- Window: { PromiseTypes }
- },
install(globalObject) {
const PromiseTypes = function() {
@@ -1867,7 +1766,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedPromiseTypes.prototype),
constructor: {
writable: true,
configurable: true,
@@ -1906,11 +1805,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Reflect {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedReflect {
get ReflectedBoolean() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2091,16 +1986,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Reflect\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Reflect is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Reflect is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2108,14 +2003,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -2125,10 +2018,6 @@ const iface = {
}
return obj;
},
- interface: Reflect,
- expose: {
- Window: { Reflect }
- },
install(globalObject) {
const Reflect = function() {
@@ -2138,7 +2027,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedReflect.prototype),
constructor: {
writable: true,
configurable: true,
@@ -2212,11 +2101,7 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SeqAndRec {
- constructor() {
- return iface.setup(Object.create(new.target.prototype), undefined, undefined);
- }
-
+class SharedSeqAndRec {
recordConsumer(rec) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2462,16 +2347,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"SeqAndRec\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor SeqAndRec is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2479,14 +2364,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -2496,20 +2379,16 @@ const iface = {
}
return obj;
},
- interface: SeqAndRec,
- expose: {
- Window: { SeqAndRec }
- },
install(globalObject) {
const SeqAndRec = function() {
- return iface.setup(Object.create(new.target.prototype), undefined, { globalObject });
+ return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedSeqAndRec.prototype),
constructor: {
writable: true,
configurable: true,
@@ -2548,11 +2427,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Static {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedStatic {
def() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2639,16 +2514,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Static\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Static is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2656,14 +2531,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -2673,10 +2546,6 @@ const iface = {
}
return obj;
},
- interface: Static,
- expose: {
- Window: { Static }
- },
install(globalObject) {
const Static = function() {
@@ -2684,14 +2553,14 @@ const iface = {
};
Object.defineProperties(Static, {
- def: Object.getOwnPropertyDescriptor(iface.interface, \\"def\\"),
- abc: Object.getOwnPropertyDescriptor(iface.interface, \\"abc\\")
+ def: Object.getOwnPropertyDescriptor(SharedStatic, \\"def\\"),
+ abc: Object.getOwnPropertyDescriptor(SharedStatic, \\"abc\\")
});
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedStatic.prototype),
constructor: {
writable: true,
configurable: true,
@@ -2730,11 +2599,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Storage {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedStorage {
key(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2885,16 +2750,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Storage\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Storage is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Storage is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2902,14 +2767,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -3083,10 +2946,6 @@ const iface = {
}
return obj;
},
- interface: Storage,
- expose: {
- Window: { Storage }
- },
install(globalObject) {
const Storage = function() {
@@ -3096,7 +2955,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedStorage.prototype),
constructor: {
writable: true,
configurable: true,
@@ -3135,11 +2994,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierAttribute {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedStringifierAttribute {
get attr() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3202,16 +3057,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"StringifierAttribute\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor StringifierAttribute is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor StringifierAttribute is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3219,14 +3074,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -3236,10 +3089,6 @@ const iface = {
}
return obj;
},
- interface: StringifierAttribute,
- expose: {
- Window: { StringifierAttribute }
- },
install(globalObject) {
const StringifierAttribute = function() {
@@ -3249,7 +3098,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedStringifierAttribute.prototype),
constructor: {
writable: true,
configurable: true,
@@ -3288,11 +3137,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierDefaultOperation {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedStringifierDefaultOperation {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3347,16 +3192,18 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor StringifierDefaultOperation is not installed on the passed global object\\");
+ throw new Error(
+ \\"Internal error: constructor StringifierDefaultOperation is not installed on the passed global object\\"
+ );
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3364,14 +3211,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -3381,10 +3226,6 @@ const iface = {
}
return obj;
},
- interface: StringifierDefaultOperation,
- expose: {
- Window: { StringifierDefaultOperation }
- },
install(globalObject) {
const StringifierDefaultOperation = function() {
@@ -3394,7 +3235,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedStringifierDefaultOperation.prototype),
constructor: {
writable: true,
configurable: true,
@@ -3433,11 +3274,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierNamedOperation {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedStringifierNamedOperation {
operation() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3501,16 +3338,18 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"StringifierNamedOperation\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor StringifierNamedOperation is not installed on the passed global object\\");
+ throw new Error(
+ \\"Internal error: constructor StringifierNamedOperation is not installed on the passed global object\\"
+ );
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3518,14 +3357,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -3535,10 +3372,6 @@ const iface = {
}
return obj;
},
- interface: StringifierNamedOperation,
- expose: {
- Window: { StringifierNamedOperation }
- },
install(globalObject) {
const StringifierNamedOperation = function() {
@@ -3548,7 +3381,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedStringifierNamedOperation.prototype),
constructor: {
writable: true,
configurable: true,
@@ -3587,11 +3420,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierOperation {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedStringifierOperation {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3646,16 +3475,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"StringifierOperation\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor StringifierOperation is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor StringifierOperation is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3663,14 +3492,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -3680,10 +3507,6 @@ const iface = {
}
return obj;
},
- interface: StringifierOperation,
- expose: {
- Window: { StringifierOperation }
- },
install(globalObject) {
const StringifierOperation = function() {
@@ -3693,7 +3516,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedStringifierOperation.prototype),
constructor: {
writable: true,
configurable: true,
@@ -3735,11 +3558,7 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class TypedefsAndUnions {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedTypedefsAndUnions {
numOrStrConsumer(a) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -4195,16 +4014,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"TypedefsAndUnions\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor TypedefsAndUnions is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -4212,14 +4031,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -4229,10 +4046,6 @@ const iface = {
}
return obj;
},
- interface: TypedefsAndUnions,
- expose: {
- Window: { TypedefsAndUnions }
- },
install(globalObject) {
const TypedefsAndUnions = function() {
@@ -4242,7 +4055,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedTypedefsAndUnions.prototype),
constructor: {
writable: true,
configurable: true,
@@ -4281,27 +4094,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class URL {
- constructor(url) {
- if (arguments.length < 1) {
- throw new 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\\" });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- if (curArg !== undefined) {
- curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" });
- }
- args.push(curArg);
- }
- return iface.setup(Object.create(new.target.prototype), args, undefined);
- }
-
+class SharedURL {
toJSON() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -4574,16 +4367,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"URL\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor URL is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor URL is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -4591,14 +4384,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -4608,11 +4399,6 @@ const iface = {
}
return obj;
},
- interface: URL,
- expose: {
- Window: { URL },
- Worker: { URL }
- },
install(globalObject) {
const URL = function(url) {
@@ -4634,13 +4420,13 @@ const iface = {
}
args.push(curArg);
}
- return iface.setup(Object.create(new.target.prototype), args, { globalObject });
+ return iface.setup(Object.create(new.target.prototype), globalObject, args);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedURL.prototype),
constructor: {
writable: true,
configurable: true,
@@ -4679,11 +4465,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class URLList {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedURLList {
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -4763,16 +4545,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"URLList\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor URLList is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor URLList is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -4780,14 +4562,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -4957,10 +4737,6 @@ const iface = {
}
return obj;
},
- interface: URLList,
- expose: {
- Window: { URLList }
- },
install(globalObject) {
const URLList = function() {
@@ -4970,7 +4746,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedURLList.prototype),
constructor: {
writable: true,
configurable: true,
@@ -5047,86 +4823,7 @@ const IteratorPrototype = Object.create(utils.IteratorPrototype, {
configurable: true
}
});
-class URLSearchParams {
- constructor() {
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg !== undefined) {
- if (utils.isObject(curArg)) {
- if (curArg[Symbol.iterator] !== undefined) {
- if (!utils.isObject(curArg)) {
- throw new TypeError(
- \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = curArg;
- for (let nextItem of tmp) {
- if (!utils.isObject(nextItem)) {
- throw new TypeError(
- \\"Failed to construct 'URLSearchParams': parameter 1\\" +
- \\" sequence\\" +
- \\"'s element\\" +
- \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = nextItem;
- for (let nextItem of tmp) {
- nextItem = conversions[\\"USVString\\"](nextItem, {
- context:
- \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\"'s element\\" + \\"'s element\\"
- });
-
- V.push(nextItem);
- }
- nextItem = V;
- }
-
- V.push(nextItem);
- }
- curArg = V;
- }
- } else {
- if (!utils.isObject(curArg)) {
- throw new TypeError(
- \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\" is not an object.\\"
- );
- } else {
- const result = Object.create(null);
- for (const key of Reflect.ownKeys(curArg)) {
- const desc = Object.getOwnPropertyDescriptor(curArg, key);
- if (desc && desc.enumerable) {
- let typedKey = key;
-
- typedKey = conversions[\\"USVString\\"](typedKey, {
- context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\"
- });
-
- let typedValue = curArg[key];
-
- typedValue = conversions[\\"USVString\\"](typedValue, {
- context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\"
- });
-
- result[typedKey] = typedValue;
- }
- }
- curArg = result;
- }
- }
- } else {
- curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URLSearchParams': parameter 1\\" });
- }
- } else {
- curArg = \\"\\";
- }
- args.push(curArg);
- }
- return iface.setup(Object.create(new.target.prototype), args, undefined);
- }
-
+class SharedURLSearchParams {
append(name, value) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -5400,16 +5097,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"URLSearchParams\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor URLSearchParams is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor URLSearchParams is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -5417,14 +5114,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -5434,11 +5129,6 @@ const iface = {
}
return obj;
},
- interface: URLSearchParams,
- expose: {
- Window: { URLSearchParams },
- Worker: { URLSearchParams }
- },
install(globalObject) {
const URLSearchParams = function() {
@@ -5522,13 +5212,13 @@ const iface = {
}
args.push(curArg);
}
- return iface.setup(Object.create(new.target.prototype), args, { globalObject });
+ return iface.setup(Object.create(new.target.prototype), globalObject, args);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedURLSearchParams.prototype),
constructor: {
writable: true,
configurable: true,
@@ -5567,11 +5257,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class URLSearchParamsCollection {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedURLSearchParamsCollection {
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -5675,16 +5361,18 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor URLSearchParamsCollection is not installed on the passed global object\\");
+ throw new Error(
+ \\"Internal error: constructor URLSearchParamsCollection is not installed on the passed global object\\"
+ );
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -5692,14 +5380,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -5895,10 +5581,6 @@ const iface = {
}
return obj;
},
- interface: URLSearchParamsCollection,
- expose: {
- Window: { URLSearchParamsCollection }
- },
install(globalObject) {
const URLSearchParamsCollection = function() {
@@ -5908,7 +5590,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedURLSearchParamsCollection.prototype),
constructor: {
writable: true,
configurable: true,
@@ -5949,11 +5631,7 @@ const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\");
-class URLSearchParamsCollection2 extends URLSearchParamsCollection.interface {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-}
+class SharedURLSearchParamsCollection2 {}
Object.defineProperties(URLSearchParamsCollection2.prototype, {
[Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
@@ -6000,16 +5678,18 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor URLSearchParamsCollection2 is not installed on the passed global object\\");
+ throw new Error(
+ \\"Internal error: constructor URLSearchParamsCollection2 is not installed on the passed global object\\"
+ );
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6019,14 +5699,12 @@ const iface = {
_internalSetup(obj) {
URLSearchParamsCollection._internalSetup(obj);
},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -6251,10 +5929,6 @@ const iface = {
}
return obj;
},
- interface: URLSearchParamsCollection2,
- expose: {
- Window: { URLSearchParamsCollection2 }
- },
install(globalObject) {
const URLSearchParamsCollection2 = function() {
@@ -6270,7 +5944,7 @@ const iface = {
const proto = Object.create(globalObject.URLSearchParamsCollection.prototype);
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedURLSearchParamsCollection2.prototype),
constructor: {
writable: true,
configurable: true,
@@ -6309,11 +5983,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class UnderscoredProperties {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedUnderscoredProperties {
operation(sequence) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -6441,16 +6111,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"UnderscoredProperties\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor UnderscoredProperties is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor UnderscoredProperties is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6458,14 +6128,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -6475,10 +6143,6 @@ const iface = {
}
return obj;
},
- interface: UnderscoredProperties,
- expose: {
- Window: { UnderscoredProperties }
- },
install(globalObject) {
const UnderscoredProperties = function() {
@@ -6486,14 +6150,14 @@ const iface = {
};
Object.defineProperties(UnderscoredProperties, {
- const: Object.getOwnPropertyDescriptor(iface.interface, \\"const\\"),
- static: Object.getOwnPropertyDescriptor(iface.interface, \\"static\\")
+ const: Object.getOwnPropertyDescriptor(SharedUnderscoredProperties, \\"const\\"),
+ static: Object.getOwnPropertyDescriptor(SharedUnderscoredProperties, \\"static\\")
});
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedUnderscoredProperties.prototype),
constructor: {
writable: true,
configurable: true,
@@ -6532,11 +6196,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Unforgeable {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-}
+class SharedUnforgeable {}
Object.defineProperties(Unforgeable.prototype, { [Symbol.toStringTag]: { value: \\"Unforgeable\\", configurable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
@@ -6580,16 +6240,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Unforgeable\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Unforgeable is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Unforgeable is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6682,14 +6342,12 @@ const iface = {
protocol: { configurable: false }
});
},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -6699,10 +6357,6 @@ const iface = {
}
return obj;
},
- interface: Unforgeable,
- expose: {
- Window: { Unforgeable }
- },
install(globalObject) {
const Unforgeable = function() {
@@ -6712,7 +6366,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedUnforgeable.prototype),
constructor: {
writable: true,
configurable: true,
@@ -6751,11 +6405,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class UnforgeableMap {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-}
+class SharedUnforgeableMap {}
Object.defineProperties(UnforgeableMap.prototype, {
[Symbol.toStringTag]: { value: \\"UnforgeableMap\\", configurable: true }
});
@@ -6801,16 +6451,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"UnforgeableMap\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor UnforgeableMap is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor UnforgeableMap is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6833,14 +6483,12 @@ const iface = {
Object.defineProperties(obj, { a: { configurable: false } });
},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -7025,10 +6673,6 @@ const iface = {
}
return obj;
},
- interface: UnforgeableMap,
- expose: {
- Window: { UnforgeableMap }
- },
install(globalObject) {
const UnforgeableMap = function() {
@@ -7038,7 +6682,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedUnforgeableMap.prototype),
constructor: {
writable: true,
configurable: true,
@@ -7077,11 +6721,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Unscopable {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedUnscopable {
get unscopableTest() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -7170,16 +6810,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Unscopable\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Unscopable is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Unscopable is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -7187,14 +6827,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -7204,10 +6842,6 @@ const iface = {
}
return obj;
},
- interface: Unscopable,
- expose: {
- Window: { Unscopable }
- },
install(globalObject) {
const Unscopable = function() {
@@ -7217,7 +6851,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedUnscopable.prototype),
constructor: {
writable: true,
configurable: true,
@@ -7257,11 +6891,7 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Variadic {
- constructor() {
- throw new TypeError(\\"Illegal constructor\\");
- }
-
+class SharedVariadic {
simple1() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -7454,16 +7084,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"Variadic\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor Variadic is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor Variadic is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -7471,14 +7101,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -7488,10 +7116,6 @@ const iface = {
}
return obj;
},
- interface: Variadic,
- expose: {
- Window: { Variadic }
- },
install(globalObject) {
const Variadic = function() {
@@ -7501,7 +7125,7 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedVariadic.prototype),
constructor: {
writable: true,
configurable: true,
@@ -7540,11 +7164,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class ZeroArgConstructor {
- constructor() {
- return iface.setup(Object.create(new.target.prototype), undefined, undefined);
- }
-}
+class SharedZeroArgConstructor {}
Object.defineProperties(ZeroArgConstructor.prototype, {
[Symbol.toStringTag]: { value: \\"ZeroArgConstructor\\", configurable: true }
});
@@ -7590,16 +7210,16 @@ const iface = {
create(globalObject, constructorArgs, privateData) {
if (globalObject[ctorRegistry] === undefined) {
- throw new TypeError(\\"Invalid global object\\");
+ throw new Error(\\"Internal error: invalid global object\\");
}
const ctor = globalObject[ctorRegistry][\\"ZeroArgConstructor\\"];
if (ctor === undefined) {
- throw new TypeError(\\"Constructor ZeroArgConstructor is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor ZeroArgConstructor is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, constructorArgs, { ...privateData, globalObject });
+ obj = this.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -7607,14 +7227,12 @@ const iface = {
return utils.implForWrapper(obj);
},
_internalSetup(obj) {},
- setup(obj, constructorArgs, privateData) {
- if (!privateData) privateData = {};
-
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
this._internalSetup(obj);
Object.defineProperty(obj, impl, {
- value: new Impl.implementation(constructorArgs, privateData),
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
});
@@ -7624,20 +7242,16 @@ const iface = {
}
return obj;
},
- interface: ZeroArgConstructor,
- expose: {
- Window: { ZeroArgConstructor }
- },
install(globalObject) {
const ZeroArgConstructor = function() {
- return iface.setup(Object.create(new.target.prototype), undefined, { globalObject });
+ return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(iface.interface.prototype),
+ ...Object.getOwnPropertyDescriptors(SharedZeroArgConstructor.prototype),
constructor: {
writable: true,
configurable: true,
From 0220d3d2d8cad8f01cc67f1c93aeb45698165947 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Tue, 22 Oct 2019 08:52:23 +0200
Subject: [PATCH 3/8] update constructor name
---
lib/constructs/interface.js | 22 +-
test/__snapshots__/test.js.snap | 410 ++++++++++++++++----------------
2 files changed, 215 insertions(+), 217 deletions(-)
diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js
index bc937b2f..20e50499 100644
--- a/lib/constructs/interface.js
+++ b/lib/constructs/interface.js
@@ -66,8 +66,6 @@ class Interface {
this.ctx = ctx;
this.idl = idl;
this.name = idl.name;
- this.sharedConstructorName = `Shared${this.name}`;
-
for (const member of this.idl.members) {
member.definingInterface = this.name;
}
@@ -1407,7 +1405,7 @@ class Interface {
}
generateInstall() {
- const { idl, name, sharedConstructorName } = this;
+ const { idl, name } = this;
this.str += `
install(globalObject) {
@@ -1415,7 +1413,7 @@ class Interface {
const ctor = this.getConstructor();
this.str += `
- const ${name} = function(${formatArgs(ctor.argNames)}) {
+ const ctor = function ${name}(${formatArgs(ctor.argNames)}) {
${ctor.body}
};
`;
@@ -1426,7 +1424,7 @@ class Interface {
];
if (staticPropertyNames.length) {
this.str += `
- Object.defineProperties(${name}, {
+ Object.defineProperties(ctor, {
`;
for (const staticProperty of staticPropertyNames) {
@@ -1436,7 +1434,7 @@ class Interface {
propertyKey.replace("[", "").replace("]", "") :
`"${propertyKey}"`;
- this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(${sharedConstructorName}, ${propertyValue}),\n`;
+ this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(${name}, ${propertyValue}),\n`;
}
this.str += `
@@ -1464,14 +1462,14 @@ class Interface {
// newly created constructor.
this.str += `
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(${sharedConstructorName}.prototype),
+ ...Object.getOwnPropertyDescriptors(${name}.prototype),
constructor: {
writable: true,
configurable: true,
- value: ${name}
+ value: ctor
}
});
- Object.defineProperty(${name}, "prototype", {
+ Object.defineProperty(ctor, "prototype", {
writable: false,
value: proto
});
@@ -1483,12 +1481,12 @@ class Interface {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry]["${name}"] = ${name};
+ globalObject[ctorRegistry]["${name}"] = ctor;
Object.defineProperty(globalObject, "${name}", {
configurable: true,
writable: true,
- value: ${name}
+ value: ctor
});
},
`;
@@ -1497,7 +1495,7 @@ class Interface {
generate() {
this.generateIterator();
- this.str += `class ${this.sharedConstructorName} {`;
+ this.str += `class ${this.name} {`;
this.generateOffInstanceMethods();
diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap
index c8b46fa3..a9c2cbd8 100644
--- a/test/__snapshots__/test.js.snap
+++ b/test/__snapshots__/test.js.snap
@@ -9,7 +9,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedDOMImplementation {
+class DOMImplementation {
createDocumentType(qualifiedName, publicId, systemId) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -203,21 +203,21 @@ const iface = {
},
install(globalObject) {
- const DOMImplementation = function() {
+ const ctor = function DOMImplementation() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedDOMImplementation.prototype),
+ ...Object.getOwnPropertyDescriptors(DOMImplementation.prototype),
constructor: {
writable: true,
configurable: true,
- value: DOMImplementation
+ value: ctor
}
});
- Object.defineProperty(DOMImplementation, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -225,12 +225,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"DOMImplementation\\"] = DOMImplementation;
+ globalObject[ctorRegistry][\\"DOMImplementation\\"] = ctor;
Object.defineProperty(globalObject, \\"DOMImplementation\\", {
configurable: true,
writable: true,
- value: DOMImplementation
+ value: ctor
});
}
}; // iface
@@ -330,7 +330,7 @@ const convertDictionary = require(\\"./Dictionary.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedDictionaryConvert {
+class DictionaryConvert {
op() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -433,21 +433,21 @@ const iface = {
},
install(globalObject) {
- const DictionaryConvert = function() {
+ const ctor = function DictionaryConvert() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedDictionaryConvert.prototype),
+ ...Object.getOwnPropertyDescriptors(DictionaryConvert.prototype),
constructor: {
writable: true,
configurable: true,
- value: DictionaryConvert
+ value: ctor
}
});
- Object.defineProperty(DictionaryConvert, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -455,12 +455,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"DictionaryConvert\\"] = DictionaryConvert;
+ globalObject[ctorRegistry][\\"DictionaryConvert\\"] = ctor;
Object.defineProperty(globalObject, \\"DictionaryConvert\\", {
configurable: true,
writable: true,
- value: DictionaryConvert
+ value: ctor
});
}
}; // iface
@@ -481,7 +481,7 @@ const RequestDestination = require(\\"./RequestDestination.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedEnum {
+class Enum {
op(destination) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -603,21 +603,21 @@ const iface = {
},
install(globalObject) {
- const Enum = function() {
+ const ctor = function Enum() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedEnum.prototype),
+ ...Object.getOwnPropertyDescriptors(Enum.prototype),
constructor: {
writable: true,
configurable: true,
- value: Enum
+ value: ctor
}
});
- Object.defineProperty(Enum, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -625,12 +625,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Enum\\"] = Enum;
+ globalObject[ctorRegistry][\\"Enum\\"] = ctor;
Object.defineProperty(globalObject, \\"Enum\\", {
configurable: true,
writable: true,
- value: Enum
+ value: ctor
});
}
}; // iface
@@ -649,7 +649,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedGlobal {}
+class Global {}
Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
@@ -812,21 +812,21 @@ const iface = {
},
install(globalObject) {
- const Global = function() {
+ const ctor = function Global() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedGlobal.prototype),
+ ...Object.getOwnPropertyDescriptors(Global.prototype),
constructor: {
writable: true,
configurable: true,
- value: Global
+ value: ctor
}
});
- Object.defineProperty(Global, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -834,12 +834,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Global\\"] = Global;
+ globalObject[ctorRegistry][\\"Global\\"] = ctor;
Object.defineProperty(globalObject, \\"Global\\", {
configurable: true,
writable: true,
- value: Global
+ value: ctor
});
}
}; // iface
@@ -858,7 +858,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedLegacyArrayClass {
+class LegacyArrayClass {
get length() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -948,21 +948,21 @@ const iface = {
},
install(globalObject) {
- const LegacyArrayClass = function() {
+ const ctor = function LegacyArrayClass() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedLegacyArrayClass.prototype),
+ ...Object.getOwnPropertyDescriptors(LegacyArrayClass.prototype),
constructor: {
writable: true,
configurable: true,
- value: LegacyArrayClass
+ value: ctor
}
});
- Object.defineProperty(LegacyArrayClass, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -970,12 +970,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"LegacyArrayClass\\"] = LegacyArrayClass;
+ globalObject[ctorRegistry][\\"LegacyArrayClass\\"] = ctor;
Object.defineProperty(globalObject, \\"LegacyArrayClass\\", {
configurable: true,
writable: true,
- value: LegacyArrayClass
+ value: ctor
});
}
}; // iface
@@ -994,7 +994,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedMixedIn {
+class MixedIn {
mixedInOp() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -1140,26 +1140,26 @@ const iface = {
},
install(globalObject) {
- const MixedIn = function() {
+ const ctor = function MixedIn() {
throw new TypeError(\\"Illegal constructor\\");
};
- Object.defineProperties(MixedIn, {
- mixedInConst: Object.getOwnPropertyDescriptor(SharedMixedIn, \\"mixedInConst\\"),
- ifaceMixinConst: Object.getOwnPropertyDescriptor(SharedMixedIn, \\"ifaceMixinConst\\")
+ Object.defineProperties(ctor, {
+ mixedInConst: Object.getOwnPropertyDescriptor(MixedIn, \\"mixedInConst\\"),
+ ifaceMixinConst: Object.getOwnPropertyDescriptor(MixedIn, \\"ifaceMixinConst\\")
});
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedMixedIn.prototype),
+ ...Object.getOwnPropertyDescriptors(MixedIn.prototype),
constructor: {
writable: true,
configurable: true,
- value: MixedIn
+ value: ctor
}
});
- Object.defineProperty(MixedIn, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -1167,12 +1167,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"MixedIn\\"] = MixedIn;
+ globalObject[ctorRegistry][\\"MixedIn\\"] = ctor;
Object.defineProperty(globalObject, \\"MixedIn\\", {
configurable: true,
writable: true,
- value: MixedIn
+ value: ctor
});
}
}; // iface
@@ -1193,7 +1193,7 @@ const isURL = require(\\"./URL.js\\").is;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedOverloads {
+class Overloads {
compatible(arg1) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -1559,7 +1559,7 @@ const iface = {
},
install(globalObject) {
- const Overloads = function() {
+ const ctor = function Overloads() {
const args = [];
switch (arguments.length) {
case 0:
@@ -1587,14 +1587,14 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedOverloads.prototype),
+ ...Object.getOwnPropertyDescriptors(Overloads.prototype),
constructor: {
writable: true,
configurable: true,
- value: Overloads
+ value: ctor
}
});
- Object.defineProperty(Overloads, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -1602,12 +1602,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Overloads\\"] = Overloads;
+ globalObject[ctorRegistry][\\"Overloads\\"] = ctor;
Object.defineProperty(globalObject, \\"Overloads\\", {
configurable: true,
writable: true,
- value: Overloads
+ value: ctor
});
}
}; // iface
@@ -1626,7 +1626,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedPromiseTypes {
+class PromiseTypes {
voidPromiseConsumer(p) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -1759,21 +1759,21 @@ const iface = {
},
install(globalObject) {
- const PromiseTypes = function() {
+ const ctor = function PromiseTypes() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedPromiseTypes.prototype),
+ ...Object.getOwnPropertyDescriptors(PromiseTypes.prototype),
constructor: {
writable: true,
configurable: true,
- value: PromiseTypes
+ value: ctor
}
});
- Object.defineProperty(PromiseTypes, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -1781,12 +1781,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"PromiseTypes\\"] = PromiseTypes;
+ globalObject[ctorRegistry][\\"PromiseTypes\\"] = ctor;
Object.defineProperty(globalObject, \\"PromiseTypes\\", {
configurable: true,
writable: true,
- value: PromiseTypes
+ value: ctor
});
}
}; // iface
@@ -1805,7 +1805,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedReflect {
+class Reflect {
get ReflectedBoolean() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2020,21 +2020,21 @@ const iface = {
},
install(globalObject) {
- const Reflect = function() {
+ const ctor = function Reflect() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedReflect.prototype),
+ ...Object.getOwnPropertyDescriptors(Reflect.prototype),
constructor: {
writable: true,
configurable: true,
- value: Reflect
+ value: ctor
}
});
- Object.defineProperty(Reflect, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -2042,12 +2042,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Reflect\\"] = Reflect;
+ globalObject[ctorRegistry][\\"Reflect\\"] = ctor;
Object.defineProperty(globalObject, \\"Reflect\\", {
configurable: true,
writable: true,
- value: Reflect
+ value: ctor
});
}
}; // iface
@@ -2101,7 +2101,7 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedSeqAndRec {
+class SeqAndRec {
recordConsumer(rec) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2381,21 +2381,21 @@ const iface = {
},
install(globalObject) {
- const SeqAndRec = function() {
+ const ctor = function SeqAndRec() {
return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedSeqAndRec.prototype),
+ ...Object.getOwnPropertyDescriptors(SeqAndRec.prototype),
constructor: {
writable: true,
configurable: true,
- value: SeqAndRec
+ value: ctor
}
});
- Object.defineProperty(SeqAndRec, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -2403,12 +2403,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"SeqAndRec\\"] = SeqAndRec;
+ globalObject[ctorRegistry][\\"SeqAndRec\\"] = ctor;
Object.defineProperty(globalObject, \\"SeqAndRec\\", {
configurable: true,
writable: true,
- value: SeqAndRec
+ value: ctor
});
}
}; // iface
@@ -2427,7 +2427,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedStatic {
+class Static {
def() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2548,26 +2548,26 @@ const iface = {
},
install(globalObject) {
- const Static = function() {
+ const ctor = function Static() {
throw new TypeError(\\"Illegal constructor\\");
};
- Object.defineProperties(Static, {
- def: Object.getOwnPropertyDescriptor(SharedStatic, \\"def\\"),
- abc: Object.getOwnPropertyDescriptor(SharedStatic, \\"abc\\")
+ Object.defineProperties(ctor, {
+ def: Object.getOwnPropertyDescriptor(Static, \\"def\\"),
+ abc: Object.getOwnPropertyDescriptor(Static, \\"abc\\")
});
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedStatic.prototype),
+ ...Object.getOwnPropertyDescriptors(Static.prototype),
constructor: {
writable: true,
configurable: true,
- value: Static
+ value: ctor
}
});
- Object.defineProperty(Static, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -2575,12 +2575,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Static\\"] = Static;
+ globalObject[ctorRegistry][\\"Static\\"] = ctor;
Object.defineProperty(globalObject, \\"Static\\", {
configurable: true,
writable: true,
- value: Static
+ value: ctor
});
}
}; // iface
@@ -2599,7 +2599,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedStorage {
+class Storage {
key(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -2948,21 +2948,21 @@ const iface = {
},
install(globalObject) {
- const Storage = function() {
+ const ctor = function Storage() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedStorage.prototype),
+ ...Object.getOwnPropertyDescriptors(Storage.prototype),
constructor: {
writable: true,
configurable: true,
- value: Storage
+ value: ctor
}
});
- Object.defineProperty(Storage, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -2970,12 +2970,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Storage\\"] = Storage;
+ globalObject[ctorRegistry][\\"Storage\\"] = ctor;
Object.defineProperty(globalObject, \\"Storage\\", {
configurable: true,
writable: true,
- value: Storage
+ value: ctor
});
}
}; // iface
@@ -2994,7 +2994,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedStringifierAttribute {
+class StringifierAttribute {
get attr() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3091,21 +3091,21 @@ const iface = {
},
install(globalObject) {
- const StringifierAttribute = function() {
+ const ctor = function StringifierAttribute() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedStringifierAttribute.prototype),
+ ...Object.getOwnPropertyDescriptors(StringifierAttribute.prototype),
constructor: {
writable: true,
configurable: true,
- value: StringifierAttribute
+ value: ctor
}
});
- Object.defineProperty(StringifierAttribute, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -3113,12 +3113,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"StringifierAttribute\\"] = StringifierAttribute;
+ globalObject[ctorRegistry][\\"StringifierAttribute\\"] = ctor;
Object.defineProperty(globalObject, \\"StringifierAttribute\\", {
configurable: true,
writable: true,
- value: StringifierAttribute
+ value: ctor
});
}
}; // iface
@@ -3137,7 +3137,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedStringifierDefaultOperation {
+class StringifierDefaultOperation {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3228,21 +3228,21 @@ const iface = {
},
install(globalObject) {
- const StringifierDefaultOperation = function() {
+ const ctor = function StringifierDefaultOperation() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedStringifierDefaultOperation.prototype),
+ ...Object.getOwnPropertyDescriptors(StringifierDefaultOperation.prototype),
constructor: {
writable: true,
configurable: true,
- value: StringifierDefaultOperation
+ value: ctor
}
});
- Object.defineProperty(StringifierDefaultOperation, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -3250,12 +3250,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"] = StringifierDefaultOperation;
+ globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"] = ctor;
Object.defineProperty(globalObject, \\"StringifierDefaultOperation\\", {
configurable: true,
writable: true,
- value: StringifierDefaultOperation
+ value: ctor
});
}
}; // iface
@@ -3274,7 +3274,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedStringifierNamedOperation {
+class StringifierNamedOperation {
operation() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3374,21 +3374,21 @@ const iface = {
},
install(globalObject) {
- const StringifierNamedOperation = function() {
+ const ctor = function StringifierNamedOperation() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedStringifierNamedOperation.prototype),
+ ...Object.getOwnPropertyDescriptors(StringifierNamedOperation.prototype),
constructor: {
writable: true,
configurable: true,
- value: StringifierNamedOperation
+ value: ctor
}
});
- Object.defineProperty(StringifierNamedOperation, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -3396,12 +3396,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"StringifierNamedOperation\\"] = StringifierNamedOperation;
+ globalObject[ctorRegistry][\\"StringifierNamedOperation\\"] = ctor;
Object.defineProperty(globalObject, \\"StringifierNamedOperation\\", {
configurable: true,
writable: true,
- value: StringifierNamedOperation
+ value: ctor
});
}
}; // iface
@@ -3420,7 +3420,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedStringifierOperation {
+class StringifierOperation {
toString() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -3509,21 +3509,21 @@ const iface = {
},
install(globalObject) {
- const StringifierOperation = function() {
+ const ctor = function StringifierOperation() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedStringifierOperation.prototype),
+ ...Object.getOwnPropertyDescriptors(StringifierOperation.prototype),
constructor: {
writable: true,
configurable: true,
- value: StringifierOperation
+ value: ctor
}
});
- Object.defineProperty(StringifierOperation, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -3531,12 +3531,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"StringifierOperation\\"] = StringifierOperation;
+ globalObject[ctorRegistry][\\"StringifierOperation\\"] = ctor;
Object.defineProperty(globalObject, \\"StringifierOperation\\", {
configurable: true,
writable: true,
- value: StringifierOperation
+ value: ctor
});
}
}; // iface
@@ -3558,7 +3558,7 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedTypedefsAndUnions {
+class TypedefsAndUnions {
numOrStrConsumer(a) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -4048,21 +4048,21 @@ const iface = {
},
install(globalObject) {
- const TypedefsAndUnions = function() {
+ const ctor = function TypedefsAndUnions() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedTypedefsAndUnions.prototype),
+ ...Object.getOwnPropertyDescriptors(TypedefsAndUnions.prototype),
constructor: {
writable: true,
configurable: true,
- value: TypedefsAndUnions
+ value: ctor
}
});
- Object.defineProperty(TypedefsAndUnions, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -4070,12 +4070,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"TypedefsAndUnions\\"] = TypedefsAndUnions;
+ globalObject[ctorRegistry][\\"TypedefsAndUnions\\"] = ctor;
Object.defineProperty(globalObject, \\"TypedefsAndUnions\\", {
configurable: true,
writable: true,
- value: TypedefsAndUnions
+ value: ctor
});
}
}; // iface
@@ -4094,7 +4094,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedURL {
+class URL {
toJSON() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -4401,7 +4401,7 @@ const iface = {
},
install(globalObject) {
- const URL = function(url) {
+ const ctor = function URL(url) {
if (arguments.length < 1) {
throw new TypeError(
\\"Failed to construct 'URL': 1 argument required, but only \\" + arguments.length + \\" present.\\"
@@ -4426,14 +4426,14 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedURL.prototype),
+ ...Object.getOwnPropertyDescriptors(URL.prototype),
constructor: {
writable: true,
configurable: true,
- value: URL
+ value: ctor
}
});
- Object.defineProperty(URL, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -4441,12 +4441,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"URL\\"] = URL;
+ globalObject[ctorRegistry][\\"URL\\"] = ctor;
Object.defineProperty(globalObject, \\"URL\\", {
configurable: true,
writable: true,
- value: URL
+ value: ctor
});
}
}; // iface
@@ -4465,7 +4465,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedURLList {
+class URLList {
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -4739,21 +4739,21 @@ const iface = {
},
install(globalObject) {
- const URLList = function() {
+ const ctor = function URLList() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedURLList.prototype),
+ ...Object.getOwnPropertyDescriptors(URLList.prototype),
constructor: {
writable: true,
configurable: true,
- value: URLList
+ value: ctor
}
});
- Object.defineProperty(URLList, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -4761,12 +4761,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"URLList\\"] = URLList;
+ globalObject[ctorRegistry][\\"URLList\\"] = ctor;
Object.defineProperty(globalObject, \\"URLList\\", {
configurable: true,
writable: true,
- value: URLList
+ value: ctor
});
}
}; // iface
@@ -4823,7 +4823,7 @@ const IteratorPrototype = Object.create(utils.IteratorPrototype, {
configurable: true
}
});
-class SharedURLSearchParams {
+class URLSearchParams {
append(name, value) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -5131,7 +5131,7 @@ const iface = {
},
install(globalObject) {
- const URLSearchParams = function() {
+ const ctor = function URLSearchParams() {
const args = [];
{
let curArg = arguments[0];
@@ -5218,14 +5218,14 @@ const iface = {
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedURLSearchParams.prototype),
+ ...Object.getOwnPropertyDescriptors(URLSearchParams.prototype),
constructor: {
writable: true,
configurable: true,
- value: URLSearchParams
+ value: ctor
}
});
- Object.defineProperty(URLSearchParams, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -5233,12 +5233,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"URLSearchParams\\"] = URLSearchParams;
+ globalObject[ctorRegistry][\\"URLSearchParams\\"] = ctor;
Object.defineProperty(globalObject, \\"URLSearchParams\\", {
configurable: true,
writable: true,
- value: URLSearchParams
+ value: ctor
});
}
}; // iface
@@ -5257,7 +5257,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedURLSearchParamsCollection {
+class URLSearchParamsCollection {
item(index) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -5583,21 +5583,21 @@ const iface = {
},
install(globalObject) {
- const URLSearchParamsCollection = function() {
+ const ctor = function URLSearchParamsCollection() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedURLSearchParamsCollection.prototype),
+ ...Object.getOwnPropertyDescriptors(URLSearchParamsCollection.prototype),
constructor: {
writable: true,
configurable: true,
- value: URLSearchParamsCollection
+ value: ctor
}
});
- Object.defineProperty(URLSearchParamsCollection, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -5605,12 +5605,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"] = URLSearchParamsCollection;
+ globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"] = ctor;
Object.defineProperty(globalObject, \\"URLSearchParamsCollection\\", {
configurable: true,
writable: true,
- value: URLSearchParamsCollection
+ value: ctor
});
}
}; // iface
@@ -5631,7 +5631,7 @@ const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\");
-class SharedURLSearchParamsCollection2 {}
+class URLSearchParamsCollection2 {}
Object.defineProperties(URLSearchParamsCollection2.prototype, {
[Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true },
[Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
@@ -5931,7 +5931,7 @@ const iface = {
},
install(globalObject) {
- const URLSearchParamsCollection2 = function() {
+ const ctor = function URLSearchParamsCollection2() {
throw new TypeError(\\"Illegal constructor\\");
};
@@ -5944,14 +5944,14 @@ const iface = {
const proto = Object.create(globalObject.URLSearchParamsCollection.prototype);
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedURLSearchParamsCollection2.prototype),
+ ...Object.getOwnPropertyDescriptors(URLSearchParamsCollection2.prototype),
constructor: {
writable: true,
configurable: true,
- value: URLSearchParamsCollection2
+ value: ctor
}
});
- Object.defineProperty(URLSearchParamsCollection2, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -5959,12 +5959,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"] = URLSearchParamsCollection2;
+ globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"] = ctor;
Object.defineProperty(globalObject, \\"URLSearchParamsCollection2\\", {
configurable: true,
writable: true,
- value: URLSearchParamsCollection2
+ value: ctor
});
}
}; // iface
@@ -5983,7 +5983,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedUnderscoredProperties {
+class UnderscoredProperties {
operation(sequence) {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -6145,26 +6145,26 @@ const iface = {
},
install(globalObject) {
- const UnderscoredProperties = function() {
+ const ctor = function UnderscoredProperties() {
throw new TypeError(\\"Illegal constructor\\");
};
- Object.defineProperties(UnderscoredProperties, {
- const: Object.getOwnPropertyDescriptor(SharedUnderscoredProperties, \\"const\\"),
- static: Object.getOwnPropertyDescriptor(SharedUnderscoredProperties, \\"static\\")
+ Object.defineProperties(ctor, {
+ const: Object.getOwnPropertyDescriptor(UnderscoredProperties, \\"const\\"),
+ static: Object.getOwnPropertyDescriptor(UnderscoredProperties, \\"static\\")
});
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedUnderscoredProperties.prototype),
+ ...Object.getOwnPropertyDescriptors(UnderscoredProperties.prototype),
constructor: {
writable: true,
configurable: true,
- value: UnderscoredProperties
+ value: ctor
}
});
- Object.defineProperty(UnderscoredProperties, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -6172,12 +6172,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"UnderscoredProperties\\"] = UnderscoredProperties;
+ globalObject[ctorRegistry][\\"UnderscoredProperties\\"] = ctor;
Object.defineProperty(globalObject, \\"UnderscoredProperties\\", {
configurable: true,
writable: true,
- value: UnderscoredProperties
+ value: ctor
});
}
}; // iface
@@ -6196,7 +6196,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedUnforgeable {}
+class Unforgeable {}
Object.defineProperties(Unforgeable.prototype, { [Symbol.toStringTag]: { value: \\"Unforgeable\\", configurable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
@@ -6359,21 +6359,21 @@ const iface = {
},
install(globalObject) {
- const Unforgeable = function() {
+ const ctor = function Unforgeable() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedUnforgeable.prototype),
+ ...Object.getOwnPropertyDescriptors(Unforgeable.prototype),
constructor: {
writable: true,
configurable: true,
- value: Unforgeable
+ value: ctor
}
});
- Object.defineProperty(Unforgeable, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -6381,12 +6381,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Unforgeable\\"] = Unforgeable;
+ globalObject[ctorRegistry][\\"Unforgeable\\"] = ctor;
Object.defineProperty(globalObject, \\"Unforgeable\\", {
configurable: true,
writable: true,
- value: Unforgeable
+ value: ctor
});
}
}; // iface
@@ -6405,7 +6405,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedUnforgeableMap {}
+class UnforgeableMap {}
Object.defineProperties(UnforgeableMap.prototype, {
[Symbol.toStringTag]: { value: \\"UnforgeableMap\\", configurable: true }
});
@@ -6675,21 +6675,21 @@ const iface = {
},
install(globalObject) {
- const UnforgeableMap = function() {
+ const ctor = function UnforgeableMap() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedUnforgeableMap.prototype),
+ ...Object.getOwnPropertyDescriptors(UnforgeableMap.prototype),
constructor: {
writable: true,
configurable: true,
- value: UnforgeableMap
+ value: ctor
}
});
- Object.defineProperty(UnforgeableMap, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -6697,12 +6697,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"UnforgeableMap\\"] = UnforgeableMap;
+ globalObject[ctorRegistry][\\"UnforgeableMap\\"] = ctor;
Object.defineProperty(globalObject, \\"UnforgeableMap\\", {
configurable: true,
writable: true,
- value: UnforgeableMap
+ value: ctor
});
}
}; // iface
@@ -6721,7 +6721,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedUnscopable {
+class Unscopable {
get unscopableTest() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -6844,21 +6844,21 @@ const iface = {
},
install(globalObject) {
- const Unscopable = function() {
+ const ctor = function Unscopable() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedUnscopable.prototype),
+ ...Object.getOwnPropertyDescriptors(Unscopable.prototype),
constructor: {
writable: true,
configurable: true,
- value: Unscopable
+ value: ctor
}
});
- Object.defineProperty(Unscopable, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -6866,12 +6866,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Unscopable\\"] = Unscopable;
+ globalObject[ctorRegistry][\\"Unscopable\\"] = ctor;
Object.defineProperty(globalObject, \\"Unscopable\\", {
configurable: true,
writable: true,
- value: Unscopable
+ value: ctor
});
}
}; // iface
@@ -6891,7 +6891,7 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedVariadic {
+class Variadic {
simple1() {
if (!this || !module.exports.is(this)) {
throw new TypeError(\\"Illegal invocation\\");
@@ -7118,21 +7118,21 @@ const iface = {
},
install(globalObject) {
- const Variadic = function() {
+ const ctor = function Variadic() {
throw new TypeError(\\"Illegal constructor\\");
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedVariadic.prototype),
+ ...Object.getOwnPropertyDescriptors(Variadic.prototype),
constructor: {
writable: true,
configurable: true,
- value: Variadic
+ value: ctor
}
});
- Object.defineProperty(Variadic, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -7140,12 +7140,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"Variadic\\"] = Variadic;
+ globalObject[ctorRegistry][\\"Variadic\\"] = ctor;
Object.defineProperty(globalObject, \\"Variadic\\", {
configurable: true,
writable: true,
- value: Variadic
+ value: ctor
});
}
}; // iface
@@ -7164,7 +7164,7 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class SharedZeroArgConstructor {}
+class ZeroArgConstructor {}
Object.defineProperties(ZeroArgConstructor.prototype, {
[Symbol.toStringTag]: { value: \\"ZeroArgConstructor\\", configurable: true }
});
@@ -7244,21 +7244,21 @@ const iface = {
},
install(globalObject) {
- const ZeroArgConstructor = function() {
+ const ctor = function ZeroArgConstructor() {
return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
};
const proto = {};
Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SharedZeroArgConstructor.prototype),
+ ...Object.getOwnPropertyDescriptors(ZeroArgConstructor.prototype),
constructor: {
writable: true,
configurable: true,
- value: ZeroArgConstructor
+ value: ctor
}
});
- Object.defineProperty(ZeroArgConstructor, \\"prototype\\", {
+ Object.defineProperty(ctor, \\"prototype\\", {
writable: false,
value: proto
});
@@ -7266,12 +7266,12 @@ const iface = {
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = {};
}
- globalObject[ctorRegistry][\\"ZeroArgConstructor\\"] = ZeroArgConstructor;
+ globalObject[ctorRegistry][\\"ZeroArgConstructor\\"] = ctor;
Object.defineProperty(globalObject, \\"ZeroArgConstructor\\", {
configurable: true,
writable: true,
- value: ZeroArgConstructor
+ value: ctor
});
}
}; // iface
From 5ad0dc1e99866c35f9f49e5d5a28e39d8ad90daa Mon Sep 17 00:00:00 2001
From: Domenic Denicola
Date: Sun, 27 Oct 2019 13:18:57 -0400
Subject: [PATCH 4/8] Readme tweaks
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 1f466c2e..72586569 100644
--- a/README.md
+++ b/README.md
@@ -153,7 +153,7 @@ In practice, this means doing a type-check equivalent to `is(value)`, and if it
#### `install(globalObject)`
-This method creates a brand new wrapper constructor and prototype and attach it to the passed `globalObject`. It also attaches the created constructor on the passed `globalObject` for it to be reused when creating new wrapper instances on the same `globalObject`. It is important to invoke `install` before invoking `create`, `createImpl` or `setup` otherwise they will throw.
+This method creates a brand new wrapper constructor and prototype and attach it to the passed `globalObject`. It also registers the created constructor with the `globalObject`'s global constructor registry, which makes `create()`, `createImpl()`, and `setup()` work. (Thus, it is important to invoke `install()` before invoking those methods, as otherwise they will throw.)
#### `create(globalObject, constructorArgs, privateData)`
From 7a2a07803f717d20f66c077aeb352b179b9186b8 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Mon, 28 Oct 2019 06:39:45 +0100
Subject: [PATCH 5/8] update based on PR feedback
---
lib/constructs/interface.js | 8 +-
test/__snapshots__/test.js.snap | 170 ++++++++++++++++----------------
2 files changed, 89 insertions(+), 89 deletions(-)
diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js
index 20e50499..d3ad30d2 100644
--- a/lib/constructs/interface.js
+++ b/lib/constructs/interface.js
@@ -1105,7 +1105,7 @@ class Interface {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1128,7 +1128,7 @@ class Interface {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -1447,7 +1447,7 @@ class Interface {
// before on the global object.
this.str += `
if (globalObject.${idl.inheritance} === undefined) {
- throw new Error('Evaluation order error. Attempting to evaluate ${name} before ${idl.inheritance}');
+ throw new Error('Internal error: attempting to evaluate ${name} before ${idl.inheritance}');
}
const proto = Object.create(globalObject.${idl.inheritance}.prototype);
@@ -1479,7 +1479,7 @@ class Interface {
// used when invoking interface.create, and interface.creatImpl). And also attach it to the global object.
this.str += `
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry]["${name}"] = ctor;
diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap
index a9c2cbd8..561511cf 100644
--- a/test/__snapshots__/test.js.snap
+++ b/test/__snapshots__/test.js.snap
@@ -178,7 +178,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -189,7 +189,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -223,7 +223,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"DOMImplementation\\"] = ctor;
@@ -408,7 +408,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -419,7 +419,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -453,7 +453,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"DictionaryConvert\\"] = ctor;
@@ -578,7 +578,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -589,7 +589,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -623,7 +623,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Enum\\"] = ctor;
@@ -702,7 +702,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -798,7 +798,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -832,7 +832,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Global\\"] = ctor;
@@ -923,7 +923,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -934,7 +934,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -968,7 +968,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"LegacyArrayClass\\"] = ctor;
@@ -1115,7 +1115,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1126,7 +1126,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -1165,7 +1165,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"MixedIn\\"] = ctor;
@@ -1534,7 +1534,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1545,7 +1545,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -1600,7 +1600,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Overloads\\"] = ctor;
@@ -1734,7 +1734,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -1745,7 +1745,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -1779,7 +1779,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"PromiseTypes\\"] = ctor;
@@ -1995,7 +1995,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2006,7 +2006,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -2040,7 +2040,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Reflect\\"] = ctor;
@@ -2356,7 +2356,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2367,7 +2367,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -2401,7 +2401,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"SeqAndRec\\"] = ctor;
@@ -2523,7 +2523,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2534,7 +2534,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -2573,7 +2573,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Static\\"] = ctor;
@@ -2759,7 +2759,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -2770,7 +2770,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -2968,7 +2968,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Storage\\"] = ctor;
@@ -3066,7 +3066,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3077,7 +3077,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -3111,7 +3111,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"StringifierAttribute\\"] = ctor;
@@ -3203,7 +3203,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3214,7 +3214,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -3248,7 +3248,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"] = ctor;
@@ -3349,7 +3349,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3360,7 +3360,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -3394,7 +3394,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"StringifierNamedOperation\\"] = ctor;
@@ -3484,7 +3484,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -3495,7 +3495,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -3529,7 +3529,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"StringifierOperation\\"] = ctor;
@@ -4023,7 +4023,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -4034,7 +4034,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -4068,7 +4068,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"TypedefsAndUnions\\"] = ctor;
@@ -4376,7 +4376,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -4387,7 +4387,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -4439,7 +4439,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"URL\\"] = ctor;
@@ -4554,7 +4554,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -4565,7 +4565,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -4759,7 +4759,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"URLList\\"] = ctor;
@@ -5106,7 +5106,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -5117,7 +5117,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -5231,7 +5231,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"URLSearchParams\\"] = ctor;
@@ -5372,7 +5372,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -5383,7 +5383,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -5603,7 +5603,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"] = ctor;
@@ -5689,7 +5689,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -5702,7 +5702,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -5937,7 +5937,7 @@ const iface = {
if (globalObject.URLSearchParamsCollection === undefined) {
throw new Error(
- \\"Evaluation order error. Attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\"
+ \\"Internal error: attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\"
);
}
@@ -5957,7 +5957,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"] = ctor;
@@ -6120,7 +6120,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6131,7 +6131,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -6170,7 +6170,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"UnderscoredProperties\\"] = ctor;
@@ -6249,7 +6249,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6345,7 +6345,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -6379,7 +6379,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Unforgeable\\"] = ctor;
@@ -6460,7 +6460,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6486,7 +6486,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -6695,7 +6695,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"UnforgeableMap\\"] = ctor;
@@ -6819,7 +6819,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -6830,7 +6830,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -6864,7 +6864,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Unscopable\\"] = ctor;
@@ -7093,7 +7093,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -7104,7 +7104,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -7138,7 +7138,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"Variadic\\"] = ctor;
@@ -7219,7 +7219,7 @@ const iface = {
}
let obj = Object.create(ctor.prototype);
- obj = this.setup(obj, globalObject, constructorArgs, privateData);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
return obj;
},
createImpl(globalObject, constructorArgs, privateData) {
@@ -7230,7 +7230,7 @@ const iface = {
setup(obj, globalObject, constructorArgs = [], privateData = {}) {
privateData.wrapper = obj;
- this._internalSetup(obj);
+ iface._internalSetup(obj);
Object.defineProperty(obj, impl, {
value: new Impl.implementation(globalObject, constructorArgs, privateData),
configurable: true
@@ -7264,7 +7264,7 @@ const iface = {
});
if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = {};
+ globalObject[ctorRegistry] = Object.create(null);
}
globalObject[ctorRegistry][\\"ZeroArgConstructor\\"] = ctor;
From 74ddc14b09cb8e20e32b4d2171e1132116c35e5a Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Mon, 28 Oct 2019 07:33:47 +0100
Subject: [PATCH 6/8] remove property hack
---
lib/constructs/interface.js | 28 ++++++++++++----------------
lib/utils.js | 29 +++++++++++++++++++----------
2 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js
index d3ad30d2..c7c811ce 100644
--- a/lib/constructs/interface.js
+++ b/lib/constructs/interface.js
@@ -1247,7 +1247,7 @@ class Interface {
continue;
}
- const propName = utils.stringifyPropertyName(name);
+ const propName = utils.stringifyPropertyKey(name);
if (type === "regular") {
addOne(propName, args, body);
} else {
@@ -1261,7 +1261,7 @@ class Interface {
}
for (const [name, { type, args, body }] of this._outputStaticMethods) {
- const propName = utils.stringifyPropertyName(name);
+ const propName = utils.stringifyPropertyKey(name);
if (type === "regular") {
addOne(`static ${propName}`, args, body);
} else {
@@ -1298,7 +1298,7 @@ class Interface {
if (descriptorModifier === undefined) {
continue;
}
- protoProps.set(utils.stringifyPropertyName(name), descriptorModifier);
+ protoProps.set(utils.stringifyPropertyKey(name), descriptorModifier);
}
for (const [name, { type, descriptor }] of this._outputStaticMethods) {
@@ -1306,7 +1306,7 @@ class Interface {
if (descriptorModifier === undefined) {
continue;
}
- classProps.set(utils.stringifyPropertyName(name), descriptorModifier);
+ classProps.set(utils.stringifyPropertyKey(name), descriptorModifier);
}
for (const [name, { whence, body, descriptor }] of this._outputProperties) {
@@ -1316,13 +1316,13 @@ class Interface {
const descriptorModifier =
getPropertyDescriptorModifier(defaultDefinePropertyDescriptor, descriptor, "regular", body);
- protoProps.set(utils.stringifyPropertyName(name), descriptorModifier);
+ protoProps.set(utils.stringifyPropertyKey(name), descriptorModifier);
}
for (const [name, { body, descriptor }] of this._outputStaticProperties) {
const descriptorModifier =
getPropertyDescriptorModifier(defaultDefinePropertyDescriptor, descriptor, "regular", body);
- classProps.set(utils.stringifyPropertyName(name), descriptorModifier);
+ classProps.set(utils.stringifyPropertyKey(name), descriptorModifier);
}
if (protoProps.size > 0) {
@@ -1351,7 +1351,7 @@ class Interface {
continue;
}
- const propName = utils.stringifyPropertyName(name);
+ const propName = utils.stringifyPropertyKey(name);
if (type === "regular") {
addOne(propName, args, body);
} else {
@@ -1367,7 +1367,7 @@ class Interface {
if (descriptorModifier === undefined) {
continue;
}
- props.set(utils.stringifyPropertyName(name), descriptorModifier);
+ props.set(utils.stringifyPropertyKey(name), descriptorModifier);
}
for (const [name, { whence, body, descriptor }] of this._outputProperties) {
@@ -1375,7 +1375,7 @@ class Interface {
continue;
}
- const propName = utils.stringifyPropertyName(name);
+ const propName = utils.stringifyPropertyKey(name);
methods.push(`${propName}: ${body}`);
const descriptorModifier = getPropertyDescriptorModifier(defaultObjectLiteralDescriptor, descriptor, "regular");
@@ -1428,13 +1428,9 @@ class Interface {
`;
for (const staticProperty of staticPropertyNames) {
- // TODO: Improve this code. It's a really bad hack.
- const propertyKey = utils.stringifyPropertyName(staticProperty);
- const propertyValue = propertyKey.startsWith("[") && propertyKey.endsWith("]") ?
- propertyKey.replace("[", "").replace("]", "") :
- `"${propertyKey}"`;
-
- this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(${name}, ${propertyValue}),\n`;
+ const propertyKey = utils.stringifyPropertyKey(staticProperty);
+ const propertyName = utils.stringifyPropertyName(staticProperty);
+ this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(${name}, ${propertyName}),\n`;
}
this.str += `
diff --git a/lib/utils.js b/lib/utils.js
index 9c1f95b1..423fcfcc 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -36,21 +36,29 @@ function isOnInstance(memberIDL, interfaceIDL) {
return memberIDL.special !== "static" && (getExtAttr(memberIDL.extAttrs, "Unforgeable") || isGlobal(interfaceIDL));
}
-function stringifyPropertyName(propName) {
- if (typeof propName === "symbol") {
- const desc = String(propName).replace(/^Symbol\((.*)\)$/, "$1");
- if (!desc.startsWith("Symbol.")) {
- throw new Error(`Internal error: Unsupported property name ${String(propName)}`);
- }
- return `[${desc}]`;
+function symbolName(symbol) {
+ const desc = String(symbol).replace(/^Symbol\((.*)\)$/, "$1");
+ if (!desc.startsWith("Symbol.")) {
+ throw new Error(`Internal error: Unsupported property name ${String(symbol)}`);
}
+ return desc;
+}
+function propertyName(name) {
// All Web IDL identifiers are valid JavaScript PropertyNames, other than those with '-'.
- const isJSIdentifier = !propName.includes("-");
+ const isJSIdentifier = !name.includes("-");
if (isJSIdentifier) {
- return propName;
+ return name;
}
- return JSON.stringify(propName);
+ return JSON.stringify(name);
+}
+
+function stringifyPropertyKey(prop) {
+ return typeof prop === "symbol" ? `[${symbolName(prop)}]` : propertyName(prop);
+}
+
+function stringifyPropertyName(prop) {
+ return typeof prop === "symbol" ? symbolName(prop) : JSON.stringify(propertyName(prop));
}
class RequiresMap extends Map {
@@ -94,6 +102,7 @@ module.exports = {
getExtAttr,
isGlobal,
isOnInstance,
+ stringifyPropertyKey,
stringifyPropertyName,
RequiresMap
};
From 19bd4bef2fad9dfc0fa88c3782fc7ee67f3ef79f Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Sat, 2 Nov 2019 09:41:52 +0100
Subject: [PATCH 7/8] generate interface wrapper class inline
---
lib/constructs/interface.js | 78 +-
test/__snapshots__/test.js.snap | 5977 +++++++++++++++----------------
2 files changed, 2809 insertions(+), 3246 deletions(-)
diff --git a/lib/constructs/interface.js b/lib/constructs/interface.js
index c7c811ce..e4b89b4b 100644
--- a/lib/constructs/interface.js
+++ b/lib/constructs/interface.js
@@ -1149,7 +1149,7 @@ class Interface {
`;
}
- getConstructor() {
+ addConstructor() {
const overloads = Overloads.getEffectiveOverloads("constructor", this.name, 0, this);
let body;
@@ -1184,7 +1184,7 @@ class Interface {
`;
}
- return { body, argNames };
+ this.addMethod("prototype", "constructor", argNames, body, "regular", { enumerable: false });
}
get defaultWhence() {
@@ -1201,6 +1201,8 @@ class Interface {
}
addAllMethodsProperties() {
+ this.addConstructor();
+
this.addProperty("prototype", Symbol.toStringTag, JSON.stringify(this.name), {
writable: false
});
@@ -1411,78 +1413,32 @@ class Interface {
install(globalObject) {
`;
- const ctor = this.getConstructor();
- this.str += `
- const ctor = function ${name}(${formatArgs(ctor.argNames)}) {
- ${ctor.body}
- };
- `;
-
- const staticPropertyNames = [
- ...this._outputStaticProperties.keys(),
- ...this._outputStaticMethods.keys()
- ];
- if (staticPropertyNames.length) {
- this.str += `
- Object.defineProperties(ctor, {
- `;
-
- for (const staticProperty of staticPropertyNames) {
- const propertyKey = utils.stringifyPropertyKey(staticProperty);
- const propertyName = utils.stringifyPropertyName(staticProperty);
- this.str += `${propertyKey}: Object.getOwnPropertyDescriptor(${name}, ${propertyName}),\n`;
- }
-
- this.str += `
- });
- `;
- }
-
if (idl.inheritance) {
- // If the interface inherits from another one add a check to make sure that the parent interface is installed
- // before on the global object.
this.str += `
if (globalObject.${idl.inheritance} === undefined) {
throw new Error('Internal error: attempting to evaluate ${name} before ${idl.inheritance}');
}
-
- const proto = Object.create(globalObject.${idl.inheritance}.prototype);
- `;
- } else {
- this.str += `
- const proto = {};
`;
}
- // Assign the shared prototype descriptors to brand new one. Once the prototype chain is ready, attach it to the
- // newly created constructor.
- this.str += `
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(${name}.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
- }
- });
- Object.defineProperty(ctor, "prototype", {
- writable: false,
- value: proto
- });
- `;
+ const ext = idl.inheritance ? ` extends globalObject.${idl.inheritance}` : "";
+
+ this.str += `class ${name}${ext} {`;
+ this.generateOffInstanceMethods();
+ this.str += "}";
+
+ this.generateOffInstanceAfterClass();
- // Add the newly create constructor to the constructor registry attached to the global object (this this will be
- // used when invoking interface.create, and interface.creatImpl). And also attach it to the global object.
this.str += `
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry]["${name}"] = ctor;
+ globalObject[ctorRegistry]["${name}"] = ${name};
Object.defineProperty(globalObject, "${name}", {
configurable: true,
writable: true,
- value: ctor
+ value: ${name}
});
},
`;
@@ -1491,14 +1447,6 @@ class Interface {
generate() {
this.generateIterator();
- this.str += `class ${this.name} {`;
-
- this.generateOffInstanceMethods();
-
- this.str += "}";
-
- this.generateOffInstanceAfterClass();
-
this.str += `
const iface = {
`;
diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap
index 561511cf..aaf336f5 100644
--- a/test/__snapshots__/test.js.snap
+++ b/test/__snapshots__/test.js.snap
@@ -9,124 +9,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class DOMImplementation {
- createDocumentType(qualifiedName, publicId, systemId) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 3) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[2];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\"
- });
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].createDocumentType(...args));
- }
-
- createDocument(namespace, qualifiedName) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 2) {
- throw new TypeError(
- \\"Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 1\\"
- });
- }
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 2\\",
- treatNullAsEmptyString: true
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[2];
- if (curArg !== undefined) {
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- curArg = utils.tryImplForWrapper(curArg);
- }
- } else {
- curArg = null;
- }
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].createDocument(...args));
- }
-
- createHTMLDocument() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg !== undefined) {
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\"
- });
- }
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].createHTMLDocument(...args));
- }
-
- hasFeature() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].hasFeature();
- }
-}
-Object.defineProperties(DOMImplementation.prototype, {
- createDocumentType: { enumerable: true },
- createDocument: { enumerable: true },
- createHTMLDocument: { enumerable: true },
- hasFeature: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"DOMImplementation\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -203,34 +85,137 @@ const iface = {
},
install(globalObject) {
- const ctor = function DOMImplementation() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class DOMImplementation {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ createDocumentType(qualifiedName, publicId, systemId) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 3) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[2];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\"
+ });
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].createDocumentType(...args));
+ }
- const proto = {};
+ createDocument(namespace, qualifiedName) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(DOMImplementation.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ if (arguments.length < 2) {
+ throw new TypeError(
+ \\"Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 1\\"
+ });
+ }
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'createDocument' on 'DOMImplementation': parameter 2\\",
+ treatNullAsEmptyString: true
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[2];
+ if (curArg !== undefined) {
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ curArg = utils.tryImplForWrapper(curArg);
+ }
+ } else {
+ curArg = null;
+ }
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].createDocument(...args));
+ }
+
+ createHTMLDocument() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg !== undefined) {
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\"
+ });
+ }
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].createHTMLDocument(...args));
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ hasFeature() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].hasFeature();
+ }
+ }
+ Object.defineProperties(DOMImplementation.prototype, {
+ createDocumentType: { enumerable: true },
+ createDocument: { enumerable: true },
+ createHTMLDocument: { enumerable: true },
+ hasFeature: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"DOMImplementation\\", configurable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"DOMImplementation\\"] = ctor;
+ globalObject[ctorRegistry][\\"DOMImplementation\\"] = DOMImplementation;
Object.defineProperty(globalObject, \\"DOMImplementation\\", {
configurable: true,
writable: true,
- value: ctor
+ value: DOMImplementation
});
}
}; // iface
@@ -330,33 +315,6 @@ const convertDictionary = require(\\"./Dictionary.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class DictionaryConvert {
- op() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg !== undefined) {
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 1\\"
- });
- }
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = convertDictionary(curArg, { context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" });
- args.push(curArg);
- }
- return this[impl].op(...args);
- }
-}
-Object.defineProperties(DictionaryConvert.prototype, {
- op: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"DictionaryConvert\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -433,34 +391,46 @@ const iface = {
},
install(globalObject) {
- const ctor = function DictionaryConvert() {
- throw new TypeError(\\"Illegal constructor\\");
- };
-
- const proto = {};
+ class DictionaryConvert {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(DictionaryConvert.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ op() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg !== undefined) {
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 1\\"
+ });
+ }
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = convertDictionary(curArg, { context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" });
+ args.push(curArg);
+ }
+ return this[impl].op(...args);
}
+ }
+ Object.defineProperties(DictionaryConvert.prototype, {
+ op: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"DictionaryConvert\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"DictionaryConvert\\"] = ctor;
+ globalObject[ctorRegistry][\\"DictionaryConvert\\"] = DictionaryConvert;
Object.defineProperty(globalObject, \\"DictionaryConvert\\", {
configurable: true,
writable: true,
- value: ctor
+ value: DictionaryConvert
});
}
}; // iface
@@ -481,52 +451,6 @@ const RequestDestination = require(\\"./RequestDestination.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Enum {
- op(destination) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'op' on 'Enum': 1 argument required, but only \\" + arguments.length + \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- curArg = convertRequestDestination(curArg, { context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" });
- args.push(curArg);
- }
- return this[impl].op(...args);
- }
-
- get attr() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return utils.tryWrapperForImpl(this[impl][\\"attr\\"]);
- }
-
- set attr(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = \`\${V}\`;
- if (!RequestDestination.enumerationValues.has(V)) {
- return;
- }
-
- this[impl][\\"attr\\"] = V;
- }
-}
-Object.defineProperties(Enum.prototype, {
- op: { enumerable: true },
- attr: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Enum\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -603,34 +527,65 @@ const iface = {
},
install(globalObject) {
- const ctor = function Enum() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class Enum {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ op(destination) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'op' on 'Enum': 1 argument required, but only \\" + arguments.length + \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ curArg = convertRequestDestination(curArg, { context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" });
+ args.push(curArg);
+ }
+ return this[impl].op(...args);
+ }
- const proto = {};
+ get attr() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Enum.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return utils.tryWrapperForImpl(this[impl][\\"attr\\"]);
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ set attr(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = \`\${V}\`;
+ if (!RequestDestination.enumerationValues.has(V)) {
+ return;
+ }
+
+ this[impl][\\"attr\\"] = V;
+ }
+ }
+ Object.defineProperties(Enum.prototype, {
+ op: { enumerable: true },
+ attr: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Enum\\", configurable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"Enum\\"] = ctor;
+ globalObject[ctorRegistry][\\"Enum\\"] = Enum;
Object.defineProperty(globalObject, \\"Enum\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Enum
});
}
}; // iface
@@ -649,8 +604,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Global {}
-Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -812,34 +765,21 @@ const iface = {
},
install(globalObject) {
- const ctor = function Global() {
- throw new TypeError(\\"Illegal constructor\\");
- };
-
- const proto = {};
-
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Global.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ class Global {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
+ }
+ Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"Global\\"] = ctor;
+ globalObject[ctorRegistry][\\"Global\\"] = Global;
Object.defineProperty(globalObject, \\"Global\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Global
});
}
}; // iface
@@ -858,20 +798,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class LegacyArrayClass {
- get length() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"length\\"];
- }
-}
-Object.setPrototypeOf(LegacyArrayClass.prototype, Array.prototype);
-Object.defineProperties(LegacyArrayClass.prototype, {
- length: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"LegacyArrayClass\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -948,34 +874,33 @@ const iface = {
},
install(globalObject) {
- const ctor = function LegacyArrayClass() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class LegacyArrayClass {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ get length() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(LegacyArrayClass.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl][\\"length\\"];
}
+ }
+ Object.setPrototypeOf(LegacyArrayClass.prototype, Array.prototype);
+ Object.defineProperties(LegacyArrayClass.prototype, {
+ length: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"LegacyArrayClass\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"LegacyArrayClass\\"] = ctor;
+ globalObject[ctorRegistry][\\"LegacyArrayClass\\"] = LegacyArrayClass;
Object.defineProperty(globalObject, \\"LegacyArrayClass\\", {
configurable: true,
writable: true,
- value: ctor
+ value: LegacyArrayClass
});
}
}; // iface
@@ -994,76 +919,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class MixedIn {
- mixedInOp() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].mixedInOp();
- }
-
- ifaceMixinOp() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].ifaceMixinOp();
- }
-
- get mixedInAttr() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"mixedInAttr\\"];
- }
-
- set mixedInAttr(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"DOMString\\"](V, {
- context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\"
- });
-
- this[impl][\\"mixedInAttr\\"] = V;
- }
-
- get ifaceMixinAttr() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"ifaceMixinAttr\\"];
- }
-
- set ifaceMixinAttr(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"DOMString\\"](V, {
- context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\"
- });
-
- this[impl][\\"ifaceMixinAttr\\"] = V;
- }
-}
-Object.defineProperties(MixedIn.prototype, {
- mixedInOp: { enumerable: true },
- ifaceMixinOp: { enumerable: true },
- mixedInAttr: { enumerable: true },
- ifaceMixinAttr: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"MixedIn\\", configurable: true },
- mixedInConst: { value: 43, enumerable: true },
- ifaceMixinConst: { value: 42, enumerable: true }
-});
-Object.defineProperties(MixedIn, {
- mixedInConst: { value: 43, enumerable: true },
- ifaceMixinConst: { value: 42, enumerable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -1140,39 +995,89 @@ const iface = {
},
install(globalObject) {
- const ctor = function MixedIn() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class MixedIn {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- Object.defineProperties(ctor, {
- mixedInConst: Object.getOwnPropertyDescriptor(MixedIn, \\"mixedInConst\\"),
- ifaceMixinConst: Object.getOwnPropertyDescriptor(MixedIn, \\"ifaceMixinConst\\")
- });
+ mixedInOp() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].mixedInOp();
+ }
+
+ ifaceMixinOp() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].ifaceMixinOp();
+ }
+
+ get mixedInAttr() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"mixedInAttr\\"];
+ }
+
+ set mixedInAttr(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"DOMString\\"](V, {
+ context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\"
+ });
+
+ this[impl][\\"mixedInAttr\\"] = V;
+ }
+
+ get ifaceMixinAttr() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"ifaceMixinAttr\\"];
+ }
+
+ set ifaceMixinAttr(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const proto = {};
+ V = conversions[\\"DOMString\\"](V, {
+ context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\"
+ });
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(MixedIn.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ this[impl][\\"ifaceMixinAttr\\"] = V;
}
+ }
+ Object.defineProperties(MixedIn.prototype, {
+ mixedInOp: { enumerable: true },
+ ifaceMixinOp: { enumerable: true },
+ mixedInAttr: { enumerable: true },
+ ifaceMixinAttr: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"MixedIn\\", configurable: true },
+ mixedInConst: { value: 43, enumerable: true },
+ ifaceMixinConst: { value: 42, enumerable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
+ Object.defineProperties(MixedIn, {
+ mixedInConst: { value: 43, enumerable: true },
+ ifaceMixinConst: { value: 42, enumerable: true }
});
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"MixedIn\\"] = ctor;
+ globalObject[ctorRegistry][\\"MixedIn\\"] = MixedIn;
Object.defineProperty(globalObject, \\"MixedIn\\", {
configurable: true,
writable: true,
- value: ctor
+ value: MixedIn
});
}
}; // iface
@@ -1188,301 +1093,11 @@ exports[`Overloads.webidl 1`] = `
const conversions = require(\\"webidl-conversions\\");
const utils = require(\\"./utils.js\\");
-const convertURL = require(\\"./URL.js\\").convert;
const isURL = require(\\"./URL.js\\").is;
+const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Overloads {
- compatible(arg1) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'compatible' on 'Overloads': 1 argument required, but only \\" + arguments.length + \\" present.\\"
- );
- }
- const args = [];
- switch (arguments.length) {
- case 1:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- break;
- case 2:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\"
- });
- args.push(curArg);
- }
- break;
- default:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[2];
- if (curArg !== undefined) {
- curArg = conversions[\\"long\\"](curArg, {
- context: \\"Failed to execute 'compatible' on 'Overloads': parameter 3\\"
- });
- } else {
- curArg = 0;
- }
- args.push(curArg);
- }
- }
- return utils.tryWrapperForImpl(this[impl].compatible(...args));
- }
-
- incompatible1(arg1) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'incompatible1' on 'Overloads': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (typeof curArg === \\"number\\") {
- {
- let curArg = arguments[0];
- curArg = conversions[\\"long\\"](curArg, {
- context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- } else {
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible1' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- }
- }
- return this[impl].incompatible1(...args);
- }
-
- incompatible2(arg1) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- switch (arguments.length) {
- case 1:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- break;
- default:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 2\\"
- });
- args.push(curArg);
- }
- }
- return this[impl].incompatible2(...args);
- }
-
- incompatible3(arg1) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- switch (arguments.length) {
- case 1:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- break;
- case 2:
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- if (curArg === undefined) {
- {
- let curArg = arguments[1];
- if (curArg !== undefined) {
- curArg = convertURL(curArg, {
- context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
- });
- }
- args.push(curArg);
- }
- } else if (isURL(curArg)) {
- {
- let curArg = arguments[1];
- if (curArg !== undefined) {
- curArg = convertURL(curArg, {
- context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
- });
- }
- args.push(curArg);
- }
- } else if (
- curArg instanceof ArrayBuffer ||
- (typeof SharedArrayBuffer !== \\"undefined\\" && curArg instanceof SharedArrayBuffer)
- ) {
- {
- let curArg = arguments[1];
- if (curArg instanceof ArrayBuffer) {
- } else if (ArrayBuffer.isView(curArg)) {
- } else {
- throw new TypeError(
- \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\"
- );
- }
- args.push(curArg);
- }
- } else if (ArrayBuffer.isView(curArg)) {
- {
- let curArg = arguments[1];
- if (curArg instanceof ArrayBuffer) {
- } else if (ArrayBuffer.isView(curArg)) {
- } else {
- throw new TypeError(
- \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\"
- );
- }
- args.push(curArg);
- }
- } else {
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
- });
- args.push(curArg);
- }
- }
- }
- break;
- case 3:
- throw new 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\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"long\\"](curArg, {
- context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[2];
- if (curArg instanceof ArrayBuffer) {
- } else if (ArrayBuffer.isView(curArg)) {
- } else {
- throw new TypeError(
- \\"Failed to execute 'incompatible3' on 'Overloads': parameter 3\\" + \\" is not of any supported type.\\"
- );
- }
- args.push(curArg);
- }
- {
- let curArg = arguments[3];
- if (curArg instanceof ArrayBuffer) {
- } else if (ArrayBuffer.isView(curArg)) {
- } else {
- throw new TypeError(
- \\"Failed to execute 'incompatible3' on 'Overloads': parameter 4\\" + \\" is not of any supported type.\\"
- );
- }
- args.push(curArg);
- }
- }
- return this[impl].incompatible3(...args);
- }
-}
-Object.defineProperties(Overloads.prototype, {
- compatible: { enumerable: true },
- incompatible1: { enumerable: true },
- incompatible2: { enumerable: true },
- incompatible3: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Overloads\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -1559,55 +1174,332 @@ const iface = {
},
install(globalObject) {
- const ctor = function Overloads() {
- const args = [];
- switch (arguments.length) {
- case 0:
- break;
- default: {
+ class Overloads {
+ constructor() {
+ const args = [];
+ switch (arguments.length) {
+ case 0:
+ break;
+ default: {
+ let curArg = arguments[0];
+ if (isURL(curArg)) {
+ {
+ let curArg = arguments[0];
+ curArg = convertURL(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\\" });
+ args.push(curArg);
+ }
+ }
+ }
+ }
+ return iface.setup(Object.create(new.target.prototype), globalObject, args);
+ }
+
+ compatible(arg1) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'compatible' on 'Overloads': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ switch (arguments.length) {
+ case 1:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ break;
+ case 2:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ break;
+ default:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'compatible' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'compatible' on 'Overloads': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[2];
+ if (curArg !== undefined) {
+ curArg = conversions[\\"long\\"](curArg, {
+ context: \\"Failed to execute 'compatible' on 'Overloads': parameter 3\\"
+ });
+ } else {
+ curArg = 0;
+ }
+ args.push(curArg);
+ }
+ }
+ return utils.tryWrapperForImpl(this[impl].compatible(...args));
+ }
+
+ incompatible1(arg1) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible1' on 'Overloads': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
let curArg = arguments[0];
- if (isURL(curArg)) {
+ if (typeof curArg === \\"number\\") {
{
let curArg = arguments[0];
- curArg = convertURL(curArg, { context: \\"Failed to construct 'Overloads': parameter 1\\" });
+ curArg = conversions[\\"long\\"](curArg, {
+ context: \\"Failed to execute 'incompatible1' on '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 execute 'incompatible1' on 'Overloads': parameter 1\\"
+ });
args.push(curArg);
}
}
}
+ return this[impl].incompatible1(...args);
}
- return iface.setup(Object.create(new.target.prototype), globalObject, args);
- };
-
- const proto = {};
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Overloads.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
- }
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ incompatible2(arg1) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = Object.create(null);
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ switch (arguments.length) {
+ case 1:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ break;
+ default:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'incompatible2' on 'Overloads': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ }
+ return this[impl].incompatible2(...args);
+ }
+
+ incompatible3(arg1) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ switch (arguments.length) {
+ case 1:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ break;
+ case 2:
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ if (curArg === undefined) {
+ {
+ let curArg = arguments[1];
+ if (curArg !== undefined) {
+ curArg = convertURL(curArg, {
+ context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
+ });
+ }
+ args.push(curArg);
+ }
+ } else if (isURL(curArg)) {
+ {
+ let curArg = arguments[1];
+ if (curArg !== undefined) {
+ curArg = convertURL(curArg, {
+ context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
+ });
+ }
+ args.push(curArg);
+ }
+ } else if (
+ curArg instanceof ArrayBuffer ||
+ (typeof SharedArrayBuffer !== \\"undefined\\" && curArg instanceof SharedArrayBuffer)
+ ) {
+ {
+ let curArg = arguments[1];
+ if (curArg instanceof ArrayBuffer) {
+ } else if (ArrayBuffer.isView(curArg)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\"
+ );
+ }
+ args.push(curArg);
+ }
+ } else if (ArrayBuffer.isView(curArg)) {
+ {
+ let curArg = arguments[1];
+ if (curArg instanceof ArrayBuffer) {
+ } else if (ArrayBuffer.isView(curArg)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + \\" is not of any supported type.\\"
+ );
+ }
+ args.push(curArg);
+ }
+ } else {
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ }
+ }
+ break;
+ case 3:
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"long\\"](curArg, {
+ context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[2];
+ if (curArg instanceof ArrayBuffer) {
+ } else if (ArrayBuffer.isView(curArg)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible3' on 'Overloads': parameter 3\\" + \\" is not of any supported type.\\"
+ );
+ }
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[3];
+ if (curArg instanceof ArrayBuffer) {
+ } else if (ArrayBuffer.isView(curArg)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'incompatible3' on 'Overloads': parameter 4\\" + \\" is not of any supported type.\\"
+ );
+ }
+ args.push(curArg);
+ }
+ }
+ return this[impl].incompatible3(...args);
+ }
+ }
+ Object.defineProperties(Overloads.prototype, {
+ compatible: { enumerable: true },
+ incompatible1: { enumerable: true },
+ incompatible2: { enumerable: true },
+ incompatible3: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Overloads\\", configurable: true }
+ });
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"Overloads\\"] = ctor;
+ globalObject[ctorRegistry][\\"Overloads\\"] = Overloads;
Object.defineProperty(globalObject, \\"Overloads\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Overloads
});
}
}; // iface
@@ -1626,63 +1518,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class PromiseTypes {
- voidPromiseConsumer(p) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'voidPromiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- curArg = Promise.resolve(curArg).then(value => {}, reason => reason);
- args.push(curArg);
- }
- return this[impl].voidPromiseConsumer(...args);
- }
-
- promiseConsumer(p) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'promiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- curArg = Promise.resolve(curArg).then(
- value => {
- value = conversions[\\"double\\"](value, {
- context: \\"Failed to execute 'promiseConsumer' on 'PromiseTypes': parameter 1\\" + \\" promise value\\"
- });
-
- return value;
- },
- reason => reason
- );
- args.push(curArg);
- }
- return this[impl].promiseConsumer(...args);
- }
-}
-Object.defineProperties(PromiseTypes.prototype, {
- voidPromiseConsumer: { enumerable: true },
- promiseConsumer: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"PromiseTypes\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -1759,34 +1594,76 @@ const iface = {
},
install(globalObject) {
- const ctor = function PromiseTypes() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class PromiseTypes {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ voidPromiseConsumer(p) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'voidPromiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ curArg = Promise.resolve(curArg).then(value => {}, reason => reason);
+ args.push(curArg);
+ }
+ return this[impl].voidPromiseConsumer(...args);
+ }
+
+ promiseConsumer(p) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const proto = {};
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'promiseConsumer' on 'PromiseTypes': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ curArg = Promise.resolve(curArg).then(
+ value => {
+ value = conversions[\\"double\\"](value, {
+ context: \\"Failed to execute 'promiseConsumer' on 'PromiseTypes': parameter 1\\" + \\" promise value\\"
+ });
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(PromiseTypes.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return value;
+ },
+ reason => reason
+ );
+ args.push(curArg);
+ }
+ return this[impl].promiseConsumer(...args);
}
+ }
+ Object.defineProperties(PromiseTypes.prototype, {
+ voidPromiseConsumer: { enumerable: true },
+ promiseConsumer: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"PromiseTypes\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"PromiseTypes\\"] = ctor;
+ globalObject[ctorRegistry][\\"PromiseTypes\\"] = PromiseTypes;
Object.defineProperty(globalObject, \\"PromiseTypes\\", {
configurable: true,
writable: true,
- value: ctor
+ value: PromiseTypes
});
}
}; // iface
@@ -1805,145 +1682,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Reflect {
- get ReflectedBoolean() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].hasAttributeNS(null, \\"reflectedboolean\\");
- }
-
- set ReflectedBoolean(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"boolean\\"](V, {
- context: \\"Failed to set the 'ReflectedBoolean' property on 'Reflect': The provided value\\"
- });
-
- if (V) {
- this[impl].setAttributeNS(null, \\"reflectedboolean\\", \\"\\");
- } else {
- this[impl].removeAttributeNS(null, \\"reflectedboolean\\");
- }
- }
-
- get ReflectedDOMString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- const value = this[impl].getAttributeNS(null, \\"reflecteddomstring\\");
- return value === null ? \\"\\" : value;
- }
-
- set ReflectedDOMString(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"DOMString\\"](V, {
- context: \\"Failed to set the 'ReflectedDOMString' property on 'Reflect': The provided value\\"
- });
-
- this[impl].setAttributeNS(null, \\"reflecteddomstring\\", V);
- }
-
- get ReflectedLong() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- const value = parseInt(this[impl].getAttributeNS(null, \\"reflectedlong\\"));
- return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value;
- }
-
- set ReflectedLong(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"long\\"](V, {
- context: \\"Failed to set the 'ReflectedLong' property on 'Reflect': The provided value\\"
- });
-
- this[impl].setAttributeNS(null, \\"reflectedlong\\", String(V));
- }
-
- get ReflectedUnsignedLong() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- const value = parseInt(this[impl].getAttributeNS(null, \\"reflectedunsignedlong\\"));
- return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
- }
-
- set ReflectedUnsignedLong(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"unsigned long\\"](V, {
- context: \\"Failed to set the 'ReflectedUnsignedLong' property on 'Reflect': The provided value\\"
- });
-
- this[impl].setAttributeNS(null, \\"reflectedunsignedlong\\", String(V > 2147483647 ? 0 : V));
- }
-
- get ReflectionTest() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- const value = this[impl].getAttributeNS(null, \\"reflection\\");
- return value === null ? \\"\\" : value;
- }
-
- set ReflectionTest(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"DOMString\\"](V, {
- context: \\"Failed to set the 'ReflectionTest' property on 'Reflect': The provided value\\"
- });
-
- this[impl].setAttributeNS(null, \\"reflection\\", V);
- }
-
- get withUnderscore() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- const value = this[impl].getAttributeNS(null, \\"with-underscore\\");
- return value === null ? \\"\\" : value;
- }
-
- set withUnderscore(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"DOMString\\"](V, {
- context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\"
- });
-
- this[impl].setAttributeNS(null, \\"with-underscore\\", V);
- }
-}
-Object.defineProperties(Reflect.prototype, {
- ReflectedBoolean: { enumerable: true },
- ReflectedDOMString: { enumerable: true },
- ReflectedLong: { enumerable: true },
- ReflectedUnsignedLong: { enumerable: true },
- ReflectionTest: { enumerable: true },
- withUnderscore: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Reflect\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -2020,458 +1758,211 @@ const iface = {
},
install(globalObject) {
- const ctor = function Reflect() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class Reflect {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ get ReflectedBoolean() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Reflect.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl].hasAttributeNS(null, \\"reflectedboolean\\");
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
- if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = Object.create(null);
- }
- globalObject[ctorRegistry][\\"Reflect\\"] = ctor;
+ set ReflectedBoolean(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperty(globalObject, \\"Reflect\\", {
- configurable: true,
- writable: true,
- value: ctor
- });
- }
-}; // iface
-module.exports = iface;
+ V = conversions[\\"boolean\\"](V, {
+ context: \\"Failed to set the 'ReflectedBoolean' property on 'Reflect': The provided value\\"
+ });
-const Impl = require(\\"../implementations/Reflect.js\\");
-"
-`;
+ if (V) {
+ this[impl].setAttributeNS(null, \\"reflectedboolean\\", \\"\\");
+ } else {
+ this[impl].removeAttributeNS(null, \\"reflectedboolean\\");
+ }
+ }
-exports[`RequestDestination.webidl 1`] = `
-"\\"use strict\\";
+ get ReflectedDOMString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
-const enumerationValues = new Set([
- \\"\\",
- \\"audio\\",
- \\"document\\",
- \\"embed\\",
- \\"font\\",
- \\"image\\",
- \\"manifest\\",
- \\"object\\",
- \\"report\\",
- \\"script\\",
- \\"sharedworker\\",
- \\"style\\",
- \\"track\\",
- \\"video\\",
- \\"worker\\",
- \\"xslt\\"
-]);
-module.exports = {
- enumerationValues,
- convert(value, { context = \\"The provided value\\" } = {}) {
- const string = \`\${value}\`;
- if (!enumerationValues.has(value)) {
- throw new TypeError(\`\${context} '\${value}' is not a valid enumeration value for RequestDestination\`);
- }
- return string;
- }
-};
-"
-`;
-
-exports[`SeqAndRec.webidl 1`] = `
-"\\"use strict\\";
-
-const conversions = require(\\"webidl-conversions\\");
-const utils = require(\\"./utils.js\\");
-
-const convertURL = require(\\"./URL.js\\").convert;
-const impl = utils.implSymbol;
-const ctorRegistry = utils.ctorRegistrySymbol;
-
-class SeqAndRec {
- recordConsumer(rec) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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.\\");
- } else {
- const result = Object.create(null);
- for (const key of Reflect.ownKeys(curArg)) {
- const desc = Object.getOwnPropertyDescriptor(curArg, key);
- if (desc && desc.enumerable) {
- let typedKey = key;
-
- typedKey = conversions[\\"USVString\\"](typedKey, {
- context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\"
- });
-
- let typedValue = curArg[key];
-
- typedValue = conversions[\\"double\\"](typedValue, {
- context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\"
- });
-
- result[typedKey] = typedValue;
- }
- }
- curArg = result;
+ const value = this[impl].getAttributeNS(null, \\"reflecteddomstring\\");
+ return value === null ? \\"\\" : value;
}
- args.push(curArg);
- }
- return this[impl].recordConsumer(...args);
- }
-
- recordConsumer2(rec) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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.\\");
- } else {
- const result = Object.create(null);
- for (const key of Reflect.ownKeys(curArg)) {
- const desc = Object.getOwnPropertyDescriptor(curArg, key);
- if (desc && desc.enumerable) {
- let typedKey = key;
-
- typedKey = conversions[\\"USVString\\"](typedKey, {
- context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\"
- });
- let typedValue = curArg[key];
+ set ReflectedDOMString(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- typedValue = convertURL(typedValue, {
- context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\"
- });
+ V = conversions[\\"DOMString\\"](V, {
+ context: \\"Failed to set the 'ReflectedDOMString' property on 'Reflect': The provided value\\"
+ });
- result[typedKey] = typedValue;
- }
- }
- curArg = result;
+ this[impl].setAttributeNS(null, \\"reflecteddomstring\\", V);
}
- args.push(curArg);
- }
- return this[impl].recordConsumer2(...args);
- }
- sequenceConsumer(seq) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ get ReflectedLong() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (arguments.length < 1) {
- throw new 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(
- \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = curArg;
- for (let nextItem of tmp) {
- nextItem = conversions[\\"USVString\\"](nextItem, {
- context: \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\"
- });
+ const value = parseInt(this[impl].getAttributeNS(null, \\"reflectedlong\\"));
+ return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value;
+ }
- V.push(nextItem);
+ set ReflectedLong(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
}
- curArg = V;
- }
- args.push(curArg);
- }
- return this[impl].sequenceConsumer(...args);
- }
- sequenceConsumer2(seq) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ V = conversions[\\"long\\"](V, {
+ context: \\"Failed to set the 'ReflectedLong' property on 'Reflect': The provided value\\"
+ });
- if (arguments.length < 1) {
- throw new 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(
- \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = curArg;
- for (let nextItem of tmp) {
- nextItem = utils.tryImplForWrapper(nextItem);
+ this[impl].setAttributeNS(null, \\"reflectedlong\\", String(V));
+ }
- V.push(nextItem);
+ get ReflectedUnsignedLong() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
}
- curArg = V;
+
+ const value = parseInt(this[impl].getAttributeNS(null, \\"reflectedunsignedlong\\"));
+ return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value;
}
- args.push(curArg);
- }
- return this[impl].sequenceConsumer2(...args);
- }
- frozenArrayConsumer(arr) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ set ReflectedUnsignedLong(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (arguments.length < 1) {
- throw new 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(
- \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = curArg;
- for (let nextItem of tmp) {
- nextItem = conversions[\\"double\\"](nextItem, {
- context: \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\"
- });
+ V = conversions[\\"unsigned long\\"](V, {
+ context: \\"Failed to set the 'ReflectedUnsignedLong' property on 'Reflect': The provided value\\"
+ });
- V.push(nextItem);
- }
- curArg = V;
- }
- curArg = Object.freeze(curArg);
- args.push(curArg);
- }
- return this[impl].frozenArrayConsumer(...args);
- }
-}
-Object.defineProperties(SeqAndRec.prototype, {
- recordConsumer: { enumerable: true },
- recordConsumer2: { enumerable: true },
- sequenceConsumer: { enumerable: true },
- sequenceConsumer2: { enumerable: true },
- frozenArrayConsumer: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"SeqAndRec\\", configurable: true }
-});
-const iface = {
- // When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
- // method into this array. It allows objects that directly implements *those* interfaces to be recognized as
- // implementing this mixin interface.
- _mixedIntoPredicates: [],
- is(obj) {
- if (obj) {
- if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
- return true;
- }
- for (const isMixedInto of module.exports._mixedIntoPredicates) {
- if (isMixedInto(obj)) {
- return true;
- }
- }
- }
- return false;
- },
- isImpl(obj) {
- if (obj) {
- if (obj instanceof Impl.implementation) {
- return true;
+ this[impl].setAttributeNS(null, \\"reflectedunsignedlong\\", String(V > 2147483647 ? 0 : V));
}
- const wrapper = utils.wrapperForImpl(obj);
- for (const isMixedInto of module.exports._mixedIntoPredicates) {
- if (isMixedInto(wrapper)) {
- return true;
+ get ReflectionTest() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
}
+
+ const value = this[impl].getAttributeNS(null, \\"reflection\\");
+ return value === null ? \\"\\" : value;
}
- }
- return false;
- },
- convert(obj, { context = \\"The provided value\\" } = {}) {
- if (module.exports.is(obj)) {
- return utils.implForWrapper(obj);
- }
- throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`);
- },
- create(globalObject, constructorArgs, privateData) {
- if (globalObject[ctorRegistry] === undefined) {
- throw new Error(\\"Internal error: invalid global object\\");
- }
+ set ReflectionTest(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const ctor = globalObject[ctorRegistry][\\"SeqAndRec\\"];
- if (ctor === undefined) {
- throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\");
- }
+ V = conversions[\\"DOMString\\"](V, {
+ context: \\"Failed to set the 'ReflectionTest' property on 'Reflect': The provided value\\"
+ });
- let obj = Object.create(ctor.prototype);
- obj = iface.setup(obj, globalObject, constructorArgs, privateData);
- return obj;
- },
- createImpl(globalObject, constructorArgs, privateData) {
- const obj = iface.create(globalObject, constructorArgs, privateData);
- return utils.implForWrapper(obj);
- },
- _internalSetup(obj) {},
- setup(obj, globalObject, constructorArgs = [], privateData = {}) {
- privateData.wrapper = obj;
+ this[impl].setAttributeNS(null, \\"reflection\\", V);
+ }
- iface._internalSetup(obj);
- Object.defineProperty(obj, impl, {
- value: new Impl.implementation(globalObject, constructorArgs, privateData),
- configurable: true
- });
+ get withUnderscore() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- obj[impl][utils.wrapperSymbol] = obj;
- if (Impl.init) {
- Impl.init(obj[impl], privateData);
- }
- return obj;
- },
+ const value = this[impl].getAttributeNS(null, \\"with-underscore\\");
+ return value === null ? \\"\\" : value;
+ }
- install(globalObject) {
- const ctor = function SeqAndRec() {
- return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
- };
+ set withUnderscore(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const proto = {};
+ V = conversions[\\"DOMString\\"](V, {
+ context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\"
+ });
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(SeqAndRec.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ this[impl].setAttributeNS(null, \\"with-underscore\\", V);
}
+ }
+ Object.defineProperties(Reflect.prototype, {
+ ReflectedBoolean: { enumerable: true },
+ ReflectedDOMString: { enumerable: true },
+ ReflectedLong: { enumerable: true },
+ ReflectedUnsignedLong: { enumerable: true },
+ ReflectionTest: { enumerable: true },
+ withUnderscore: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Reflect\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"SeqAndRec\\"] = ctor;
+ globalObject[ctorRegistry][\\"Reflect\\"] = Reflect;
- Object.defineProperty(globalObject, \\"SeqAndRec\\", {
+ Object.defineProperty(globalObject, \\"Reflect\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Reflect
});
}
}; // iface
module.exports = iface;
-const Impl = require(\\"../implementations/SeqAndRec.js\\");
+const Impl = require(\\"../implementations/Reflect.js\\");
"
`;
-exports[`Static.webidl 1`] = `
+exports[`RequestDestination.webidl 1`] = `
"\\"use strict\\";
-const conversions = require(\\"webidl-conversions\\");
-const utils = require(\\"./utils.js\\");
-
-const impl = utils.implSymbol;
-const ctorRegistry = utils.ctorRegistrySymbol;
-
-class Static {
- def() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].def();
- }
-
- get abc() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
+const enumerationValues = new Set([
+ \\"\\",
+ \\"audio\\",
+ \\"document\\",
+ \\"embed\\",
+ \\"font\\",
+ \\"image\\",
+ \\"manifest\\",
+ \\"object\\",
+ \\"report\\",
+ \\"script\\",
+ \\"sharedworker\\",
+ \\"style\\",
+ \\"track\\",
+ \\"video\\",
+ \\"worker\\",
+ \\"xslt\\"
+]);
+module.exports = {
+ enumerationValues,
+ convert(value, { context = \\"The provided value\\" } = {}) {
+ const string = \`\${value}\`;
+ if (!enumerationValues.has(value)) {
+ throw new TypeError(\`\${context} '\${value}' is not a valid enumeration value for RequestDestination\`);
}
-
- return this[impl][\\"abc\\"];
+ return string;
}
+};
+"
+`;
- set abc(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" });
-
- this[impl][\\"abc\\"] = V;
- }
+exports[`SeqAndRec.webidl 1`] = `
+"\\"use strict\\";
- static def() {
- return Impl.implementation.def();
- }
+const conversions = require(\\"webidl-conversions\\");
+const utils = require(\\"./utils.js\\");
- static get abc() {
- return Impl.implementation[\\"abc\\"];
- }
+const convertURL = require(\\"./URL.js\\").convert;
+const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
- static set abc(V) {
- return Impl.implementation[\\"abc\\"];
- }
-}
-Object.defineProperties(Static.prototype, {
- def: { enumerable: true },
- abc: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Static\\", configurable: true }
-});
-Object.defineProperties(Static, { def: { enumerable: true }, abc: { enumerable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -2509,7 +2000,7 @@ const iface = {
if (module.exports.is(obj)) {
return utils.implForWrapper(obj);
}
- throw new TypeError(\`\${context} is not of type 'Static'.\`);
+ throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`);
},
create(globalObject, constructorArgs, privateData) {
@@ -2517,9 +2008,9 @@ const iface = {
throw new Error(\\"Internal error: invalid global object\\");
}
- const ctor = globalObject[ctorRegistry][\\"Static\\"];
+ const ctor = globalObject[ctorRegistry][\\"SeqAndRec\\"];
if (ctor === undefined) {
- throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\");
+ throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\");
}
let obj = Object.create(ctor.prototype);
@@ -2548,49 +2039,237 @@ const iface = {
},
install(globalObject) {
- const ctor = function Static() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class SeqAndRec {
+ constructor() {
+ return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
+ }
- Object.defineProperties(ctor, {
- def: Object.getOwnPropertyDescriptor(Static, \\"def\\"),
- abc: Object.getOwnPropertyDescriptor(Static, \\"abc\\")
- });
+ recordConsumer(rec) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const proto = {};
+ if (arguments.length < 1) {
+ throw new 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.\\"
+ );
+ } else {
+ const result = Object.create(null);
+ for (const key of Reflect.ownKeys(curArg)) {
+ const desc = Object.getOwnPropertyDescriptor(curArg, key);
+ if (desc && desc.enumerable) {
+ let typedKey = key;
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Static.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
- }
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ typedKey = conversions[\\"USVString\\"](typedKey, {
+ context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\"
+ });
- if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = Object.create(null);
- }
- globalObject[ctorRegistry][\\"Static\\"] = ctor;
+ let typedValue = curArg[key];
- Object.defineProperty(globalObject, \\"Static\\", {
- configurable: true,
- writable: true,
- value: ctor
- });
+ typedValue = conversions[\\"double\\"](typedValue, {
+ context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\"
+ });
+
+ result[typedKey] = typedValue;
+ }
+ }
+ curArg = result;
+ }
+ args.push(curArg);
+ }
+ return this[impl].recordConsumer(...args);
+ }
+
+ recordConsumer2(rec) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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.\\"
+ );
+ } else {
+ const result = Object.create(null);
+ for (const key of Reflect.ownKeys(curArg)) {
+ const desc = Object.getOwnPropertyDescriptor(curArg, key);
+ if (desc && desc.enumerable) {
+ let typedKey = key;
+
+ typedKey = conversions[\\"USVString\\"](typedKey, {
+ context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\"
+ });
+
+ let typedValue = curArg[key];
+
+ typedValue = convertURL(typedValue, {
+ context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\"
+ });
+
+ result[typedKey] = typedValue;
+ }
+ }
+ curArg = result;
+ }
+ args.push(curArg);
+ }
+ return this[impl].recordConsumer2(...args);
+ }
+
+ sequenceConsumer(seq) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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(
+ \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = curArg;
+ for (let nextItem of tmp) {
+ nextItem = conversions[\\"USVString\\"](nextItem, {
+ context: \\"Failed to execute 'sequenceConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\"
+ });
+
+ V.push(nextItem);
+ }
+ curArg = V;
+ }
+ args.push(curArg);
+ }
+ return this[impl].sequenceConsumer(...args);
+ }
+
+ sequenceConsumer2(seq) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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(
+ \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = curArg;
+ for (let nextItem of tmp) {
+ nextItem = utils.tryImplForWrapper(nextItem);
+
+ V.push(nextItem);
+ }
+ curArg = V;
+ }
+ args.push(curArg);
+ }
+ return this[impl].sequenceConsumer2(...args);
+ }
+
+ frozenArrayConsumer(arr) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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(
+ \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = curArg;
+ for (let nextItem of tmp) {
+ nextItem = conversions[\\"double\\"](nextItem, {
+ context: \\"Failed to execute 'frozenArrayConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s element\\"
+ });
+
+ V.push(nextItem);
+ }
+ curArg = V;
+ }
+ curArg = Object.freeze(curArg);
+ args.push(curArg);
+ }
+ return this[impl].frozenArrayConsumer(...args);
+ }
+ }
+ Object.defineProperties(SeqAndRec.prototype, {
+ recordConsumer: { enumerable: true },
+ recordConsumer2: { enumerable: true },
+ sequenceConsumer: { enumerable: true },
+ sequenceConsumer2: { enumerable: true },
+ frozenArrayConsumer: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"SeqAndRec\\", configurable: true }
+ });
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = Object.create(null);
+ }
+ globalObject[ctorRegistry][\\"SeqAndRec\\"] = SeqAndRec;
+
+ Object.defineProperty(globalObject, \\"SeqAndRec\\", {
+ configurable: true,
+ writable: true,
+ value: SeqAndRec
+ });
}
}; // iface
module.exports = iface;
-const Impl = require(\\"../implementations/Static.js\\");
+const Impl = require(\\"../implementations/SeqAndRec.js\\");
"
`;
-exports[`Storage.webidl 1`] = `
+exports[`Static.webidl 1`] = `
"\\"use strict\\";
const conversions = require(\\"webidl-conversions\\");
@@ -2599,115 +2278,160 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Storage {
- key(index) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
+const iface = {
+ // When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
+ // method into this array. It allows objects that directly implements *those* interfaces to be recognized as
+ // implementing this mixin interface.
+ _mixedIntoPredicates: [],
+ is(obj) {
+ if (obj) {
+ if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
+ return true;
+ }
+ for (const isMixedInto of module.exports._mixedIntoPredicates) {
+ if (isMixedInto(obj)) {
+ return true;
+ }
+ }
}
+ return false;
+ },
+ isImpl(obj) {
+ if (obj) {
+ if (obj instanceof Impl.implementation) {
+ return true;
+ }
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'key' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\"
- );
+ const wrapper = utils.wrapperForImpl(obj);
+ for (const isMixedInto of module.exports._mixedIntoPredicates) {
+ if (isMixedInto(wrapper)) {
+ return true;
+ }
+ }
}
- const args = [];
- {
- let curArg = arguments[0];
- curArg = conversions[\\"unsigned long\\"](curArg, { context: \\"Failed to execute 'key' on 'Storage': parameter 1\\" });
- args.push(curArg);
+ return false;
+ },
+ convert(obj, { context = \\"The provided value\\" } = {}) {
+ if (module.exports.is(obj)) {
+ return utils.implForWrapper(obj);
}
- return this[impl].key(...args);
- }
+ throw new TypeError(\`\${context} is not of type 'Static'.\`);
+ },
- getItem(key) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new Error(\\"Internal error: invalid global object\\");
}
- if (arguments.length < 1) {
- throw new 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\\" });
- args.push(curArg);
+ const ctor = globalObject[ctorRegistry][\\"Static\\"];
+ if (ctor === undefined) {
+ throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\");
}
- return this[impl].getItem(...args);
- }
- setItem(key, value) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ let obj = Object.create(ctor.prototype);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
+ return obj;
+ },
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
+ return utils.implForWrapper(obj);
+ },
+ _internalSetup(obj) {},
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
+ privateData.wrapper = obj;
- if (arguments.length < 2) {
- throw new 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\\" });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\" });
- args.push(curArg);
- }
- return this[impl].setItem(...args);
- }
+ iface._internalSetup(obj);
+ Object.defineProperty(obj, impl, {
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
+ configurable: true
+ });
- removeItem(key) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
+ obj[impl][utils.wrapperSymbol] = obj;
+ if (Impl.init) {
+ Impl.init(obj[impl], privateData);
}
+ return obj;
+ },
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'removeItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\"
- );
+ install(globalObject) {
+ class Static {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ def() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].def();
+ }
+
+ get abc() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"abc\\"];
+ }
+
+ set abc(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"DOMString\\"](V, {
+ context: \\"Failed to set the 'abc' property on 'Static': The provided value\\"
+ });
+
+ this[impl][\\"abc\\"] = V;
+ }
+
+ static def() {
+ return Impl.implementation.def();
+ }
+
+ static get abc() {
+ return Impl.implementation[\\"abc\\"];
+ }
+
+ static set abc(V) {
+ return Impl.implementation[\\"abc\\"];
+ }
}
- const args = [];
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'removeItem' on 'Storage': parameter 1\\"
- });
- args.push(curArg);
+ Object.defineProperties(Static.prototype, {
+ def: { enumerable: true },
+ abc: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Static\\", configurable: true }
+ });
+ Object.defineProperties(Static, { def: { enumerable: true }, abc: { enumerable: true } });
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = Object.create(null);
}
- return this[impl].removeItem(...args);
+ globalObject[ctorRegistry][\\"Static\\"] = Static;
+
+ Object.defineProperty(globalObject, \\"Static\\", {
+ configurable: true,
+ writable: true,
+ value: Static
+ });
}
+}; // iface
+module.exports = iface;
- clear() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+const Impl = require(\\"../implementations/Static.js\\");
+"
+`;
- return this[impl].clear();
- }
+exports[`Storage.webidl 1`] = `
+"\\"use strict\\";
- get length() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+const conversions = require(\\"webidl-conversions\\");
+const utils = require(\\"./utils.js\\");
+
+const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
- return this[impl][\\"length\\"];
- }
-}
-Object.defineProperties(Storage.prototype, {
- key: { enumerable: true },
- getItem: { enumerable: true },
- setItem: { enumerable: true },
- removeItem: { enumerable: true },
- clear: { enumerable: true },
- length: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Storage\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -2948,34 +2672,138 @@ const iface = {
},
install(globalObject) {
- const ctor = function Storage() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class Storage {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ key(index) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Storage.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].key(...args);
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
- if (globalObject[ctorRegistry] === undefined) {
- globalObject[ctorRegistry] = Object.create(null);
- }
- globalObject[ctorRegistry][\\"Storage\\"] = ctor;
+ getItem(key) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].getItem(...args);
+ }
+
+ setItem(key, value) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 2) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].setItem(...args);
+ }
+
+ removeItem(key) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].removeItem(...args);
+ }
+
+ clear() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].clear();
+ }
+
+ get length() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"length\\"];
+ }
+ }
+ Object.defineProperties(Storage.prototype, {
+ key: { enumerable: true },
+ getItem: { enumerable: true },
+ setItem: { enumerable: true },
+ removeItem: { enumerable: true },
+ clear: { enumerable: true },
+ length: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Storage\\", configurable: true }
+ });
+ if (globalObject[ctorRegistry] === undefined) {
+ globalObject[ctorRegistry] = Object.create(null);
+ }
+ globalObject[ctorRegistry][\\"Storage\\"] = Storage;
Object.defineProperty(globalObject, \\"Storage\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Storage
});
}
}; // iface
@@ -2994,27 +2822,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierAttribute {
- get attr() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"attr\\"];
- }
-
- toString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- return this[impl][\\"attr\\"];
- }
-}
-Object.defineProperties(StringifierAttribute.prototype, {
- attr: { enumerable: true },
- toString: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"StringifierAttribute\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -3091,34 +2898,40 @@ const iface = {
},
install(globalObject) {
- const ctor = function StringifierAttribute() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class StringifierAttribute {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ get attr() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(StringifierAttribute.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl][\\"attr\\"];
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ toString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ return this[impl][\\"attr\\"];
+ }
+ }
+ Object.defineProperties(StringifierAttribute.prototype, {
+ attr: { enumerable: true },
+ toString: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"StringifierAttribute\\", configurable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"StringifierAttribute\\"] = ctor;
+ globalObject[ctorRegistry][\\"StringifierAttribute\\"] = StringifierAttribute;
Object.defineProperty(globalObject, \\"StringifierAttribute\\", {
configurable: true,
writable: true,
- value: ctor
+ value: StringifierAttribute
});
}
}; // iface
@@ -3137,19 +2950,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierDefaultOperation {
- toString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].toString();
- }
-}
-Object.defineProperties(StringifierDefaultOperation.prototype, {
- toString: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"StringifierDefaultOperation\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -3228,34 +3028,32 @@ const iface = {
},
install(globalObject) {
- const ctor = function StringifierDefaultOperation() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class StringifierDefaultOperation {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ toString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(StringifierDefaultOperation.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl].toString();
}
+ }
+ Object.defineProperties(StringifierDefaultOperation.prototype, {
+ toString: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"StringifierDefaultOperation\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"] = ctor;
+ globalObject[ctorRegistry][\\"StringifierDefaultOperation\\"] = StringifierDefaultOperation;
Object.defineProperty(globalObject, \\"StringifierDefaultOperation\\", {
configurable: true,
writable: true,
- value: ctor
+ value: StringifierDefaultOperation
});
}
}; // iface
@@ -3274,28 +3072,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierNamedOperation {
- operation() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].operation();
- }
-
- toString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].operation();
- }
-}
-Object.defineProperties(StringifierNamedOperation.prototype, {
- operation: { enumerable: true },
- toString: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"StringifierNamedOperation\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -3374,34 +3150,41 @@ const iface = {
},
install(globalObject) {
- const ctor = function StringifierNamedOperation() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class StringifierNamedOperation {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ operation() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(StringifierNamedOperation.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl].operation();
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ toString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].operation();
+ }
+ }
+ Object.defineProperties(StringifierNamedOperation.prototype, {
+ operation: { enumerable: true },
+ toString: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"StringifierNamedOperation\\", configurable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"StringifierNamedOperation\\"] = ctor;
+ globalObject[ctorRegistry][\\"StringifierNamedOperation\\"] = StringifierNamedOperation;
Object.defineProperty(globalObject, \\"StringifierNamedOperation\\", {
configurable: true,
writable: true,
- value: ctor
+ value: StringifierNamedOperation
});
}
}; // iface
@@ -3420,19 +3203,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class StringifierOperation {
- toString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].toString();
- }
-}
-Object.defineProperties(StringifierOperation.prototype, {
- toString: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"StringifierOperation\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -3509,34 +3279,32 @@ const iface = {
},
install(globalObject) {
- const ctor = function StringifierOperation() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class StringifierOperation {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ toString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(StringifierOperation.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl].toString();
}
+ }
+ Object.defineProperties(StringifierOperation.prototype, {
+ toString: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"StringifierOperation\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"StringifierOperation\\"] = ctor;
+ globalObject[ctorRegistry][\\"StringifierOperation\\"] = StringifierOperation;
Object.defineProperty(globalObject, \\"StringifierOperation\\", {
configurable: true,
writable: true,
- value: ctor
+ value: StringifierOperation
});
}
}; // iface
@@ -3558,295 +3326,242 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class TypedefsAndUnions {
- numOrStrConsumer(a) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (typeof curArg === \\"number\\") {
- curArg = conversions[\\"double\\"](curArg, {
- context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\",
- clamp: true
- });
- } else {
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\"
- });
+const iface = {
+ // When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
+ // method into this array. It allows objects that directly implements *those* interfaces to be recognized as
+ // implementing this mixin interface.
+ _mixedIntoPredicates: [],
+ is(obj) {
+ if (obj) {
+ if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
+ return true;
}
- args.push(curArg);
- }
- return this[impl].numOrStrConsumer(...args);
- }
-
- numOrEnumConsumer(a) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- if (typeof curArg === \\"number\\") {
- curArg = conversions[\\"double\\"](curArg, {
- context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\"
- });
- } else {
- curArg = convertRequestDestination(curArg, {
- context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\"
- });
+ for (const isMixedInto of module.exports._mixedIntoPredicates) {
+ if (isMixedInto(obj)) {
+ return true;
}
}
- args.push(curArg);
- }
- return this[impl].numOrEnumConsumer(...args);
- }
-
- numOrStrOrNullConsumer(a) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
}
+ return false;
+ },
+ isImpl(obj) {
+ if (obj) {
+ if (obj instanceof Impl.implementation) {
+ return true;
+ }
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- if (typeof curArg === \\"number\\") {
- curArg = conversions[\\"double\\"](curArg, {
- context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
- clamp: true,
- enforceRange: true
- });
- } else {
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
- enforceRange: true
- });
+ const wrapper = utils.wrapperForImpl(obj);
+ for (const isMixedInto of module.exports._mixedIntoPredicates) {
+ if (isMixedInto(wrapper)) {
+ return true;
}
}
- args.push(curArg);
}
- return this[impl].numOrStrOrNullConsumer(...args);
- }
-
- numOrStrOrURLOrNullConsumer(a) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
+ return false;
+ },
+ convert(obj, { context = \\"The provided value\\" } = {}) {
+ if (module.exports.is(obj)) {
+ return utils.implForWrapper(obj);
}
+ throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`);
+ },
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- if (isURL(curArg)) {
- curArg = utils.implForWrapper(curArg);
- } else if (typeof curArg === \\"number\\") {
- curArg = conversions[\\"double\\"](curArg, {
- context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
- clamp: true,
- enforceRange: true
- });
- } else {
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
- enforceRange: true
- });
- }
- }
- args.push(curArg);
+ create(globalObject, constructorArgs, privateData) {
+ if (globalObject[ctorRegistry] === undefined) {
+ throw new Error(\\"Internal error: invalid global object\\");
}
- return this[impl].numOrStrOrURLOrNullConsumer(...args);
- }
- urlMapInnerConsumer(a) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
+ const ctor = globalObject[ctorRegistry][\\"TypedefsAndUnions\\"];
+ if (ctor === undefined) {
+ throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\");
}
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
+ let obj = Object.create(ctor.prototype);
+ obj = iface.setup(obj, globalObject, constructorArgs, privateData);
+ return obj;
+ },
+ createImpl(globalObject, constructorArgs, privateData) {
+ const obj = iface.create(globalObject, constructorArgs, privateData);
+ return utils.implForWrapper(obj);
+ },
+ _internalSetup(obj) {},
+ setup(obj, globalObject, constructorArgs = [], privateData = {}) {
+ privateData.wrapper = obj;
+
+ iface._internalSetup(obj);
+ Object.defineProperty(obj, impl, {
+ value: new Impl.implementation(globalObject, constructorArgs, privateData),
+ configurable: true
+ });
+
+ obj[impl][utils.wrapperSymbol] = obj;
+ if (Impl.init) {
+ Impl.init(obj[impl], privateData);
}
- const args = [];
- {
- let curArg = arguments[0];
- if (!utils.isObject(curArg)) {
- throw new TypeError(
- \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\"
- );
- } else {
- const result = Object.create(null);
- for (const key of Reflect.ownKeys(curArg)) {
- const desc = Object.getOwnPropertyDescriptor(curArg, key);
- if (desc && desc.enumerable) {
- let typedKey = key;
-
- typedKey = conversions[\\"USVString\\"](typedKey, {
- context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\"
- });
+ return obj;
+ },
- let typedValue = curArg[key];
+ install(globalObject) {
+ class TypedefsAndUnions {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- typedValue = convertURL(typedValue, {
- context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\"
- });
+ numOrStrConsumer(a) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- result[typedKey] = typedValue;
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (typeof curArg === \\"number\\") {
+ curArg = conversions[\\"double\\"](curArg, {
+ context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\",
+ clamp: true
+ });
+ } else {
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': parameter 1\\"
+ });
}
+ args.push(curArg);
}
- curArg = result;
+ return this[impl].numOrStrConsumer(...args);
}
- args.push(curArg);
- }
- return this[impl].urlMapInnerConsumer(...args);
- }
- urlMapConsumer(a) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ numOrEnumConsumer(a) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- if (!utils.isObject(curArg)) {
+ if (arguments.length < 1) {
throw new TypeError(
- \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\"
+ \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
);
- } else {
- const result = Object.create(null);
- for (const key of Reflect.ownKeys(curArg)) {
- const desc = Object.getOwnPropertyDescriptor(curArg, key);
- if (desc && desc.enumerable) {
- let typedKey = key;
-
- typedKey = conversions[\\"USVString\\"](typedKey, {
- context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\"
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ if (typeof curArg === \\"number\\") {
+ curArg = conversions[\\"double\\"](curArg, {
+ context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\"
});
-
- let typedValue = curArg[key];
-
- typedValue = convertURL(typedValue, {
- context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\"
+ } else {
+ curArg = convertRequestDestination(curArg, {
+ context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\"
});
-
- result[typedKey] = typedValue;
}
}
- curArg = result;
+ args.push(curArg);
}
+ return this[impl].numOrEnumConsumer(...args);
}
- args.push(curArg);
- }
- return this[impl].urlMapConsumer(...args);
- }
- bufferSourceOrURLConsumer(b) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ numOrStrOrNullConsumer(a) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (isURL(curArg)) {
- curArg = utils.implForWrapper(curArg);
- } else if (curArg instanceof ArrayBuffer) {
- } else if (ArrayBuffer.isView(curArg)) {
- } else {
- throw new TypeError(
- \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': parameter 1\\" +
- \\" is not of any supported type.\\"
- );
- }
- args.push(curArg);
- }
- return this[impl].bufferSourceOrURLConsumer(...args);
- }
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ if (typeof curArg === \\"number\\") {
+ curArg = conversions[\\"double\\"](curArg, {
+ context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
+ clamp: true,
+ enforceRange: true
+ });
+ } else {
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
+ enforceRange: true
+ });
+ }
+ }
+ args.push(curArg);
+ }
+ return this[impl].numOrStrOrNullConsumer(...args);
+ }
- arrayBufferViewOrURLMapConsumer(b) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ numOrStrOrURLOrNullConsumer(a) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg === null || curArg === undefined) {
- curArg = null;
- } else {
- if (ArrayBuffer.isView(curArg)) {
- } else if (utils.isObject(curArg)) {
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ if (isURL(curArg)) {
+ curArg = utils.implForWrapper(curArg);
+ } else if (typeof curArg === \\"number\\") {
+ curArg = conversions[\\"double\\"](curArg, {
+ context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
+ clamp: true,
+ enforceRange: true
+ });
+ } else {
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': parameter 1\\",
+ enforceRange: true
+ });
+ }
+ }
+ args.push(curArg);
+ }
+ return this[impl].numOrStrOrURLOrNullConsumer(...args);
+ }
+
+ urlMapInnerConsumer(a) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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(
- \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
- \\" record\\" +
- \\" is not an object.\\"
+ \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\"
);
} else {
const result = Object.create(null);
@@ -3856,19 +3571,13 @@ class TypedefsAndUnions {
let typedKey = key;
typedKey = conversions[\\"USVString\\"](typedKey, {
- context:
- \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
- \\" record\\" +
- \\"'s key\\"
+ context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\"
});
let typedValue = curArg[key];
typedValue = convertURL(typedValue, {
- context:
- \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
- \\" record\\" +
- \\"'s value\\"
+ context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\"
});
result[typedKey] = typedValue;
@@ -3876,206 +3585,251 @@ class TypedefsAndUnions {
}
curArg = result;
}
- } else {
+ args.push(curArg);
+ }
+ return this[impl].urlMapInnerConsumer(...args);
+ }
+
+ urlMapConsumer(a) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
throw new TypeError(
- \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
- \\" is not of any supported type.\\"
+ \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
);
}
- }
- args.push(curArg);
- }
- return this[impl].arrayBufferViewOrURLMapConsumer(...args);
- }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ if (!utils.isObject(curArg)) {
+ throw new TypeError(
+ \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\" is not an object.\\"
+ );
+ } else {
+ const result = Object.create(null);
+ for (const key of Reflect.ownKeys(curArg)) {
+ const desc = Object.getOwnPropertyDescriptor(curArg, key);
+ if (desc && desc.enumerable) {
+ let typedKey = key;
- arrayBufferViewDupConsumer(b) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ typedKey = conversions[\\"USVString\\"](typedKey, {
+ context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\"
+ });
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
- arguments.length +
- \\" present.\\"
- );
- }
- const args = [];
- {
- let curArg = arguments[0];
- if (ArrayBuffer.isView(curArg)) {
- } else {
- throw new TypeError(
- \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': parameter 1\\" +
- \\" is not of any supported type.\\"
- );
- }
- args.push(curArg);
- }
- return this[impl].arrayBufferViewDupConsumer(...args);
- }
+ let typedValue = curArg[key];
- get buf() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ typedValue = convertURL(typedValue, {
+ context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\"
+ });
- return utils.tryWrapperForImpl(this[impl][\\"buf\\"]);
- }
+ result[typedKey] = typedValue;
+ }
+ }
+ curArg = result;
+ }
+ }
+ args.push(curArg);
+ }
+ return this[impl].urlMapConsumer(...args);
+ }
- set buf(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ bufferSourceOrURLConsumer(b) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- if (V instanceof ArrayBuffer) {
- } else if (ArrayBuffer.isView(V) && (V instanceof Uint8Array || V instanceof Uint16Array)) {
- } else {
- throw new TypeError(
- \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + \\" is not of any supported type.\\"
- );
- }
- this[impl][\\"buf\\"] = V;
- }
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (isURL(curArg)) {
+ curArg = utils.implForWrapper(curArg);
+ } else if (curArg instanceof ArrayBuffer) {
+ } else if (ArrayBuffer.isView(curArg)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': parameter 1\\" +
+ \\" is not of any supported type.\\"
+ );
+ }
+ args.push(curArg);
+ }
+ return this[impl].bufferSourceOrURLConsumer(...args);
+ }
- get time() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ arrayBufferViewOrURLMapConsumer(b) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- return this[impl][\\"time\\"];
- }
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg === null || curArg === undefined) {
+ curArg = null;
+ } else {
+ if (ArrayBuffer.isView(curArg)) {
+ } else if (utils.isObject(curArg)) {
+ if (!utils.isObject(curArg)) {
+ throw new TypeError(
+ \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
+ \\" record\\" +
+ \\" is not an object.\\"
+ );
+ } else {
+ const result = Object.create(null);
+ for (const key of Reflect.ownKeys(curArg)) {
+ const desc = Object.getOwnPropertyDescriptor(curArg, key);
+ if (desc && desc.enumerable) {
+ let typedKey = key;
- set time(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+ typedKey = conversions[\\"USVString\\"](typedKey, {
+ context:
+ \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
+ \\" record\\" +
+ \\"'s key\\"
+ });
- V = conversions[\\"unsigned long long\\"](V, {
- context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\"
- });
+ let typedValue = curArg[key];
- this[impl][\\"time\\"] = V;
- }
-}
-Object.defineProperties(TypedefsAndUnions.prototype, {
- numOrStrConsumer: { enumerable: true },
- numOrEnumConsumer: { enumerable: true },
- numOrStrOrNullConsumer: { enumerable: true },
- numOrStrOrURLOrNullConsumer: { enumerable: true },
- urlMapInnerConsumer: { enumerable: true },
- urlMapConsumer: { enumerable: true },
- bufferSourceOrURLConsumer: { enumerable: true },
- arrayBufferViewOrURLMapConsumer: { enumerable: true },
- arrayBufferViewDupConsumer: { enumerable: true },
- buf: { enumerable: true },
- time: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"TypedefsAndUnions\\", configurable: true }
-});
-const iface = {
- // When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
- // method into this array. It allows objects that directly implements *those* interfaces to be recognized as
- // implementing this mixin interface.
- _mixedIntoPredicates: [],
- is(obj) {
- if (obj) {
- if (utils.hasOwn(obj, impl) && obj[impl] instanceof Impl.implementation) {
- return true;
- }
- for (const isMixedInto of module.exports._mixedIntoPredicates) {
- if (isMixedInto(obj)) {
- return true;
+ typedValue = convertURL(typedValue, {
+ context:
+ \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
+ \\" record\\" +
+ \\"'s value\\"
+ });
+
+ result[typedKey] = typedValue;
+ }
+ }
+ curArg = result;
+ }
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" +
+ \\" is not of any supported type.\\"
+ );
+ }
+ }
+ args.push(curArg);
}
- }
- }
- return false;
- },
- isImpl(obj) {
- if (obj) {
- if (obj instanceof Impl.implementation) {
- return true;
+ return this[impl].arrayBufferViewOrURLMapConsumer(...args);
}
- const wrapper = utils.wrapperForImpl(obj);
- for (const isMixedInto of module.exports._mixedIntoPredicates) {
- if (isMixedInto(wrapper)) {
- return true;
+ arrayBufferViewDupConsumer(b) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
}
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (ArrayBuffer.isView(curArg)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': parameter 1\\" +
+ \\" is not of any supported type.\\"
+ );
+ }
+ args.push(curArg);
+ }
+ return this[impl].arrayBufferViewDupConsumer(...args);
}
- }
- return false;
- },
- convert(obj, { context = \\"The provided value\\" } = {}) {
- if (module.exports.is(obj)) {
- return utils.implForWrapper(obj);
- }
- throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`);
- },
- create(globalObject, constructorArgs, privateData) {
- if (globalObject[ctorRegistry] === undefined) {
- throw new Error(\\"Internal error: invalid global object\\");
- }
+ get buf() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const ctor = globalObject[ctorRegistry][\\"TypedefsAndUnions\\"];
- if (ctor === undefined) {
- throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\");
- }
+ return utils.tryWrapperForImpl(this[impl][\\"buf\\"]);
+ }
- let obj = Object.create(ctor.prototype);
- obj = iface.setup(obj, globalObject, constructorArgs, privateData);
- return obj;
- },
- createImpl(globalObject, constructorArgs, privateData) {
- const obj = iface.create(globalObject, constructorArgs, privateData);
- return utils.implForWrapper(obj);
- },
- _internalSetup(obj) {},
- setup(obj, globalObject, constructorArgs = [], privateData = {}) {
- privateData.wrapper = obj;
+ set buf(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- iface._internalSetup(obj);
- Object.defineProperty(obj, impl, {
- value: new Impl.implementation(globalObject, constructorArgs, privateData),
- configurable: true
- });
+ if (V instanceof ArrayBuffer) {
+ } else if (ArrayBuffer.isView(V) && (V instanceof Uint8Array || V instanceof Uint16Array)) {
+ } else {
+ throw new TypeError(
+ \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" +
+ \\" is not of any supported type.\\"
+ );
+ }
+ this[impl][\\"buf\\"] = V;
+ }
- obj[impl][utils.wrapperSymbol] = obj;
- if (Impl.init) {
- Impl.init(obj[impl], privateData);
- }
- return obj;
- },
+ get time() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- install(globalObject) {
- const ctor = function TypedefsAndUnions() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ return this[impl][\\"time\\"];
+ }
- const proto = {};
+ set time(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(TypedefsAndUnions.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ V = conversions[\\"unsigned long long\\"](V, {
+ context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\"
+ });
+
+ this[impl][\\"time\\"] = V;
}
+ }
+ Object.defineProperties(TypedefsAndUnions.prototype, {
+ numOrStrConsumer: { enumerable: true },
+ numOrEnumConsumer: { enumerable: true },
+ numOrStrOrNullConsumer: { enumerable: true },
+ numOrStrOrURLOrNullConsumer: { enumerable: true },
+ urlMapInnerConsumer: { enumerable: true },
+ urlMapConsumer: { enumerable: true },
+ bufferSourceOrURLConsumer: { enumerable: true },
+ arrayBufferViewOrURLMapConsumer: { enumerable: true },
+ arrayBufferViewDupConsumer: { enumerable: true },
+ buf: { enumerable: true },
+ time: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"TypedefsAndUnions\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"TypedefsAndUnions\\"] = ctor;
+ globalObject[ctorRegistry][\\"TypedefsAndUnions\\"] = TypedefsAndUnions;
Object.defineProperty(globalObject, \\"TypedefsAndUnions\\", {
configurable: true,
writable: true,
- value: ctor
+ value: TypedefsAndUnions
});
}
}; // iface
@@ -4085,246 +3839,15 @@ const Impl = require(\\"../implementations/TypedefsAndUnions.js\\");
"
`;
-exports[`URL.webidl 1`] = `
-"\\"use strict\\";
-
-const conversions = require(\\"webidl-conversions\\");
-const utils = require(\\"./utils.js\\");
-
-const impl = utils.implSymbol;
-const ctorRegistry = utils.ctorRegistrySymbol;
-
-class URL {
- toJSON() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].toJSON();
- }
-
- get href() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"href\\"];
- }
-
- set href(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" });
-
- this[impl][\\"href\\"] = V;
- }
-
- toString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- return this[impl][\\"href\\"];
- }
-
- get origin() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"origin\\"];
- }
-
- get protocol() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"protocol\\"];
- }
-
- set protocol(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" });
-
- this[impl][\\"protocol\\"] = V;
- }
-
- get username() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"username\\"];
- }
-
- set username(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'username' property on 'URL': The provided value\\" });
-
- this[impl][\\"username\\"] = V;
- }
-
- get password() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"password\\"];
- }
-
- set password(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'password' property on 'URL': The provided value\\" });
-
- this[impl][\\"password\\"] = V;
- }
-
- get host() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"host\\"];
- }
-
- set host(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" });
-
- this[impl][\\"host\\"] = V;
- }
-
- get hostname() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"hostname\\"];
- }
-
- set hostname(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" });
-
- this[impl][\\"hostname\\"] = V;
- }
-
- get port() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"port\\"];
- }
-
- set port(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" });
-
- this[impl][\\"port\\"] = V;
- }
-
- get pathname() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"pathname\\"];
- }
-
- set pathname(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" });
-
- this[impl][\\"pathname\\"] = V;
- }
-
- get search() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"search\\"];
- }
-
- set search(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" });
-
- this[impl][\\"search\\"] = V;
- }
-
- get searchParams() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return utils.getSameObject(this, \\"searchParams\\", () => {
- return utils.tryWrapperForImpl(this[impl][\\"searchParams\\"]);
- });
- }
-
- get hash() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"hash\\"];
- }
+exports[`URL.webidl 1`] = `
+"\\"use strict\\";
- set hash(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+const conversions = require(\\"webidl-conversions\\");
+const utils = require(\\"./utils.js\\");
- V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" });
+const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
- this[impl][\\"hash\\"] = V;
- }
-}
-Object.defineProperties(URL.prototype, {
- toJSON: { enumerable: true },
- href: { enumerable: true },
- toString: { enumerable: true },
- origin: { enumerable: true },
- protocol: { enumerable: true },
- username: { enumerable: true },
- password: { enumerable: true },
- host: { enumerable: true },
- hostname: { enumerable: true },
- port: { enumerable: true },
- pathname: { enumerable: true },
- search: { enumerable: true },
- searchParams: { enumerable: true },
- hash: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"URL\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -4401,52 +3924,280 @@ const iface = {
},
install(globalObject) {
- const ctor = function URL(url) {
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to construct 'URL': 1 argument required, but only \\" + arguments.length + \\" present.\\"
- );
+ class URL {
+ constructor(url) {
+ if (arguments.length < 1) {
+ throw new 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\\" });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ if (curArg !== undefined) {
+ curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" });
+ }
+ args.push(curArg);
+ }
+ return iface.setup(Object.create(new.target.prototype), globalObject, args);
}
- const args = [];
- {
- let curArg = arguments[0];
- curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 1\\" });
- args.push(curArg);
+
+ toJSON() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].toJSON();
}
- {
- let curArg = arguments[1];
- if (curArg !== undefined) {
- curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" });
+
+ get href() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
}
- args.push(curArg);
+
+ return this[impl][\\"href\\"];
}
- return iface.setup(Object.create(new.target.prototype), globalObject, args);
- };
- const proto = {};
+ set href(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" });
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(URL.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ this[impl][\\"href\\"] = V;
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ toString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ return this[impl][\\"href\\"];
+ }
+
+ get origin() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"origin\\"];
+ }
+
+ get protocol() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"protocol\\"];
+ }
+
+ set protocol(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, {
+ context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\"
+ });
+
+ this[impl][\\"protocol\\"] = V;
+ }
+
+ get username() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"username\\"];
+ }
+
+ set username(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, {
+ context: \\"Failed to set the 'username' property on 'URL': The provided value\\"
+ });
+
+ this[impl][\\"username\\"] = V;
+ }
+
+ get password() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"password\\"];
+ }
+
+ set password(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, {
+ context: \\"Failed to set the 'password' property on 'URL': The provided value\\"
+ });
+
+ this[impl][\\"password\\"] = V;
+ }
+
+ get host() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"host\\"];
+ }
+
+ set host(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" });
+
+ this[impl][\\"host\\"] = V;
+ }
+
+ get hostname() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"hostname\\"];
+ }
+
+ set hostname(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, {
+ context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\"
+ });
+
+ this[impl][\\"hostname\\"] = V;
+ }
+
+ get port() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"port\\"];
+ }
+
+ set port(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" });
+
+ this[impl][\\"port\\"] = V;
+ }
+
+ get pathname() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"pathname\\"];
+ }
+
+ set pathname(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, {
+ context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\"
+ });
+
+ this[impl][\\"pathname\\"] = V;
+ }
+
+ get search() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"search\\"];
+ }
+
+ set search(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, {
+ context: \\"Failed to set the 'search' property on 'URL': The provided value\\"
+ });
+
+ this[impl][\\"search\\"] = V;
+ }
+
+ get searchParams() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return utils.getSameObject(this, \\"searchParams\\", () => {
+ return utils.tryWrapperForImpl(this[impl][\\"searchParams\\"]);
+ });
+ }
+
+ get hash() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"hash\\"];
+ }
+
+ set hash(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" });
+
+ this[impl][\\"hash\\"] = V;
+ }
+ }
+ Object.defineProperties(URL.prototype, {
+ toJSON: { enumerable: true },
+ href: { enumerable: true },
+ toString: { enumerable: true },
+ origin: { enumerable: true },
+ protocol: { enumerable: true },
+ username: { enumerable: true },
+ password: { enumerable: true },
+ host: { enumerable: true },
+ hostname: { enumerable: true },
+ port: { enumerable: true },
+ pathname: { enumerable: true },
+ search: { enumerable: true },
+ searchParams: { enumerable: true },
+ hash: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"URL\\", configurable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"URL\\"] = ctor;
+ globalObject[ctorRegistry][\\"URL\\"] = URL;
Object.defineProperty(globalObject, \\"URL\\", {
configurable: true,
writable: true,
- value: ctor
+ value: URL
});
}
}; // iface
@@ -4465,44 +4216,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class URLList {
- item(index) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\" });
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].item(...args));
- }
-
- get length() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"length\\"];
- }
-}
-Object.defineProperties(URLList.prototype, {
- item: { enumerable: true },
- length: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"URLList\\", configurable: true },
- [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true },
- keys: { value: Array.prototype.keys, configurable: true, enumerable: true, writable: true },
- values: { value: Array.prototype[Symbol.iterator], configurable: true, enumerable: true, writable: true },
- entries: { value: Array.prototype.entries, configurable: true, enumerable: true, writable: true },
- forEach: { value: Array.prototype.forEach, configurable: true, enumerable: true, writable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -4739,34 +4452,59 @@ const iface = {
},
install(globalObject) {
- const ctor = function URLList() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class URLList {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- const proto = {};
+ item(index) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(URLList.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].item(...args));
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ get length() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"length\\"];
+ }
+ }
+ Object.defineProperties(URLList.prototype, {
+ item: { enumerable: true },
+ length: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"URLList\\", configurable: true },
+ [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true },
+ keys: { value: Array.prototype.keys, configurable: true, enumerable: true, writable: true },
+ values: { value: Array.prototype[Symbol.iterator], configurable: true, enumerable: true, writable: true },
+ entries: { value: Array.prototype.entries, configurable: true, enumerable: true, writable: true },
+ forEach: { value: Array.prototype.forEach, configurable: true, enumerable: true, writable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"URLList\\"] = ctor;
+ globalObject[ctorRegistry][\\"URLList\\"] = URLList;
Object.defineProperty(globalObject, \\"URLList\\", {
configurable: true,
writable: true,
- value: ctor
+ value: URLList
});
}
}; // iface
@@ -4802,250 +4540,28 @@ const IteratorPrototype = Object.create(utils.IteratorPrototype, {
let result;
switch (kind) {
- case \\"key\\":
- result = key;
- break;
- case \\"value\\":
- result = value;
- break;
- case \\"key+value\\":
- result = [key, value];
- break;
- }
- return { value: result, done: false };
- },
- writable: true,
- enumerable: true,
- configurable: true
- },
- [Symbol.toStringTag]: {
- value: \\"URLSearchParams Iterator\\",
- configurable: true
- }
-});
-class URLSearchParams {
- append(name, value) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 2) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"USVString\\"](curArg, {
- context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 2\\"
- });
- args.push(curArg);
- }
- return this[impl].append(...args);
- }
-
- delete(name) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return this[impl].delete(...args);
- }
-
- get(name) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return this[impl].get(...args);
- }
-
- getAll(name) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].getAll(...args));
- }
-
- has(name) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return this[impl].has(...args);
- }
-
- set(name, value) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 2) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- {
- let curArg = arguments[1];
- curArg = conversions[\\"USVString\\"](curArg, {
- context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\"
- });
- args.push(curArg);
- }
- return this[impl].set(...args);
- }
-
- sort() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].sort();
- }
-
- toString() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl].toString();
- }
-
- keys() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- return module.exports.createDefaultIterator(this, \\"key\\");
- }
-
- values() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- return module.exports.createDefaultIterator(this, \\"value\\");
- }
-
- entries() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- return module.exports.createDefaultIterator(this, \\"key+value\\");
- }
-
- forEach(callback) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- if (arguments.length < 1) {
- throw new TypeError(\\"Failed to execute 'forEach' on 'iterable': 1 argument required, \\" + \\"but only 0 present.\\");
- }
- if (typeof callback !== \\"function\\") {
- throw new TypeError(
- \\"Failed to execute 'forEach' on 'iterable': The callback provided \\" + \\"as parameter 1 is not a function.\\"
- );
- }
- const thisArg = arguments[1];
- let pairs = Array.from(this[impl]);
- let i = 0;
- while (i < pairs.length) {
- const [key, value] = pairs[i].map(utils.tryWrapperForImpl);
- callback.call(thisArg, value, key, this);
- pairs = Array.from(this[impl]);
- i++;
- }
+ case \\"key\\":
+ result = key;
+ break;
+ case \\"value\\":
+ result = value;
+ break;
+ case \\"key+value\\":
+ result = [key, value];
+ break;
+ }
+ return { value: result, done: false };
+ },
+ writable: true,
+ enumerable: true,
+ configurable: true
+ },
+ [Symbol.toStringTag]: {
+ value: \\"URLSearchParams Iterator\\",
+ configurable: true
}
-}
-Object.defineProperties(URLSearchParams.prototype, {
- append: { enumerable: true },
- delete: { enumerable: true },
- get: { enumerable: true },
- getAll: { enumerable: true },
- has: { enumerable: true },
- set: { enumerable: true },
- sort: { enumerable: true },
- toString: { enumerable: true },
- keys: { enumerable: true },
- values: { enumerable: true },
- entries: { enumerable: true },
- forEach: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"URLSearchParams\\", configurable: true },
- [Symbol.iterator]: { value: URLSearchParams.prototype.entries, configurable: true, writable: true }
});
+
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -5131,114 +4647,330 @@ const iface = {
},
install(globalObject) {
- const ctor = function URLSearchParams() {
- const args = [];
- {
- let curArg = arguments[0];
- if (curArg !== undefined) {
- if (utils.isObject(curArg)) {
- if (curArg[Symbol.iterator] !== undefined) {
- if (!utils.isObject(curArg)) {
- throw new TypeError(
- \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = curArg;
- for (let nextItem of tmp) {
- if (!utils.isObject(nextItem)) {
- throw new TypeError(
- \\"Failed to construct 'URLSearchParams': parameter 1\\" +
- \\" sequence\\" +
- \\"'s element\\" +
- \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = nextItem;
- for (let nextItem of tmp) {
- nextItem = conversions[\\"USVString\\"](nextItem, {
- context:
- \\"Failed to construct 'URLSearchParams': parameter 1\\" +
+ class URLSearchParams {
+ constructor() {
+ const args = [];
+ {
+ let curArg = arguments[0];
+ if (curArg !== undefined) {
+ if (utils.isObject(curArg)) {
+ if (curArg[Symbol.iterator] !== undefined) {
+ if (!utils.isObject(curArg)) {
+ throw new TypeError(
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" sequence\\" + \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = curArg;
+ for (let nextItem of tmp) {
+ if (!utils.isObject(nextItem)) {
+ throw new TypeError(
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" +
\\" sequence\\" +
\\"'s element\\" +
- \\"'s element\\"
- });
-
- V.push(nextItem);
+ \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = nextItem;
+ for (let nextItem of tmp) {
+ nextItem = conversions[\\"USVString\\"](nextItem, {
+ context:
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" +
+ \\" sequence\\" +
+ \\"'s element\\" +
+ \\"'s element\\"
+ });
+
+ V.push(nextItem);
+ }
+ nextItem = V;
}
- nextItem = V;
- }
- V.push(nextItem);
+ V.push(nextItem);
+ }
+ curArg = V;
}
- curArg = V;
- }
- } else {
- if (!utils.isObject(curArg)) {
- throw new TypeError(
- \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\" is not an object.\\"
- );
} else {
- const result = Object.create(null);
- for (const key of Reflect.ownKeys(curArg)) {
- const desc = Object.getOwnPropertyDescriptor(curArg, key);
- if (desc && desc.enumerable) {
- let typedKey = key;
-
- typedKey = conversions[\\"USVString\\"](typedKey, {
- context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\"
- });
+ if (!utils.isObject(curArg)) {
+ throw new TypeError(
+ \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\" is not an object.\\"
+ );
+ } else {
+ const result = Object.create(null);
+ for (const key of Reflect.ownKeys(curArg)) {
+ const desc = Object.getOwnPropertyDescriptor(curArg, key);
+ if (desc && desc.enumerable) {
+ let typedKey = key;
+
+ typedKey = conversions[\\"USVString\\"](typedKey, {
+ context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\"
+ });
- let typedValue = curArg[key];
+ let typedValue = curArg[key];
- typedValue = conversions[\\"USVString\\"](typedValue, {
- context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\"
- });
+ typedValue = conversions[\\"USVString\\"](typedValue, {
+ context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\"
+ });
- result[typedKey] = typedValue;
+ result[typedKey] = typedValue;
+ }
}
+ curArg = result;
}
- curArg = result;
}
+ } else {
+ curArg = conversions[\\"USVString\\"](curArg, {
+ context: \\"Failed to construct 'URLSearchParams': parameter 1\\"
+ });
}
} else {
- curArg = conversions[\\"USVString\\"](curArg, {
- context: \\"Failed to construct 'URLSearchParams': parameter 1\\"
- });
+ curArg = \\"\\";
}
- } else {
- curArg = \\"\\";
+ args.push(curArg);
+ }
+ return iface.setup(Object.create(new.target.prototype), globalObject, args);
+ }
+
+ append(name, value) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 2) {
+ throw new 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\\"
+ });
+ args.push(curArg);
}
- args.push(curArg);
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"USVString\\"](curArg, {
+ context: \\"Failed to execute 'append' on 'URLSearchParams': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].append(...args);
}
- return iface.setup(Object.create(new.target.prototype), globalObject, args);
- };
- const proto = {};
+ delete(name) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(URLSearchParams.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].delete(...args);
+ }
+
+ get(name) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].get(...args);
+ }
+
+ getAll(name) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].getAll(...args));
+ }
+
+ has(name) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].has(...args);
+ }
+
+ set(name, value) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 2) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ {
+ let curArg = arguments[1];
+ curArg = conversions[\\"USVString\\"](curArg, {
+ context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\"
+ });
+ args.push(curArg);
+ }
+ return this[impl].set(...args);
+ }
+
+ sort() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].sort();
+ }
+
+ toString() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl].toString();
+ }
+
+ keys() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ return module.exports.createDefaultIterator(this, \\"key\\");
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ values() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ return module.exports.createDefaultIterator(this, \\"value\\");
+ }
+
+ entries() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ return module.exports.createDefaultIterator(this, \\"key+value\\");
+ }
+
+ forEach(callback) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'forEach' on 'iterable': 1 argument required, \\" + \\"but only 0 present.\\"
+ );
+ }
+ if (typeof callback !== \\"function\\") {
+ throw new TypeError(
+ \\"Failed to execute 'forEach' on 'iterable': The callback provided \\" + \\"as parameter 1 is not a function.\\"
+ );
+ }
+ const thisArg = arguments[1];
+ let pairs = Array.from(this[impl]);
+ let i = 0;
+ while (i < pairs.length) {
+ const [key, value] = pairs[i].map(utils.tryWrapperForImpl);
+ callback.call(thisArg, value, key, this);
+ pairs = Array.from(this[impl]);
+ i++;
+ }
+ }
+ }
+ Object.defineProperties(URLSearchParams.prototype, {
+ append: { enumerable: true },
+ delete: { enumerable: true },
+ get: { enumerable: true },
+ getAll: { enumerable: true },
+ has: { enumerable: true },
+ set: { enumerable: true },
+ sort: { enumerable: true },
+ toString: { enumerable: true },
+ keys: { enumerable: true },
+ values: { enumerable: true },
+ entries: { enumerable: true },
+ forEach: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"URLSearchParams\\", configurable: true },
+ [Symbol.iterator]: { value: URLSearchParams.prototype.entries, configurable: true, writable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"URLSearchParams\\"] = ctor;
+ globalObject[ctorRegistry][\\"URLSearchParams\\"] = URLSearchParams;
Object.defineProperty(globalObject, \\"URLSearchParams\\", {
configurable: true,
writable: true,
- value: ctor
+ value: URLSearchParams
});
}
}; // iface
@@ -5257,68 +4989,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class URLSearchParamsCollection {
- item(index) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].item(...args));
- }
-
- namedItem(name) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return utils.tryWrapperForImpl(this[impl].namedItem(...args));
- }
-
- get length() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"length\\"];
- }
-}
-Object.defineProperties(URLSearchParamsCollection.prototype, {
- item: { enumerable: true },
- namedItem: { enumerable: true },
- length: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection\\", configurable: true },
- [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -5583,34 +5253,81 @@ const iface = {
},
install(globalObject) {
- const ctor = function URLSearchParamsCollection() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class URLSearchParamsCollection {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ item(index) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].item(...args));
+ }
+
+ namedItem(name) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return utils.tryWrapperForImpl(this[impl].namedItem(...args));
+ }
- const proto = {};
+ get length() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(URLSearchParamsCollection.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ return this[impl][\\"length\\"];
}
+ }
+ Object.defineProperties(URLSearchParamsCollection.prototype, {
+ item: { enumerable: true },
+ namedItem: { enumerable: true },
+ length: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection\\", configurable: true },
+ [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"] = ctor;
+ globalObject[ctorRegistry][\\"URLSearchParamsCollection\\"] = URLSearchParamsCollection;
Object.defineProperty(globalObject, \\"URLSearchParamsCollection\\", {
configurable: true,
writable: true,
- value: ctor
+ value: URLSearchParamsCollection
});
}
}; // iface
@@ -5631,11 +5348,6 @@ const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\");
-class URLSearchParamsCollection2 {}
-Object.defineProperties(URLSearchParamsCollection2.prototype, {
- [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true },
- [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -5931,144 +5643,47 @@ const iface = {
},
install(globalObject) {
- const ctor = function URLSearchParamsCollection2() {
- throw new TypeError(\\"Illegal constructor\\");
- };
-
if (globalObject.URLSearchParamsCollection === undefined) {
throw new Error(
\\"Internal error: attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\"
);
}
-
- const proto = Object.create(globalObject.URLSearchParamsCollection.prototype);
-
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(URLSearchParamsCollection2.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
}
+ }
+ Object.defineProperties(URLSearchParamsCollection2.prototype, {
+ [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true },
+ [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"] = ctor;
+ globalObject[ctorRegistry][\\"URLSearchParamsCollection2\\"] = URLSearchParamsCollection2;
Object.defineProperty(globalObject, \\"URLSearchParamsCollection2\\", {
configurable: true,
writable: true,
- value: ctor
- });
- }
-}; // iface
-module.exports = iface;
-
-const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\");
-"
-`;
-
-exports[`UnderscoredProperties.webidl 1`] = `
-"\\"use strict\\";
-
-const conversions = require(\\"webidl-conversions\\");
-const utils = require(\\"./utils.js\\");
-
-const impl = utils.implSymbol;
-const ctorRegistry = utils.ctorRegistrySymbol;
-
-class UnderscoredProperties {
- operation(sequence) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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(
- \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\" is not an iterable object.\\"
- );
- } else {
- const V = [];
- const tmp = curArg;
- for (let nextItem of tmp) {
- nextItem = conversions[\\"DOMString\\"](nextItem, {
- context: \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\"'s element\\"
- });
-
- V.push(nextItem);
- }
- curArg = V;
- }
- args.push(curArg);
- }
- return this[impl].operation(...args);
- }
-
- get attribute() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"attribute\\"];
+ value: URLSearchParamsCollection2
+ });
}
+}; // iface
+module.exports = iface;
- set attribute(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
+const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\");
+"
+`;
- V = conversions[\\"byte\\"](V, {
- context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\"
- });
+exports[`UnderscoredProperties.webidl 1`] = `
+"\\"use strict\\";
- this[impl][\\"attribute\\"] = V;
- }
+const conversions = require(\\"webidl-conversions\\");
+const utils = require(\\"./utils.js\\");
+
+const impl = utils.implSymbol;
+const ctorRegistry = utils.ctorRegistrySymbol;
- static static(void_) {
- if (arguments.length < 1) {
- throw new 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\\"
- });
- args.push(curArg);
- }
- return Impl.implementation.static(...args);
- }
-}
-Object.defineProperties(UnderscoredProperties.prototype, {
- operation: { enumerable: true },
- attribute: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"UnderscoredProperties\\", configurable: true },
- const: { value: 42, enumerable: true }
-});
-Object.defineProperties(UnderscoredProperties, {
- static: { enumerable: true },
- const: { value: 42, enumerable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -6145,39 +5760,105 @@ const iface = {
},
install(globalObject) {
- const ctor = function UnderscoredProperties() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class UnderscoredProperties {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
- Object.defineProperties(ctor, {
- const: Object.getOwnPropertyDescriptor(UnderscoredProperties, \\"const\\"),
- static: Object.getOwnPropertyDescriptor(UnderscoredProperties, \\"static\\")
- });
+ operation(sequence) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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(
+ \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\" is not an iterable object.\\"
+ );
+ } else {
+ const V = [];
+ const tmp = curArg;
+ for (let nextItem of tmp) {
+ nextItem = conversions[\\"DOMString\\"](nextItem, {
+ context: \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\"'s element\\"
+ });
+
+ V.push(nextItem);
+ }
+ curArg = V;
+ }
+ args.push(curArg);
+ }
+ return this[impl].operation(...args);
+ }
+
+ get attribute() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"attribute\\"];
+ }
+
+ set attribute(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"byte\\"](V, {
+ context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\"
+ });
- const proto = {};
+ this[impl][\\"attribute\\"] = V;
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(UnderscoredProperties.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ static static(void_) {
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ return Impl.implementation.static(...args);
}
+ }
+ Object.defineProperties(UnderscoredProperties.prototype, {
+ operation: { enumerable: true },
+ attribute: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"UnderscoredProperties\\", configurable: true },
+ const: { value: 42, enumerable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
+ Object.defineProperties(UnderscoredProperties, {
+ static: { enumerable: true },
+ const: { value: 42, enumerable: true }
});
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"UnderscoredProperties\\"] = ctor;
+ globalObject[ctorRegistry][\\"UnderscoredProperties\\"] = UnderscoredProperties;
Object.defineProperty(globalObject, \\"UnderscoredProperties\\", {
configurable: true,
writable: true,
- value: ctor
+ value: UnderscoredProperties
});
}
}; // iface
@@ -6196,8 +5877,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Unforgeable {}
-Object.defineProperties(Unforgeable.prototype, { [Symbol.toStringTag]: { value: \\"Unforgeable\\", configurable: true } });
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -6359,34 +6038,23 @@ const iface = {
},
install(globalObject) {
- const ctor = function Unforgeable() {
- throw new TypeError(\\"Illegal constructor\\");
- };
-
- const proto = {};
-
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Unforgeable.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ class Unforgeable {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
}
+ }
+ Object.defineProperties(Unforgeable.prototype, {
+ [Symbol.toStringTag]: { value: \\"Unforgeable\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"Unforgeable\\"] = ctor;
+ globalObject[ctorRegistry][\\"Unforgeable\\"] = Unforgeable;
Object.defineProperty(globalObject, \\"Unforgeable\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Unforgeable
});
}
}; // iface
@@ -6405,10 +6073,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class UnforgeableMap {}
-Object.defineProperties(UnforgeableMap.prototype, {
- [Symbol.toStringTag]: { value: \\"UnforgeableMap\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -6675,34 +6339,23 @@ const iface = {
},
install(globalObject) {
- const ctor = function UnforgeableMap() {
- throw new TypeError(\\"Illegal constructor\\");
- };
-
- const proto = {};
-
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(UnforgeableMap.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ class UnforgeableMap {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
}
+ }
+ Object.defineProperties(UnforgeableMap.prototype, {
+ [Symbol.toStringTag]: { value: \\"UnforgeableMap\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"UnforgeableMap\\"] = ctor;
+ globalObject[ctorRegistry][\\"UnforgeableMap\\"] = UnforgeableMap;
Object.defineProperty(globalObject, \\"UnforgeableMap\\", {
configurable: true,
writable: true,
- value: ctor
+ value: UnforgeableMap
});
}
}; // iface
@@ -6721,53 +6374,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Unscopable {
- get unscopableTest() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"unscopableTest\\"];
- }
-
- set unscopableTest(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"boolean\\"](V, {
- context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\"
- });
-
- this[impl][\\"unscopableTest\\"] = V;
- }
-
- get unscopableMixin() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- return this[impl][\\"unscopableMixin\\"];
- }
-
- set unscopableMixin(V) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- V = conversions[\\"boolean\\"](V, {
- context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\"
- });
-
- this[impl][\\"unscopableMixin\\"] = V;
- }
-}
-Object.defineProperties(Unscopable.prototype, {
- unscopableTest: { enumerable: true },
- unscopableMixin: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Unscopable\\", configurable: true },
- [Symbol.unscopables]: { value: { unscopableTest: true, unscopableMixin: true, __proto__: null }, configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -6844,34 +6450,69 @@ const iface = {
},
install(globalObject) {
- const ctor = function Unscopable() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class Unscopable {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ get unscopableTest() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"unscopableTest\\"];
+ }
+
+ set unscopableTest(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
- const proto = {};
+ V = conversions[\\"boolean\\"](V, {
+ context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\"
+ });
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Unscopable.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ this[impl][\\"unscopableTest\\"] = V;
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ get unscopableMixin() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ return this[impl][\\"unscopableMixin\\"];
+ }
+
+ set unscopableMixin(V) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ V = conversions[\\"boolean\\"](V, {
+ context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\"
+ });
+
+ this[impl][\\"unscopableMixin\\"] = V;
+ }
+ }
+ Object.defineProperties(Unscopable.prototype, {
+ unscopableTest: { enumerable: true },
+ unscopableMixin: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Unscopable\\", configurable: true },
+ [Symbol.unscopables]: {
+ value: { unscopableTest: true, unscopableMixin: true, __proto__: null },
+ configurable: true
+ }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"Unscopable\\"] = ctor;
+ globalObject[ctorRegistry][\\"Unscopable\\"] = Unscopable;
Object.defineProperty(globalObject, \\"Unscopable\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Unscopable
});
}
}; // iface
@@ -6891,157 +6532,6 @@ const convertURL = require(\\"./URL.js\\").convert;
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class Variadic {
- simple1() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- 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)
- });
- args.push(curArg);
- }
- return this[impl].simple1(...args);
- }
-
- simple2(first) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new 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\\" });
- args.push(curArg);
- }
- for (let i = 1; i < arguments.length; i++) {
- let curArg = arguments[i];
- curArg = convertURL(curArg, { context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) });
- args.push(curArg);
- }
- return this[impl].simple2(...args);
- }
-
- overloaded1() {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
- const args = [];
- switch (arguments.length) {
- case 0:
- break;
- default: {
- let curArg = arguments[0];
- if (typeof curArg === \\"number\\") {
- 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)
- });
- args.push(curArg);
- }
- } else {
- 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)
- });
- args.push(curArg);
- }
- }
- }
- }
- return this[impl].overloaded1(...args);
- }
-
- overloaded2(first) {
- if (!this || !module.exports.is(this)) {
- throw new TypeError(\\"Illegal invocation\\");
- }
-
- if (arguments.length < 1) {
- throw new TypeError(
- \\"Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \\" + arguments.length + \\" present.\\"
- );
- }
- const args = [];
- switch (arguments.length) {
- case 1:
- {
- let curArg = arguments[0];
- if (typeof curArg === \\"number\\") {
- {
- let curArg = arguments[0];
- curArg = conversions[\\"unsigned long\\"](curArg, {
- context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
- });
- args.push(curArg);
- }
- } else {
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
- });
- args.push(curArg);
- }
- }
- }
- break;
- default: {
- let curArg = arguments[0];
- if (typeof curArg === \\"number\\") {
- {
- let curArg = arguments[0];
- curArg = conversions[\\"unsigned long\\"](curArg, {
- context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
- });
- 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)
- });
- args.push(curArg);
- }
- } else {
- {
- let curArg = arguments[0];
- curArg = conversions[\\"DOMString\\"](curArg, {
- context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
- });
- 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)
- });
- args.push(curArg);
- }
- }
- }
- }
- return this[impl].overloaded2(...args);
- }
-}
-Object.defineProperties(Variadic.prototype, {
- simple1: { enumerable: true },
- simple2: { enumerable: true },
- overloaded1: { enumerable: true },
- overloaded2: { enumerable: true },
- [Symbol.toStringTag]: { value: \\"Variadic\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -7118,34 +6608,174 @@ const iface = {
},
install(globalObject) {
- const ctor = function Variadic() {
- throw new TypeError(\\"Illegal constructor\\");
- };
+ class Variadic {
+ constructor() {
+ throw new TypeError(\\"Illegal constructor\\");
+ }
+
+ simple1() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ 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)
+ });
+ args.push(curArg);
+ }
+ return this[impl].simple1(...args);
+ }
- const proto = {};
+ simple2(first) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new 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\\"
+ });
+ args.push(curArg);
+ }
+ for (let i = 1; i < arguments.length; i++) {
+ let curArg = arguments[i];
+ curArg = convertURL(curArg, { context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) });
+ args.push(curArg);
+ }
+ return this[impl].simple2(...args);
+ }
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(Variadic.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ overloaded1() {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+ const args = [];
+ switch (arguments.length) {
+ case 0:
+ break;
+ default: {
+ let curArg = arguments[0];
+ if (typeof curArg === \\"number\\") {
+ 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)
+ });
+ args.push(curArg);
+ }
+ } else {
+ 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)
+ });
+ args.push(curArg);
+ }
+ }
+ }
+ }
+ return this[impl].overloaded1(...args);
}
- });
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
+ overloaded2(first) {
+ if (!this || !module.exports.is(this)) {
+ throw new TypeError(\\"Illegal invocation\\");
+ }
+
+ if (arguments.length < 1) {
+ throw new TypeError(
+ \\"Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \\" +
+ arguments.length +
+ \\" present.\\"
+ );
+ }
+ const args = [];
+ switch (arguments.length) {
+ case 1:
+ {
+ let curArg = arguments[0];
+ if (typeof curArg === \\"number\\") {
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"unsigned long\\"](curArg, {
+ context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ } else {
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
+ });
+ args.push(curArg);
+ }
+ }
+ }
+ break;
+ default: {
+ let curArg = arguments[0];
+ if (typeof curArg === \\"number\\") {
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"unsigned long\\"](curArg, {
+ context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
+ });
+ 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)
+ });
+ args.push(curArg);
+ }
+ } else {
+ {
+ let curArg = arguments[0];
+ curArg = conversions[\\"DOMString\\"](curArg, {
+ context: \\"Failed to execute 'overloaded2' on 'Variadic': parameter 1\\"
+ });
+ 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)
+ });
+ args.push(curArg);
+ }
+ }
+ }
+ }
+ return this[impl].overloaded2(...args);
+ }
+ }
+ Object.defineProperties(Variadic.prototype, {
+ simple1: { enumerable: true },
+ simple2: { enumerable: true },
+ overloaded1: { enumerable: true },
+ overloaded2: { enumerable: true },
+ [Symbol.toStringTag]: { value: \\"Variadic\\", configurable: true }
+ });
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"Variadic\\"] = ctor;
+ globalObject[ctorRegistry][\\"Variadic\\"] = Variadic;
Object.defineProperty(globalObject, \\"Variadic\\", {
configurable: true,
writable: true,
- value: ctor
+ value: Variadic
});
}
}; // iface
@@ -7164,10 +6794,6 @@ const utils = require(\\"./utils.js\\");
const impl = utils.implSymbol;
const ctorRegistry = utils.ctorRegistrySymbol;
-class ZeroArgConstructor {}
-Object.defineProperties(ZeroArgConstructor.prototype, {
- [Symbol.toStringTag]: { value: \\"ZeroArgConstructor\\", configurable: true }
-});
const iface = {
// When an interface-module that implements this interface as a mixin is loaded, it will append its own \`.is()\`
// method into this array. It allows objects that directly implements *those* interfaces to be recognized as
@@ -7244,34 +6870,23 @@ const iface = {
},
install(globalObject) {
- const ctor = function ZeroArgConstructor() {
- return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
- };
-
- const proto = {};
-
- Object.defineProperties(proto, {
- ...Object.getOwnPropertyDescriptors(ZeroArgConstructor.prototype),
- constructor: {
- writable: true,
- configurable: true,
- value: ctor
+ class ZeroArgConstructor {
+ constructor() {
+ return iface.setup(Object.create(new.target.prototype), globalObject, undefined);
}
+ }
+ Object.defineProperties(ZeroArgConstructor.prototype, {
+ [Symbol.toStringTag]: { value: \\"ZeroArgConstructor\\", configurable: true }
});
- Object.defineProperty(ctor, \\"prototype\\", {
- writable: false,
- value: proto
- });
-
if (globalObject[ctorRegistry] === undefined) {
globalObject[ctorRegistry] = Object.create(null);
}
- globalObject[ctorRegistry][\\"ZeroArgConstructor\\"] = ctor;
+ globalObject[ctorRegistry][\\"ZeroArgConstructor\\"] = ZeroArgConstructor;
Object.defineProperty(globalObject, \\"ZeroArgConstructor\\", {
configurable: true,
writable: true,
- value: ctor
+ value: ZeroArgConstructor
});
}
}; // iface
From d5e76f950541e229287f07b6ef75c1892445a039 Mon Sep 17 00:00:00 2001
From: Pierre-Marie Dartus
Date: Tue, 5 Nov 2019 07:05:33 +0100
Subject: [PATCH 8/8] make symbol name more specific to avoid conflict
---
lib/output/utils.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/output/utils.js b/lib/output/utils.js
index c02838f6..3618315d 100644
--- a/lib/output/utils.js
+++ b/lib/output/utils.js
@@ -12,7 +12,7 @@ function hasOwn(obj, prop) {
const wrapperSymbol = Symbol("wrapper");
const implSymbol = Symbol("impl");
const sameObjectCaches = Symbol("SameObject caches");
-const ctorRegistrySymbol = Symbol.for("constructor registry");
+const ctorRegistrySymbol = Symbol.for("[webidl2js] constructor registry");
function getSameObject(wrapper, prop, creator) {
if (!wrapper[sameObjectCaches]) {