From a272dce75ff1a97b0d845556bbe5ec44849fddb3 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 20 Apr 2020 16:23:54 -0400 Subject: [PATCH] Rename unforgeable test files --- test/__snapshots__/test.js.snap | 15798 ++++++++-------- ...geable.webidl => LegacyUnforgeable.webidl} | 2 +- ...Map.webidl => LegacyUnforgeableMap.webidl} | 2 +- 3 files changed, 7901 insertions(+), 7901 deletions(-) rename test/cases/{Unforgeable.webidl => LegacyUnforgeable.webidl} (88%) rename test/cases/{UnforgeableMap.webidl => LegacyUnforgeableMap.webidl} (82%) diff --git a/test/__snapshots__/test.js.snap b/test/__snapshots__/test.js.snap index f776c036..ec1a2b51 100644 --- a/test/__snapshots__/test.js.snap +++ b/test/__snapshots__/test.js.snap @@ -2104,7 +2104,7 @@ const Impl = require(\\"../implementations/HTMLConstructor.js\\"); " `; -exports[`with processors MixedIn.webidl 1`] = ` +exports[`with processors LegacyUnforgeable.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -2113,7 +2113,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"MixedIn\\"; +const interfaceName = \\"LegacyUnforgeable\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -2125,7 +2125,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'MixedIn'.\`); + throw new TypeError(\`\${context} is not of type 'LegacyUnforgeable'.\`); }; function makeWrapper(globalObject) { @@ -2133,9 +2133,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"MixedIn\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"LegacyUnforgeable\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor MixedIn is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor LegacyUnforgeable is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -2151,7 +2151,105 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { return utils.implForWrapper(wrapper); }; -exports._internalSetup = (wrapper, globalObject) => {}; +exports._internalSetup = (wrapper, globalObject) => { + Object.defineProperties( + wrapper, + Object.getOwnPropertyDescriptors({ + assign(url) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'assign' on 'LegacyUnforgeable': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } + const args = []; + { + let curArg = arguments[0]; + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to execute 'assign' on 'LegacyUnforgeable': parameter 1\\" + }); + args.push(curArg); + } + return esValue[implSymbol].assign(...args); + }, + get href() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"href\\"]; + }, + set href(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'href' property on 'LegacyUnforgeable': The provided value\\" + }); + + esValue[implSymbol][\\"href\\"] = V; + }, + toString() { + const esValue = this; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"href\\"]; + }, + get origin() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"origin\\"]; + }, + get protocol() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"protocol\\"]; + }, + set protocol(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'protocol' property on 'LegacyUnforgeable': The provided value\\" + }); + + esValue[implSymbol][\\"protocol\\"] = V; + } + }) + ); + + Object.defineProperties(wrapper, { + assign: { configurable: false, writable: false }, + href: { configurable: false }, + toString: { configurable: false, writable: false }, + origin: { configurable: false }, + protocol: { configurable: false } + }); +}; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -2191,234 +2289,96 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class MixedIn { + class LegacyUnforgeable { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - - mixedInOp() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].mixedInOp(); - } - - ifaceMixinOp() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].ifaceMixinOp(); - } - - get mixedInAttr() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"mixedInAttr\\"]; - } - - set mixedInAttr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\" - }); - - esValue[implSymbol][\\"mixedInAttr\\"] = V; - } - - get ifaceMixinAttr() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"ifaceMixinAttr\\"]; - } - - set ifaceMixinAttr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\" - }); - - esValue[implSymbol][\\"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 } + Object.defineProperties(LegacyUnforgeable.prototype, { + [Symbol.toStringTag]: { value: \\"LegacyUnforgeable\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = MixedIn; + globalObject[ctorRegistrySymbol][interfaceName] = LegacyUnforgeable; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: MixedIn + value: LegacyUnforgeable }); }; -const Impl = require(\\"../implementations/MixedIn.js\\"); +const Impl = require(\\"../implementations/LegacyUnforgeable.js\\"); " `; -exports[`with processors NodeFilter.webidl 1`] = ` +exports[`with processors LegacyUnforgeableMap.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { - if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); - } - - function callTheUserObjectsOperation(node) { - let thisArg = utils.tryWrapperForImpl(this); - let O = value; - let X = O; - - if (typeof O !== \\"function\\") { - X = O[\\"acceptNode\\"]; - if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement NodeFilter.\`); - } - thisArg = O; - } +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - node = utils.tryWrapperForImpl(node); +const interfaceName = \\"LegacyUnforgeableMap\\"; - let callResult = Reflect.apply(X, thisArg, [node]); +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'LegacyUnforgeableMap'.\`); +}; - callResult = conversions[\\"unsigned short\\"](callResult, { context: context }); +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - return callResult; + const ctor = globalObject[ctorRegistrySymbol][\\"LegacyUnforgeableMap\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor LegacyUnforgeableMap is not installed on the passed global object\\"); } - callTheUserObjectsOperation[utils.wrapperSymbol] = value; - callTheUserObjectsOperation.objectReference = value; + return Object.create(ctor.prototype); +} - return callTheUserObjectsOperation; +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); }; -const exposed = new Set([\\"Window\\"]); +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } +exports._internalSetup = (wrapper, globalObject) => { + Object.defineProperties( + wrapper, + Object.getOwnPropertyDescriptors({ + get a() { + const esValue = this !== null && this !== undefined ? this : globalObject; - const NodeFilter = () => { - throw new TypeError(\\"Illegal invocation\\"); - }; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - Object.defineProperties(NodeFilter, { - FILTER_ACCEPT: { value: 1, enumerable: true }, - FILTER_REJECT: { value: 2, enumerable: true }, - FILTER_SKIP: { value: 3, enumerable: true }, - SHOW_ALL: { value: 0xffffffff, enumerable: true }, - SHOW_ELEMENT: { value: 0x1, enumerable: true }, - SHOW_ATTRIBUTE: { value: 0x2, enumerable: true }, - SHOW_TEXT: { value: 0x4, enumerable: true }, - SHOW_CDATA_SECTION: { value: 0x8, enumerable: true }, - SHOW_ENTITY_REFERENCE: { value: 0x10, enumerable: true }, - SHOW_ENTITY: { value: 0x20, enumerable: true }, - SHOW_PROCESSING_INSTRUCTION: { value: 0x40, enumerable: true }, - SHOW_COMMENT: { value: 0x80, enumerable: true }, - SHOW_DOCUMENT: { value: 0x100, enumerable: true }, - SHOW_DOCUMENT_TYPE: { value: 0x200, enumerable: true }, - SHOW_DOCUMENT_FRAGMENT: { value: 0x400, enumerable: true }, - SHOW_NOTATION: { value: 0x800, enumerable: true } - }); - - Object.defineProperty(globalObject, \\"NodeFilter\\", { - configurable: true, - writable: true, - value: NodeFilter - }); -}; -" -`; - -exports[`with processors Overloads.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const URL = require(\\"./URL.js\\"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"Overloads\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Overloads'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"Overloads\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Overloads is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; + return esValue[implSymbol][\\"a\\"]; + } + }) + ); -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); + Object.defineProperties(wrapper, { a: { configurable: false } }); }; -exports._internalSetup = (wrapper, globalObject) => {}; - exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -2428,6 +2388,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -2444,6 +2406,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -2457,1588 +2421,70 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class Overloads { + class LegacyUnforgeableMap { constructor() { - const args = []; - switch (arguments.length) { - case 0: - break; - default: { - let curArg = arguments[0]; - if (URL.is(curArg)) { - { - let curArg = arguments[0]; - curArg = URL.convert(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 exports.setup(Object.create(new.target.prototype), globalObject, args); + throw new TypeError(\\"Illegal constructor\\"); } + } + Object.defineProperties(LegacyUnforgeableMap.prototype, { + [Symbol.toStringTag]: { value: \\"LegacyUnforgeableMap\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = LegacyUnforgeableMap; - compatible(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: LegacyUnforgeableMap + }); +}; - 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); - } +const proxyHandler = { + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; } - return utils.tryWrapperForImpl(esValue[implSymbol].compatible(...args)); + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; } + return Reflect.apply(getter, receiver, []); + }, - incompatible1(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + }, - 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 esValue[implSymbol].incompatible1(...args); - } - - incompatible2(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].incompatible2(...args); - } - - incompatible3(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 = URL.convert(curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" - }); - } - args.push(curArg); - } - } else if (URL.is(curArg)) { - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = URL.convert(curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" - }); - } - args.push(curArg); - } - } else if (utils.isArrayBuffer(curArg)) { - { - let curArg = arguments[1]; - if (utils.isArrayBuffer(curArg)) { - } 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 (utils.isArrayBuffer(curArg)) { - } 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 (utils.isArrayBuffer(curArg)) { - } 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 (utils.isArrayBuffer(curArg)) { - } 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 esValue[implSymbol].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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = Overloads; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Overloads - }); -}; - -const Impl = require(\\"../implementations/Overloads.js\\"); -" -`; - -exports[`with processors PromiseTypes.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"PromiseTypes\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"PromiseTypes\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor PromiseTypes is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class PromiseTypes { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - - voidPromiseConsumer(p) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].voidPromiseConsumer(...args); - } - - promiseConsumer(p) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].promiseConsumer(...args); - } - } - Object.defineProperties(PromiseTypes.prototype, { - voidPromiseConsumer: { enumerable: true }, - promiseConsumer: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"PromiseTypes\\", configurable: true } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = PromiseTypes; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: PromiseTypes - }); -}; - -const Impl = require(\\"../implementations/PromiseTypes.js\\"); -" -`; - -exports[`with processors Reflect.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const whatwg_url = require(\\"whatwg-url\\"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"Reflect\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Reflect'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"Reflect\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Reflect is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Reflect { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - - get reflectedBoolean() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].hasAttributeNS(null, \\"reflectedboolean\\"); - } - - set reflectedBoolean(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\" - }); - - if (V) { - esValue[implSymbol].setAttributeNS(null, \\"reflectedboolean\\", \\"\\"); - } else { - esValue[implSymbol].removeAttributeNS(null, \\"reflectedboolean\\"); - } - } - - get reflectedDOMString() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - const value = esValue[implSymbol].getAttributeNS(null, \\"reflecteddomstring\\"); - return value === null ? \\"\\" : value; - } - - set reflectedDOMString(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol].setAttributeNS(null, \\"reflecteddomstring\\", V); - } - - get reflectedLong() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - const value = parseInt(esValue[implSymbol].getAttributeNS(null, \\"reflectedlong\\")); - return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value; - } - - set reflectedLong(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"long\\"](V, { - context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol].setAttributeNS(null, \\"reflectedlong\\", String(V)); - } - - get reflectedUnsignedLong() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - const value = parseInt(esValue[implSymbol].getAttributeNS(null, \\"reflectedunsignedlong\\")); - return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value; - } - - set reflectedUnsignedLong(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol].setAttributeNS(null, \\"reflectedunsignedlong\\", String(V > 2147483647 ? 0 : V)); - } - - get reflectedUSVStringURL() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - const value = esValue[implSymbol].getAttributeNS(null, \\"reflectedusvstringurl\\"); - if (value === null) { - return \\"\\"; - } - const urlRecord = whatwg_url.parseURL(value, { baseURL: \\"http://localhost:8080/\\" }); - return urlRecord === null ? conversions.USVString(value) : whatwg_url.serializeURL(urlRecord); - } - - set reflectedUSVStringURL(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol].setAttributeNS(null, \\"reflectedusvstringurl\\", V); - } - - get reflectionTest() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - const value = esValue[implSymbol].getAttributeNS(null, \\"reflection\\"); - return value === null ? \\"\\" : value; - } - - set reflectionTest(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol].setAttributeNS(null, \\"reflection\\", V); - } - - get withUnderscore() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - const value = esValue[implSymbol].getAttributeNS(null, \\"with-underscore\\"); - return value === null ? \\"\\" : value; - } - - set withUnderscore(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol].setAttributeNS(null, \\"with-underscore\\", V); - } - } - Object.defineProperties(Reflect.prototype, { - reflectedBoolean: { enumerable: true }, - reflectedDOMString: { enumerable: true }, - reflectedLong: { enumerable: true }, - reflectedUnsignedLong: { enumerable: true }, - reflectedUSVStringURL: { enumerable: true }, - reflectionTest: { enumerable: true }, - withUnderscore: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"Reflect\\", configurable: true } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = Reflect; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Reflect - }); -}; - -const Impl = require(\\"../implementations/Reflect.js\\"); -" -`; - -exports[`with processors RequestDestination.webidl 1`] = ` -"\\"use strict\\"; - -const enumerationValues = new Set([ - \\"\\", - \\"audio\\", - \\"document\\", - \\"embed\\", - \\"font\\", - \\"image\\", - \\"manifest\\", - \\"object\\", - \\"report\\", - \\"script\\", - \\"sharedworker\\", - \\"style\\", - \\"track\\", - \\"video\\", - \\"worker\\", - \\"xslt\\" -]); -exports.enumerationValues = enumerationValues; - -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { - const string = \`\${value}\`; - if (!enumerationValues.has(string)) { - throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); - } - return string; -}; -" -`; - -exports[`with processors SeqAndRec.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const URL = require(\\"./URL.js\\"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"SeqAndRec\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"SeqAndRec\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class SeqAndRec { - constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - recordConsumer(rec) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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; - } - args.push(curArg); - } - return esValue[implSymbol].recordConsumer(...args); - } - - recordConsumer2(rec) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 = URL.convert(typedValue, { - context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" - }); - - result[typedKey] = typedValue; - } - } - curArg = result; - } - args.push(curArg); - } - return esValue[implSymbol].recordConsumer2(...args); - } - - sequenceConsumer(seq) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].sequenceConsumer(...args); - } - - sequenceConsumer2(seq) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].sequenceConsumer2(...args); - } - - frozenArrayConsumer(arr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = SeqAndRec; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SeqAndRec - }); -}; - -const Impl = require(\\"../implementations/SeqAndRec.js\\"); -" -`; - -exports[`with processors Static.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"Static\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Static'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"Static\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Static { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - - def() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].def(); - } - - get abc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"abc\\"]; - } - - set abc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); - - esValue[implSymbol][\\"abc\\"] = V; - } - - static def() { - return Impl.implementation.def(); - } - - static get abc() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - return Impl.implementation[\\"abc\\"]; - } - - static set abc(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - 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 } }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = Static; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Static - }); -}; - -const Impl = require(\\"../implementations/Static.js\\"); -" -`; - -exports[`with processors Storage.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"Storage\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Storage'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"Storage\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Storage is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => {}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); - - wrapper = new Proxy(wrapper, proxyHandler); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; - -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); - - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); - - wrapper = new Proxy(wrapper, proxyHandler); - - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; - -const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Storage { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - - key(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - 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 esValue[implSymbol].key(...args); - } - - getItem(key) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].getItem(...args); - } - - setItem(key, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].setItem(...args); - } - - removeItem(key) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].removeItem(...args); - } - - clear() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].clear(); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = Storage; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Storage - }); -}; - -const proxyHandler = { - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - }, - - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - }, - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); + ownKeys(target) { + const keys = new Set(); + + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); } } @@ -4055,7 +2501,7 @@ const proxyHandler = { let ignoreNamedProps = false; if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { - const namedValue = target[implSymbol].getItem(P); + const namedValue = target[implSymbol][utils.namedGet](P); return { writable: true, @@ -4077,10 +2523,15 @@ const proxyHandler = { let namedValue = V; namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" }); - target[implSymbol].setItem(P, namedValue); + const creating = !target[implSymbol][utils.supportsPropertyName](P); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); + } return true; } @@ -4123,20 +2574,27 @@ const proxyHandler = { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; - } + if (![\\"a\\"].includes(P)) { + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } - let namedValue = desc.value; + let namedValue = desc.value; - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" - }); + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + }); - target[implSymbol].setItem(P, namedValue); + const creating = !target[implSymbol][utils.supportsPropertyName](P); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); + } - return true; + return true; + } } return Reflect.defineProperty(target, P, desc); }, @@ -4147,8 +2605,7 @@ const proxyHandler = { } if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { - target[implSymbol].removeItem(P); - return true; + return false; } return Reflect.deleteProperty(target, P); @@ -4159,11 +2616,11 @@ const proxyHandler = { } }; -const Impl = require(\\"../implementations/Storage.js\\"); +const Impl = require(\\"../implementations/LegacyUnforgeableMap.js\\"); " `; -exports[`with processors StringifierAttribute.webidl 1`] = ` +exports[`with processors MixedIn.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -4172,7 +2629,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierAttribute\\"; +const interfaceName = \\"MixedIn\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -4184,7 +2641,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); + throw new TypeError(\`\${context} is not of type 'MixedIn'.\`); }; function makeWrapper(globalObject) { @@ -4192,9 +2649,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierAttribute\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"MixedIn\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor StringifierAttribute is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor MixedIn is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -4250,132 +2707,143 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierAttribute { + class MixedIn { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - get attr() { + mixedInOp() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].mixedInOp(); + } + + ifaceMixinOp() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].ifaceMixinOp(); + } + + get mixedInAttr() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"attr\\"]; + return esValue[implSymbol][\\"mixedInAttr\\"]; } - toString() { - const esValue = this; + set mixedInAttr(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"attr\\"]; + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\" + }); + + esValue[implSymbol][\\"mixedInAttr\\"] = V; + } + + get ifaceMixinAttr() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"ifaceMixinAttr\\"]; + } + + set ifaceMixinAttr(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\" + }); + + esValue[implSymbol][\\"ifaceMixinAttr\\"] = V; } } - Object.defineProperties(StringifierAttribute.prototype, { - attr: { enumerable: true }, - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierAttribute\\", configurable: true } + 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 } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierAttribute; + globalObject[ctorRegistrySymbol][interfaceName] = MixedIn; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierAttribute + value: MixedIn }); }; -const Impl = require(\\"../implementations/StringifierAttribute.js\\"); -" -`; - -exports[`with processors StringifierDefaultOperation.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"StringifierDefaultOperation\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } +const Impl = require(\\"../implementations/MixedIn.js\\"); +" +`; - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierDefaultOperation\\"]; - if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor StringifierDefaultOperation is not installed on the passed global object\\" - ); - } +exports[`with processors NodeFilter.webidl 1`] = ` +"\\"use strict\\"; - return Object.create(ctor.prototype); -} +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; +exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { + if (!utils.isObject(value)) { + throw new TypeError(\`\${context} is not an object.\`); + } -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; + function callTheUserObjectsOperation(node) { + let thisArg = utils.tryWrapperForImpl(this); + let O = value; + let X = O; -exports._internalSetup = (wrapper, globalObject) => {}; + if (typeof O !== \\"function\\") { + X = O[\\"acceptNode\\"]; + if (typeof X !== \\"function\\") { + throw new TypeError(\`\${context} does not correctly implement NodeFilter.\`); + } + thisArg = O; + } -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; + node = utils.tryWrapperForImpl(node); - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); + let callResult = Reflect.apply(X, thisArg, [node]); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; + callResult = conversions[\\"unsigned short\\"](callResult, { context: context }); -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); + return callResult; + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); + callTheUserObjectsOperation[utils.wrapperSymbol] = value; + callTheUserObjectsOperation.objectReference = value; - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; + return callTheUserObjectsOperation; }; const exposed = new Set([\\"Window\\"]); @@ -4384,50 +2852,50 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierDefaultOperation { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - toString() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + const NodeFilter = () => { + throw new TypeError(\\"Illegal invocation\\"); + }; - return esValue[implSymbol].toString(); - } - } - Object.defineProperties(StringifierDefaultOperation.prototype, { - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierDefaultOperation\\", configurable: true } + Object.defineProperties(NodeFilter, { + FILTER_ACCEPT: { value: 1, enumerable: true }, + FILTER_REJECT: { value: 2, enumerable: true }, + FILTER_SKIP: { value: 3, enumerable: true }, + SHOW_ALL: { value: 0xffffffff, enumerable: true }, + SHOW_ELEMENT: { value: 0x1, enumerable: true }, + SHOW_ATTRIBUTE: { value: 0x2, enumerable: true }, + SHOW_TEXT: { value: 0x4, enumerable: true }, + SHOW_CDATA_SECTION: { value: 0x8, enumerable: true }, + SHOW_ENTITY_REFERENCE: { value: 0x10, enumerable: true }, + SHOW_ENTITY: { value: 0x20, enumerable: true }, + SHOW_PROCESSING_INSTRUCTION: { value: 0x40, enumerable: true }, + SHOW_COMMENT: { value: 0x80, enumerable: true }, + SHOW_DOCUMENT: { value: 0x100, enumerable: true }, + SHOW_DOCUMENT_TYPE: { value: 0x200, enumerable: true }, + SHOW_DOCUMENT_FRAGMENT: { value: 0x400, enumerable: true }, + SHOW_NOTATION: { value: 0x800, enumerable: true } }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierDefaultOperation; - Object.defineProperty(globalObject, interfaceName, { + Object.defineProperty(globalObject, \\"NodeFilter\\", { configurable: true, writable: true, - value: StringifierDefaultOperation + value: NodeFilter }); }; - -const Impl = require(\\"../implementations/StringifierDefaultOperation.js\\"); " `; -exports[`with processors StringifierNamedOperation.webidl 1`] = ` +exports[`with processors Overloads.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierNamedOperation\\"; +const interfaceName = \\"Overloads\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -4439,7 +2907,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); + throw new TypeError(\`\${context} is not of type 'Overloads'.\`); }; function makeWrapper(globalObject) { @@ -4447,11 +2915,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierNamedOperation\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Overloads\\"]; if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor StringifierNamedOperation is not installed on the passed global object\\" - ); + throw new Error(\\"Internal error: constructor Overloads is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -4507,51 +2973,341 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierNamedOperation { + class Overloads { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + const args = []; + switch (arguments.length) { + case 0: + break; + default: { + let curArg = arguments[0]; + if (URL.is(curArg)) { + { + let curArg = arguments[0]; + curArg = URL.convert(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 exports.setup(Object.create(new.target.prototype), globalObject, args); + } + + compatible(arg1) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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(esValue[implSymbol].compatible(...args)); + } + + incompatible1(arg1) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].incompatible1(...args); } - operation() { + incompatible2(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].operation(); + 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 esValue[implSymbol].incompatible2(...args); } - toString() { + incompatible3(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].operation(); + 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 = URL.convert(curArg, { + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + }); + } + args.push(curArg); + } + } else if (URL.is(curArg)) { + { + let curArg = arguments[1]; + if (curArg !== undefined) { + curArg = URL.convert(curArg, { + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + }); + } + args.push(curArg); + } + } else if (utils.isArrayBuffer(curArg)) { + { + let curArg = arguments[1]; + if (utils.isArrayBuffer(curArg)) { + } 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 (utils.isArrayBuffer(curArg)) { + } 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 (utils.isArrayBuffer(curArg)) { + } 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 (utils.isArrayBuffer(curArg)) { + } 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 esValue[implSymbol].incompatible3(...args); } } - Object.defineProperties(StringifierNamedOperation.prototype, { - operation: { enumerable: true }, - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierNamedOperation\\", configurable: true } + Object.defineProperties(Overloads.prototype, { + compatible: { enumerable: true }, + incompatible1: { enumerable: true }, + incompatible2: { enumerable: true }, + incompatible3: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"Overloads\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierNamedOperation; + globalObject[ctorRegistrySymbol][interfaceName] = Overloads; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierNamedOperation + value: Overloads }); }; -const Impl = require(\\"../implementations/StringifierNamedOperation.js\\"); +const Impl = require(\\"../implementations/Overloads.js\\"); " `; -exports[`with processors StringifierOperation.webidl 1`] = ` +exports[`with processors PromiseTypes.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -4560,7 +3316,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierOperation\\"; +const interfaceName = \\"PromiseTypes\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -4572,7 +3328,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`); + throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`); }; function makeWrapper(globalObject) { @@ -4580,9 +3336,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierOperation\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"PromiseTypes\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor StringifierOperation is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor PromiseTypes is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -4638,52 +3394,99 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierOperation { + class PromiseTypes { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - toString() { + voidPromiseConsumer(p) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].toString(); + 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 esValue[implSymbol].voidPromiseConsumer(...args); + } + + promiseConsumer(p) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].promiseConsumer(...args); } } - Object.defineProperties(StringifierOperation.prototype, { - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierOperation\\", configurable: true } + Object.defineProperties(PromiseTypes.prototype, { + voidPromiseConsumer: { enumerable: true }, + promiseConsumer: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"PromiseTypes\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierOperation; + globalObject[ctorRegistrySymbol][interfaceName] = PromiseTypes; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierOperation + value: PromiseTypes }); }; -const Impl = require(\\"../implementations/StringifierOperation.js\\"); +const Impl = require(\\"../implementations/PromiseTypes.js\\"); " `; -exports[`with processors TypedefsAndUnions.webidl 1`] = ` +exports[`with processors Reflect.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const RequestDestination = require(\\"./RequestDestination.js\\"); -const URL = require(\\"./URL.js\\"); +const whatwg_url = require(\\"whatwg-url\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"TypedefsAndUnions\\"; +const interfaceName = \\"Reflect\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -4695,7 +3498,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); + throw new TypeError(\`\${context} is not of type 'Reflect'.\`); }; function makeWrapper(globalObject) { @@ -4703,9 +3506,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"TypedefsAndUnions\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Reflect\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Reflect is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -4761,471 +3564,263 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class TypedefsAndUnions { + class Reflect { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - numOrStrConsumer(a) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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\\" - }); - } - args.push(curArg); - } - return esValue[implSymbol].numOrStrConsumer(...args); - } - - numOrEnumConsumer(a) { + get reflectedBoolean() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 = RequestDestination.convert(curArg, { - context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" - }); - } - } - args.push(curArg); - } - return esValue[implSymbol].numOrEnumConsumer(...args); - } - numOrStrOrNullConsumer(a) { - const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - 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 esValue[implSymbol].numOrStrOrNullConsumer(...args); + return esValue[implSymbol].hasAttributeNS(null, \\"reflectedboolean\\"); } - numOrStrOrURLOrNullConsumer(a) { + set reflectedBoolean(V) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - 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 (URL.is(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 esValue[implSymbol].numOrStrOrURLOrNullConsumer(...args); - } - urlMapInnerConsumer(a) { - const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { 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 '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\\" - }); - - let typedValue = curArg[key]; - - typedValue = URL.convert(typedValue, { - context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" - }); + V = conversions[\\"boolean\\"](V, { + context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\" + }); - result[typedKey] = typedValue; - } - } - curArg = result; - } - args.push(curArg); + if (V) { + esValue[implSymbol].setAttributeNS(null, \\"reflectedboolean\\", \\"\\"); + } else { + esValue[implSymbol].removeAttributeNS(null, \\"reflectedboolean\\"); } - return esValue[implSymbol].urlMapInnerConsumer(...args); } - urlMapConsumer(a) { + get reflectedDOMString() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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)) { - 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; - - typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" - }); - - let typedValue = curArg[key]; - - typedValue = URL.convert(typedValue, { - context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" - }); - - result[typedKey] = typedValue; - } - } - curArg = result; - } - } - args.push(curArg); + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].urlMapConsumer(...args); + + const value = esValue[implSymbol].getAttributeNS(null, \\"reflecteddomstring\\"); + return value === null ? \\"\\" : value; } - bufferSourceOrURLConsumer(b) { + set reflectedDOMString(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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 (URL.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else if (utils.isArrayBuffer(curArg)) { - } 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 esValue[implSymbol].bufferSourceOrURLConsumer(...args); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol].setAttributeNS(null, \\"reflecteddomstring\\", V); } - arrayBufferViewOrURLMapConsumer(b) { + get reflectedLong() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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 value = parseInt(esValue[implSymbol].getAttributeNS(null, \\"reflectedlong\\")); + return isNaN(value) || value < -2147483648 || value > 2147483647 ? 0 : value; + } + + set reflectedLong(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - 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; - typedKey = conversions[\\"USVString\\"](typedKey, { - context: - \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + - \\" record\\" + - \\"'s key\\" - }); + V = conversions[\\"long\\"](V, { + context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\" + }); - let typedValue = curArg[key]; + esValue[implSymbol].setAttributeNS(null, \\"reflectedlong\\", String(V)); + } - typedValue = URL.convert(typedValue, { - context: - \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + - \\" record\\" + - \\"'s value\\" - }); + get reflectedUnsignedLong() { + const esValue = this !== null && this !== undefined ? this : globalObject; - 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); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].arrayBufferViewOrURLMapConsumer(...args); + + const value = parseInt(esValue[implSymbol].getAttributeNS(null, \\"reflectedunsignedlong\\")); + return isNaN(value) || value < 0 || value > 2147483647 ? 0 : value; } - arrayBufferViewDupConsumer(b) { + set reflectedUnsignedLong(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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.\\" - ); + V = conversions[\\"unsigned long\\"](V, { + context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol].setAttributeNS(null, \\"reflectedunsignedlong\\", String(V > 2147483647 ? 0 : V)); + } + + get reflectedUSVStringURL() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - 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); + + const value = esValue[implSymbol].getAttributeNS(null, \\"reflectedusvstringurl\\"); + if (value === null) { + return \\"\\"; } - return esValue[implSymbol].arrayBufferViewDupConsumer(...args); + const urlRecord = whatwg_url.parseURL(value, { baseURL: \\"http://localhost:8080/\\" }); + return urlRecord === null ? conversions.USVString(value) : whatwg_url.serializeURL(urlRecord); } - get buf() { + set reflectedUSVStringURL(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return utils.tryWrapperForImpl(esValue[implSymbol][\\"buf\\"]); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol].setAttributeNS(null, \\"reflectedusvstringurl\\", V); } - set buf(V) { + get reflectionTest() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (utils.isArrayBuffer(V)) { - } else if ( - ArrayBuffer.isView(V) && - (V.constructor.name === \\"Uint8Array\\" || V.constructor.name === \\"Uint16Array\\") - ) { - } else { - throw new TypeError( - \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + - \\" is not of any supported type.\\" - ); + const value = esValue[implSymbol].getAttributeNS(null, \\"reflection\\"); + return value === null ? \\"\\" : value; + } + + set reflectionTest(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - esValue[implSymbol][\\"buf\\"] = V; + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol].setAttributeNS(null, \\"reflection\\", V); } - get time() { + get withUnderscore() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"time\\"]; + const value = esValue[implSymbol].getAttributeNS(null, \\"with-underscore\\"); + return value === null ? \\"\\" : value; } - set time(V) { + set withUnderscore(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"unsigned long long\\"](V, { - context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\" + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\" }); - esValue[implSymbol][\\"time\\"] = V; + esValue[implSymbol].setAttributeNS(null, \\"with-underscore\\", 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.defineProperties(Reflect.prototype, { + reflectedBoolean: { enumerable: true }, + reflectedDOMString: { enumerable: true }, + reflectedLong: { enumerable: true }, + reflectedUnsignedLong: { enumerable: true }, + reflectedUSVStringURL: { enumerable: true }, + reflectionTest: { enumerable: true }, + withUnderscore: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"Reflect\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = TypedefsAndUnions; + globalObject[ctorRegistrySymbol][interfaceName] = Reflect; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: Reflect + }); +}; + +const Impl = require(\\"../implementations/Reflect.js\\"); +" +`; + +exports[`with processors RequestDestination.webidl 1`] = ` +"\\"use strict\\"; + +const enumerationValues = new Set([ + \\"\\", + \\"audio\\", + \\"document\\", + \\"embed\\", + \\"font\\", + \\"image\\", + \\"manifest\\", + \\"object\\", + \\"report\\", + \\"script\\", + \\"sharedworker\\", + \\"style\\", + \\"track\\", + \\"video\\", + \\"worker\\", + \\"xslt\\" +]); +exports.enumerationValues = enumerationValues; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: TypedefsAndUnions - }); +exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { + const string = \`\${value}\`; + if (!enumerationValues.has(string)) { + throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); + } + return string; }; - -const Impl = require(\\"../implementations/TypedefsAndUnions.js\\"); " `; -exports[`with processors URL.webidl 1`] = ` +exports[`with processors SeqAndRec.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URL\\"; +const interfaceName = \\"SeqAndRec\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -5237,7 +3832,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URL'.\`); + throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`); }; function makeWrapper(globalObject) { @@ -5245,9 +3840,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URL\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"SeqAndRec\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor URL is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -5297,347 +3892,403 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\", \\"Worker\\"]); +const exposed = new Set([\\"Window\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class URL { - constructor(url) { + class SeqAndRec { + constructor() { + return exports.setup(Object.create(new.target.prototype), globalObject, undefined); + } + + recordConsumer(rec) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + if (arguments.length < 1) { throw new TypeError( - \\"Failed to construct 'URL': 1 argument required, but only \\" + arguments.length + \\" present.\\" + \\"Failed to execute 'recordConsumer' on 'SeqAndRec': 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 exports.setup(Object.create(new.target.prototype), globalObject, args); - } + 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; - toJSON() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + typedKey = conversions[\\"USVString\\"](typedKey, { + context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" + }); - return esValue[implSymbol].toJSON(); - } + let typedValue = curArg[key]; - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; + typedValue = conversions[\\"double\\"](typedValue, { + context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + result[typedKey] = typedValue; + } + } + curArg = result; + } + args.push(curArg); } - - return esValue[implSymbol][\\"href\\"]; + return esValue[implSymbol].recordConsumer(...args); } - set href(V) { + recordConsumer2(rec) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" }); - - esValue[implSymbol][\\"href\\"] = V; - } - - toString() { - const esValue = this; - if (!exports.is(esValue)) { - 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; - return esValue[implSymbol][\\"href\\"]; - } - - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + typedKey = conversions[\\"USVString\\"](typedKey, { + context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" + }); - return esValue[implSymbol][\\"origin\\"]; - } + let typedValue = curArg[key]; - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; + typedValue = URL.convert(typedValue, { + context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + result[typedKey] = typedValue; + } + } + curArg = result; + } + args.push(curArg); } - - return esValue[implSymbol][\\"protocol\\"]; + return esValue[implSymbol].recordConsumer2(...args); } - set protocol(V) { + sequenceConsumer(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" - }); - - esValue[implSymbol][\\"protocol\\"] = V; - } - - get username() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - 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\\" + }); - return esValue[implSymbol][\\"username\\"]; - } - - set username(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + V.push(nextItem); + } + curArg = V; + } + args.push(curArg); } - - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'username' property on 'URL': The provided value\\" - }); - - esValue[implSymbol][\\"username\\"] = V; + return esValue[implSymbol].sequenceConsumer(...args); } - get password() { + sequenceConsumer2(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"password\\"]; - } - - set password(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - 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 = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'password' property on 'URL': The provided value\\" - }); - - esValue[implSymbol][\\"password\\"] = V; - } - - get host() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + V.push(nextItem); + } + curArg = V; + } + args.push(curArg); } - - return esValue[implSymbol][\\"host\\"]; + return esValue[implSymbol].sequenceConsumer2(...args); } - set host(V) { + frozenArrayConsumer(arr) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" }); + 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\\" + }); - esValue[implSymbol][\\"host\\"] = V; + V.push(nextItem); + } + curArg = V; + } + curArg = Object.freeze(curArg); + args.push(curArg); + } + return esValue[implSymbol].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[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = SeqAndRec; - get hostname() { - const esValue = this !== null && this !== undefined ? this : globalObject; + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: SeqAndRec + }); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const Impl = require(\\"../implementations/SeqAndRec.js\\"); +" +`; - return esValue[implSymbol][\\"hostname\\"]; - } +exports[`with processors Static.webidl 1`] = ` +"\\"use strict\\"; - set hostname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" - }); +const interfaceName = \\"Static\\"; - esValue[implSymbol][\\"hostname\\"] = V; - } +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'Static'.\`); +}; - get port() { - const esValue = this !== null && this !== undefined ? this : globalObject; +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + const ctor = globalObject[ctorRegistrySymbol][\\"Static\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\"); + } - return esValue[implSymbol][\\"port\\"]; - } + return Object.create(ctor.prototype); +} - set port(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" }); +exports._internalSetup = (wrapper, globalObject) => {}; - esValue[implSymbol][\\"port\\"] = V; - } +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; - get pathname() { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; - return esValue[implSymbol][\\"pathname\\"]; - } +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); - set pathname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" - }); +const exposed = new Set([\\"Window\\"]); - esValue[implSymbol][\\"pathname\\"] = V; +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class Static { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - get search() { + def() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"search\\"]; + return esValue[implSymbol].def(); } - set search(V) { + get abc() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" }); - - esValue[implSymbol][\\"search\\"] = V; + return esValue[implSymbol][\\"abc\\"]; } - get searchParams() { + set abc(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return utils.getSameObject(this, \\"searchParams\\", () => { - return utils.tryWrapperForImpl(esValue[implSymbol][\\"searchParams\\"]); - }); - } - - get hash() { - const esValue = this !== null && this !== undefined ? this : globalObject; + V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + esValue[implSymbol][\\"abc\\"] = V; + } - return esValue[implSymbol][\\"hash\\"]; + static def() { + return Impl.implementation.def(); } - set hash(V) { + static get abc() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return Impl.implementation[\\"abc\\"]; + } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" }); + static set abc(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - esValue[implSymbol][\\"hash\\"] = V; + return Impl.implementation[\\"abc\\"]; } } - 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 } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URL; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: URL - }); - - if (globalNames.includes(\\"Window\\")) { - Object.defineProperty(globalObject, \\"webkitURL\\", { - configurable: true, - writable: true, - value: URL - }); - } + globalObject[ctorRegistrySymbol][interfaceName] = Static; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: Static + }); }; -const Impl = require(\\"../implementations/URL.js\\"); +const Impl = require(\\"../implementations/Static.js\\"); " `; -exports[`with processors URLList.webidl 1`] = ` +exports[`with processors Storage.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -5646,7 +4297,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URLList\\"; +const interfaceName = \\"Storage\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -5658,7 +4309,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLList'.\`); + throw new TypeError(\`\${context} is not of type 'Storage'.\`); }; function makeWrapper(globalObject) { @@ -5666,9 +4317,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLList\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Storage\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor URLList is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Storage is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -5728,12 +4379,12 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class URLList { + class Storage { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - item(index) { + key(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -5741,18 +4392,92 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'item' on 'URLList': 1 argument required, but only \\" + arguments.length + \\" present.\\" + \\"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 'item' on 'URLList': parameter 1\\" + curArg = conversions[\\"unsigned long\\"](curArg, { context: \\"Failed to execute 'key' on 'Storage': parameter 1\\" }); + args.push(curArg); + } + return esValue[implSymbol].key(...args); + } + + getItem(key) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].getItem(...args); + } + + setItem(key, value) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].setItem(...args); + } + + removeItem(key) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); + return esValue[implSymbol].removeItem(...args); + } + + clear() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].clear(); } get length() { @@ -5765,25 +4490,24 @@ exports.install = (globalObject, globalNames) => { return esValue[implSymbol][\\"length\\"]; } } - Object.defineProperties(URLList.prototype, { - item: { enumerable: true }, + 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: \\"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 } + [Symbol.toStringTag]: { value: \\"Storage\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URLList; + globalObject[ctorRegistrySymbol][interfaceName] = Storage; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: URLList + value: Storage }); }; @@ -5828,8 +4552,10 @@ const proxyHandler = { ownKeys(target) { const keys = new Set(); - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(\`\${key}\`); + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); + } } for (const key of Reflect.ownKeys(target)) { @@ -5844,19 +4570,15 @@ const proxyHandler = { } let ignoreNamedProps = false; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { + const namedValue = target[implSymbol].getItem(P); - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].item(index); - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; + return { + writable: true, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; } return Reflect.getOwnPropertyDescriptor(target, P); @@ -5867,23 +4589,19 @@ const proxyHandler = { return Reflect.set(target, P, V, receiver); } if (target === receiver) { - utils.isArrayIndexPropName(P); - } - let ownDesc; + if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { + let namedValue = V; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + }); - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].item(index); - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + target[implSymbol].setItem(P, namedValue); + + return true; } } + let ownDesc; if (ownDesc === undefined) { ownDesc = Reflect.getOwnPropertyDescriptor(target, P); @@ -5921,11 +4639,21 @@ const proxyHandler = { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } - if (utils.isArrayIndexPropName(P)) { - return false; - } + let namedValue = desc.value; + + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + }); + target[implSymbol].setItem(P, namedValue); + + return true; + } return Reflect.defineProperty(target, P, desc); }, @@ -5934,9 +4662,9 @@ const proxyHandler = { return Reflect.deleteProperty(target, P); } - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !target[implSymbol][utils.supportsPropertyIndex](index); + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { + target[implSymbol].removeItem(P); + return true; } return Reflect.deleteProperty(target, P); @@ -5947,11 +4675,11 @@ const proxyHandler = { } }; -const Impl = require(\\"../implementations/URLList.js\\"); +const Impl = require(\\"../implementations/Storage.js\\"); " `; -exports[`with processors URLSearchParams.webidl 1`] = ` +exports[`with processors StringifierAttribute.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -5960,67 +4688,19 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URLSearchParams\\"; - -const IteratorPrototype = Object.create(utils.IteratorPrototype, { - next: { - value: function next() { - const internal = this[utils.iterInternalSymbol]; - const { target, kind, index } = internal; - const values = Array.from(target[implSymbol]); - const len = values.length; - if (index >= len) { - return { value: undefined, done: true }; - } - - const pair = values[index]; - internal.index = index + 1; - const [key, value] = pair.map(utils.tryWrapperForImpl); - - 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 - } -}); +const interfaceName = \\"StringifierAttribute\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; }; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'URLSearchParams'.\`); -}; - -exports.createDefaultIterator = (target, kind) => { - const iterator = Object.create(IteratorPrototype); - Object.defineProperty(iterator, utils.iterInternalSymbol, { - value: { target, kind, index: 0 }, - configurable: true - }); - return iterator; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); }; function makeWrapper(globalObject) { @@ -6028,9 +4708,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParams\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierAttribute\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor URLSearchParams is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor StringifierAttribute is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -6080,350 +4760,181 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\", \\"Worker\\"]); +const exposed = new Set([\\"Window\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - 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 exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - append(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].append(...args); - } - - delete(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].delete(...args); - } - - get(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].get(...args); - } - - getAll(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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(esValue[implSymbol].getAll(...args)); - } - - has(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].has(...args); - } - - set(name, value) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].set(...args); + class StringifierAttribute { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - sort() { + get attr() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].sort(); + return esValue[implSymbol][\\"attr\\"]; } toString() { - const esValue = this !== null && this !== undefined ? this : globalObject; + const esValue = this; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].toString(); + return esValue[implSymbol][\\"attr\\"]; } + } + Object.defineProperties(StringifierAttribute.prototype, { + attr: { enumerable: true }, + toString: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"StringifierAttribute\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = StringifierAttribute; - keys() { - if (!this || !exports.is(this)) { - throw new TypeError(\\"Illegal invocation\\"); - } - return exports.createDefaultIterator(this, \\"key\\"); - } + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: StringifierAttribute + }); +}; - values() { - if (!this || !exports.is(this)) { - throw new TypeError(\\"Illegal invocation\\"); - } - return exports.createDefaultIterator(this, \\"value\\"); - } +const Impl = require(\\"../implementations/StringifierAttribute.js\\"); +" +`; - entries() { - if (!this || !exports.is(this)) { - throw new TypeError(\\"Illegal invocation\\"); - } - return exports.createDefaultIterator(this, \\"key+value\\"); +exports[`with processors StringifierDefaultOperation.webidl 1`] = ` +"\\"use strict\\"; + +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); + +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; + +const interfaceName = \\"StringifierDefaultOperation\\"; + +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); +}; + +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } + + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierDefaultOperation\\"]; + if (ctor === undefined) { + throw new Error( + \\"Internal error: constructor StringifierDefaultOperation is not installed on the passed global object\\" + ); + } + + return Object.create(ctor.prototype); +} + +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; + +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; + +exports._internalSetup = (wrapper, globalObject) => {}; + +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class StringifierDefaultOperation { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - forEach(callback) { - if (!this || !exports.is(this)) { + toString() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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[implSymbol]); - 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[implSymbol]); - i++; - } + + return esValue[implSymbol].toString(); } } - 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 }, + Object.defineProperties(StringifierDefaultOperation.prototype, { 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 } + [Symbol.toStringTag]: { value: \\"StringifierDefaultOperation\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParams; + globalObject[ctorRegistrySymbol][interfaceName] = StringifierDefaultOperation; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: URLSearchParams + value: StringifierDefaultOperation }); }; -const Impl = require(\\"../implementations/URLSearchParams.js\\"); +const Impl = require(\\"../implementations/StringifierDefaultOperation.js\\"); " `; -exports[`with processors URLSearchParamsCollection.webidl 1`] = ` +exports[`with processors StringifierNamedOperation.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -6432,7 +4943,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URLSearchParamsCollection\\"; +const interfaceName = \\"StringifierNamedOperation\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -6444,7 +4955,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); + throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); }; function makeWrapper(globalObject) { @@ -6452,10 +4963,10 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierNamedOperation\\"]; if (ctor === undefined) { throw new Error( - \\"Internal error: constructor URLSearchParamsCollection is not installed on the passed global object\\" + \\"Internal error: constructor StringifierNamedOperation is not installed on the passed global object\\" ); } @@ -6483,8 +4994,6 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -6501,8 +5010,6 @@ exports.new = globalObject => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -6516,290 +5023,183 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class URLSearchParamsCollection { + class StringifierNamedOperation { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - item(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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(esValue[implSymbol].item(...args)); - } - - namedItem(name) { + operation() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { 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(esValue[implSymbol].namedItem(...args)); + return esValue[implSymbol].operation(); } - get length() { + toString() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"length\\"]; + return esValue[implSymbol].operation(); } - } - 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.defineProperties(StringifierNamedOperation.prototype, { + operation: { enumerable: true }, + toString: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"StringifierNamedOperation\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection; + globalObject[ctorRegistrySymbol][interfaceName] = StringifierNamedOperation; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: URLSearchParamsCollection + value: StringifierNamedOperation }); }; -const proxyHandler = { - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - }, +const Impl = require(\\"../implementations/StringifierNamedOperation.js\\"); +" +`; - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - }, +exports[`with processors StringifierOperation.webidl 1`] = ` +"\\"use strict\\"; - ownKeys(target) { - const keys = new Set(); +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(\`\${key}\`); - } +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); - } - } +const interfaceName = \\"StringifierOperation\\"; - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - }, +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`); +}; - getOwnPropertyDescriptor(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - ignoreNamedProps = true; - } + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierOperation\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor StringifierOperation is not installed on the passed global object\\"); + } - const namedValue = target[implSymbol].namedItem(P); + return Object.create(ctor.prototype); +} - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: false, - enumerable: false, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; - return Reflect.getOwnPropertyDescriptor(target, P); - }, +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; - set(target, P, V, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.set(target, P, V, receiver); - } - if (target === receiver) { - utils.isArrayIndexPropName(P); +exports._internalSetup = (wrapper, globalObject) => {}; - typeof P === \\"string\\" && !utils.isArrayIndexPropName(P); - } - let ownDesc; +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; - } - } + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, P, V, receiver); - } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (!ownDesc.writable) { - return false; - } - if (!utils.isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); - let valueDesc; - if (existingDesc !== undefined) { - if (existingDesc.get || existingDesc.set) { - return false; - } - if (!existingDesc.writable) { - return false; - } - valueDesc = { value: V }; - } else { - valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; - } - return Reflect.defineProperty(receiver, P, valueDesc); - }, + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; - defineProperty(target, P, desc) { - if (typeof P === \\"symbol\\") { - return Reflect.defineProperty(target, P, desc); - } +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); - if (utils.isArrayIndexPropName(P)) { - return false; - } - if (!utils.hasOwn(target, P)) { - const creating = !(target[implSymbol].namedItem(P) !== null); - if (!creating) { - return false; - } - } - return Reflect.defineProperty(target, P, desc); - }, + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); - deleteProperty(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.deleteProperty(target, P); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== undefined); - } +const exposed = new Set([\\"Window\\"]); - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class StringifierOperation { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - return Reflect.deleteProperty(target, P); - }, + toString() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - preventExtensions() { - return false; + return esValue[implSymbol].toString(); + } + } + Object.defineProperties(StringifierOperation.prototype, { + toString: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"StringifierOperation\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); } + globalObject[ctorRegistrySymbol][interfaceName] = StringifierOperation; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: StringifierOperation + }); }; -const Impl = require(\\"../implementations/URLSearchParamsCollection.js\\"); +const Impl = require(\\"../implementations/StringifierOperation.js\\"); " `; -exports[`with processors URLSearchParamsCollection2.webidl 1`] = ` +exports[`with processors TypedefsAndUnions.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const RequestDestination = require(\\"./RequestDestination.js\\"); const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\"); -const interfaceName = \\"URLSearchParamsCollection2\\"; +const interfaceName = \\"TypedefsAndUnions\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -6811,7 +5211,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); + throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); }; function makeWrapper(globalObject) { @@ -6819,11 +5219,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection2\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"TypedefsAndUnions\\"]; if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor URLSearchParamsCollection2 is not installed on the passed global object\\" - ); + throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -6839,9 +5237,7 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { return utils.implForWrapper(wrapper); }; -exports._internalSetup = (wrapper, globalObject) => { - URLSearchParamsCollection._internalSetup(wrapper, globalObject); -}; +exports._internalSetup = (wrapper, globalObject) => {}; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -6852,8 +5248,6 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -6870,8 +5264,6 @@ exports.new = globalObject => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -6885,253 +5277,462 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - - if (globalObject.URLSearchParamsCollection === undefined) { - throw new Error( - \\"Internal error: attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\" - ); - } - class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection { + class TypedefsAndUnions { 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 } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection2; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: URLSearchParamsCollection2 - }); -}; + numOrStrConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -const proxyHandler = { - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'numOrStrConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; + 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); + } + return esValue[implSymbol].numOrStrConsumer(...args); } - return Reflect.apply(getter, receiver, []); - }, - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); + numOrEnumConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 = RequestDestination.convert(curArg, { + context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" + }); + } + } + args.push(curArg); + } + return esValue[implSymbol].numOrEnumConsumer(...args); } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; + + numOrStrOrNullConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + 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 esValue[implSymbol].numOrStrOrNullConsumer(...args); } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); + + numOrStrOrURLOrNullConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + 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 (URL.is(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 esValue[implSymbol].numOrStrOrURLOrNullConsumer(...args); } - return false; - }, - ownKeys(target) { - const keys = new Set(); + urlMapInnerConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 '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\\" + }); + + let typedValue = curArg[key]; + + typedValue = URL.convert(typedValue, { + context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" + }); - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(\`\${key}\`); + result[typedKey] = typedValue; + } + } + curArg = result; + } + args.push(curArg); + } + return esValue[implSymbol].urlMapInnerConsumer(...args); } - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); + urlMapConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - } - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - }, + 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)) { + 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; - getOwnPropertyDescriptor(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; + typedKey = conversions[\\"USVString\\"](typedKey, { + context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" + }); - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + let typedValue = curArg[key]; + + typedValue = URL.convert(typedValue, { + context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" + }); + + result[typedKey] = typedValue; + } + } + curArg = result; + } + } + args.push(curArg); } - ignoreNamedProps = true; + return esValue[implSymbol].urlMapConsumer(...args); } - const namedValue = target[implSymbol].namedItem(P); + bufferSourceOrURLConsumer(b) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; + 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 (URL.is(curArg)) { + curArg = utils.implForWrapper(curArg); + } else if (utils.isArrayBuffer(curArg)) { + } 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 esValue[implSymbol].bufferSourceOrURLConsumer(...args); } - return Reflect.getOwnPropertyDescriptor(target, P); - }, + arrayBufferViewOrURLMapConsumer(b) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - set(target, P, V, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.set(target, P, V, receiver); - } - if (target === receiver) { - utils.isArrayIndexPropName(P); + 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; - if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { - let namedValue = V; + typedKey = conversions[\\"USVString\\"](typedKey, { + context: + \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + + \\" record\\" + + \\"'s key\\" + }); - namedValue = URL.convert(namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" - }); + let typedValue = curArg[key]; - const creating = !(target[implSymbol].namedItem(P) !== null); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } + typedValue = URL.convert(typedValue, { + context: + \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + + \\" record\\" + + \\"'s value\\" + }); - return true; + 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 esValue[implSymbol].arrayBufferViewOrURLMapConsumer(...args); } - let ownDesc; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + arrayBufferViewDupConsumer(b) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - } - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, P, V, receiver); - } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (!ownDesc.writable) { - return false; - } - if (!utils.isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); - let valueDesc; - if (existingDesc !== undefined) { - if (existingDesc.get || existingDesc.set) { - return false; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); } - if (!existingDesc.writable) { - return false; + 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); } - valueDesc = { value: V }; - } else { - valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + return esValue[implSymbol].arrayBufferViewDupConsumer(...args); } - return Reflect.defineProperty(receiver, P, valueDesc); - }, - defineProperty(target, P, desc) { - if (typeof P === \\"symbol\\") { - return Reflect.defineProperty(target, P, desc); - } + get buf() { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (utils.isArrayIndexPropName(P)) { - return false; - } - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - let namedValue = desc.value; + return utils.tryWrapperForImpl(esValue[implSymbol][\\"buf\\"]); + } - namedValue = URL.convert(namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" - }); + set buf(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - const creating = !(target[implSymbol].namedItem(P) !== null); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return true; + if (utils.isArrayBuffer(V)) { + } else if ( + ArrayBuffer.isView(V) && + (V.constructor.name === \\"Uint8Array\\" || V.constructor.name === \\"Uint16Array\\") + ) { + } else { + throw new TypeError( + \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + + \\" is not of any supported type.\\" + ); + } + esValue[implSymbol][\\"buf\\"] = V; } - return Reflect.defineProperty(target, P, desc); - }, - deleteProperty(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.deleteProperty(target, P); - } + get time() { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== undefined); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; + return esValue[implSymbol][\\"time\\"]; } - return Reflect.deleteProperty(target, P); - }, + set time(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - preventExtensions() { - return false; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"unsigned long long\\"](V, { + context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\" + }); + + esValue[implSymbol][\\"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 } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); } + globalObject[ctorRegistrySymbol][interfaceName] = TypedefsAndUnions; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: TypedefsAndUnions + }); }; -const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\"); +const Impl = require(\\"../implementations/TypedefsAndUnions.js\\"); " `; -exports[`with processors UnderscoredProperties.webidl 1`] = ` +exports[`with processors URL.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -7140,7 +5741,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"UnderscoredProperties\\"; +const interfaceName = \\"URL\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -7152,7 +5753,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); + throw new TypeError(\`\${context} is not of type 'URL'.\`); }; function makeWrapper(globalObject) { @@ -7160,9 +5761,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"UnderscoredProperties\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URL\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor UnderscoredProperties is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor URL is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -7173,372 +5774,386 @@ exports.create = (globalObject, constructorArgs, privateData) => { return exports.setup(wrapper, globalObject, constructorArgs, privateData); }; -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; + +exports._internalSetup = (wrapper, globalObject) => {}; + +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\", \\"Worker\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + 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 exports.setup(Object.create(new.target.prototype), globalObject, args); + } + + toJSON() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].toJSON(); + } + + get href() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"href\\"]; + } + + set href(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" }); + + esValue[implSymbol][\\"href\\"] = V; + } + + toString() { + const esValue = this; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"href\\"]; + } + + get origin() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"origin\\"]; + } + + get protocol() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"protocol\\"]; + } + + set protocol(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" + }); + + esValue[implSymbol][\\"protocol\\"] = V; + } + + get username() { + const esValue = this !== null && this !== undefined ? this : globalObject; -exports._internalSetup = (wrapper, globalObject) => {}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; + return esValue[implSymbol][\\"username\\"]; + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); + set username(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'username' property on 'URL': The provided value\\" + }); - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); + esValue[implSymbol][\\"username\\"] = V; + } - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; + get password() { + const esValue = this !== null && this !== undefined ? this : globalObject; -const exposed = new Set([\\"Window\\"]); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class UnderscoredProperties { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); + return esValue[implSymbol][\\"password\\"]; } - operation(sequence) { + set password(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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 = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'password' property on 'URL': The provided value\\" + }); - V.push(nextItem); - } - curArg = V; - } - args.push(curArg); - } - return esValue[implSymbol].operation(...args); + esValue[implSymbol][\\"password\\"] = V; } - get attribute() { + get host() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"attribute\\"]; + return esValue[implSymbol][\\"host\\"]; } - set attribute(V) { + set host(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"byte\\"](V, { - context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\" - }); + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" }); - esValue[implSymbol][\\"attribute\\"] = V; + esValue[implSymbol][\\"host\\"] = V; } - 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); + get hostname() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - 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 } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = UnderscoredProperties; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: UnderscoredProperties - }); -}; + return esValue[implSymbol][\\"hostname\\"]; + } -const Impl = require(\\"../implementations/UnderscoredProperties.js\\"); -" -`; + set hostname(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; -exports[`with processors Unforgeable.webidl 1`] = ` -"\\"use strict\\"; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" + }); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; + esValue[implSymbol][\\"hostname\\"] = V; + } -const interfaceName = \\"Unforgeable\\"; + get port() { + const esValue = this !== null && this !== undefined ? this : globalObject; -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Unforgeable'.\`); -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } + return esValue[implSymbol][\\"port\\"]; + } - const ctor = globalObject[ctorRegistrySymbol][\\"Unforgeable\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Unforgeable is not installed on the passed global object\\"); - } + set port(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - return Object.create(ctor.prototype); -} + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" }); -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; + esValue[implSymbol][\\"port\\"] = V; + } -exports._internalSetup = (wrapper, globalObject) => { - Object.defineProperties( - wrapper, - Object.getOwnPropertyDescriptors({ - assign(url) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + get pathname() { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'assign' on 'Unforgeable': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'assign' on 'Unforgeable': parameter 1\\" - }); - args.push(curArg); - } - return esValue[implSymbol].assign(...args); - }, - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return esValue[implSymbol][\\"pathname\\"]; + } - return esValue[implSymbol][\\"href\\"]; - }, - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + set pathname(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'href' property on 'Unforgeable': The provided value\\" - }); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" + }); - esValue[implSymbol][\\"href\\"] = V; - }, - toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + esValue[implSymbol][\\"pathname\\"] = V; + } - return esValue[implSymbol][\\"href\\"]; - }, - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; + get search() { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - return esValue[implSymbol][\\"origin\\"]; - }, - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; + return esValue[implSymbol][\\"search\\"]; + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + set search(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - return esValue[implSymbol][\\"protocol\\"]; - }, - set protocol(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" }); - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'Unforgeable': The provided value\\" - }); + esValue[implSymbol][\\"search\\"] = V; + } - esValue[implSymbol][\\"protocol\\"] = V; - } - }) - ); + get searchParams() { + const esValue = this !== null && this !== undefined ? this : globalObject; - Object.defineProperties(wrapper, { - assign: { configurable: false, writable: false }, - href: { configurable: false }, - toString: { configurable: false, writable: false }, - origin: { configurable: false }, - protocol: { configurable: false } - }); -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; + return utils.getSameObject(this, \\"searchParams\\", () => { + return utils.tryWrapperForImpl(esValue[implSymbol][\\"searchParams\\"]); + }); + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); + get hash() { + const esValue = this !== null && this !== undefined ? this : globalObject; - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); + return esValue[implSymbol][\\"hash\\"]; + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); + set hash(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -const exposed = new Set([\\"Window\\"]); + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" }); -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Unforgeable { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); + esValue[implSymbol][\\"hash\\"] = V; } } - Object.defineProperties(Unforgeable.prototype, { - [Symbol.toStringTag]: { value: \\"Unforgeable\\", configurable: true } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = Unforgeable; + globalObject[ctorRegistrySymbol][interfaceName] = URL; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: Unforgeable + value: URL }); + + if (globalNames.includes(\\"Window\\")) { + Object.defineProperty(globalObject, \\"webkitURL\\", { + configurable: true, + writable: true, + value: URL + }); + } }; -const Impl = require(\\"../implementations/Unforgeable.js\\"); +const Impl = require(\\"../implementations/URL.js\\"); " `; -exports[`with processors UnforgeableMap.webidl 1`] = ` +exports[`with processors URLList.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -7547,7 +6162,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"UnforgeableMap\\"; +const interfaceName = \\"URLList\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -7559,7 +6174,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'UnforgeableMap'.\`); + throw new TypeError(\`\${context} is not of type 'URLList'.\`); }; function makeWrapper(globalObject) { @@ -7567,9 +6182,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"UnforgeableMap\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLList\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor UnforgeableMap is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor URLList is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -7585,24 +6200,7 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { return utils.implForWrapper(wrapper); }; -exports._internalSetup = (wrapper, globalObject) => { - Object.defineProperties( - wrapper, - Object.getOwnPropertyDescriptors({ - get a() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"a\\"]; - } - }) - ); - - Object.defineProperties(wrapper, { a: { configurable: false } }); -}; +exports._internalSetup = (wrapper, globalObject) => {}; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -7646,23 +6244,62 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class UnforgeableMap { + class URLList { constructor() { throw new TypeError(\\"Illegal constructor\\"); } + + item(index) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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(esValue[implSymbol].item(...args)); + } + + get length() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"length\\"]; + } } - Object.defineProperties(UnforgeableMap.prototype, { - [Symbol.toStringTag]: { value: \\"UnforgeableMap\\", configurable: true } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = UnforgeableMap; + globalObject[ctorRegistrySymbol][interfaceName] = URLList; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: UnforgeableMap + value: URLList }); }; @@ -7707,10 +6344,8 @@ const proxyHandler = { ownKeys(target) { const keys = new Set(); - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); - } + for (const key of target[implSymbol][utils.supportedPropertyIndices]) { + keys.add(\`\${key}\`); } for (const key of Reflect.ownKeys(target)) { @@ -7725,15 +6360,19 @@ const proxyHandler = { } let ignoreNamedProps = false; - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { - const namedValue = target[implSymbol][utils.namedGet](P); + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; + if (target[implSymbol][utils.supportsPropertyIndex](index)) { + const indexedValue = target[implSymbol].item(index); + return { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; + } + ignoreNamedProps = true; } return Reflect.getOwnPropertyDescriptor(target, P); @@ -7744,24 +6383,23 @@ const proxyHandler = { return Reflect.set(target, P, V, receiver); } if (target === receiver) { - if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { - let namedValue = V; - - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'UnforgeableMap': The provided value\\" - }); + utils.isArrayIndexPropName(P); + } + let ownDesc; - const creating = !target[implSymbol][utils.supportsPropertyName](P); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; - return true; + if (target[implSymbol][utils.supportsPropertyIndex](index)) { + const indexedValue = target[implSymbol].item(index); + ownDesc = { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; } } - let ownDesc; if (ownDesc === undefined) { ownDesc = Reflect.getOwnPropertyDescriptor(target, P); @@ -7799,28 +6437,11 @@ const proxyHandler = { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } - if (![\\"a\\"].includes(P)) { - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; - } - - let namedValue = desc.value; - - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'UnforgeableMap': The provided value\\" - }); - - const creating = !target[implSymbol][utils.supportsPropertyName](P); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } - return true; - } + if (utils.isArrayIndexPropName(P)) { + return false; } + return Reflect.defineProperty(target, P, desc); }, @@ -7829,8 +6450,9 @@ const proxyHandler = { return Reflect.deleteProperty(target, P); } - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { - return false; + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + return !target[implSymbol][utils.supportsPropertyIndex](index); } return Reflect.deleteProperty(target, P); @@ -7841,11 +6463,11 @@ const proxyHandler = { } }; -const Impl = require(\\"../implementations/UnforgeableMap.js\\"); +const Impl = require(\\"../implementations/URLList.js\\"); " `; -exports[`with processors Unscopable.webidl 1`] = ` +exports[`with processors URLSearchParams.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -7854,7 +6476,46 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Unscopable\\"; +const interfaceName = \\"URLSearchParams\\"; + +const IteratorPrototype = Object.create(utils.IteratorPrototype, { + next: { + value: function next() { + const internal = this[utils.iterInternalSymbol]; + const { target, kind, index } = internal; + const values = Array.from(target[implSymbol]); + const len = values.length; + if (index >= len) { + return { value: undefined, done: true }; + } + + const pair = values[index]; + internal.index = index + 1; + const [key, value] = pair.map(utils.tryWrapperForImpl); + + 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 + } +}); exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -7866,7 +6527,16 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Unscopable'.\`); + throw new TypeError(\`\${context} is not of type 'URLSearchParams'.\`); +}; + +exports.createDefaultIterator = (target, kind) => { + const iterator = Object.create(IteratorPrototype); + Object.defineProperty(iterator, utils.iterInternalSymbol, { + value: { target, kind, index: 0 }, + configurable: true + }); + return iterator; }; function makeWrapper(globalObject) { @@ -7874,9 +6544,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Unscopable\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParams\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Unscopable is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor URLSearchParams is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -7894,133 +6564,391 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { exports._internalSetup = (wrapper, globalObject) => {}; -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\", \\"Worker\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + 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 exports.setup(Object.create(new.target.prototype), globalObject, args); + } + + append(name, value) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].append(...args); + } + + delete(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); + 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 esValue[implSymbol].delete(...args); + } - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; + get(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); + 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 esValue[implSymbol].get(...args); + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); + getAll(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; + 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(esValue[implSymbol].getAll(...args)); + } -const exposed = new Set([\\"Window\\"]); + has(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Unscopable { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); + 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 esValue[implSymbol].has(...args); } - get unscopableTest() { + set(name, value) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"unscopableTest\\"]; + 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 esValue[implSymbol].set(...args); } - set unscopableTest(V) { + sort() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\" - }); - - esValue[implSymbol][\\"unscopableTest\\"] = V; + return esValue[implSymbol].sort(); } - get unscopableMixin() { + toString() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"unscopableMixin\\"]; + return esValue[implSymbol].toString(); } - set unscopableMixin(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + keys() { + if (!this || !exports.is(this)) { + throw new TypeError(\\"Illegal invocation\\"); + } + return exports.createDefaultIterator(this, \\"key\\"); + } - if (!exports.is(esValue)) { + values() { + if (!this || !exports.is(this)) { throw new TypeError(\\"Illegal invocation\\"); } + return exports.createDefaultIterator(this, \\"value\\"); + } - V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\" - }); + entries() { + if (!this || !exports.is(this)) { + throw new TypeError(\\"Illegal invocation\\"); + } + return exports.createDefaultIterator(this, \\"key+value\\"); + } - esValue[implSymbol][\\"unscopableMixin\\"] = V; + forEach(callback) { + if (!this || !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[implSymbol]); + 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[implSymbol]); + i++; + } } } - 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 - } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = Unscopable; + globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParams; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: Unscopable + value: URLSearchParams }); }; -const Impl = require(\\"../implementations/Unscopable.js\\"); +const Impl = require(\\"../implementations/URLSearchParams.js\\"); " `; -exports[`with processors Variadic.webidl 1`] = ` +exports[`with processors URLSearchParamsCollection.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Variadic\\"; +const interfaceName = \\"URLSearchParamsCollection\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -8032,7 +6960,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Variadic'.\`); + throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); }; function makeWrapper(globalObject) { @@ -8040,9 +6968,11 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Variadic\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Variadic is not installed on the passed global object\\"); + throw new Error( + \\"Internal error: constructor URLSearchParamsCollection is not installed on the passed global object\\" + ); } return Object.create(ctor.prototype); @@ -8069,6 +6999,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -8085,6 +7017,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -8098,28 +7032,36 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class Variadic { + class URLSearchParamsCollection { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - simple1() { + item(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { 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 = []; - 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) + { + let curArg = arguments[0]; + curArg = conversions[\\"unsigned long\\"](curArg, { + context: \\"Failed to execute 'item' on 'URLSearchParamsCollection': parameter 1\\" }); args.push(curArg); } - return esValue[implSymbol].simple1(...args); + return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); } - simple2(first) { + namedItem(name) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -8127,166 +7069,253 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'simple2' on 'Variadic': 1 argument required, but only \\" + arguments.length + \\" present.\\" + \\"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 'simple2' on 'Variadic': parameter 1\\" + context: \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': parameter 1\\" }); args.push(curArg); } - for (let i = 1; i < arguments.length; i++) { - let curArg = arguments[i]; - curArg = URL.convert(curArg, { context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) }); - args.push(curArg); - } - return esValue[implSymbol].simple2(...args); + return utils.tryWrapperForImpl(esValue[implSymbol].namedItem(...args)); } - overloaded1() { + get length() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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 esValue[implSymbol][\\"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 } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: URLSearchParamsCollection + }); +}; + +const proxyHandler = { + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; } - return esValue[implSymbol].overloaded1(...args); + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; } + return Reflect.apply(getter, receiver, []); + }, - overloaded2(first) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + }, + + ownKeys(target) { + const keys = new Set(); + + for (const key of target[implSymbol][utils.supportedPropertyIndices]) { + keys.add(\`\${key}\`); + } + + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); } + } - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'overloaded2' on 'Variadic': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); + for (const key of Reflect.ownKeys(target)) { + keys.add(key); + } + return [...keys]; + }, + + getOwnPropertyDescriptor(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.getOwnPropertyDescriptor(target, P); + } + let ignoreNamedProps = false; + + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + return { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; } - 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); - } - } - } + ignoreNamedProps = true; + } + + const namedValue = target[implSymbol].namedItem(P); + + if (namedValue !== null && !(P in target) && !ignoreNamedProps) { + return { + writable: false, + enumerable: false, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; + } + + return Reflect.getOwnPropertyDescriptor(target, P); + }, + + set(target, P, V, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.set(target, P, V, receiver); + } + if (target === receiver) { + utils.isArrayIndexPropName(P); + + typeof P === \\"string\\" && !utils.isArrayIndexPropName(P); + } + let ownDesc; + + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + ownDesc = { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; } - return esValue[implSymbol].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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = Variadic; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Variadic - }); + if (ownDesc === undefined) { + ownDesc = Reflect.getOwnPropertyDescriptor(target, P); + } + if (ownDesc === undefined) { + const parent = Reflect.getPrototypeOf(target); + if (parent !== null) { + return Reflect.set(parent, P, V, receiver); + } + ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; + } + if (!ownDesc.writable) { + return false; + } + if (!utils.isObject(receiver)) { + return false; + } + const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); + let valueDesc; + if (existingDesc !== undefined) { + if (existingDesc.get || existingDesc.set) { + return false; + } + if (!existingDesc.writable) { + return false; + } + valueDesc = { value: V }; + } else { + valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + } + return Reflect.defineProperty(receiver, P, valueDesc); + }, + + defineProperty(target, P, desc) { + if (typeof P === \\"symbol\\") { + return Reflect.defineProperty(target, P, desc); + } + + if (utils.isArrayIndexPropName(P)) { + return false; + } + if (!utils.hasOwn(target, P)) { + const creating = !(target[implSymbol].namedItem(P) !== null); + if (!creating) { + return false; + } + } + return Reflect.defineProperty(target, P, desc); + }, + + deleteProperty(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.deleteProperty(target, P); + } + + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + return !(target[implSymbol].item(index) !== undefined); + } + + if (target[implSymbol].namedItem(P) !== null && !(P in target)) { + return false; + } + + return Reflect.deleteProperty(target, P); + }, + + preventExtensions() { + return false; + } }; -const Impl = require(\\"../implementations/Variadic.js\\"); +const Impl = require(\\"../implementations/URLSearchParamsCollection.js\\"); " `; -exports[`with processors ZeroArgConstructor.webidl 1`] = ` +exports[`with processors URLSearchParamsCollection2.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; +const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\"); -const interfaceName = \\"ZeroArgConstructor\\"; +const interfaceName = \\"URLSearchParamsCollection2\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -8298,7 +7327,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`); + throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); }; function makeWrapper(globalObject) { @@ -8306,9 +7335,11 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"ZeroArgConstructor\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection2\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor ZeroArgConstructor is not installed on the passed global object\\"); + throw new Error( + \\"Internal error: constructor URLSearchParamsCollection2 is not installed on the passed global object\\" + ); } return Object.create(ctor.prototype); @@ -8324,7 +7355,9 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { return utils.implForWrapper(wrapper); }; -exports._internalSetup = (wrapper, globalObject) => {}; +exports._internalSetup = (wrapper, globalObject) => { + URLSearchParamsCollection._internalSetup(wrapper, globalObject); +}; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -8335,6 +7368,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -8351,6 +7386,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -8364,83 +7401,253 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class ZeroArgConstructor { + + if (globalObject.URLSearchParamsCollection === undefined) { + throw new Error( + \\"Internal error: attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\" + ); + } + class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection { constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); + throw new TypeError(\\"Illegal constructor\\"); } } - Object.defineProperties(ZeroArgConstructor.prototype, { - [Symbol.toStringTag]: { value: \\"ZeroArgConstructor\\", configurable: true } + Object.defineProperties(URLSearchParamsCollection2.prototype, { + [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true }, + [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = ZeroArgConstructor; + globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection2; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: URLSearchParamsCollection2 + }); +}; + +const proxyHandler = { + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; + } + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; + } + return Reflect.apply(getter, receiver, []); + }, + + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + }, + + ownKeys(target) { + const keys = new Set(); + + for (const key of target[implSymbol][utils.supportedPropertyIndices]) { + keys.add(\`\${key}\`); + } + + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); + } + } + + for (const key of Reflect.ownKeys(target)) { + keys.add(key); + } + return [...keys]; + }, + + getOwnPropertyDescriptor(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.getOwnPropertyDescriptor(target, P); + } + let ignoreNamedProps = false; + + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + return { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; + } + ignoreNamedProps = true; + } + + const namedValue = target[implSymbol].namedItem(P); + + if (namedValue !== null && !(P in target) && !ignoreNamedProps) { + return { + writable: true, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; + } + + return Reflect.getOwnPropertyDescriptor(target, P); + }, + + set(target, P, V, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.set(target, P, V, receiver); + } + if (target === receiver) { + utils.isArrayIndexPropName(P); + + if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { + let namedValue = V; + + namedValue = URL.convert(namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" + }); + + const creating = !(target[implSymbol].namedItem(P) !== null); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); + } + + return true; + } + } + let ownDesc; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: ZeroArgConstructor - }); -}; + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + ownDesc = { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; + } + } -const Impl = require(\\"../implementations/ZeroArgConstructor.js\\"); -" -`; + if (ownDesc === undefined) { + ownDesc = Reflect.getOwnPropertyDescriptor(target, P); + } + if (ownDesc === undefined) { + const parent = Reflect.getPrototypeOf(target); + if (parent !== null) { + return Reflect.set(parent, P, V, receiver); + } + ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; + } + if (!ownDesc.writable) { + return false; + } + if (!utils.isObject(receiver)) { + return false; + } + const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); + let valueDesc; + if (existingDesc !== undefined) { + if (existingDesc.get || existingDesc.set) { + return false; + } + if (!existingDesc.writable) { + return false; + } + valueDesc = { value: V }; + } else { + valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + } + return Reflect.defineProperty(receiver, P, valueDesc); + }, -exports[`without processors AsyncCallbackInterface.webidl 1`] = ` -"\\"use strict\\"; + defineProperty(target, P, desc) { + if (typeof P === \\"symbol\\") { + return Reflect.defineProperty(target, P, desc); + } -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); + if (utils.isArrayIndexPropName(P)) { + return false; + } + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { - if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); - } + let namedValue = desc.value; - function callTheUserObjectsOperation() { - let thisArg = utils.tryWrapperForImpl(this); - let O = value; - let X = O; + namedValue = URL.convert(namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" + }); - try { - if (typeof O !== \\"function\\") { - X = O[\\"asyncMethod\\"]; - if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement AsyncCallbackInterface.\`); - } - thisArg = O; + const creating = !(target[implSymbol].namedItem(P) !== null); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); } - let callResult = Reflect.apply(X, thisArg, []); + return true; + } + return Reflect.defineProperty(target, P, desc); + }, - callResult = Promise.resolve(callResult).then( - value => { - value = conversions[\\"any\\"](value, { context: context + \\" promise value\\" }); + deleteProperty(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.deleteProperty(target, P); + } - return value; - }, - reason => reason - ); + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + return !(target[implSymbol].item(index) !== undefined); + } - return callResult; - } catch (err) { - return Promise.reject(err); + if (target[implSymbol].namedItem(P) !== null && !(P in target)) { + return false; } - } - callTheUserObjectsOperation[utils.wrapperSymbol] = value; - callTheUserObjectsOperation.objectReference = value; + return Reflect.deleteProperty(target, P); + }, - return callTheUserObjectsOperation; + preventExtensions() { + return false; + } }; -exports.install = (globalObject, globalNames) => {}; +const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\"); " `; -exports[`without processors BufferSourceTypes.webidl 1`] = ` +exports[`with processors UnderscoredProperties.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -8449,7 +7656,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"BufferSourceTypes\\"; +const interfaceName = \\"UnderscoredProperties\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -8461,7 +7668,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'BufferSourceTypes'.\`); + throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); }; function makeWrapper(globalObject) { @@ -8469,9 +7676,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"BufferSourceTypes\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"UnderscoredProperties\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor BufferSourceTypes is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor UnderscoredProperties is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -8527,12 +7734,12 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class BufferSourceTypes { + class UnderscoredProperties { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - bs(source) { + operation(sequence) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -8540,7 +7747,7 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'bs' on 'BufferSourceTypes': 1 argument required, but only \\" + + \\"Failed to execute 'operation' on 'UnderscoredProperties': 1 argument required, but only \\" + arguments.length + \\" present.\\" ); @@ -8548,129 +7755,55 @@ exports.install = (globalObject, globalNames) => { const args = []; { let curArg = arguments[0]; - if (utils.isArrayBuffer(curArg)) { - } else if (ArrayBuffer.isView(curArg)) { - } else { + if (!utils.isObject(curArg)) { throw new TypeError( - \\"Failed to execute 'bs' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" + \\"Failed to execute 'operation' on 'UnderscoredProperties': parameter 1\\" + \\" is not an iterable object.\\" ); - } - args.push(curArg); - } - return esValue[implSymbol].bs(...args); - } - - ab(ab) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'ab' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"ArrayBuffer\\"](curArg, { - context: \\"Failed to execute 'ab' on 'BufferSourceTypes': parameter 1\\" - }); - args.push(curArg); - } - return esValue[implSymbol].ab(...args); - } - - abv(abv) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'abv' on 'BufferSourceTypes': 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 'abv' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" - ); + 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 esValue[implSymbol].abv(...args); + return esValue[implSymbol].operation(...args); } - u8a(u8) { + get attribute() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'u8a' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"Uint8Array\\"](curArg, { - context: \\"Failed to execute 'u8a' on 'BufferSourceTypes': parameter 1\\" - }); - args.push(curArg); - } - return esValue[implSymbol].u8a(...args); - } - abUnion(ab) { - const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'abUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); - } - const args = []; - { - let curArg = arguments[0]; - if (utils.isArrayBuffer(curArg)) { - } else { - curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'abUnion' on 'BufferSourceTypes': parameter 1\\" - }); - } - args.push(curArg); - } - return esValue[implSymbol].abUnion(...args); + return esValue[implSymbol][\\"attribute\\"]; } - u8aUnion(ab) { + set attribute(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } + V = conversions[\\"byte\\"](V, { + context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\" + }); + + esValue[implSymbol][\\"attribute\\"] = V; + } + + static static(void_) { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + + \\"Failed to execute 'static' on 'UnderscoredProperties': 1 argument required, but only \\" + arguments.length + \\" present.\\" ); @@ -8678,43 +7811,41 @@ exports.install = (globalObject, globalNames) => { const args = []; { let curArg = arguments[0]; - if (ArrayBuffer.isView(curArg) && curArg.constructor.name === \\"Uint8Array\\") { - } else { - curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': parameter 1\\" - }); - } + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'static' on 'UnderscoredProperties': parameter 1\\" + }); args.push(curArg); } - return esValue[implSymbol].u8aUnion(...args); + return Impl.implementation.static(...args); } } - Object.defineProperties(BufferSourceTypes.prototype, { - bs: { enumerable: true }, - ab: { enumerable: true }, - abv: { enumerable: true }, - u8a: { enumerable: true }, - abUnion: { enumerable: true }, - u8aUnion: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"BufferSourceTypes\\", configurable: true } + 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 } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = BufferSourceTypes; + globalObject[ctorRegistrySymbol][interfaceName] = UnderscoredProperties; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: BufferSourceTypes + value: UnderscoredProperties }); }; -const Impl = require(\\"../implementations/BufferSourceTypes.js\\"); +const Impl = require(\\"../implementations/UnderscoredProperties.js\\"); " `; -exports[`without processors CEReactions.webidl 1`] = ` +exports[`with processors Unscopable.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -8723,7 +7854,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"CEReactions\\"; +const interfaceName = \\"Unscopable\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -8735,7 +7866,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'CEReactions'.\`); + throw new TypeError(\`\${context} is not of type 'Unscopable'.\`); }; function makeWrapper(globalObject) { @@ -8743,23 +7874,14 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"CEReactions\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Unscopable\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor CEReactions is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Unscopable is not installed on the passed global object\\"); } return Object.create(ctor.prototype); } -function makeProxy(wrapper, globalObject) { - let proxyHandler = proxyHandlerCache.get(globalObject); - if (proxyHandler === undefined) { - proxyHandler = new ProxyHandler(globalObject); - proxyHandlerCache.set(globalObject, proxyHandler); - } - return new Proxy(wrapper, proxyHandler); -} - exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -8781,8 +7903,6 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = makeProxy(wrapper, globalObject); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -8799,8 +7919,6 @@ exports.new = globalObject => { configurable: true }); - wrapper = makeProxy(wrapper, globalObject); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -8814,260 +7932,95 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class CEReactions { + class Unscopable { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - method() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].method(); - } - - get attr() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"attr\\"]; - } - - set attr(V) { + get unscopableTest() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'attr' property on 'CEReactions': The provided value\\" - }); - - esValue[implSymbol][\\"attr\\"] = V; - } - } - Object.defineProperties(CEReactions.prototype, { - method: { enumerable: true }, - attr: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"CEReactions\\", configurable: true } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = CEReactions; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: CEReactions - }); -}; - -const proxyHandlerCache = new WeakMap(); -class ProxyHandler { - constructor(globalObject) { - this._globalObject = globalObject; - } - - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - } - - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - } - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - } - - getOwnPropertyDescriptor(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { - const namedValue = target[implSymbol][utils.namedGet](P); - - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - } - - set(target, P, V, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.set(target, P, V, receiver); - } - if (target === receiver) { - const globalObject = this._globalObject; - - if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { - let namedValue = V; - - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" - }); - - const creating = !target[implSymbol][utils.supportsPropertyName](P); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } - - return true; - } - } - let ownDesc; - - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, P, V, receiver); - } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (!ownDesc.writable) { - return false; - } - if (!utils.isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); - let valueDesc; - if (existingDesc !== undefined) { - if (existingDesc.get || existingDesc.set) { - return false; - } - if (!existingDesc.writable) { - return false; - } - valueDesc = { value: V }; - } else { - valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; - } - return Reflect.defineProperty(receiver, P, valueDesc); - } - - defineProperty(target, P, desc) { - if (typeof P === \\"symbol\\") { - return Reflect.defineProperty(target, P, desc); + return esValue[implSymbol][\\"unscopableTest\\"]; } - const globalObject = this._globalObject; - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; - } + set unscopableTest(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - let namedValue = desc.value; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + V = conversions[\\"boolean\\"](V, { + context: \\"Failed to set the 'unscopableTest' property on 'Unscopable': The provided value\\" }); - const creating = !target[implSymbol][utils.supportsPropertyName](P); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); + esValue[implSymbol][\\"unscopableTest\\"] = V; + } + + get unscopableMixin() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return true; + return esValue[implSymbol][\\"unscopableMixin\\"]; } - return Reflect.defineProperty(target, P, desc); - } - deleteProperty(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.deleteProperty(target, P); - } + set unscopableMixin(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - const globalObject = this._globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { - target[implSymbol][utils.namedDelete](P); - return true; - } + V = conversions[\\"boolean\\"](V, { + context: \\"Failed to set the 'unscopableMixin' property on 'Unscopable': The provided value\\" + }); - return Reflect.deleteProperty(target, P); + esValue[implSymbol][\\"unscopableMixin\\"] = V; + } } - - preventExtensions() { - return false; + 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[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); } -} + globalObject[ctorRegistrySymbol][interfaceName] = Unscopable; -const Impl = require(\\"../implementations/CEReactions.js\\"); + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: Unscopable + }); +}; + +const Impl = require(\\"../implementations/Unscopable.js\\"); " `; -exports[`without processors DOMImplementation.webidl 1`] = ` +exports[`with processors Variadic.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"DOMImplementation\\"; +const interfaceName = \\"Variadic\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -9079,7 +8032,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DOMImplementation'.\`); + throw new TypeError(\`\${context} is not of type 'Variadic'.\`); }; function makeWrapper(globalObject) { @@ -9087,9 +8040,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"DOMImplementation\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Variadic\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor DOMImplementation is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Variadic is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -9145,149 +8098,186 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class DOMImplementation { + class Variadic { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - createDocumentType(qualifiedName, publicId, systemId) { + simple1() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { 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]; + for (let i = 0; i < arguments.length; i++) { + let curArg = arguments[i]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 3\\" + context: \\"Failed to execute 'simple1' on 'Variadic': parameter \\" + (i + 1) }); args.push(curArg); } - return utils.tryWrapperForImpl(esValue[implSymbol].createDocumentType(...args)); + return esValue[implSymbol].simple1(...args); } - createDocument(namespace, qualifiedName) { + simple2(first) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (arguments.length < 2) { + if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'createDocument' on 'DOMImplementation': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" + \\"Failed to execute 'simple2' on 'Variadic': 1 argument 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 + context: \\"Failed to execute 'simple2' on 'Variadic': parameter 1\\" }); args.push(curArg); } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - if (curArg === null || curArg === undefined) { - curArg = null; + for (let i = 1; i < arguments.length; i++) { + let curArg = arguments[i]; + curArg = URL.convert(curArg, { context: \\"Failed to execute 'simple2' on 'Variadic': parameter \\" + (i + 1) }); + args.push(curArg); + } + return esValue[implSymbol].simple2(...args); + } + + overloaded1() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 { - curArg = utils.tryImplForWrapper(curArg); + 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); + } } - } else { - curArg = null; } - args.push(curArg); } - return utils.tryWrapperForImpl(esValue[implSymbol].createDocument(...args)); + return esValue[implSymbol].overloaded1(...args); } - createHTMLDocument() { + overloaded2(first) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { 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 = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'createHTMLDocument' on 'DOMImplementation': parameter 1\\" - }); + 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); + } + } } - args.push(curArg); - } - return utils.tryWrapperForImpl(esValue[implSymbol].createHTMLDocument(...args)); - } - - hasFeature() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); } - - return esValue[implSymbol].hasFeature(); + return esValue[implSymbol].overloaded2(...args); } } - Object.defineProperties(DOMImplementation.prototype, { - createDocumentType: { enumerable: true }, - createDocument: { enumerable: true }, - createHTMLDocument: { enumerable: true }, - hasFeature: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"DOMImplementation\\", configurable: true } + Object.defineProperties(Variadic.prototype, { + simple1: { enumerable: true }, + simple2: { enumerable: true }, + overloaded1: { enumerable: true }, + overloaded2: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"Variadic\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = DOMImplementation; + globalObject[ctorRegistrySymbol][interfaceName] = Variadic; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: DOMImplementation + value: Variadic }); }; -const Impl = require(\\"../implementations/DOMImplementation.js\\"); +const Impl = require(\\"../implementations/Variadic.js\\"); " `; -exports[`without processors DOMRect.webidl 1`] = ` +exports[`with processors ZeroArgConstructor.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -9296,7 +8286,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"DOMRect\\"; +const interfaceName = \\"ZeroArgConstructor\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -9308,7 +8298,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DOMRect'.\`); + throw new TypeError(\`\${context} is not of type 'ZeroArgConstructor'.\`); }; function makeWrapper(globalObject) { @@ -9316,9 +8306,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"DOMRect\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"ZeroArgConstructor\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor DOMRect is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor ZeroArgConstructor is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -9368,291 +8358,372 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\", \\"Worker\\"]); +const exposed = new Set([\\"Window\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class DOMRect { + class ZeroArgConstructor { constructor() { - const args = []; - { - let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 1\\" - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 2\\" - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[2]; - if (curArg !== undefined) { - curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 3\\" - }); - } else { - curArg = 0; - } - args.push(curArg); - } - { - let curArg = arguments[3]; - if (curArg !== undefined) { - curArg = conversions[\\"unrestricted double\\"](curArg, { - context: \\"Failed to construct 'DOMRect': parameter 4\\" - }); - } else { - curArg = 0; - } - args.push(curArg); - } - return exports.setup(Object.create(new.target.prototype), globalObject, args); + return exports.setup(Object.create(new.target.prototype), globalObject, undefined); } + } + Object.defineProperties(ZeroArgConstructor.prototype, { + [Symbol.toStringTag]: { value: \\"ZeroArgConstructor\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = ZeroArgConstructor; - get x() { - const esValue = this !== null && this !== undefined ? this : globalObject; + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: ZeroArgConstructor + }); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); +const Impl = require(\\"../implementations/ZeroArgConstructor.js\\"); +" +`; + +exports[`without processors AsyncCallbackInterface.webidl 1`] = ` +"\\"use strict\\"; + +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); + +exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { + if (!utils.isObject(value)) { + throw new TypeError(\`\${context} is not an object.\`); + } + + function callTheUserObjectsOperation() { + let thisArg = utils.tryWrapperForImpl(this); + let O = value; + let X = O; + + try { + if (typeof O !== \\"function\\") { + X = O[\\"asyncMethod\\"]; + if (typeof X !== \\"function\\") { + throw new TypeError(\`\${context} does not correctly implement AsyncCallbackInterface.\`); + } + thisArg = O; } - return esValue[implSymbol][\\"x\\"]; + let callResult = Reflect.apply(X, thisArg, []); + + callResult = Promise.resolve(callResult).then( + value => { + value = conversions[\\"any\\"](value, { context: context + \\" promise value\\" }); + + return value; + }, + reason => reason + ); + + return callResult; + } catch (err) { + return Promise.reject(err); } + } - set x(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + callTheUserObjectsOperation[utils.wrapperSymbol] = value; + callTheUserObjectsOperation.objectReference = value; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return callTheUserObjectsOperation; +}; - V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'x' property on 'DOMRect': The provided value\\" - }); +exports.install = (globalObject, globalNames) => {}; +" +`; + +exports[`without processors BufferSourceTypes.webidl 1`] = ` +"\\"use strict\\"; + +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); + +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; + +const interfaceName = \\"BufferSourceTypes\\"; + +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'BufferSourceTypes'.\`); +}; + +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } + + const ctor = globalObject[ctorRegistrySymbol][\\"BufferSourceTypes\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor BufferSourceTypes is not installed on the passed global object\\"); + } + + return Object.create(ctor.prototype); +} + +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; + +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; + +exports._internalSetup = (wrapper, globalObject) => {}; + +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\"]); - esValue[implSymbol][\\"x\\"] = V; +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class BufferSourceTypes { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - get y() { + bs(source) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"y\\"]; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'bs' on 'BufferSourceTypes': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } + const args = []; + { + let curArg = arguments[0]; + if (utils.isArrayBuffer(curArg)) { + } else if (ArrayBuffer.isView(curArg)) { + } else { + throw new TypeError( + \\"Failed to execute 'bs' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" + ); + } + args.push(curArg); + } + return esValue[implSymbol].bs(...args); } - set y(V) { + ab(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'y' property on 'DOMRect': The provided value\\" - }); - - esValue[implSymbol][\\"y\\"] = V; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'ab' on 'BufferSourceTypes': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } + const args = []; + { + let curArg = arguments[0]; + curArg = conversions[\\"ArrayBuffer\\"](curArg, { + context: \\"Failed to execute 'ab' on 'BufferSourceTypes': parameter 1\\" + }); + args.push(curArg); + } + return esValue[implSymbol].ab(...args); } - get width() { + abv(abv) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"width\\"]; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'abv' on 'BufferSourceTypes': 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 'abv' on 'BufferSourceTypes': parameter 1\\" + \\" is not of any supported type.\\" + ); + } + args.push(curArg); + } + return esValue[implSymbol].abv(...args); } - set width(V) { + u8a(u8) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'width' property on 'DOMRect': The provided value\\" - }); - - esValue[implSymbol][\\"width\\"] = V; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'u8a' on 'BufferSourceTypes': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } + const args = []; + { + let curArg = arguments[0]; + curArg = conversions[\\"Uint8Array\\"](curArg, { + context: \\"Failed to execute 'u8a' on 'BufferSourceTypes': parameter 1\\" + }); + args.push(curArg); + } + return esValue[implSymbol].u8a(...args); } - get height() { + abUnion(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"height\\"]; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'abUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } + const args = []; + { + let curArg = arguments[0]; + if (utils.isArrayBuffer(curArg)) { + } else { + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'abUnion' on 'BufferSourceTypes': parameter 1\\" + }); + } + args.push(curArg); + } + return esValue[implSymbol].abUnion(...args); } - set height(V) { + u8aUnion(ab) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"unrestricted double\\"](V, { - context: \\"Failed to set the 'height' property on 'DOMRect': The provided value\\" - }); - - esValue[implSymbol][\\"height\\"] = V; - } - - static fromRect() { + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } const args = []; { let curArg = arguments[0]; - if (curArg !== undefined) { - curArg = utils.tryImplForWrapper(curArg); + if (ArrayBuffer.isView(curArg) && curArg.constructor.name === \\"Uint8Array\\") { + } else { + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'u8aUnion' on 'BufferSourceTypes': parameter 1\\" + }); } args.push(curArg); } - return utils.tryWrapperForImpl(Impl.implementation.fromRect(...args)); - } - } - Object.defineProperties(DOMRect.prototype, { - x: { enumerable: true }, - y: { enumerable: true }, - width: { enumerable: true }, - height: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"DOMRect\\", configurable: true } - }); - Object.defineProperties(DOMRect, { fromRect: { enumerable: true } }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = DOMRect; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DOMRect - }); - - if (globalNames.includes(\\"Window\\")) { - Object.defineProperty(globalObject, \\"SVGRect\\", { - configurable: true, - writable: true, - value: DOMRect - }); - } -}; - -const Impl = require(\\"../implementations/DOMRect.js\\"); -" -`; - -exports[`without processors Dictionary.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const URL = require(\\"./URL.js\\"); -const URLSearchParams = require(\\"./URLSearchParams.js\\"); - -exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {}) => { - { - const key = \\"boolWithDefault\\"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions[\\"boolean\\"](value, { context: context + \\" has member 'boolWithDefault' that\\" }); - - ret[key] = value; - } else { - ret[key] = false; - } - } - - { - const key = \\"requiredInterface\\"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = URL.convert(value, { context: context + \\" has member 'requiredInterface' that\\" }); - - ret[key] = value; - } else { - throw new TypeError(\\"requiredInterface is required in 'Dictionary'\\"); - } - } - - { - const key = \\"seq\\"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - if (!utils.isObject(value)) { - throw new TypeError(context + \\" has member 'seq' that\\" + \\" is not an iterable object.\\"); - } else { - const V = []; - const tmp = value; - for (let nextItem of tmp) { - nextItem = URLSearchParams.convert(nextItem, { context: context + \\" has member 'seq' that\\" + \\"'s element\\" }); - - V.push(nextItem); - } - value = V; - } - - ret[key] = value; - } - } - - { - const key = \\"vanillaString\\"; - let value = obj === undefined || obj === null ? undefined : obj[key]; - if (value !== undefined) { - value = conversions[\\"DOMString\\"](value, { context: context + \\" has member 'vanillaString' that\\" }); - - ret[key] = value; + return esValue[implSymbol].u8aUnion(...args); } } -}; - -exports.convert = function convert(obj, { context = \\"The provided value\\" } = {}) { - if (obj !== undefined && typeof obj !== \\"object\\" && typeof obj !== \\"function\\") { - throw new TypeError(\`\${context} is not an object.\`); + Object.defineProperties(BufferSourceTypes.prototype, { + bs: { enumerable: true }, + ab: { enumerable: true }, + abv: { enumerable: true }, + u8a: { enumerable: true }, + abUnion: { enumerable: true }, + u8aUnion: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"BufferSourceTypes\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); } + globalObject[ctorRegistrySymbol][interfaceName] = BufferSourceTypes; - const ret = Object.create(null); - exports._convertInherit(obj, ret, { context }); - return ret; + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: BufferSourceTypes + }); }; + +const Impl = require(\\"../implementations/BufferSourceTypes.js\\"); " `; -exports[`without processors DictionaryConvert.webidl 1`] = ` +exports[`without processors CEReactions.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const Dictionary = require(\\"./Dictionary.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"DictionaryConvert\\"; +const interfaceName = \\"CEReactions\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -9664,7 +8735,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'DictionaryConvert'.\`); + throw new TypeError(\`\${context} is not of type 'CEReactions'.\`); }; function makeWrapper(globalObject) { @@ -9672,14 +8743,23 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"DictionaryConvert\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"CEReactions\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor DictionaryConvert is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor CEReactions is not installed on the passed global object\\"); } return Object.create(ctor.prototype); } +function makeProxy(wrapper, globalObject) { + let proxyHandler = proxyHandlerCache.get(globalObject); + if (proxyHandler === undefined) { + proxyHandler = new ProxyHandler(globalObject); + proxyHandlerCache.set(globalObject, proxyHandler); + } + return new Proxy(wrapper, proxyHandler); +} + exports.create = (globalObject, constructorArgs, privateData) => { const wrapper = makeWrapper(globalObject); return exports.setup(wrapper, globalObject, constructorArgs, privateData); @@ -9701,6 +8781,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = makeProxy(wrapper, globalObject); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -9717,6 +8799,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = makeProxy(wrapper, globalObject); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -9730,65 +8814,260 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class DictionaryConvert { + class CEReactions { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - op() { + method() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { 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\\" - }); + + return esValue[implSymbol].method(); + } + + get attr() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"attr\\"]; + } + + set attr(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'attr' property on 'CEReactions': The provided value\\" + }); + + esValue[implSymbol][\\"attr\\"] = V; + } + } + Object.defineProperties(CEReactions.prototype, { + method: { enumerable: true }, + attr: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"CEReactions\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = CEReactions; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: CEReactions + }); +}; + +const proxyHandlerCache = new WeakMap(); +class ProxyHandler { + constructor(globalObject) { + this._globalObject = globalObject; + } + + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; + } + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; + } + return Reflect.apply(getter, receiver, []); + } + + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + } + + ownKeys(target) { + const keys = new Set(); + + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); + } + } + + for (const key of Reflect.ownKeys(target)) { + keys.add(key); + } + return [...keys]; + } + + getOwnPropertyDescriptor(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.getOwnPropertyDescriptor(target, P); + } + let ignoreNamedProps = false; + + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { + const namedValue = target[implSymbol][utils.namedGet](P); + + return { + writable: true, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; + } + + return Reflect.getOwnPropertyDescriptor(target, P); + } + + set(target, P, V, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.set(target, P, V, receiver); + } + if (target === receiver) { + const globalObject = this._globalObject; + + if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { + let namedValue = V; + + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + }); + + const creating = !target[implSymbol][utils.supportsPropertyName](P); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); } - args.push(curArg); + + return true; } - { - let curArg = arguments[1]; - curArg = Dictionary.convert(curArg, { context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" }); - args.push(curArg); + } + let ownDesc; + + if (ownDesc === undefined) { + ownDesc = Reflect.getOwnPropertyDescriptor(target, P); + } + if (ownDesc === undefined) { + const parent = Reflect.getPrototypeOf(target); + if (parent !== null) { + return Reflect.set(parent, P, V, receiver); + } + ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; + } + if (!ownDesc.writable) { + return false; + } + if (!utils.isObject(receiver)) { + return false; + } + const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); + let valueDesc; + if (existingDesc !== undefined) { + if (existingDesc.get || existingDesc.set) { + return false; + } + if (!existingDesc.writable) { + return false; + } + valueDesc = { value: V }; + } else { + valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + } + return Reflect.defineProperty(receiver, P, valueDesc); + } + + defineProperty(target, P, desc) { + if (typeof P === \\"symbol\\") { + return Reflect.defineProperty(target, P, desc); + } + + const globalObject = this._globalObject; + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } + + let namedValue = desc.value; + + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'CEReactions': The provided value\\" + }); + + const creating = !target[implSymbol][utils.supportsPropertyName](P); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); } - return esValue[implSymbol].op(...args); + + return true; } + return Reflect.defineProperty(target, P, desc); } - Object.defineProperties(DictionaryConvert.prototype, { - op: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"DictionaryConvert\\", configurable: true } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); + + deleteProperty(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.deleteProperty(target, P); + } + + const globalObject = this._globalObject; + + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { + target[implSymbol][utils.namedDelete](P); + return true; + } + + return Reflect.deleteProperty(target, P); } - globalObject[ctorRegistrySymbol][interfaceName] = DictionaryConvert; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: DictionaryConvert - }); -}; + preventExtensions() { + return false; + } +} -const Impl = require(\\"../implementations/DictionaryConvert.js\\"); +const Impl = require(\\"../implementations/CEReactions.js\\"); " `; -exports[`without processors Enum.webidl 1`] = ` +exports[`without processors DOMImplementation.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const RequestDestination = require(\\"./RequestDestination.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Enum\\"; +const interfaceName = \\"DOMImplementation\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -9800,7 +9079,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Enum'.\`); + throw new TypeError(\`\${context} is not of type 'DOMImplementation'.\`); }; function makeWrapper(globalObject) { @@ -9808,9 +9087,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Enum\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"DOMImplementation\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Enum is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor DOMImplementation is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -9866,127 +9145,158 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class Enum { + class DOMImplementation { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - op(destination) { + createDocumentType(qualifiedName, publicId, systemId) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (arguments.length < 1) { + if (arguments.length < 3) { throw new TypeError( - \\"Failed to execute 'op' on 'Enum': 1 argument required, but only \\" + arguments.length + \\" present.\\" + \\"Failed to execute 'createDocumentType' on 'DOMImplementation': 3 arguments required, but only \\" + + arguments.length + + \\" present.\\" ); } const args = []; { let curArg = arguments[0]; - curArg = RequestDestination.convert(curArg, { context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" }); + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'createDocumentType' on 'DOMImplementation': parameter 1\\" + }); args.push(curArg); } - return esValue[implSymbol].op(...args); + { + 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(esValue[implSymbol].createDocumentType(...args)); } - get attr() { + createDocument(namespace, qualifiedName) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return utils.tryWrapperForImpl(esValue[implSymbol][\\"attr\\"]); + 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(esValue[implSymbol].createDocument(...args)); } - set attr(V) { + createHTMLDocument() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { 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(esValue[implSymbol].createHTMLDocument(...args)); + } - V = \`\${V}\`; - if (!RequestDestination.enumerationValues.has(V)) { - return; + hasFeature() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - esValue[implSymbol][\\"attr\\"] = V; + return esValue[implSymbol].hasFeature(); } } - Object.defineProperties(Enum.prototype, { - op: { enumerable: true }, - attr: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"Enum\\", configurable: true } + Object.defineProperties(DOMImplementation.prototype, { + createDocumentType: { enumerable: true }, + createDocument: { enumerable: true }, + createHTMLDocument: { enumerable: true }, + hasFeature: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"DOMImplementation\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = Enum; + globalObject[ctorRegistrySymbol][interfaceName] = DOMImplementation; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: Enum + value: DOMImplementation }); }; -const Impl = require(\\"../implementations/Enum.js\\"); -" -`; - -exports[`without processors EventListener.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { - if (!utils.isObject(value)) { - throw new TypeError(\`\${context} is not an object.\`); - } - - function callTheUserObjectsOperation(event) { - let thisArg = utils.tryWrapperForImpl(this); - let O = value; - let X = O; - - if (typeof O !== \\"function\\") { - X = O[\\"handleEvent\\"]; - if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement EventListener.\`); - } - thisArg = O; - } - - event = utils.tryWrapperForImpl(event); - - let callResult = Reflect.apply(X, thisArg, [event]); - } - - callTheUserObjectsOperation[utils.wrapperSymbol] = value; - callTheUserObjectsOperation.objectReference = value; - - return callTheUserObjectsOperation; -}; - -exports.install = (globalObject, globalNames) => {}; +const Impl = require(\\"../implementations/DOMImplementation.js\\"); " `; -exports[`without processors EventTarget.webidl 1`] = ` +exports[`without processors DOMRect.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const EventListener = require(\\"./EventListener.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"EventTarget\\"; +const interfaceName = \\"DOMRect\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -9998,7 +9308,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'EventTarget'.\`); + throw new TypeError(\`\${context} is not of type 'DOMRect'.\`); }; function makeWrapper(globalObject) { @@ -10006,9 +9316,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"EventTarget\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"DOMRect\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor EventTarget is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor DOMRect is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -10058,307 +9368,291 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\", \\"Worker\\", \\"AudioWorklet\\"]); +const exposed = new Set([\\"Window\\", \\"Worker\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class EventTarget { + class DOMRect { constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); - } - - addEventListener(type, callback) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + const args = []; + { + let curArg = arguments[0]; + if (curArg !== undefined) { + curArg = conversions[\\"unrestricted double\\"](curArg, { + context: \\"Failed to construct 'DOMRect': parameter 1\\" + }); + } else { + curArg = 0; + } + args.push(curArg); } - - if (arguments.length < 2) { - throw new TypeError( - \\"Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only \\" + - arguments.length + - \\" present.\\" - ); + { + let curArg = arguments[1]; + if (curArg !== undefined) { + curArg = conversions[\\"unrestricted double\\"](curArg, { + context: \\"Failed to construct 'DOMRect': parameter 2\\" + }); + } else { + curArg = 0; + } + args.push(curArg); } - const args = []; { - let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 1\\" - }); + let curArg = arguments[2]; + if (curArg !== undefined) { + curArg = conversions[\\"unrestricted double\\"](curArg, { + context: \\"Failed to construct 'DOMRect': parameter 3\\" + }); + } else { + curArg = 0; + } args.push(curArg); } { - let curArg = arguments[1]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - curArg = EventListener.convert(curArg, { - context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 2\\" + let curArg = arguments[3]; + if (curArg !== undefined) { + curArg = conversions[\\"unrestricted double\\"](curArg, { + context: \\"Failed to construct 'DOMRect': parameter 4\\" }); + } else { + curArg = 0; } args.push(curArg); } - return esValue[implSymbol].addEventListener(...args); + return exports.setup(Object.create(new.target.prototype), globalObject, args); } - } - Object.defineProperties(EventTarget.prototype, { - addEventListener: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"EventTarget\\", configurable: true } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = EventTarget; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: EventTarget - }); -}; - -const Impl = require(\\"../implementations/EventTarget.js\\"); -" -`; -exports[`without processors Global.webidl 1`] = ` -"\\"use strict\\"; + get x() { + const esValue = this !== null && this !== undefined ? this : globalObject; -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; + return esValue[implSymbol][\\"x\\"]; + } -const interfaceName = \\"Global\\"; + set x(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Global'.\`); -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } + V = conversions[\\"unrestricted double\\"](V, { + context: \\"Failed to set the 'x' property on 'DOMRect': The provided value\\" + }); - const ctor = globalObject[ctorRegistrySymbol][\\"Global\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Global is not installed on the passed global object\\"); - } + esValue[implSymbol][\\"x\\"] = V; + } - return Object.create(ctor.prototype); -} + get y() { + const esValue = this !== null && this !== undefined ? this : globalObject; -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; + return esValue[implSymbol][\\"y\\"]; + } -exports._internalSetup = (wrapper, globalObject) => { - Object.defineProperties( - wrapper, - Object.getOwnPropertyDescriptors({ - op() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + set y(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - return esValue[implSymbol].op(); - }, - unforgeableOp() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - return esValue[implSymbol].unforgeableOp(); - }, - get attr() { - const esValue = this !== null && this !== undefined ? this : globalObject; + V = conversions[\\"unrestricted double\\"](V, { + context: \\"Failed to set the 'y' property on 'DOMRect': The provided value\\" + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + esValue[implSymbol][\\"y\\"] = V; + } - return esValue[implSymbol][\\"attr\\"]; - }, - set attr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + get width() { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'attr' property on 'Global': The provided value\\" - }); + return esValue[implSymbol][\\"width\\"]; + } - esValue[implSymbol][\\"attr\\"] = V; - }, - get unforgeableAttr() { - const esValue = this !== null && this !== undefined ? this : globalObject; + set width(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - return esValue[implSymbol][\\"unforgeableAttr\\"]; - }, - set unforgeableAttr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + V = conversions[\\"unrestricted double\\"](V, { + context: \\"Failed to set the 'width' property on 'DOMRect': The provided value\\" + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + esValue[implSymbol][\\"width\\"] = V; + } - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'unforgeableAttr' property on 'Global': The provided value\\" - }); + get height() { + const esValue = this !== null && this !== undefined ? this : globalObject; - esValue[implSymbol][\\"unforgeableAttr\\"] = V; - }, - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return esValue[implSymbol][\\"height\\"]; + } - return esValue[implSymbol][\\"length\\"]; - }, - set length(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + set height(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'length' property on 'Global': The provided value\\" - }); + V = conversions[\\"unrestricted double\\"](V, { + context: \\"Failed to set the 'height' property on 'DOMRect': The provided value\\" + }); - esValue[implSymbol][\\"length\\"] = V; - }, - [Symbol.iterator]: Array.prototype[Symbol.iterator], - keys: Array.prototype.keys, - values: Array.prototype[Symbol.iterator], - entries: Array.prototype.entries, - forEach: Array.prototype.forEach - }) - ); + esValue[implSymbol][\\"height\\"] = V; + } - Object.defineProperties(wrapper, { - unforgeableOp: { configurable: false, writable: false }, - unforgeableAttr: { configurable: false }, - [Symbol.iterator]: { enumerable: false } + static fromRect() { + const args = []; + { + let curArg = arguments[0]; + if (curArg !== undefined) { + curArg = utils.tryImplForWrapper(curArg); + } + args.push(curArg); + } + return utils.tryWrapperForImpl(Impl.implementation.fromRect(...args)); + } + } + Object.defineProperties(DOMRect.prototype, { + x: { enumerable: true }, + y: { enumerable: true }, + width: { enumerable: true }, + height: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"DOMRect\\", configurable: true } }); -}; - -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; + Object.defineProperties(DOMRect, { fromRect: { enumerable: true } }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = DOMRect; - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: DOMRect }); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); + if (globalNames.includes(\\"Window\\")) { + Object.defineProperty(globalObject, \\"SVGRect\\", { + configurable: true, + writable: true, + value: DOMRect + }); } - return wrapper; }; -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); +const Impl = require(\\"../implementations/DOMRect.js\\"); +" +`; - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); +exports[`without processors Dictionary.webidl 1`] = ` +"\\"use strict\\"; - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); -const exposed = new Set([\\"Global\\"]); +const URL = require(\\"./URL.js\\"); +const URLSearchParams = require(\\"./URLSearchParams.js\\"); -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Global { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); +exports._convertInherit = (obj, ret, { context = \\"The provided value\\" } = {}) => { + { + const key = \\"boolWithDefault\\"; + let value = obj === undefined || obj === null ? undefined : obj[key]; + if (value !== undefined) { + value = conversions[\\"boolean\\"](value, { context: context + \\" has member 'boolWithDefault' that\\" }); + + ret[key] = value; + } else { + ret[key] = false; } + } - static staticOp() { - return Impl.implementation.staticOp(); + { + const key = \\"requiredInterface\\"; + let value = obj === undefined || obj === null ? undefined : obj[key]; + if (value !== undefined) { + value = URL.convert(value, { context: context + \\" has member 'requiredInterface' that\\" }); + + ret[key] = value; + } else { + throw new TypeError(\\"requiredInterface is required in 'Dictionary'\\"); } + } - static get staticAttr() { - const esValue = this !== null && this !== undefined ? this : globalObject; + { + const key = \\"seq\\"; + let value = obj === undefined || obj === null ? undefined : obj[key]; + if (value !== undefined) { + if (!utils.isObject(value)) { + throw new TypeError(context + \\" has member 'seq' that\\" + \\" is not an iterable object.\\"); + } else { + const V = []; + const tmp = value; + for (let nextItem of tmp) { + nextItem = URLSearchParams.convert(nextItem, { context: context + \\" has member 'seq' that\\" + \\"'s element\\" }); - return Impl.implementation[\\"staticAttr\\"]; + V.push(nextItem); + } + value = V; + } + + ret[key] = value; } + } - static set staticAttr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + { + const key = \\"vanillaString\\"; + let value = obj === undefined || obj === null ? undefined : obj[key]; + if (value !== undefined) { + value = conversions[\\"DOMString\\"](value, { context: context + \\" has member 'vanillaString' that\\" }); - return Impl.implementation[\\"staticAttr\\"]; + ret[key] = value; } } - Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } }); - Object.defineProperties(Global, { staticOp: { enumerable: true }, staticAttr: { enumerable: true } }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); +}; + +exports.convert = function convert(obj, { context = \\"The provided value\\" } = {}) { + if (obj !== undefined && typeof obj !== \\"object\\" && typeof obj !== \\"function\\") { + throw new TypeError(\`\${context} is not an object.\`); } - globalObject[ctorRegistrySymbol][interfaceName] = Global; - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Global - }); + const ret = Object.create(null); + exports._convertInherit(obj, ret, { context }); + return ret; }; - -const Impl = require(\\"../implementations/Global.js\\"); " `; -exports[`without processors HTMLConstructor.webidl 1`] = ` +exports[`without processors DictionaryConvert.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const Dictionary = require(\\"./Dictionary.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"HTMLConstructor\\"; +const interfaceName = \\"DictionaryConvert\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -10370,7 +9664,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'HTMLConstructor'.\`); + throw new TypeError(\`\${context} is not of type 'DictionaryConvert'.\`); }; function makeWrapper(globalObject) { @@ -10378,9 +9672,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"HTMLConstructor\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"DictionaryConvert\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor HTMLConstructor is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor DictionaryConvert is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -10436,40 +9730,65 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class HTMLConstructor { + class DictionaryConvert { constructor() { throw new TypeError(\\"Illegal constructor\\"); } + + op() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 = Dictionary.convert(curArg, { context: \\"Failed to execute 'op' on 'DictionaryConvert': parameter 2\\" }); + args.push(curArg); + } + return esValue[implSymbol].op(...args); + } } - Object.defineProperties(HTMLConstructor.prototype, { - [Symbol.toStringTag]: { value: \\"HTMLConstructor\\", configurable: true } + Object.defineProperties(DictionaryConvert.prototype, { + op: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"DictionaryConvert\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = HTMLConstructor; + globalObject[ctorRegistrySymbol][interfaceName] = DictionaryConvert; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: HTMLConstructor + value: DictionaryConvert }); }; -const Impl = require(\\"../implementations/HTMLConstructor.js\\"); +const Impl = require(\\"../implementations/DictionaryConvert.js\\"); " `; -exports[`without processors MixedIn.webidl 1`] = ` +exports[`without processors Enum.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const RequestDestination = require(\\"./RequestDestination.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"MixedIn\\"; +const interfaceName = \\"Enum\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -10481,7 +9800,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'MixedIn'.\`); + throw new TypeError(\`\${context} is not of type 'Enum'.\`); }; function makeWrapper(globalObject) { @@ -10489,9 +9808,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"MixedIn\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Enum\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor MixedIn is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Enum is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -10547,107 +9866,78 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class MixedIn { + class Enum { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - mixedInOp() { + op(destination) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].mixedInOp(); - } - - ifaceMixinOp() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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.\\" + ); } - - return esValue[implSymbol].ifaceMixinOp(); - } - - get mixedInAttr() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + const args = []; + { + let curArg = arguments[0]; + curArg = RequestDestination.convert(curArg, { context: \\"Failed to execute 'op' on 'Enum': parameter 1\\" }); + args.push(curArg); } - - return esValue[implSymbol][\\"mixedInAttr\\"]; + return esValue[implSymbol].op(...args); } - set mixedInAttr(V) { + get attr() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\" - }); - - esValue[implSymbol][\\"mixedInAttr\\"] = V; + return utils.tryWrapperForImpl(esValue[implSymbol][\\"attr\\"]); } - get ifaceMixinAttr() { + set attr(V) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"ifaceMixinAttr\\"]; - } - - set ifaceMixinAttr(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + V = \`\${V}\`; + if (!RequestDestination.enumerationValues.has(V)) { + return; } - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\" - }); - - esValue[implSymbol][\\"ifaceMixinAttr\\"] = V; + esValue[implSymbol][\\"attr\\"] = 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 } + Object.defineProperties(Enum.prototype, { + op: { enumerable: true }, + attr: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"Enum\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = MixedIn; + globalObject[ctorRegistrySymbol][interfaceName] = Enum; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: MixedIn + value: Enum }); }; -const Impl = require(\\"../implementations/MixedIn.js\\"); +const Impl = require(\\"../implementations/Enum.js\\"); " `; -exports[`without processors NodeFilter.webidl 1`] = ` +exports[`without processors EventListener.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -10658,26 +9948,22 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } throw new TypeError(\`\${context} is not an object.\`); } - function callTheUserObjectsOperation(node) { + function callTheUserObjectsOperation(event) { let thisArg = utils.tryWrapperForImpl(this); let O = value; let X = O; if (typeof O !== \\"function\\") { - X = O[\\"acceptNode\\"]; + X = O[\\"handleEvent\\"]; if (typeof X !== \\"function\\") { - throw new TypeError(\`\${context} does not correctly implement NodeFilter.\`); + throw new TypeError(\`\${context} does not correctly implement EventListener.\`); } thisArg = O; } - node = utils.tryWrapperForImpl(node); - - let callResult = Reflect.apply(X, thisArg, [node]); - - callResult = conversions[\\"unsigned short\\"](callResult, { context: context }); + event = utils.tryWrapperForImpl(event); - return callResult; + let callResult = Reflect.apply(X, thisArg, [event]); } callTheUserObjectsOperation[utils.wrapperSymbol] = value; @@ -10686,56 +9972,21 @@ exports.convert = function convert(value, { context = \\"The provided value\\" } return callTheUserObjectsOperation; }; -const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - - const NodeFilter = () => { - throw new TypeError(\\"Illegal invocation\\"); - }; - - Object.defineProperties(NodeFilter, { - FILTER_ACCEPT: { value: 1, enumerable: true }, - FILTER_REJECT: { value: 2, enumerable: true }, - FILTER_SKIP: { value: 3, enumerable: true }, - SHOW_ALL: { value: 0xffffffff, enumerable: true }, - SHOW_ELEMENT: { value: 0x1, enumerable: true }, - SHOW_ATTRIBUTE: { value: 0x2, enumerable: true }, - SHOW_TEXT: { value: 0x4, enumerable: true }, - SHOW_CDATA_SECTION: { value: 0x8, enumerable: true }, - SHOW_ENTITY_REFERENCE: { value: 0x10, enumerable: true }, - SHOW_ENTITY: { value: 0x20, enumerable: true }, - SHOW_PROCESSING_INSTRUCTION: { value: 0x40, enumerable: true }, - SHOW_COMMENT: { value: 0x80, enumerable: true }, - SHOW_DOCUMENT: { value: 0x100, enumerable: true }, - SHOW_DOCUMENT_TYPE: { value: 0x200, enumerable: true }, - SHOW_DOCUMENT_FRAGMENT: { value: 0x400, enumerable: true }, - SHOW_NOTATION: { value: 0x800, enumerable: true } - }); - - Object.defineProperty(globalObject, \\"NodeFilter\\", { - configurable: true, - writable: true, - value: NodeFilter - }); -}; +exports.install = (globalObject, globalNames) => {}; " `; -exports[`without processors Overloads.webidl 1`] = ` +exports[`without processors EventTarget.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const URL = require(\\"./URL.js\\"); +const EventListener = require(\\"./EventListener.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Overloads\\"; +const interfaceName = \\"EventTarget\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -10747,7 +9998,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Overloads'.\`); + throw new TypeError(\`\${context} is not of type 'EventTarget'.\`); }; function makeWrapper(globalObject) { @@ -10755,9 +10006,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Overloads\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"EventTarget\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Overloads is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor EventTarget is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -10807,347 +10058,73 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\"]); +const exposed = new Set([\\"Window\\", \\"Worker\\", \\"AudioWorklet\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class Overloads { + class EventTarget { constructor() { - const args = []; - switch (arguments.length) { - case 0: - break; - default: { - let curArg = arguments[0]; - if (URL.is(curArg)) { - { - let curArg = arguments[0]; - curArg = URL.convert(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 exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - compatible(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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(esValue[implSymbol].compatible(...args)); - } - - incompatible1(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].incompatible1(...args); - } - - incompatible2(arg1) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].incompatible2(...args); + return exports.setup(Object.create(new.target.prototype), globalObject, undefined); } - incompatible3(arg1) { + addEventListener(type, callback) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (arguments.length < 1) { + if (arguments.length < 2) { throw new TypeError( - \\"Failed to execute 'incompatible3' on 'Overloads': 1 argument required, but only \\" + + \\"Failed to execute 'addEventListener' on 'EventTarget': 2 arguments 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 = URL.convert(curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" - }); - } - args.push(curArg); - } - } else if (URL.is(curArg)) { - { - let curArg = arguments[1]; - if (curArg !== undefined) { - curArg = URL.convert(curArg, { - context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" - }); - } - args.push(curArg); - } - } else if (utils.isArrayBuffer(curArg)) { - { - let curArg = arguments[1]; - if (utils.isArrayBuffer(curArg)) { - } 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 (utils.isArrayBuffer(curArg)) { - } 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 (utils.isArrayBuffer(curArg)) { - } 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 (utils.isArrayBuffer(curArg)) { - } 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); - } + { + let curArg = arguments[0]; + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 1\\" + }); + args.push(curArg); } - return esValue[implSymbol].incompatible3(...args); + { + let curArg = arguments[1]; + if (curArg === null || curArg === undefined) { + curArg = null; + } else { + curArg = EventListener.convert(curArg, { + context: \\"Failed to execute 'addEventListener' on 'EventTarget': parameter 2\\" + }); + } + args.push(curArg); + } + return esValue[implSymbol].addEventListener(...args); } } - Object.defineProperties(Overloads.prototype, { - compatible: { enumerable: true }, - incompatible1: { enumerable: true }, - incompatible2: { enumerable: true }, - incompatible3: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"Overloads\\", configurable: true } + Object.defineProperties(EventTarget.prototype, { + addEventListener: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"EventTarget\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = Overloads; + globalObject[ctorRegistrySymbol][interfaceName] = EventTarget; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: Overloads + value: EventTarget }); }; -const Impl = require(\\"../implementations/Overloads.js\\"); +const Impl = require(\\"../implementations/EventTarget.js\\"); " `; -exports[`without processors PromiseTypes.webidl 1`] = ` +exports[`without processors Global.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -11156,7 +10133,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"PromiseTypes\\"; +const interfaceName = \\"Global\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -11168,7 +10145,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`); + throw new TypeError(\`\${context} is not of type 'Global'.\`); }; function makeWrapper(globalObject) { @@ -11176,9 +10153,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"PromiseTypes\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Global\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor PromiseTypes is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Global is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -11189,13 +10166,112 @@ exports.create = (globalObject, constructorArgs, privateData) => { return exports.setup(wrapper, globalObject, constructorArgs, privateData); }; -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; + +exports._internalSetup = (wrapper, globalObject) => { + Object.defineProperties( + wrapper, + Object.getOwnPropertyDescriptors({ + op() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].op(); + }, + unforgeableOp() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].unforgeableOp(); + }, + get attr() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"attr\\"]; + }, + set attr(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'attr' property on 'Global': The provided value\\" + }); + + esValue[implSymbol][\\"attr\\"] = V; + }, + get unforgeableAttr() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"unforgeableAttr\\"]; + }, + set unforgeableAttr(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'unforgeableAttr' property on 'Global': The provided value\\" + }); + + esValue[implSymbol][\\"unforgeableAttr\\"] = V; + }, + get length() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"length\\"]; + }, + set length(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"unsigned long\\"](V, { + context: \\"Failed to set the 'length' property on 'Global': The provided value\\" + }); + + esValue[implSymbol][\\"length\\"] = V; + }, + [Symbol.iterator]: Array.prototype[Symbol.iterator], + keys: Array.prototype.keys, + values: Array.prototype[Symbol.iterator], + entries: Array.prototype.entries, + forEach: Array.prototype.forEach + }) + ); + + Object.defineProperties(wrapper, { + unforgeableOp: { configurable: false, writable: false }, + unforgeableAttr: { configurable: false }, + [Symbol.iterator]: { enumerable: false } + }); }; -exports._internalSetup = (wrapper, globalObject) => {}; - exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -11228,95 +10304,52 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\"]); +const exposed = new Set([\\"Global\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class PromiseTypes { + class Global { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - voidPromiseConsumer(p) { + static staticOp() { + return Impl.implementation.staticOp(); + } + + static get staticAttr() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].voidPromiseConsumer(...args); + return Impl.implementation[\\"staticAttr\\"]; } - promiseConsumer(p) { + static set staticAttr(V) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 esValue[implSymbol].promiseConsumer(...args); + return Impl.implementation[\\"staticAttr\\"]; } } - Object.defineProperties(PromiseTypes.prototype, { - voidPromiseConsumer: { enumerable: true }, - promiseConsumer: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"PromiseTypes\\", configurable: true } - }); + Object.defineProperties(Global.prototype, { [Symbol.toStringTag]: { value: \\"Global\\", configurable: true } }); + Object.defineProperties(Global, { staticOp: { enumerable: true }, staticAttr: { enumerable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = PromiseTypes; + globalObject[ctorRegistrySymbol][interfaceName] = Global; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: PromiseTypes + value: Global }); }; -const Impl = require(\\"../implementations/PromiseTypes.js\\"); +const Impl = require(\\"../implementations/Global.js\\"); " `; -exports[`without processors Reflect.webidl 1`] = ` +exports[`without processors HTMLConstructor.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -11325,7 +10358,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Reflect\\"; +const interfaceName = \\"HTMLConstructor\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -11337,7 +10370,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Reflect'.\`); + throw new TypeError(\`\${context} is not of type 'HTMLConstructor'.\`); }; function makeWrapper(globalObject) { @@ -11345,9 +10378,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Reflect\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"HTMLConstructor\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Reflect is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor HTMLConstructor is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -11403,249 +10436,249 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class Reflect { + class HTMLConstructor { constructor() { throw new TypeError(\\"Illegal constructor\\"); } + } + Object.defineProperties(HTMLConstructor.prototype, { + [Symbol.toStringTag]: { value: \\"HTMLConstructor\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = HTMLConstructor; - get reflectedBoolean() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"reflectedBoolean\\"]; - } - - set reflectedBoolean(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"boolean\\"](V, { - context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol][\\"reflectedBoolean\\"] = V; - } - - get reflectedDOMString() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"reflectedDOMString\\"]; - } - - set reflectedDOMString(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\" - }); - - esValue[implSymbol][\\"reflectedDOMString\\"] = V; - } + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: HTMLConstructor + }); +}; - get reflectedLong() { - const esValue = this !== null && this !== undefined ? this : globalObject; +const Impl = require(\\"../implementations/HTMLConstructor.js\\"); +" +`; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +exports[`without processors LegacyUnforgeable.webidl 1`] = ` +"\\"use strict\\"; - return esValue[implSymbol][\\"reflectedLong\\"]; - } +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); - set reflectedLong(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const interfaceName = \\"LegacyUnforgeable\\"; - V = conversions[\\"long\\"](V, { - context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\" - }); +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'LegacyUnforgeable'.\`); +}; - esValue[implSymbol][\\"reflectedLong\\"] = V; - } +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - get reflectedUnsignedLong() { - const esValue = this !== null && this !== undefined ? this : globalObject; + const ctor = globalObject[ctorRegistrySymbol][\\"LegacyUnforgeable\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor LegacyUnforgeable is not installed on the passed global object\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return Object.create(ctor.prototype); +} - return esValue[implSymbol][\\"reflectedUnsignedLong\\"]; - } +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; - set reflectedUnsignedLong(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +exports._internalSetup = (wrapper, globalObject) => { + Object.defineProperties( + wrapper, + Object.getOwnPropertyDescriptors({ + assign(url) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - V = conversions[\\"unsigned long\\"](V, { - context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\" - }); + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'assign' on 'LegacyUnforgeable': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); + } + const args = []; + { + let curArg = arguments[0]; + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to execute 'assign' on 'LegacyUnforgeable': parameter 1\\" + }); + args.push(curArg); + } + return esValue[implSymbol].assign(...args); + }, + get href() { + const esValue = this !== null && this !== undefined ? this : globalObject; - esValue[implSymbol][\\"reflectedUnsignedLong\\"] = V; - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - get reflectedUSVStringURL() { - const esValue = this !== null && this !== undefined ? this : globalObject; + return esValue[implSymbol][\\"href\\"]; + }, + set href(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - return esValue[implSymbol][\\"reflectedUSVStringURL\\"]; - } + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'href' property on 'LegacyUnforgeable': The provided value\\" + }); - set reflectedUSVStringURL(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + esValue[implSymbol][\\"href\\"] = V; + }, + toString() { + const esValue = this; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return esValue[implSymbol][\\"href\\"]; + }, + get origin() { + const esValue = this !== null && this !== undefined ? this : globalObject; - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\" - }); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - esValue[implSymbol][\\"reflectedUSVStringURL\\"] = V; - } + return esValue[implSymbol][\\"origin\\"]; + }, + get protocol() { + const esValue = this !== null && this !== undefined ? this : globalObject; - get reflectionTest() { - const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return esValue[implSymbol][\\"protocol\\"]; + }, + set protocol(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - return esValue[implSymbol][\\"reflectionTest\\"]; - } + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - set reflectionTest(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'protocol' property on 'LegacyUnforgeable': The provided value\\" + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + esValue[implSymbol][\\"protocol\\"] = V; } + }) + ); - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\" - }); + Object.defineProperties(wrapper, { + assign: { configurable: false, writable: false }, + href: { configurable: false }, + toString: { configurable: false, writable: false }, + origin: { configurable: false }, + protocol: { configurable: false } + }); +}; - esValue[implSymbol][\\"reflectionTest\\"] = V; - } +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; - get withUnderscore() { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; - return esValue[implSymbol][\\"withUnderscore\\"]; - } +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); - set withUnderscore(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; - V = conversions[\\"DOMString\\"](V, { - context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\" - }); +const exposed = new Set([\\"Window\\"]); - esValue[implSymbol][\\"withUnderscore\\"] = V; +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class LegacyUnforgeable { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } } - Object.defineProperties(Reflect.prototype, { - reflectedBoolean: { enumerable: true }, - reflectedDOMString: { enumerable: true }, - reflectedLong: { enumerable: true }, - reflectedUnsignedLong: { enumerable: true }, - reflectedUSVStringURL: { enumerable: true }, - reflectionTest: { enumerable: true }, - withUnderscore: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"Reflect\\", configurable: true } + Object.defineProperties(LegacyUnforgeable.prototype, { + [Symbol.toStringTag]: { value: \\"LegacyUnforgeable\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = Reflect; + globalObject[ctorRegistrySymbol][interfaceName] = LegacyUnforgeable; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: Reflect + value: LegacyUnforgeable }); }; -const Impl = require(\\"../implementations/Reflect.js\\"); -" -`; - -exports[`without processors RequestDestination.webidl 1`] = ` -"\\"use strict\\"; - -const enumerationValues = new Set([ - \\"\\", - \\"audio\\", - \\"document\\", - \\"embed\\", - \\"font\\", - \\"image\\", - \\"manifest\\", - \\"object\\", - \\"report\\", - \\"script\\", - \\"sharedworker\\", - \\"style\\", - \\"track\\", - \\"video\\", - \\"worker\\", - \\"xslt\\" -]); -exports.enumerationValues = enumerationValues; - -exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { - const string = \`\${value}\`; - if (!enumerationValues.has(string)) { - throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); - } - return string; -}; +const Impl = require(\\"../implementations/LegacyUnforgeable.js\\"); " `; -exports[`without processors SeqAndRec.webidl 1`] = ` +exports[`without processors LegacyUnforgeableMap.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"SeqAndRec\\"; +const interfaceName = \\"LegacyUnforgeableMap\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -11657,7 +10690,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`); + throw new TypeError(\`\${context} is not of type 'LegacyUnforgeableMap'.\`); }; function makeWrapper(globalObject) { @@ -11665,9 +10698,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"SeqAndRec\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"LegacyUnforgeableMap\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor LegacyUnforgeableMap is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -11683,7 +10716,24 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { return utils.implForWrapper(wrapper); }; -exports._internalSetup = (wrapper, globalObject) => {}; +exports._internalSetup = (wrapper, globalObject) => { + Object.defineProperties( + wrapper, + Object.getOwnPropertyDescriptors({ + get a() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"a\\"]; + } + }) + ); + + Object.defineProperties(wrapper, { a: { configurable: false } }); +}; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -11694,6 +10744,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -11710,6 +10762,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -11723,236 +10777,206 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class SeqAndRec { + class LegacyUnforgeableMap { constructor() { - return exports.setup(Object.create(new.target.prototype), globalObject, undefined); + throw new TypeError(\\"Illegal constructor\\"); } + } + Object.defineProperties(LegacyUnforgeableMap.prototype, { + [Symbol.toStringTag]: { value: \\"LegacyUnforgeableMap\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = LegacyUnforgeableMap; - recordConsumer(rec) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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; + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: LegacyUnforgeableMap + }); +}; - typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" - }); +const proxyHandler = { + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; + } + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; + } + return Reflect.apply(getter, receiver, []); + }, - let typedValue = curArg[key]; + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + }, - typedValue = conversions[\\"double\\"](typedValue, { - context: \\"Failed to execute 'recordConsumer' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" - }); + ownKeys(target) { + const keys = new Set(); - result[typedKey] = typedValue; - } - } - curArg = result; - } - args.push(curArg); + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); } - return esValue[implSymbol].recordConsumer(...args); } - recordConsumer2(rec) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + for (const key of Reflect.ownKeys(target)) { + keys.add(key); + } + return [...keys]; + }, - 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; + getOwnPropertyDescriptor(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.getOwnPropertyDescriptor(target, P); + } + let ignoreNamedProps = false; - typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s key\\" - }); + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { + const namedValue = target[implSymbol][utils.namedGet](P); - let typedValue = curArg[key]; + return { + writable: true, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; + } - typedValue = URL.convert(typedValue, { - context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" - }); + return Reflect.getOwnPropertyDescriptor(target, P); + }, - result[typedKey] = typedValue; - } - } - curArg = result; - } - args.push(curArg); - } - return esValue[implSymbol].recordConsumer2(...args); + set(target, P, V, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.set(target, P, V, receiver); } + if (target === receiver) { + if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { + let namedValue = V; - sequenceConsumer(seq) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + }); - 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.\\" - ); + const creating = !target[implSymbol][utils.supportsPropertyName](P); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); } 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; + target[implSymbol][utils.namedSetExisting](P, namedValue); } - args.push(curArg); + + return true; } - return esValue[implSymbol].sequenceConsumer(...args); } + let ownDesc; - sequenceConsumer2(seq) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); + if (ownDesc === undefined) { + ownDesc = Reflect.getOwnPropertyDescriptor(target, P); + } + if (ownDesc === undefined) { + const parent = Reflect.getPrototypeOf(target); + if (parent !== null) { + return Reflect.set(parent, P, V, receiver); } - - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'sequenceConsumer2' on 'SeqAndRec': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); + ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; + } + if (!ownDesc.writable) { + return false; + } + if (!utils.isObject(receiver)) { + return false; + } + const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); + let valueDesc; + if (existingDesc !== undefined) { + if (existingDesc.get || existingDesc.set) { + return false; } - 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); + if (!existingDesc.writable) { + return false; } - return esValue[implSymbol].sequenceConsumer2(...args); + valueDesc = { value: V }; + } else { + valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; } + return Reflect.defineProperty(receiver, P, valueDesc); + }, - frozenArrayConsumer(arr) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + defineProperty(target, P, desc) { + if (typeof P === \\"symbol\\") { + return Reflect.defineProperty(target, P, desc); + } + if (![\\"a\\"].includes(P)) { + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } - 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\\" - }); + let namedValue = desc.value; - V.push(nextItem); - } - curArg = V; + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'LegacyUnforgeableMap': The provided value\\" + }); + + const creating = !target[implSymbol][utils.supportsPropertyName](P); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); } - curArg = Object.freeze(curArg); - args.push(curArg); + + return true; } - return esValue[implSymbol].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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = SeqAndRec; + return Reflect.defineProperty(target, P, desc); + }, - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: SeqAndRec - }); + deleteProperty(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.deleteProperty(target, P); + } + + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { + return false; + } + + return Reflect.deleteProperty(target, P); + }, + + preventExtensions() { + return false; + } }; -const Impl = require(\\"../implementations/SeqAndRec.js\\"); +const Impl = require(\\"../implementations/LegacyUnforgeableMap.js\\"); " `; -exports[`without processors Static.webidl 1`] = ` +exports[`without processors MixedIn.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -11961,7 +10985,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Static\\"; +const interfaceName = \\"MixedIn\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -11973,7 +10997,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Static'.\`); + throw new TypeError(\`\${context} is not of type 'MixedIn'.\`); }; function makeWrapper(globalObject) { @@ -11981,9 +11005,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Static\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"MixedIn\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor MixedIn is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -12039,90 +11063,195 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class Static { + class MixedIn { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - def() { + mixedInOp() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].def(); + return esValue[implSymbol].mixedInOp(); } - get abc() { + ifaceMixinOp() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"abc\\"]; + return esValue[implSymbol].ifaceMixinOp(); } - set abc(V) { + get mixedInAttr() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); - - esValue[implSymbol][\\"abc\\"] = V; + return esValue[implSymbol][\\"mixedInAttr\\"]; } - static def() { - return Impl.implementation.def(); + set mixedInAttr(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'mixedInAttr' property on 'MixedIn': The provided value\\" + }); + + esValue[implSymbol][\\"mixedInAttr\\"] = V; } - static get abc() { + get ifaceMixinAttr() { const esValue = this !== null && this !== undefined ? this : globalObject; - return Impl.implementation[\\"abc\\"]; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"ifaceMixinAttr\\"]; } - static set abc(V) { + set ifaceMixinAttr(V) { const esValue = this !== null && this !== undefined ? this : globalObject; - return Impl.implementation[\\"abc\\"]; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'ifaceMixinAttr' property on 'MixedIn': The provided value\\" + }); + + esValue[implSymbol][\\"ifaceMixinAttr\\"] = V; } } - Object.defineProperties(Static.prototype, { - def: { enumerable: true }, - abc: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"Static\\", configurable: true } + 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 } }); - Object.defineProperties(Static, { def: { enumerable: true }, abc: { enumerable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = Static; + globalObject[ctorRegistrySymbol][interfaceName] = MixedIn; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: Static + value: MixedIn }); }; -const Impl = require(\\"../implementations/Static.js\\"); +const Impl = require(\\"../implementations/MixedIn.js\\"); " `; -exports[`without processors Storage.webidl 1`] = ` +exports[`without processors NodeFilter.webidl 1`] = ` +"\\"use strict\\"; + +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); + +exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { + if (!utils.isObject(value)) { + throw new TypeError(\`\${context} is not an object.\`); + } + + function callTheUserObjectsOperation(node) { + let thisArg = utils.tryWrapperForImpl(this); + let O = value; + let X = O; + + if (typeof O !== \\"function\\") { + X = O[\\"acceptNode\\"]; + if (typeof X !== \\"function\\") { + throw new TypeError(\`\${context} does not correctly implement NodeFilter.\`); + } + thisArg = O; + } + + node = utils.tryWrapperForImpl(node); + + let callResult = Reflect.apply(X, thisArg, [node]); + + callResult = conversions[\\"unsigned short\\"](callResult, { context: context }); + + return callResult; + } + + callTheUserObjectsOperation[utils.wrapperSymbol] = value; + callTheUserObjectsOperation.objectReference = value; + + return callTheUserObjectsOperation; +}; + +const exposed = new Set([\\"Window\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + + const NodeFilter = () => { + throw new TypeError(\\"Illegal invocation\\"); + }; + + Object.defineProperties(NodeFilter, { + FILTER_ACCEPT: { value: 1, enumerable: true }, + FILTER_REJECT: { value: 2, enumerable: true }, + FILTER_SKIP: { value: 3, enumerable: true }, + SHOW_ALL: { value: 0xffffffff, enumerable: true }, + SHOW_ELEMENT: { value: 0x1, enumerable: true }, + SHOW_ATTRIBUTE: { value: 0x2, enumerable: true }, + SHOW_TEXT: { value: 0x4, enumerable: true }, + SHOW_CDATA_SECTION: { value: 0x8, enumerable: true }, + SHOW_ENTITY_REFERENCE: { value: 0x10, enumerable: true }, + SHOW_ENTITY: { value: 0x20, enumerable: true }, + SHOW_PROCESSING_INSTRUCTION: { value: 0x40, enumerable: true }, + SHOW_COMMENT: { value: 0x80, enumerable: true }, + SHOW_DOCUMENT: { value: 0x100, enumerable: true }, + SHOW_DOCUMENT_TYPE: { value: 0x200, enumerable: true }, + SHOW_DOCUMENT_FRAGMENT: { value: 0x400, enumerable: true }, + SHOW_NOTATION: { value: 0x800, enumerable: true } + }); + + Object.defineProperty(globalObject, \\"NodeFilter\\", { + configurable: true, + writable: true, + value: NodeFilter + }); +}; +" +`; + +exports[`without processors Overloads.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"Storage\\"; +const interfaceName = \\"Overloads\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -12134,7 +11263,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'Storage'.\`); + throw new TypeError(\`\${context} is not of type 'Overloads'.\`); }; function makeWrapper(globalObject) { @@ -12142,9 +11271,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"Storage\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Overloads\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Storage is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Overloads is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -12171,8 +11300,6 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -12189,8 +11316,6 @@ exports.new = globalObject => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -12199,82 +11324,108 @@ exports.new = globalObject => { }; const exposed = new Set([\\"Window\\"]); - -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Storage { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - - key(index) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - 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 esValue[implSymbol].key(...args); - } - - getItem(key) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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.\\" - ); - } + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class Overloads { + constructor() { const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'getItem' on 'Storage': parameter 1\\" }); - args.push(curArg); + switch (arguments.length) { + case 0: + break; + default: { + let curArg = arguments[0]; + if (URL.is(curArg)) { + { + let curArg = arguments[0]; + curArg = URL.convert(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 esValue[implSymbol].getItem(...args); + return exports.setup(Object.create(new.target.prototype), globalObject, args); } - setItem(key, value) { + compatible(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (arguments.length < 2) { + if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'setItem' on 'Storage': 2 arguments required, but only \\" + arguments.length + \\" present.\\" + \\"Failed to execute 'compatible' on 'Overloads': 1 argument 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); + 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 esValue[implSymbol].setItem(...args); + return utils.tryWrapperForImpl(esValue[implSymbol].compatible(...args)); } - removeItem(key) { + incompatible1(arg1) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -12282,229 +11433,237 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'removeItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" + \\"Failed to execute 'incompatible1' on 'Overloads': 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 esValue[implSymbol].removeItem(...args); - } - - clear() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].clear(); - } - - get length() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = Storage; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Storage - }); -}; - -const proxyHandler = { - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - }, - - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - }, - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); - } - } - - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - }, - - getOwnPropertyDescriptor(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; - - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { - const namedValue = target[implSymbol].getItem(P); - - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - }, - - set(target, P, V, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.set(target, P, V, receiver); - } - if (target === receiver) { - if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { - let namedValue = V; - - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" - }); - - target[implSymbol].setItem(P, namedValue); - - return true; + 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 esValue[implSymbol].incompatible1(...args); } - let ownDesc; - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, P, V, receiver); + incompatible2(arg1) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (!ownDesc.writable) { - return false; - } - if (!utils.isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); - let valueDesc; - if (existingDesc !== undefined) { - if (existingDesc.get || existingDesc.set) { - return false; + + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'incompatible2' on 'Overloads': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); } - if (!existingDesc.writable) { - return false; + 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); + } } - valueDesc = { value: V }; - } else { - valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + return esValue[implSymbol].incompatible2(...args); } - return Reflect.defineProperty(receiver, P, valueDesc); - }, - defineProperty(target, P, desc) { - if (typeof P === \\"symbol\\") { - return Reflect.defineProperty(target, P, desc); - } - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; + incompatible3(arg1) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - let namedValue = desc.value; - - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" - }); - - target[implSymbol].setItem(P, namedValue); - - return true; - } - return Reflect.defineProperty(target, P, desc); - }, - - deleteProperty(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.deleteProperty(target, P); - } - - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { - target[implSymbol].removeItem(P); - return true; + 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 = URL.convert(curArg, { + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + }); + } + args.push(curArg); + } + } else if (URL.is(curArg)) { + { + let curArg = arguments[1]; + if (curArg !== undefined) { + curArg = URL.convert(curArg, { + context: \\"Failed to execute 'incompatible3' on 'Overloads': parameter 2\\" + }); + } + args.push(curArg); + } + } else if (utils.isArrayBuffer(curArg)) { + { + let curArg = arguments[1]; + if (utils.isArrayBuffer(curArg)) { + } 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 (utils.isArrayBuffer(curArg)) { + } 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 (utils.isArrayBuffer(curArg)) { + } 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 (utils.isArrayBuffer(curArg)) { + } 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 esValue[implSymbol].incompatible3(...args); } - - return Reflect.deleteProperty(target, P); - }, - - preventExtensions() { - return false; } + Object.defineProperties(Overloads.prototype, { + compatible: { enumerable: true }, + incompatible1: { enumerable: true }, + incompatible2: { enumerable: true }, + incompatible3: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"Overloads\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = Overloads; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: Overloads + }); }; -const Impl = require(\\"../implementations/Storage.js\\"); +const Impl = require(\\"../implementations/Overloads.js\\"); " `; -exports[`without processors StringifierAttribute.webidl 1`] = ` +exports[`without processors PromiseTypes.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -12513,7 +11672,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierAttribute\\"; +const interfaceName = \\"PromiseTypes\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -12525,7 +11684,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); + throw new TypeError(\`\${context} is not of type 'PromiseTypes'.\`); }; function makeWrapper(globalObject) { @@ -12533,9 +11692,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierAttribute\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"PromiseTypes\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor StringifierAttribute is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor PromiseTypes is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -12591,52 +11750,89 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierAttribute { + class PromiseTypes { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - get attr() { + voidPromiseConsumer(p) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"attr\\"]; + 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 esValue[implSymbol].voidPromiseConsumer(...args); } - toString() { - const esValue = this; + promiseConsumer(p) { + const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"attr\\"]; + 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 esValue[implSymbol].promiseConsumer(...args); } } - Object.defineProperties(StringifierAttribute.prototype, { - attr: { enumerable: true }, - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierAttribute\\", configurable: true } + Object.defineProperties(PromiseTypes.prototype, { + voidPromiseConsumer: { enumerable: true }, + promiseConsumer: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"PromiseTypes\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierAttribute; + globalObject[ctorRegistrySymbol][interfaceName] = PromiseTypes; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierAttribute + value: PromiseTypes }); }; -const Impl = require(\\"../implementations/StringifierAttribute.js\\"); +const Impl = require(\\"../implementations/PromiseTypes.js\\"); " `; -exports[`without processors StringifierDefaultOperation.webidl 1`] = ` +exports[`without processors Reflect.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -12645,7 +11841,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierDefaultOperation\\"; +const interfaceName = \\"Reflect\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -12657,7 +11853,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); + throw new TypeError(\`\${context} is not of type 'Reflect'.\`); }; function makeWrapper(globalObject) { @@ -12665,11 +11861,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierDefaultOperation\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Reflect\\"]; if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor StringifierDefaultOperation is not installed on the passed global object\\" - ); + throw new Error(\\"Internal error: constructor Reflect is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -12687,88 +11881,287 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { exports._internalSetup = (wrapper, globalObject) => {}; -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class Reflect { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); + } + + get reflectedBoolean() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"reflectedBoolean\\"]; + } + + set reflectedBoolean(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"boolean\\"](V, { + context: \\"Failed to set the 'reflectedBoolean' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol][\\"reflectedBoolean\\"] = V; + } + + get reflectedDOMString() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"reflectedDOMString\\"]; + } + + set reflectedDOMString(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'reflectedDOMString' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol][\\"reflectedDOMString\\"] = V; + } + + get reflectedLong() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"reflectedLong\\"]; + } + + set reflectedLong(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"long\\"](V, { + context: \\"Failed to set the 'reflectedLong' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol][\\"reflectedLong\\"] = V; + } + + get reflectedUnsignedLong() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"reflectedUnsignedLong\\"]; + } + + set reflectedUnsignedLong(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"unsigned long\\"](V, { + context: \\"Failed to set the 'reflectedUnsignedLong' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol][\\"reflectedUnsignedLong\\"] = V; + } + + get reflectedUSVStringURL() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"reflectedUSVStringURL\\"]; + } + + set reflectedUSVStringURL(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'reflectedUSVStringURL' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol][\\"reflectedUSVStringURL\\"] = V; + } + + get reflectionTest() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"reflectionTest\\"]; + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); + set reflectionTest(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'reflectionTest' property on 'Reflect': The provided value\\" + }); - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); + esValue[implSymbol][\\"reflectionTest\\"] = V; + } - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; + get withUnderscore() { + const esValue = this !== null && this !== undefined ? this : globalObject; -const exposed = new Set([\\"Window\\"]); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class StringifierDefaultOperation { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); + return esValue[implSymbol][\\"withUnderscore\\"]; } - toString() { + set withUnderscore(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].toString(); + V = conversions[\\"DOMString\\"](V, { + context: \\"Failed to set the 'withUnderscore' property on 'Reflect': The provided value\\" + }); + + esValue[implSymbol][\\"withUnderscore\\"] = V; } } - Object.defineProperties(StringifierDefaultOperation.prototype, { - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierDefaultOperation\\", configurable: true } + Object.defineProperties(Reflect.prototype, { + reflectedBoolean: { enumerable: true }, + reflectedDOMString: { enumerable: true }, + reflectedLong: { enumerable: true }, + reflectedUnsignedLong: { enumerable: true }, + reflectedUSVStringURL: { enumerable: true }, + reflectionTest: { enumerable: true }, + withUnderscore: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"Reflect\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierDefaultOperation; + globalObject[ctorRegistrySymbol][interfaceName] = Reflect; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierDefaultOperation + value: Reflect }); }; -const Impl = require(\\"../implementations/StringifierDefaultOperation.js\\"); +const Impl = require(\\"../implementations/Reflect.js\\"); " `; -exports[`without processors StringifierNamedOperation.webidl 1`] = ` +exports[`without processors RequestDestination.webidl 1`] = ` +"\\"use strict\\"; + +const enumerationValues = new Set([ + \\"\\", + \\"audio\\", + \\"document\\", + \\"embed\\", + \\"font\\", + \\"image\\", + \\"manifest\\", + \\"object\\", + \\"report\\", + \\"script\\", + \\"sharedworker\\", + \\"style\\", + \\"track\\", + \\"video\\", + \\"worker\\", + \\"xslt\\" +]); +exports.enumerationValues = enumerationValues; + +exports.convert = function convert(value, { context = \\"The provided value\\" } = {}) { + const string = \`\${value}\`; + if (!enumerationValues.has(string)) { + throw new TypeError(\`\${context} '\${string}' is not a valid enumeration value for RequestDestination\`); + } + return string; +}; +" +`; + +exports[`without processors SeqAndRec.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierNamedOperation\\"; +const interfaceName = \\"SeqAndRec\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -12780,7 +12173,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); + throw new TypeError(\`\${context} is not of type 'SeqAndRec'.\`); }; function makeWrapper(globalObject) { @@ -12788,11 +12181,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierNamedOperation\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"SeqAndRec\\"]; if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor StringifierNamedOperation is not installed on the passed global object\\" - ); + throw new Error(\\"Internal error: constructor SeqAndRec is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -12848,51 +12239,236 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierNamedOperation { + class SeqAndRec { constructor() { - throw new TypeError(\\"Illegal constructor\\"); + return exports.setup(Object.create(new.target.prototype), globalObject, undefined); + } + + recordConsumer(rec) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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; + } + args.push(curArg); + } + return esValue[implSymbol].recordConsumer(...args); + } + + recordConsumer2(rec) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 = URL.convert(typedValue, { + context: \\"Failed to execute 'recordConsumer2' on 'SeqAndRec': parameter 1\\" + \\"'s value\\" + }); + + result[typedKey] = typedValue; + } + } + curArg = result; + } + args.push(curArg); + } + return esValue[implSymbol].recordConsumer2(...args); + } + + sequenceConsumer(seq) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].sequenceConsumer(...args); } - operation() { + sequenceConsumer2(seq) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].operation(); + 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 esValue[implSymbol].sequenceConsumer2(...args); } - toString() { + frozenArrayConsumer(arr) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].operation(); + 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 esValue[implSymbol].frozenArrayConsumer(...args); } } - Object.defineProperties(StringifierNamedOperation.prototype, { - operation: { enumerable: true }, - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierNamedOperation\\", configurable: true } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierNamedOperation; + globalObject[ctorRegistrySymbol][interfaceName] = SeqAndRec; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierNamedOperation + value: SeqAndRec }); }; -const Impl = require(\\"../implementations/StringifierNamedOperation.js\\"); +const Impl = require(\\"../implementations/SeqAndRec.js\\"); " `; -exports[`without processors StringifierOperation.webidl 1`] = ` +exports[`without processors Static.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -12901,7 +12477,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"StringifierOperation\\"; +const interfaceName = \\"Static\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -12913,7 +12489,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`); + throw new TypeError(\`\${context} is not of type 'Static'.\`); }; function makeWrapper(globalObject) { @@ -12921,9 +12497,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"StringifierOperation\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Static\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor StringifierOperation is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Static is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -12979,52 +12555,90 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class StringifierOperation { + class Static { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - toString() { + def() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].toString(); + return esValue[implSymbol].def(); + } + + get abc() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"abc\\"]; + } + + set abc(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"DOMString\\"](V, { context: \\"Failed to set the 'abc' property on 'Static': The provided value\\" }); + + esValue[implSymbol][\\"abc\\"] = V; + } + + static def() { + return Impl.implementation.def(); + } + + static get abc() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + return Impl.implementation[\\"abc\\"]; + } + + static set abc(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + return Impl.implementation[\\"abc\\"]; } } - Object.defineProperties(StringifierOperation.prototype, { - toString: { enumerable: true }, - [Symbol.toStringTag]: { value: \\"StringifierOperation\\", configurable: true } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = StringifierOperation; + globalObject[ctorRegistrySymbol][interfaceName] = Static; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: StringifierOperation + value: Static }); }; -const Impl = require(\\"../implementations/StringifierOperation.js\\"); +const Impl = require(\\"../implementations/Static.js\\"); " `; -exports[`without processors TypedefsAndUnions.webidl 1`] = ` +exports[`without processors Storage.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); -const RequestDestination = require(\\"./RequestDestination.js\\"); -const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"TypedefsAndUnions\\"; +const interfaceName = \\"Storage\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -13036,7 +12650,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); + throw new TypeError(\`\${context} is not of type 'Storage'.\`); }; function makeWrapper(globalObject) { @@ -13044,9 +12658,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"TypedefsAndUnions\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"Storage\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor Storage is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -13073,6 +12687,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -13089,6 +12705,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -13102,77 +12720,12 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class TypedefsAndUnions { + class Storage { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - numOrStrConsumer(a) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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\\" - }); - } - args.push(curArg); - } - return esValue[implSymbol].numOrStrConsumer(...args); - } - - numOrEnumConsumer(a) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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 = RequestDestination.convert(curArg, { - context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" - }); - } - } - args.push(curArg); - } - return esValue[implSymbol].numOrEnumConsumer(...args); - } - - numOrStrOrNullConsumer(a) { + key(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -13180,36 +12733,19 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'numOrStrOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + \\"Failed to execute 'key' on 'Storage': 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 - }); - } - } + curArg = conversions[\\"unsigned long\\"](curArg, { context: \\"Failed to execute 'key' on 'Storage': parameter 1\\" }); args.push(curArg); } - return esValue[implSymbol].numOrStrOrNullConsumer(...args); + return esValue[implSymbol].key(...args); } - numOrStrOrURLOrNullConsumer(a) { + getItem(key) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -13217,85 +12753,44 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'numOrStrOrURLOrNullConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + \\"Failed to execute 'getItem' on 'Storage': 1 argument required, but only \\" + arguments.length + \\" present.\\" ); } const args = []; { let curArg = arguments[0]; - if (curArg === null || curArg === undefined) { - curArg = null; - } else { - if (URL.is(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 - }); - } - } + curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'getItem' on 'Storage': parameter 1\\" }); args.push(curArg); } - return esValue[implSymbol].numOrStrOrURLOrNullConsumer(...args); + return esValue[implSymbol].getItem(...args); } - urlMapInnerConsumer(a) { + setItem(key, value) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - if (arguments.length < 1) { + if (arguments.length < 2) { throw new TypeError( - \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + \\"Failed to execute 'setItem' on 'Storage': 2 arguments required, but only \\" + arguments.length + \\" present.\\" ); } 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\\" - }); - - let typedValue = curArg[key]; - - typedValue = URL.convert(typedValue, { - context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" - }); - - result[typedKey] = typedValue; - } - } - curArg = result; - } + curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 1\\" }); args.push(curArg); } - return esValue[implSymbol].urlMapInnerConsumer(...args); + { + let curArg = arguments[1]; + curArg = conversions[\\"DOMString\\"](curArg, { context: \\"Failed to execute 'setItem' on 'Storage': parameter 2\\" }); + args.push(curArg); + } + return esValue[implSymbol].setItem(...args); } - urlMapConsumer(a) { + removeItem(key) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -13303,261 +12798,361 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + \\"Failed to execute 'removeItem' on 'Storage': 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)) { - 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; + curArg = conversions[\\"DOMString\\"](curArg, { + context: \\"Failed to execute 'removeItem' on 'Storage': parameter 1\\" + }); + args.push(curArg); + } + return esValue[implSymbol].removeItem(...args); + } + + clear() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol].clear(); + } + + get length() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"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[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = Storage; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: Storage + }); +}; + +const proxyHandler = { + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; + } + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; + } + return Reflect.apply(getter, receiver, []); + }, + + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + }, + + ownKeys(target) { + const keys = new Set(); + + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); + } + } + + for (const key of Reflect.ownKeys(target)) { + keys.add(key); + } + return [...keys]; + }, + + getOwnPropertyDescriptor(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.getOwnPropertyDescriptor(target, P); + } + let ignoreNamedProps = false; + + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { + const namedValue = target[implSymbol].getItem(P); + + return { + writable: true, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; + } + + return Reflect.getOwnPropertyDescriptor(target, P); + }, + + set(target, P, V, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.set(target, P, V, receiver); + } + if (target === receiver) { + if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { + let namedValue = V; + + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + }); + + target[implSymbol].setItem(P, namedValue); + + return true; + } + } + let ownDesc; + + if (ownDesc === undefined) { + ownDesc = Reflect.getOwnPropertyDescriptor(target, P); + } + if (ownDesc === undefined) { + const parent = Reflect.getPrototypeOf(target); + if (parent !== null) { + return Reflect.set(parent, P, V, receiver); + } + ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; + } + if (!ownDesc.writable) { + return false; + } + if (!utils.isObject(receiver)) { + return false; + } + const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); + let valueDesc; + if (existingDesc !== undefined) { + if (existingDesc.get || existingDesc.set) { + return false; + } + if (!existingDesc.writable) { + return false; + } + valueDesc = { value: V }; + } else { + valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + } + return Reflect.defineProperty(receiver, P, valueDesc); + }, - typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" - }); + defineProperty(target, P, desc) { + if (typeof P === \\"symbol\\") { + return Reflect.defineProperty(target, P, desc); + } + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } - let typedValue = curArg[key]; + let namedValue = desc.value; - typedValue = URL.convert(typedValue, { - context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" - }); + namedValue = conversions[\\"DOMString\\"](namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'Storage': The provided value\\" + }); - result[typedKey] = typedValue; - } - } - curArg = result; - } - } - args.push(curArg); - } - return esValue[implSymbol].urlMapConsumer(...args); + target[implSymbol].setItem(P, namedValue); + + return true; } + return Reflect.defineProperty(target, P, desc); + }, - bufferSourceOrURLConsumer(b) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + deleteProperty(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.deleteProperty(target, P); + } - 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 (URL.is(curArg)) { - curArg = utils.implForWrapper(curArg); - } else if (utils.isArrayBuffer(curArg)) { - } 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 esValue[implSymbol].bufferSourceOrURLConsumer(...args); + if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { + target[implSymbol].removeItem(P); + return true; } - arrayBufferViewOrURLMapConsumer(b) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + return Reflect.deleteProperty(target, P); + }, - 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; + preventExtensions() { + return false; + } +}; - typedKey = conversions[\\"USVString\\"](typedKey, { - context: - \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + - \\" record\\" + - \\"'s key\\" - }); +const Impl = require(\\"../implementations/Storage.js\\"); +" +`; - let typedValue = curArg[key]; +exports[`without processors StringifierAttribute.webidl 1`] = ` +"\\"use strict\\"; - typedValue = URL.convert(typedValue, { - context: - \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + - \\" record\\" + - \\"'s value\\" - }); +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); - 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 esValue[implSymbol].arrayBufferViewOrURLMapConsumer(...args); - } +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - arrayBufferViewDupConsumer(b) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const interfaceName = \\"StringifierAttribute\\"; - 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 esValue[implSymbol].arrayBufferViewDupConsumer(...args); - } +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'StringifierAttribute'.\`); +}; - get buf() { - const esValue = this !== null && this !== undefined ? this : globalObject; +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierAttribute\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor StringifierAttribute is not installed on the passed global object\\"); + } - return utils.tryWrapperForImpl(esValue[implSymbol][\\"buf\\"]); - } + return Object.create(ctor.prototype); +} - set buf(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; - if (utils.isArrayBuffer(V)) { - } else if ( - ArrayBuffer.isView(V) && - (V.constructor.name === \\"Uint8Array\\" || V.constructor.name === \\"Uint16Array\\") - ) { - } else { - throw new TypeError( - \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + - \\" is not of any supported type.\\" - ); - } - esValue[implSymbol][\\"buf\\"] = V; +exports._internalSetup = (wrapper, globalObject) => {}; + +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class StringifierAttribute { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - get time() { + get attr() { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"time\\"]; + return esValue[implSymbol][\\"attr\\"]; } - set time(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - + toString() { + const esValue = this; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"unsigned long long\\"](V, { - context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\" - }); - - esValue[implSymbol][\\"time\\"] = V; + return esValue[implSymbol][\\"attr\\"]; } } - 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.defineProperties(StringifierAttribute.prototype, { + attr: { enumerable: true }, + toString: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"StringifierAttribute\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = TypedefsAndUnions; + globalObject[ctorRegistrySymbol][interfaceName] = StringifierAttribute; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: TypedefsAndUnions + value: StringifierAttribute }); }; -const Impl = require(\\"../implementations/TypedefsAndUnions.js\\"); +const Impl = require(\\"../implementations/StringifierAttribute.js\\"); " `; -exports[`without processors URL.webidl 1`] = ` +exports[`without processors StringifierDefaultOperation.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -13566,7 +13161,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URL\\"; +const interfaceName = \\"StringifierDefaultOperation\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -13578,7 +13173,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URL'.\`); + throw new TypeError(\`\${context} is not of type 'StringifierDefaultOperation'.\`); }; function makeWrapper(globalObject) { @@ -13586,9 +13181,11 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URL\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierDefaultOperation\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor URL is not installed on the passed global object\\"); + throw new Error( + \\"Internal error: constructor StringifierDefaultOperation is not installed on the passed global object\\" + ); } return Object.create(ctor.prototype); @@ -13638,356 +13235,312 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\", \\"Worker\\"]); +const exposed = new Set([\\"Window\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - 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 exports.setup(Object.create(new.target.prototype), globalObject, args); - } - - toJSON() { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol].toJSON(); - } - - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"href\\"]; - } - - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" }); - - esValue[implSymbol][\\"href\\"] = V; + class StringifierDefaultOperation { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"href\\"]; - } - - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"origin\\"]; - } - - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"protocol\\"]; - } - - set protocol(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" - }); - - esValue[implSymbol][\\"protocol\\"] = V; - } - - get username() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"username\\"]; - } - - set username(V) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'username' property on 'URL': The provided value\\" - }); - - esValue[implSymbol][\\"username\\"] = V; + return esValue[implSymbol].toString(); } + } + Object.defineProperties(StringifierDefaultOperation.prototype, { + toString: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"StringifierDefaultOperation\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = StringifierDefaultOperation; - get password() { - const esValue = this !== null && this !== undefined ? this : globalObject; + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: StringifierDefaultOperation + }); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const Impl = require(\\"../implementations/StringifierDefaultOperation.js\\"); +" +`; - return esValue[implSymbol][\\"password\\"]; - } +exports[`without processors StringifierNamedOperation.webidl 1`] = ` +"\\"use strict\\"; - set password(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'password' property on 'URL': The provided value\\" - }); +const interfaceName = \\"StringifierNamedOperation\\"; - esValue[implSymbol][\\"password\\"] = V; - } +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'StringifierNamedOperation'.\`); +}; - get host() { - const esValue = this !== null && this !== undefined ? this : globalObject; +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierNamedOperation\\"]; + if (ctor === undefined) { + throw new Error( + \\"Internal error: constructor StringifierNamedOperation is not installed on the passed global object\\" + ); + } - return esValue[implSymbol][\\"host\\"]; - } + return Object.create(ctor.prototype); +} - set host(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" }); +exports._internalSetup = (wrapper, globalObject) => {}; - esValue[implSymbol][\\"host\\"] = V; - } +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; - get hostname() { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; - return esValue[implSymbol][\\"hostname\\"]; - } +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); - set hostname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" - }); +const exposed = new Set([\\"Window\\"]); - esValue[implSymbol][\\"hostname\\"] = V; +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class StringifierNamedOperation { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - get port() { + operation() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"port\\"]; + return esValue[implSymbol].operation(); } - set port(V) { + toString() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" }); - - esValue[implSymbol][\\"port\\"] = V; + return esValue[implSymbol].operation(); } + } + Object.defineProperties(StringifierNamedOperation.prototype, { + operation: { enumerable: true }, + toString: { enumerable: true }, + [Symbol.toStringTag]: { value: \\"StringifierNamedOperation\\", configurable: true } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = StringifierNamedOperation; - get pathname() { - const esValue = this !== null && this !== undefined ? this : globalObject; + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: StringifierNamedOperation + }); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const Impl = require(\\"../implementations/StringifierNamedOperation.js\\"); +" +`; - return esValue[implSymbol][\\"pathname\\"]; - } +exports[`without processors StringifierOperation.webidl 1`] = ` +"\\"use strict\\"; - set pathname(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" - }); +const interfaceName = \\"StringifierOperation\\"; - esValue[implSymbol][\\"pathname\\"] = V; - } +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'StringifierOperation'.\`); +}; - get search() { - const esValue = this !== null && this !== undefined ? this : globalObject; +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + const ctor = globalObject[ctorRegistrySymbol][\\"StringifierOperation\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor StringifierOperation is not installed on the passed global object\\"); + } - return esValue[implSymbol][\\"search\\"]; - } + return Object.create(ctor.prototype); +} - set search(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" }); +exports._internalSetup = (wrapper, globalObject) => {}; - esValue[implSymbol][\\"search\\"] = V; - } +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; - get searchParams() { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; - return utils.getSameObject(this, \\"searchParams\\", () => { - return utils.tryWrapperForImpl(esValue[implSymbol][\\"searchParams\\"]); - }); - } +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); - get hash() { - const esValue = this !== null && this !== undefined ? this : globalObject; + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; - return esValue[implSymbol][\\"hash\\"]; +const exposed = new Set([\\"Window\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class StringifierOperation { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); } - set hash(V) { + toString() { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" }); - - esValue[implSymbol][\\"hash\\"] = V; + return esValue[implSymbol].toString(); } } - Object.defineProperties(URL.prototype, { - toJSON: { enumerable: true }, - href: { enumerable: true }, + Object.defineProperties(StringifierOperation.prototype, { 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 } + [Symbol.toStringTag]: { value: \\"StringifierOperation\\", configurable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URL; + globalObject[ctorRegistrySymbol][interfaceName] = StringifierOperation; Object.defineProperty(globalObject, interfaceName, { configurable: true, - writable: true, - value: URL - }); - - if (globalNames.includes(\\"Window\\")) { - Object.defineProperty(globalObject, \\"webkitURL\\", { - configurable: true, - writable: true, - value: URL - }); - } + writable: true, + value: StringifierOperation + }); }; -const Impl = require(\\"../implementations/URL.js\\"); +const Impl = require(\\"../implementations/StringifierOperation.js\\"); " `; -exports[`without processors URLList.webidl 1`] = ` +exports[`without processors TypedefsAndUnions.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const RequestDestination = require(\\"./RequestDestination.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URLList\\"; +const interfaceName = \\"TypedefsAndUnions\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -13999,7 +13552,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLList'.\`); + throw new TypeError(\`\${context} is not of type 'TypedefsAndUnions'.\`); }; function makeWrapper(globalObject) { @@ -14007,9 +13560,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLList\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"TypedefsAndUnions\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor URLList is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor TypedefsAndUnions is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -14036,8 +13589,6 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -14054,8 +13605,6 @@ exports.new = globalObject => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -14065,16 +13614,255 @@ exports.new = globalObject => { const exposed = new Set([\\"Window\\"]); -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class URLList { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class TypedefsAndUnions { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); + } + + numOrStrConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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\\" + }); + } + args.push(curArg); + } + return esValue[implSymbol].numOrStrConsumer(...args); + } + + numOrEnumConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 = RequestDestination.convert(curArg, { + context: \\"Failed to execute 'numOrEnumConsumer' on 'TypedefsAndUnions': parameter 1\\" + }); + } + } + args.push(curArg); + } + return esValue[implSymbol].numOrEnumConsumer(...args); + } + + numOrStrOrNullConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + 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 esValue[implSymbol].numOrStrOrNullConsumer(...args); + } + + numOrStrOrURLOrNullConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + 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 (URL.is(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 esValue[implSymbol].numOrStrOrURLOrNullConsumer(...args); + } + + urlMapInnerConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 '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\\" + }); + + let typedValue = curArg[key]; + + typedValue = URL.convert(typedValue, { + context: \\"Failed to execute 'urlMapInnerConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" + }); + + result[typedKey] = typedValue; + } + } + curArg = result; + } + args.push(curArg); + } + return esValue[implSymbol].urlMapInnerConsumer(...args); + } + + urlMapConsumer(a) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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)) { + 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; + + typedKey = conversions[\\"USVString\\"](typedKey, { + context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s key\\" + }); + + let typedValue = curArg[key]; + + typedValue = URL.convert(typedValue, { + context: \\"Failed to execute 'urlMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + \\"'s value\\" + }); + + result[typedKey] = typedValue; + } + } + curArg = result; + } + } + args.push(curArg); + } + return esValue[implSymbol].urlMapConsumer(...args); } - item(index) { + bufferSourceOrURLConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -14082,217 +13870,210 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'item' on 'URLList': 1 argument required, but only \\" + arguments.length + \\" present.\\" + \\"Failed to execute 'bufferSourceOrURLConsumer' on 'TypedefsAndUnions': 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\\" - }); + if (URL.is(curArg)) { + curArg = utils.implForWrapper(curArg); + } else if (utils.isArrayBuffer(curArg)) { + } 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 utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); + return esValue[implSymbol].bufferSourceOrURLConsumer(...args); } - get length() { + arrayBufferViewOrURLMapConsumer(b) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol][\\"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[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = URLList; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: URLList - }); -}; - -const proxyHandler = { - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - }, - - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - }, - - ownKeys(target) { - const keys = new Set(); - - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(\`\${key}\`); - } + 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; - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - }, + typedKey = conversions[\\"USVString\\"](typedKey, { + context: + \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + + \\" record\\" + + \\"'s key\\" + }); - getOwnPropertyDescriptor(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.getOwnPropertyDescriptor(target, P); - } - let ignoreNamedProps = false; + let typedValue = curArg[key]; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; + typedValue = URL.convert(typedValue, { + context: + \\"Failed to execute 'arrayBufferViewOrURLMapConsumer' on 'TypedefsAndUnions': parameter 1\\" + + \\" record\\" + + \\"'s value\\" + }); - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].item(index); - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + 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); } - ignoreNamedProps = true; - } - - return Reflect.getOwnPropertyDescriptor(target, P); - }, - - set(target, P, V, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.set(target, P, V, receiver); - } - if (target === receiver) { - utils.isArrayIndexPropName(P); + return esValue[implSymbol].arrayBufferViewOrURLMapConsumer(...args); } - let ownDesc; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - - if (target[implSymbol][utils.supportsPropertyIndex](index)) { - const indexedValue = target[implSymbol].item(index); - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + arrayBufferViewDupConsumer(b) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - } - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, P, V, receiver); - } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (!ownDesc.writable) { - return false; - } - if (!utils.isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); - let valueDesc; - if (existingDesc !== undefined) { - if (existingDesc.get || existingDesc.set) { - return false; - } - if (!existingDesc.writable) { - return false; + if (arguments.length < 1) { + throw new TypeError( + \\"Failed to execute 'arrayBufferViewDupConsumer' on 'TypedefsAndUnions': 1 argument required, but only \\" + + arguments.length + + \\" present.\\" + ); } - valueDesc = { value: V }; - } else { - valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + 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 esValue[implSymbol].arrayBufferViewDupConsumer(...args); } - return Reflect.defineProperty(receiver, P, valueDesc); - }, - defineProperty(target, P, desc) { - if (typeof P === \\"symbol\\") { - return Reflect.defineProperty(target, P, desc); - } + get buf() { + const esValue = this !== null && this !== undefined ? this : globalObject; - if (utils.isArrayIndexPropName(P)) { - return false; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return utils.tryWrapperForImpl(esValue[implSymbol][\\"buf\\"]); } - return Reflect.defineProperty(target, P, desc); - }, + set buf(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - deleteProperty(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.deleteProperty(target, P); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + if (utils.isArrayBuffer(V)) { + } else if ( + ArrayBuffer.isView(V) && + (V.constructor.name === \\"Uint8Array\\" || V.constructor.name === \\"Uint16Array\\") + ) { + } else { + throw new TypeError( + \\"Failed to set the 'buf' property on 'TypedefsAndUnions': The provided value\\" + + \\" is not of any supported type.\\" + ); + } + esValue[implSymbol][\\"buf\\"] = V; } - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !target[implSymbol][utils.supportsPropertyIndex](index); + get time() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"time\\"]; } - return Reflect.deleteProperty(target, P); - }, + set time(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; - preventExtensions() { - return false; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"unsigned long long\\"](V, { + context: \\"Failed to set the 'time' property on 'TypedefsAndUnions': The provided value\\" + }); + + esValue[implSymbol][\\"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 } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); } + globalObject[ctorRegistrySymbol][interfaceName] = TypedefsAndUnions; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: TypedefsAndUnions + }); }; -const Impl = require(\\"../implementations/URLList.js\\"); +const Impl = require(\\"../implementations/TypedefsAndUnions.js\\"); " `; -exports[`without processors URLSearchParams.webidl 1`] = ` +exports[`without processors URL.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -14301,46 +14082,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URLSearchParams\\"; - -const IteratorPrototype = Object.create(utils.IteratorPrototype, { - next: { - value: function next() { - const internal = this[utils.iterInternalSymbol]; - const { target, kind, index } = internal; - const values = Array.from(target[implSymbol]); - const len = values.length; - if (index >= len) { - return { value: undefined, done: true }; - } - - const pair = values[index]; - internal.index = index + 1; - const [key, value] = pair.map(utils.tryWrapperForImpl); - - 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 - } -}); +const interfaceName = \\"URL\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -14352,16 +14094,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParams'.\`); -}; - -exports.createDefaultIterator = (target, kind) => { - const iterator = Object.create(IteratorPrototype); - Object.defineProperty(iterator, utils.iterInternalSymbol, { - value: { target, kind, index: 0 }, - configurable: true - }); - return iterator; + throw new TypeError(\`\${context} is not of type 'URL'.\`); }; function makeWrapper(globalObject) { @@ -14369,9 +14102,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParams\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URL\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor URLSearchParams is not installed on the passed global object\\"); + throw new Error(\\"Internal error: constructor URL is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -14427,344 +14160,341 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class URLSearchParams { - constructor() { + 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) { - 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; + curArg = conversions[\\"USVString\\"](curArg, { context: \\"Failed to construct 'URL': parameter 2\\" }); + } + args.push(curArg); + } + return exports.setup(Object.create(new.target.prototype), globalObject, args); + } - typedKey = conversions[\\"USVString\\"](typedKey, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\" - }); + toJSON() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - let typedValue = curArg[key]; + return esValue[implSymbol].toJSON(); + } - typedValue = conversions[\\"USVString\\"](typedValue, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\" - }); + get href() { + const esValue = this !== null && this !== undefined ? this : globalObject; - result[typedKey] = typedValue; - } - } - curArg = result; - } - } - } else { - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to construct 'URLSearchParams': parameter 1\\" - }); - } - } else { - curArg = \\"\\"; - } - args.push(curArg); + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return exports.setup(Object.create(new.target.prototype), globalObject, args); + + return esValue[implSymbol][\\"href\\"]; } - append(name, value) { + set href(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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); + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'href' property on 'URL': The provided value\\" }); + + esValue[implSymbol][\\"href\\"] = V; + } + + toString() { + const esValue = this; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].append(...args); + + return esValue[implSymbol][\\"href\\"]; } - delete(name) { + get origin() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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.\\" - ); + return esValue[implSymbol][\\"origin\\"]; + } + + get protocol() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'delete' on 'URLSearchParams': parameter 1\\" - }); - args.push(curArg); + + return esValue[implSymbol][\\"protocol\\"]; + } + + set protocol(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].delete(...args); + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'protocol' property on 'URL': The provided value\\" + }); + + esValue[implSymbol][\\"protocol\\"] = V; } - get(name) { + get username() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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.\\" - ); + return esValue[implSymbol][\\"username\\"]; + } + + set username(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'get' on 'URLSearchParams': parameter 1\\" - }); - args.push(curArg); + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'username' property on 'URL': The provided value\\" + }); + + esValue[implSymbol][\\"username\\"] = V; + } + + get password() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].get(...args); + + return esValue[implSymbol][\\"password\\"]; } - getAll(name) { + set password(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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.\\" - ); + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'password' property on 'URL': The provided value\\" + }); + + esValue[implSymbol][\\"password\\"] = V; + } + + get host() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'getAll' on 'URLSearchParams': parameter 1\\" - }); - args.push(curArg); + + return esValue[implSymbol][\\"host\\"]; + } + + set host(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return utils.tryWrapperForImpl(esValue[implSymbol].getAll(...args)); + + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'host' property on 'URL': The provided value\\" }); + + esValue[implSymbol][\\"host\\"] = V; } - has(name) { + get hostname() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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.\\" - ); + return esValue[implSymbol][\\"hostname\\"]; + } + + set hostname(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'has' on 'URLSearchParams': parameter 1\\" - }); - args.push(curArg); + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'hostname' property on 'URL': The provided value\\" + }); + + esValue[implSymbol][\\"hostname\\"] = V; + } + + get port() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].has(...args); + + return esValue[implSymbol][\\"port\\"]; } - set(name, value) { + set port(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { 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.\\" - ); + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'port' property on 'URL': The provided value\\" }); + + esValue[implSymbol][\\"port\\"] = V; + } + + get pathname() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 1\\" - }); - args.push(curArg); + + return esValue[implSymbol][\\"pathname\\"]; + } + + set pathname(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - { - let curArg = arguments[1]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\" - }); - args.push(curArg); + + V = conversions[\\"USVString\\"](V, { + context: \\"Failed to set the 'pathname' property on 'URL': The provided value\\" + }); + + esValue[implSymbol][\\"pathname\\"] = V; + } + + get search() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].set(...args); + + return esValue[implSymbol][\\"search\\"]; } - sort() { + set search(V) { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].sort(); + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'search' property on 'URL': The provided value\\" }); + + esValue[implSymbol][\\"search\\"] = V; } - toString() { + get searchParams() { const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return esValue[implSymbol].toString(); + return utils.getSameObject(this, \\"searchParams\\", () => { + return utils.tryWrapperForImpl(esValue[implSymbol][\\"searchParams\\"]); + }); } - keys() { - if (!this || !exports.is(this)) { - throw new TypeError(\\"Illegal invocation\\"); - } - return exports.createDefaultIterator(this, \\"key\\"); - } + get hash() { + const esValue = this !== null && this !== undefined ? this : globalObject; - values() { - if (!this || !exports.is(this)) { + if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - return exports.createDefaultIterator(this, \\"value\\"); - } - entries() { - if (!this || !exports.is(this)) { - throw new TypeError(\\"Illegal invocation\\"); - } - return exports.createDefaultIterator(this, \\"key+value\\"); + return esValue[implSymbol][\\"hash\\"]; } - forEach(callback) { - if (!this || !exports.is(this)) { + set hash(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { 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[implSymbol]); - 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[implSymbol]); - i++; - } + + V = conversions[\\"USVString\\"](V, { context: \\"Failed to set the 'hash' property on 'URL': The provided value\\" }); + + esValue[implSymbol][\\"hash\\"] = V; } } - 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 }, + Object.defineProperties(URL.prototype, { + toJSON: { enumerable: true }, + href: { 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 } + 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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParams; + globalObject[ctorRegistrySymbol][interfaceName] = URL; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: URLSearchParams + value: URL }); + + if (globalNames.includes(\\"Window\\")) { + Object.defineProperty(globalObject, \\"webkitURL\\", { + configurable: true, + writable: true, + value: URL + }); + } }; -const Impl = require(\\"../implementations/URLSearchParams.js\\"); +const Impl = require(\\"../implementations/URL.js\\"); " `; -exports[`without processors URLSearchParamsCollection.webidl 1`] = ` +exports[`without processors URLList.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -14773,7 +14503,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"URLSearchParamsCollection\\"; +const interfaceName = \\"URLList\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -14785,7 +14515,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); + throw new TypeError(\`\${context} is not of type 'URLList'.\`); }; function makeWrapper(globalObject) { @@ -14793,11 +14523,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLList\\"]; if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor URLSearchParamsCollection is not installed on the passed global object\\" - ); + throw new Error(\\"Internal error: constructor URLList is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -14857,7 +14585,7 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class URLSearchParamsCollection { + class URLList { constructor() { throw new TypeError(\\"Illegal constructor\\"); } @@ -14870,46 +14598,20 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'item' on 'URLSearchParamsCollection': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" + \\"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 'URLSearchParamsCollection': parameter 1\\" + context: \\"Failed to execute 'item' on 'URLList': parameter 1\\" }); args.push(curArg); } return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); } - namedItem(name) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - 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(esValue[implSymbol].namedItem(...args)); - } - get length() { const esValue = this !== null && this !== undefined ? this : globalObject; @@ -14920,22 +14622,25 @@ exports.install = (globalObject, globalNames) => { return esValue[implSymbol][\\"length\\"]; } } - Object.defineProperties(URLSearchParamsCollection.prototype, { + Object.defineProperties(URLList.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 } + [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[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection; + globalObject[ctorRegistrySymbol][interfaceName] = URLList; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: URLSearchParamsCollection + value: URLList }); }; @@ -14984,12 +14689,6 @@ const proxyHandler = { keys.add(\`\${key}\`); } - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); - } - } - for (const key of Reflect.ownKeys(target)) { keys.add(key); } @@ -15004,8 +14703,9 @@ const proxyHandler = { if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { + + if (target[implSymbol][utils.supportsPropertyIndex](index)) { + const indexedValue = target[implSymbol].item(index); return { writable: false, enumerable: true, @@ -15016,17 +14716,6 @@ const proxyHandler = { ignoreNamedProps = true; } - const namedValue = target[implSymbol].namedItem(P); - - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: false, - enumerable: false, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; - } - return Reflect.getOwnPropertyDescriptor(target, P); }, @@ -15036,15 +14725,14 @@ const proxyHandler = { } if (target === receiver) { utils.isArrayIndexPropName(P); - - typeof P === \\"string\\" && !utils.isArrayIndexPropName(P); } let ownDesc; if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { + + if (target[implSymbol][utils.supportsPropertyIndex](index)) { + const indexedValue = target[implSymbol].item(index); ownDesc = { writable: false, enumerable: true, @@ -15094,12 +14782,7 @@ const proxyHandler = { if (utils.isArrayIndexPropName(P)) { return false; } - if (!utils.hasOwn(target, P)) { - const creating = !(target[implSymbol].namedItem(P) !== null); - if (!creating) { - return false; - } - } + return Reflect.defineProperty(target, P, desc); }, @@ -15110,37 +14793,70 @@ const proxyHandler = { if (utils.isArrayIndexPropName(P)) { const index = P >>> 0; - return !(target[implSymbol].item(index) !== undefined); - } - - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; + return !target[implSymbol][utils.supportsPropertyIndex](index); } return Reflect.deleteProperty(target, P); }, - - preventExtensions() { - return false; + + preventExtensions() { + return false; + } +}; + +const Impl = require(\\"../implementations/URLList.js\\"); +" +`; + +exports[`without processors URLSearchParams.webidl 1`] = ` +"\\"use strict\\"; + +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); + +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; + +const interfaceName = \\"URLSearchParams\\"; + +const IteratorPrototype = Object.create(utils.IteratorPrototype, { + next: { + value: function next() { + const internal = this[utils.iterInternalSymbol]; + const { target, kind, index } = internal; + const values = Array.from(target[implSymbol]); + const len = values.length; + if (index >= len) { + return { value: undefined, done: true }; + } + + const pair = values[index]; + internal.index = index + 1; + const [key, value] = pair.map(utils.tryWrapperForImpl); + + 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 } -}; - -const Impl = require(\\"../implementations/URLSearchParamsCollection.js\\"); -" -`; - -exports[`without processors URLSearchParamsCollection2.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const URL = require(\\"./URL.js\\"); -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\"); - -const interfaceName = \\"URLSearchParamsCollection2\\"; +}); exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -15152,7 +14868,16 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); + throw new TypeError(\`\${context} is not of type 'URLSearchParams'.\`); +}; + +exports.createDefaultIterator = (target, kind) => { + const iterator = Object.create(IteratorPrototype); + Object.defineProperty(iterator, utils.iterInternalSymbol, { + value: { target, kind, index: 0 }, + configurable: true + }); + return iterator; }; function makeWrapper(globalObject) { @@ -15160,11 +14885,9 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection2\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParams\\"]; if (ctor === undefined) { - throw new Error( - \\"Internal error: constructor URLSearchParamsCollection2 is not installed on the passed global object\\" - ); + throw new Error(\\"Internal error: constructor URLSearchParams is not installed on the passed global object\\"); } return Object.create(ctor.prototype); @@ -15180,9 +14903,7 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { return utils.implForWrapper(wrapper); }; -exports._internalSetup = (wrapper, globalObject) => { - URLSearchParamsCollection._internalSetup(wrapper, globalObject); -}; +exports._internalSetup = (wrapper, globalObject) => {}; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { privateData.wrapper = wrapper; @@ -15193,8 +14914,6 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -15211,8 +14930,6 @@ exports.new = globalObject => { configurable: true }); - wrapper = new Proxy(wrapper, proxyHandler); - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -15220,259 +14937,350 @@ exports.new = globalObject => { return wrapper[implSymbol]; }; -const exposed = new Set([\\"Window\\"]); +const exposed = new Set([\\"Window\\", \\"Worker\\"]); exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - - if (globalObject.URLSearchParamsCollection === undefined) { - throw new Error( - \\"Internal error: attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\" - ); - } - class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection { + class URLSearchParams { 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 } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); - } - globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection2; + 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\\" + }); - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: URLSearchParamsCollection2 - }); -}; + V.push(nextItem); + } + nextItem = V; + } -const proxyHandler = { - get(target, P, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.get(target, P, receiver); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc === undefined) { - const parent = Object.getPrototypeOf(target); - if (parent === null) { - return undefined; - } - return Reflect.get(target, P, receiver); - } - if (!desc.get && !desc.set) { - return desc.value; - } - const getter = desc.get; - if (getter === undefined) { - return undefined; - } - return Reflect.apply(getter, receiver, []); - }, + 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; - has(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.has(target, P); - } - const desc = this.getOwnPropertyDescriptor(target, P); - if (desc !== undefined) { - return true; - } - const parent = Object.getPrototypeOf(target); - if (parent !== null) { - return Reflect.has(parent, P); - } - return false; - }, + typedKey = conversions[\\"USVString\\"](typedKey, { + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s key\\" + }); - ownKeys(target) { - const keys = new Set(); + let typedValue = curArg[key]; - for (const key of target[implSymbol][utils.supportedPropertyIndices]) { - keys.add(\`\${key}\`); - } + typedValue = conversions[\\"USVString\\"](typedValue, { + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + \\" record\\" + \\"'s value\\" + }); - for (const key of target[implSymbol][utils.supportedPropertyNames]) { - if (!(key in target)) { - keys.add(\`\${key}\`); + result[typedKey] = typedValue; + } + } + curArg = result; + } + } + } else { + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to construct 'URLSearchParams': parameter 1\\" + }); + } + } else { + curArg = \\"\\"; + } + args.push(curArg); } + return exports.setup(Object.create(new.target.prototype), globalObject, args); } - for (const key of Reflect.ownKeys(target)) { - keys.add(key); - } - return [...keys]; - }, + append(name, value) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - getOwnPropertyDescriptor(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.getOwnPropertyDescriptor(target, P); + 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 esValue[implSymbol].append(...args); } - let ignoreNamedProps = false; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { - return { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + delete(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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); } - ignoreNamedProps = true; + return esValue[implSymbol].delete(...args); } - const namedValue = target[implSymbol].namedItem(P); + get(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - if (namedValue !== null && !(P in target) && !ignoreNamedProps) { - return { - writable: true, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(namedValue) - }; + 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 esValue[implSymbol].get(...args); } - return Reflect.getOwnPropertyDescriptor(target, P); - }, + getAll(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - set(target, P, V, receiver) { - if (typeof P === \\"symbol\\") { - return Reflect.set(target, P, V, receiver); + 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(esValue[implSymbol].getAll(...args)); } - if (target === receiver) { - utils.isArrayIndexPropName(P); - if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { - let namedValue = V; + has(name) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } - namedValue = URL.convert(namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" + 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\\" }); - - const creating = !(target[implSymbol].namedItem(P) !== null); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } - - return true; + args.push(curArg); } + return esValue[implSymbol].has(...args); } - let ownDesc; - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - const indexedValue = target[implSymbol].item(index); - if (indexedValue !== undefined) { - ownDesc = { - writable: false, - enumerable: true, - configurable: true, - value: utils.tryWrapperForImpl(indexedValue) - }; + set(name, value) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - } - if (ownDesc === undefined) { - ownDesc = Reflect.getOwnPropertyDescriptor(target, P); - } - if (ownDesc === undefined) { - const parent = Reflect.getPrototypeOf(target); - if (parent !== null) { - return Reflect.set(parent, P, V, receiver); + if (arguments.length < 2) { + throw new TypeError( + \\"Failed to execute 'set' on 'URLSearchParams': 2 arguments required, but only \\" + + arguments.length + + \\" present.\\" + ); } - ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; - } - if (!ownDesc.writable) { - return false; - } - if (!utils.isObject(receiver)) { - return false; - } - const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); - let valueDesc; - if (existingDesc !== undefined) { - if (existingDesc.get || existingDesc.set) { - return false; + const args = []; + { + let curArg = arguments[0]; + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 1\\" + }); + args.push(curArg); } - if (!existingDesc.writable) { - return false; + { + let curArg = arguments[1]; + curArg = conversions[\\"USVString\\"](curArg, { + context: \\"Failed to execute 'set' on 'URLSearchParams': parameter 2\\" + }); + args.push(curArg); } - valueDesc = { value: V }; - } else { - valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; - } - return Reflect.defineProperty(receiver, P, valueDesc); - }, - - defineProperty(target, P, desc) { - if (typeof P === \\"symbol\\") { - return Reflect.defineProperty(target, P, desc); + return esValue[implSymbol].set(...args); } - if (utils.isArrayIndexPropName(P)) { - return false; - } - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; + sort() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - let namedValue = desc.value; - - namedValue = URL.convert(namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" - }); + return esValue[implSymbol].sort(); + } - const creating = !(target[implSymbol].namedItem(P) !== null); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); + toString() { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); } - return true; + return esValue[implSymbol].toString(); } - return Reflect.defineProperty(target, P, desc); - }, - deleteProperty(target, P) { - if (typeof P === \\"symbol\\") { - return Reflect.deleteProperty(target, P); + keys() { + if (!this || !exports.is(this)) { + throw new TypeError(\\"Illegal invocation\\"); + } + return exports.createDefaultIterator(this, \\"key\\"); } - if (utils.isArrayIndexPropName(P)) { - const index = P >>> 0; - return !(target[implSymbol].item(index) !== undefined); + values() { + if (!this || !exports.is(this)) { + throw new TypeError(\\"Illegal invocation\\"); + } + return exports.createDefaultIterator(this, \\"value\\"); } - if (target[implSymbol].namedItem(P) !== null && !(P in target)) { - return false; + entries() { + if (!this || !exports.is(this)) { + throw new TypeError(\\"Illegal invocation\\"); + } + return exports.createDefaultIterator(this, \\"key+value\\"); } - return Reflect.deleteProperty(target, P); - }, - - preventExtensions() { - return false; + forEach(callback) { + if (!this || !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[implSymbol]); + 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[implSymbol]); + 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[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); } + globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParams; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: URLSearchParams + }); }; -const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\"); +const Impl = require(\\"../implementations/URLSearchParams.js\\"); " `; -exports[`without processors UnderscoredProperties.webidl 1`] = ` +exports[`without processors URLSearchParamsCollection.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); @@ -15481,7 +15289,7 @@ const utils = require(\\"./utils.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; -const interfaceName = \\"UnderscoredProperties\\"; +const interfaceName = \\"URLSearchParamsCollection\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -15493,7 +15301,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); + throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection'.\`); }; function makeWrapper(globalObject) { @@ -15501,9 +15309,11 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"UnderscoredProperties\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor UnderscoredProperties is not installed on the passed global object\\"); + throw new Error( + \\"Internal error: constructor URLSearchParamsCollection is not installed on the passed global object\\" + ); } return Object.create(ctor.prototype); @@ -15530,6 +15340,8 @@ exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -15546,6 +15358,8 @@ exports.new = globalObject => { configurable: true }); + wrapper = new Proxy(wrapper, proxyHandler); + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; if (Impl.init) { Impl.init(wrapper[implSymbol]); @@ -15559,12 +15373,12 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class UnderscoredProperties { + class URLSearchParamsCollection { constructor() { throw new TypeError(\\"Illegal constructor\\"); } - operation(sequence) { + item(index) { const esValue = this !== null && this !== undefined ? this : globalObject; if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); @@ -15572,7 +15386,7 @@ exports.install = (globalObject, globalNames) => { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'operation' on 'UnderscoredProperties': 1 argument required, but only \\" + + \\"Failed to execute 'item' on 'URLSearchParamsCollection': 1 argument required, but only \\" + arguments.length + \\" present.\\" ); @@ -15580,55 +15394,23 @@ exports.install = (globalObject, globalNames) => { 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; - } + curArg = conversions[\\"unsigned long\\"](curArg, { + context: \\"Failed to execute 'item' on 'URLSearchParamsCollection': parameter 1\\" + }); args.push(curArg); } - return esValue[implSymbol].operation(...args); - } - - get attribute() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"attribute\\"]; + return utils.tryWrapperForImpl(esValue[implSymbol].item(...args)); } - set attribute(V) { + namedItem(name) { const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { throw new TypeError(\\"Illegal invocation\\"); } - V = conversions[\\"byte\\"](V, { - context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\" - }); - - esValue[implSymbol][\\"attribute\\"] = V; - } - - static static(void_) { if (arguments.length < 1) { throw new TypeError( - \\"Failed to execute 'static' on 'UnderscoredProperties': 1 argument required, but only \\" + + \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': 1 argument required, but only \\" + arguments.length + \\" present.\\" ); @@ -15637,258 +15419,244 @@ exports.install = (globalObject, globalNames) => { { let curArg = arguments[0]; curArg = conversions[\\"DOMString\\"](curArg, { - context: \\"Failed to execute 'static' on 'UnderscoredProperties': parameter 1\\" + context: \\"Failed to execute 'namedItem' on 'URLSearchParamsCollection': parameter 1\\" }); args.push(curArg); } - return Impl.implementation.static(...args); + return utils.tryWrapperForImpl(esValue[implSymbol].namedItem(...args)); + } + + get length() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"length\\"]; } } - 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 } + 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 } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = UnderscoredProperties; + globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: UnderscoredProperties + value: URLSearchParamsCollection }); }; -const Impl = require(\\"../implementations/UnderscoredProperties.js\\"); -" -`; - -exports[`without processors Unforgeable.webidl 1`] = ` -"\\"use strict\\"; - -const conversions = require(\\"webidl-conversions\\"); -const utils = require(\\"./utils.js\\"); - -const implSymbol = utils.implSymbol; -const ctorRegistrySymbol = utils.ctorRegistrySymbol; - -const interfaceName = \\"Unforgeable\\"; - -exports.is = value => { - return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; -}; -exports.isImpl = value => { - return utils.isObject(value) && value instanceof Impl.implementation; -}; -exports.convert = (value, { context = \\"The provided value\\" } = {}) => { - if (exports.is(value)) { - return utils.implForWrapper(value); - } - throw new TypeError(\`\${context} is not of type 'Unforgeable'.\`); -}; - -function makeWrapper(globalObject) { - if (globalObject[ctorRegistrySymbol] === undefined) { - throw new Error(\\"Internal error: invalid global object\\"); - } - - const ctor = globalObject[ctorRegistrySymbol][\\"Unforgeable\\"]; - if (ctor === undefined) { - throw new Error(\\"Internal error: constructor Unforgeable is not installed on the passed global object\\"); - } - - return Object.create(ctor.prototype); -} - -exports.create = (globalObject, constructorArgs, privateData) => { - const wrapper = makeWrapper(globalObject); - return exports.setup(wrapper, globalObject, constructorArgs, privateData); -}; - -exports.createImpl = (globalObject, constructorArgs, privateData) => { - const wrapper = exports.create(globalObject, constructorArgs, privateData); - return utils.implForWrapper(wrapper); -}; - -exports._internalSetup = (wrapper, globalObject) => { - Object.defineProperties( - wrapper, - Object.getOwnPropertyDescriptors({ - assign(url) { - const esValue = this !== null && this !== undefined ? this : globalObject; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - if (arguments.length < 1) { - throw new TypeError( - \\"Failed to execute 'assign' on 'Unforgeable': 1 argument required, but only \\" + - arguments.length + - \\" present.\\" - ); - } - const args = []; - { - let curArg = arguments[0]; - curArg = conversions[\\"USVString\\"](curArg, { - context: \\"Failed to execute 'assign' on 'Unforgeable': parameter 1\\" - }); - args.push(curArg); - } - return esValue[implSymbol].assign(...args); - }, - get href() { - const esValue = this !== null && this !== undefined ? this : globalObject; +const proxyHandler = { + get(target, P, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.get(target, P, receiver); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc === undefined) { + const parent = Object.getPrototypeOf(target); + if (parent === null) { + return undefined; + } + return Reflect.get(target, P, receiver); + } + if (!desc.get && !desc.set) { + return desc.value; + } + const getter = desc.get; + if (getter === undefined) { + return undefined; + } + return Reflect.apply(getter, receiver, []); + }, - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + has(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.has(target, P); + } + const desc = this.getOwnPropertyDescriptor(target, P); + if (desc !== undefined) { + return true; + } + const parent = Object.getPrototypeOf(target); + if (parent !== null) { + return Reflect.has(parent, P); + } + return false; + }, - return esValue[implSymbol][\\"href\\"]; - }, - set href(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + ownKeys(target) { + const keys = new Set(); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + for (const key of target[implSymbol][utils.supportedPropertyIndices]) { + keys.add(\`\${key}\`); + } - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'href' property on 'Unforgeable': The provided value\\" - }); + for (const key of target[implSymbol][utils.supportedPropertyNames]) { + if (!(key in target)) { + keys.add(\`\${key}\`); + } + } - esValue[implSymbol][\\"href\\"] = V; - }, - toString() { - const esValue = this; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + for (const key of Reflect.ownKeys(target)) { + keys.add(key); + } + return [...keys]; + }, - return esValue[implSymbol][\\"href\\"]; - }, - get origin() { - const esValue = this !== null && this !== undefined ? this : globalObject; + getOwnPropertyDescriptor(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.getOwnPropertyDescriptor(target, P); + } + let ignoreNamedProps = false; - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + return { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; + } + ignoreNamedProps = true; + } - return esValue[implSymbol][\\"origin\\"]; - }, - get protocol() { - const esValue = this !== null && this !== undefined ? this : globalObject; + const namedValue = target[implSymbol].namedItem(P); - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + if (namedValue !== null && !(P in target) && !ignoreNamedProps) { + return { + writable: false, + enumerable: false, + configurable: true, + value: utils.tryWrapperForImpl(namedValue) + }; + } - return esValue[implSymbol][\\"protocol\\"]; - }, - set protocol(V) { - const esValue = this !== null && this !== undefined ? this : globalObject; + return Reflect.getOwnPropertyDescriptor(target, P); + }, - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } + set(target, P, V, receiver) { + if (typeof P === \\"symbol\\") { + return Reflect.set(target, P, V, receiver); + } + if (target === receiver) { + utils.isArrayIndexPropName(P); - V = conversions[\\"USVString\\"](V, { - context: \\"Failed to set the 'protocol' property on 'Unforgeable': The provided value\\" - }); + typeof P === \\"string\\" && !utils.isArrayIndexPropName(P); + } + let ownDesc; - esValue[implSymbol][\\"protocol\\"] = V; + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + ownDesc = { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; } - }) - ); - - Object.defineProperties(wrapper, { - assign: { configurable: false, writable: false }, - href: { configurable: false }, - toString: { configurable: false, writable: false }, - origin: { configurable: false }, - protocol: { configurable: false } - }); -}; + } -exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { - privateData.wrapper = wrapper; + if (ownDesc === undefined) { + ownDesc = Reflect.getOwnPropertyDescriptor(target, P); + } + if (ownDesc === undefined) { + const parent = Reflect.getPrototypeOf(target); + if (parent !== null) { + return Reflect.set(parent, P, V, receiver); + } + ownDesc = { writable: true, enumerable: true, configurable: true, value: undefined }; + } + if (!ownDesc.writable) { + return false; + } + if (!utils.isObject(receiver)) { + return false; + } + const existingDesc = Reflect.getOwnPropertyDescriptor(receiver, P); + let valueDesc; + if (existingDesc !== undefined) { + if (existingDesc.get || existingDesc.set) { + return false; + } + if (!existingDesc.writable) { + return false; + } + valueDesc = { value: V }; + } else { + valueDesc = { writable: true, enumerable: true, configurable: true, value: V }; + } + return Reflect.defineProperty(receiver, P, valueDesc); + }, - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: new Impl.implementation(globalObject, constructorArgs, privateData), - configurable: true - }); + defineProperty(target, P, desc) { + if (typeof P === \\"symbol\\") { + return Reflect.defineProperty(target, P, desc); + } - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper; -}; + if (utils.isArrayIndexPropName(P)) { + return false; + } + if (!utils.hasOwn(target, P)) { + const creating = !(target[implSymbol].namedItem(P) !== null); + if (!creating) { + return false; + } + } + return Reflect.defineProperty(target, P, desc); + }, -exports.new = globalObject => { - const wrapper = makeWrapper(globalObject); + deleteProperty(target, P) { + if (typeof P === \\"symbol\\") { + return Reflect.deleteProperty(target, P); + } - exports._internalSetup(wrapper, globalObject); - Object.defineProperty(wrapper, implSymbol, { - value: Object.create(Impl.implementation.prototype), - configurable: true - }); + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + return !(target[implSymbol].item(index) !== undefined); + } - wrapper[implSymbol][utils.wrapperSymbol] = wrapper; - if (Impl.init) { - Impl.init(wrapper[implSymbol]); - } - return wrapper[implSymbol]; -}; + if (target[implSymbol].namedItem(P) !== null && !(P in target)) { + return false; + } -const exposed = new Set([\\"Window\\"]); + return Reflect.deleteProperty(target, P); + }, -exports.install = (globalObject, globalNames) => { - if (!globalNames.some(globalName => exposed.has(globalName))) { - return; - } - class Unforgeable { - constructor() { - throw new TypeError(\\"Illegal constructor\\"); - } - } - Object.defineProperties(Unforgeable.prototype, { - [Symbol.toStringTag]: { value: \\"Unforgeable\\", configurable: true } - }); - if (globalObject[ctorRegistrySymbol] === undefined) { - globalObject[ctorRegistrySymbol] = Object.create(null); + preventExtensions() { + return false; } - globalObject[ctorRegistrySymbol][interfaceName] = Unforgeable; - - Object.defineProperty(globalObject, interfaceName, { - configurable: true, - writable: true, - value: Unforgeable - }); }; -const Impl = require(\\"../implementations/Unforgeable.js\\"); +const Impl = require(\\"../implementations/URLSearchParamsCollection.js\\"); " `; -exports[`without processors UnforgeableMap.webidl 1`] = ` +exports[`without processors URLSearchParamsCollection2.webidl 1`] = ` "\\"use strict\\"; const conversions = require(\\"webidl-conversions\\"); const utils = require(\\"./utils.js\\"); +const URL = require(\\"./URL.js\\"); const implSymbol = utils.implSymbol; const ctorRegistrySymbol = utils.ctorRegistrySymbol; +const URLSearchParamsCollection = require(\\"./URLSearchParamsCollection.js\\"); -const interfaceName = \\"UnforgeableMap\\"; +const interfaceName = \\"URLSearchParamsCollection2\\"; exports.is = value => { return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; @@ -15900,7 +15668,7 @@ exports.convert = (value, { context = \\"The provided value\\" } = {}) => { if (exports.is(value)) { return utils.implForWrapper(value); } - throw new TypeError(\`\${context} is not of type 'UnforgeableMap'.\`); + throw new TypeError(\`\${context} is not of type 'URLSearchParamsCollection2'.\`); }; function makeWrapper(globalObject) { @@ -15908,9 +15676,11 @@ function makeWrapper(globalObject) { throw new Error(\\"Internal error: invalid global object\\"); } - const ctor = globalObject[ctorRegistrySymbol][\\"UnforgeableMap\\"]; + const ctor = globalObject[ctorRegistrySymbol][\\"URLSearchParamsCollection2\\"]; if (ctor === undefined) { - throw new Error(\\"Internal error: constructor UnforgeableMap is not installed on the passed global object\\"); + throw new Error( + \\"Internal error: constructor URLSearchParamsCollection2 is not installed on the passed global object\\" + ); } return Object.create(ctor.prototype); @@ -15927,22 +15697,7 @@ exports.createImpl = (globalObject, constructorArgs, privateData) => { }; exports._internalSetup = (wrapper, globalObject) => { - Object.defineProperties( - wrapper, - Object.getOwnPropertyDescriptors({ - get a() { - const esValue = this !== null && this !== undefined ? this : globalObject; - - if (!exports.is(esValue)) { - throw new TypeError(\\"Illegal invocation\\"); - } - - return esValue[implSymbol][\\"a\\"]; - } - }) - ); - - Object.defineProperties(wrapper, { a: { configurable: false } }); + URLSearchParamsCollection._internalSetup(wrapper, globalObject); }; exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { @@ -15987,23 +15742,30 @@ exports.install = (globalObject, globalNames) => { if (!globalNames.some(globalName => exposed.has(globalName))) { return; } - class UnforgeableMap { + + if (globalObject.URLSearchParamsCollection === undefined) { + throw new Error( + \\"Internal error: attempting to evaluate URLSearchParamsCollection2 before URLSearchParamsCollection\\" + ); + } + class URLSearchParamsCollection2 extends globalObject.URLSearchParamsCollection { constructor() { throw new TypeError(\\"Illegal constructor\\"); } } - Object.defineProperties(UnforgeableMap.prototype, { - [Symbol.toStringTag]: { value: \\"UnforgeableMap\\", configurable: true } + Object.defineProperties(URLSearchParamsCollection2.prototype, { + [Symbol.toStringTag]: { value: \\"URLSearchParamsCollection2\\", configurable: true }, + [Symbol.iterator]: { value: Array.prototype[Symbol.iterator], configurable: true, writable: true } }); if (globalObject[ctorRegistrySymbol] === undefined) { globalObject[ctorRegistrySymbol] = Object.create(null); } - globalObject[ctorRegistrySymbol][interfaceName] = UnforgeableMap; + globalObject[ctorRegistrySymbol][interfaceName] = URLSearchParamsCollection2; Object.defineProperty(globalObject, interfaceName, { configurable: true, writable: true, - value: UnforgeableMap + value: URLSearchParamsCollection2 }); }; @@ -16048,6 +15810,10 @@ const proxyHandler = { ownKeys(target) { const keys = new Set(); + for (const key of target[implSymbol][utils.supportedPropertyIndices]) { + keys.add(\`\${key}\`); + } + for (const key of target[implSymbol][utils.supportedPropertyNames]) { if (!(key in target)) { keys.add(\`\${key}\`); @@ -16066,9 +15832,23 @@ const proxyHandler = { } let ignoreNamedProps = false; - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target) && !ignoreNamedProps) { - const namedValue = target[implSymbol][utils.namedGet](P); + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + return { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; + } + ignoreNamedProps = true; + } + + const namedValue = target[implSymbol].namedItem(P); + if (namedValue !== null && !(P in target) && !ignoreNamedProps) { return { writable: true, enumerable: true, @@ -16085,14 +15865,16 @@ const proxyHandler = { return Reflect.set(target, P, V, receiver); } if (target === receiver) { + utils.isArrayIndexPropName(P); + if (typeof P === \\"string\\" && !utils.isArrayIndexPropName(P)) { let namedValue = V; - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'UnforgeableMap': The provided value\\" + namedValue = URL.convert(namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" }); - const creating = !target[implSymbol][utils.supportsPropertyName](P); + const creating = !(target[implSymbol].namedItem(P) !== null); if (creating) { target[implSymbol][utils.namedSetNew](P, namedValue); } else { @@ -16104,6 +15886,19 @@ const proxyHandler = { } let ownDesc; + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + const indexedValue = target[implSymbol].item(index); + if (indexedValue !== undefined) { + ownDesc = { + writable: false, + enumerable: true, + configurable: true, + value: utils.tryWrapperForImpl(indexedValue) + }; + } + } + if (ownDesc === undefined) { ownDesc = Reflect.getOwnPropertyDescriptor(target, P); } @@ -16140,27 +15935,29 @@ const proxyHandler = { if (typeof P === \\"symbol\\") { return Reflect.defineProperty(target, P, desc); } - if (![\\"a\\"].includes(P)) { - if (!utils.hasOwn(target, P)) { - if (desc.get || desc.set) { - return false; - } - let namedValue = desc.value; + if (utils.isArrayIndexPropName(P)) { + return false; + } + if (!utils.hasOwn(target, P)) { + if (desc.get || desc.set) { + return false; + } - namedValue = conversions[\\"DOMString\\"](namedValue, { - context: \\"Failed to set the '\\" + P + \\"' property on 'UnforgeableMap': The provided value\\" - }); + let namedValue = desc.value; - const creating = !target[implSymbol][utils.supportsPropertyName](P); - if (creating) { - target[implSymbol][utils.namedSetNew](P, namedValue); - } else { - target[implSymbol][utils.namedSetExisting](P, namedValue); - } + namedValue = URL.convert(namedValue, { + context: \\"Failed to set the '\\" + P + \\"' property on 'URLSearchParamsCollection2': The provided value\\" + }); - return true; + const creating = !(target[implSymbol].namedItem(P) !== null); + if (creating) { + target[implSymbol][utils.namedSetNew](P, namedValue); + } else { + target[implSymbol][utils.namedSetExisting](P, namedValue); } + + return true; } return Reflect.defineProperty(target, P, desc); }, @@ -16170,7 +15967,12 @@ const proxyHandler = { return Reflect.deleteProperty(target, P); } - if (target[implSymbol][utils.supportsPropertyName](P) && !(P in target)) { + if (utils.isArrayIndexPropName(P)) { + const index = P >>> 0; + return !(target[implSymbol].item(index) !== undefined); + } + + if (target[implSymbol].namedItem(P) !== null && !(P in target)) { return false; } @@ -16182,7 +15984,205 @@ const proxyHandler = { } }; -const Impl = require(\\"../implementations/UnforgeableMap.js\\"); +const Impl = require(\\"../implementations/URLSearchParamsCollection2.js\\"); +" +`; + +exports[`without processors UnderscoredProperties.webidl 1`] = ` +"\\"use strict\\"; + +const conversions = require(\\"webidl-conversions\\"); +const utils = require(\\"./utils.js\\"); + +const implSymbol = utils.implSymbol; +const ctorRegistrySymbol = utils.ctorRegistrySymbol; + +const interfaceName = \\"UnderscoredProperties\\"; + +exports.is = value => { + return utils.isObject(value) && utils.hasOwn(value, implSymbol) && value[implSymbol] instanceof Impl.implementation; +}; +exports.isImpl = value => { + return utils.isObject(value) && value instanceof Impl.implementation; +}; +exports.convert = (value, { context = \\"The provided value\\" } = {}) => { + if (exports.is(value)) { + return utils.implForWrapper(value); + } + throw new TypeError(\`\${context} is not of type 'UnderscoredProperties'.\`); +}; + +function makeWrapper(globalObject) { + if (globalObject[ctorRegistrySymbol] === undefined) { + throw new Error(\\"Internal error: invalid global object\\"); + } + + const ctor = globalObject[ctorRegistrySymbol][\\"UnderscoredProperties\\"]; + if (ctor === undefined) { + throw new Error(\\"Internal error: constructor UnderscoredProperties is not installed on the passed global object\\"); + } + + return Object.create(ctor.prototype); +} + +exports.create = (globalObject, constructorArgs, privateData) => { + const wrapper = makeWrapper(globalObject); + return exports.setup(wrapper, globalObject, constructorArgs, privateData); +}; + +exports.createImpl = (globalObject, constructorArgs, privateData) => { + const wrapper = exports.create(globalObject, constructorArgs, privateData); + return utils.implForWrapper(wrapper); +}; + +exports._internalSetup = (wrapper, globalObject) => {}; + +exports.setup = (wrapper, globalObject, constructorArgs = [], privateData = {}) => { + privateData.wrapper = wrapper; + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: new Impl.implementation(globalObject, constructorArgs, privateData), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper; +}; + +exports.new = globalObject => { + const wrapper = makeWrapper(globalObject); + + exports._internalSetup(wrapper, globalObject); + Object.defineProperty(wrapper, implSymbol, { + value: Object.create(Impl.implementation.prototype), + configurable: true + }); + + wrapper[implSymbol][utils.wrapperSymbol] = wrapper; + if (Impl.init) { + Impl.init(wrapper[implSymbol]); + } + return wrapper[implSymbol]; +}; + +const exposed = new Set([\\"Window\\"]); + +exports.install = (globalObject, globalNames) => { + if (!globalNames.some(globalName => exposed.has(globalName))) { + return; + } + class UnderscoredProperties { + constructor() { + throw new TypeError(\\"Illegal constructor\\"); + } + + operation(sequence) { + const esValue = this !== null && this !== undefined ? this : globalObject; + if (!exports.is(esValue)) { + 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 esValue[implSymbol].operation(...args); + } + + get attribute() { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + return esValue[implSymbol][\\"attribute\\"]; + } + + set attribute(V) { + const esValue = this !== null && this !== undefined ? this : globalObject; + + if (!exports.is(esValue)) { + throw new TypeError(\\"Illegal invocation\\"); + } + + V = conversions[\\"byte\\"](V, { + context: \\"Failed to set the 'attribute' property on 'UnderscoredProperties': The provided value\\" + }); + + esValue[implSymbol][\\"attribute\\"] = V; + } + + 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 } + }); + if (globalObject[ctorRegistrySymbol] === undefined) { + globalObject[ctorRegistrySymbol] = Object.create(null); + } + globalObject[ctorRegistrySymbol][interfaceName] = UnderscoredProperties; + + Object.defineProperty(globalObject, interfaceName, { + configurable: true, + writable: true, + value: UnderscoredProperties + }); +}; + +const Impl = require(\\"../implementations/UnderscoredProperties.js\\"); " `; diff --git a/test/cases/Unforgeable.webidl b/test/cases/LegacyUnforgeable.webidl similarity index 88% rename from test/cases/Unforgeable.webidl rename to test/cases/LegacyUnforgeable.webidl index ef592351..84055469 100644 --- a/test/cases/Unforgeable.webidl +++ b/test/cases/LegacyUnforgeable.webidl @@ -1,5 +1,5 @@ [Exposed=Window] -interface Unforgeable { +interface LegacyUnforgeable { [LegacyUnforgeable] stringifier attribute USVString href; [LegacyUnforgeable] readonly attribute USVString origin; [LegacyUnforgeable] attribute USVString protocol; diff --git a/test/cases/UnforgeableMap.webidl b/test/cases/LegacyUnforgeableMap.webidl similarity index 82% rename from test/cases/UnforgeableMap.webidl rename to test/cases/LegacyUnforgeableMap.webidl index c5fdc343..789bdad4 100644 --- a/test/cases/UnforgeableMap.webidl +++ b/test/cases/LegacyUnforgeableMap.webidl @@ -1,5 +1,5 @@ [Exposed=Window] -interface UnforgeableMap { +interface LegacyUnforgeableMap { [LegacyUnforgeable] readonly attribute DOMString a; getter DOMString (DOMString x); setter DOMString (DOMString x, DOMString y);