diff options
Diffstat (limited to 'extensions/webidl')
-rw-r--r-- | extensions/webidl/00_webidl.js | 21 | ||||
-rw-r--r-- | extensions/webidl/internal.d.ts | 5 |
2 files changed, 26 insertions, 0 deletions
diff --git a/extensions/webidl/00_webidl.js b/extensions/webidl/00_webidl.js index ed777b8e5..49f586135 100644 --- a/extensions/webidl/00_webidl.js +++ b/extensions/webidl/00_webidl.js @@ -897,6 +897,26 @@ return Object.assign(prototype.prototype, methods); } + function configurePrototype(prototype) { + const descriptors = Object.getOwnPropertyDescriptors(prototype.prototype); + for (const key in descriptors) { + if (key === "constructor") continue; + const descriptor = descriptors[key]; + if ("value" in descriptor && typeof descriptor.value === "function") { + Object.defineProperty(prototype.prototype, key, { + enumerable: true, + writable: true, + configurable: true, + }); + } else if ("get" in descriptor) { + Object.defineProperty(prototype.prototype, key, { + enumerable: true, + configurable: true, + }); + } + } + } + window.__bootstrap ??= {}; window.__bootstrap.webidl = { makeException, @@ -913,5 +933,6 @@ assertBranded, illegalConstructor, mixinPairIterable, + configurePrototype, }; })(this); diff --git a/extensions/webidl/internal.d.ts b/extensions/webidl/internal.d.ts index ca72566a5..2d23f0ed2 100644 --- a/extensions/webidl/internal.d.ts +++ b/extensions/webidl/internal.d.ts @@ -298,6 +298,11 @@ declare namespace globalThis { keyKey: string | number | symbol, valueKey: string | number | symbol, ): void; + + /** + * Configure prototype properties enumerability / writability / configurability. + */ + declare function configurePrototype(prototype: any); } } } |