diff options
Diffstat (limited to 'ext/webidl')
-rw-r--r-- | ext/webidl/00_webidl.js | 28 | ||||
-rw-r--r-- | ext/webidl/internal.d.ts | 2 |
2 files changed, 18 insertions, 12 deletions
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index a532c5ac4..c3b00286f 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -1138,36 +1138,42 @@ function mixinPairIterable(name, prototype, dataSymbol, keyKey, valueKey) { return ObjectDefineProperties(prototype.prototype, properties); } -function configurePrototype(prototype) { - const descriptors = ObjectGetOwnPropertyDescriptors(prototype.prototype); +function configureInterface(interface_) { + configureProperties(interface_); + configureProperties(interface_.prototype); + ObjectDefineProperty(interface_.prototype, SymbolToStringTag, { + value: interface_.name, + enumerable: false, + configurable: true, + writable: false, + }); +} + +function configureProperties(obj) { + const descriptors = ObjectGetOwnPropertyDescriptors(obj); for (const key in descriptors) { if (!ObjectHasOwn(descriptors, key)) { continue; } if (key === "constructor") continue; + if (key === "prototype") continue; const descriptor = descriptors[key]; if ( ReflectHas(descriptor, "value") && typeof descriptor.value === "function" ) { - ObjectDefineProperty(prototype.prototype, key, { + ObjectDefineProperty(obj, key, { enumerable: true, writable: true, configurable: true, }); } else if (ReflectHas(descriptor, "get")) { - ObjectDefineProperty(prototype.prototype, key, { + ObjectDefineProperty(obj, key, { enumerable: true, configurable: true, }); } } - ObjectDefineProperty(prototype.prototype, SymbolToStringTag, { - value: prototype.name, - enumerable: false, - configurable: true, - writable: false, - }); } const setlikeInner = Symbol("[[set]]"); @@ -1275,7 +1281,7 @@ function setlike(obj, objPrototype, readonly) { export { assertBranded, brand, - configurePrototype, + configureInterface, converters, createBranded, createDictionaryConverter, diff --git a/ext/webidl/internal.d.ts b/ext/webidl/internal.d.ts index 38f176ab2..7f1f68282 100644 --- a/ext/webidl/internal.d.ts +++ b/ext/webidl/internal.d.ts @@ -543,7 +543,7 @@ declare module "ext:deno_webidl/00_webidl.js" { /** * Configure prototype properties enumerability / writability / configurability. */ - function configurePrototype(prototype: any); + function configureInterface(prototype: any); /** * Get the WebIDL / ES type of a value. |