diff options
author | Luca Casonato <hello@lcas.dev> | 2023-10-10 12:01:01 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 05:01:01 +0200 |
commit | 2665ca103e64ae07d7c29d3400d0c37ec691ff50 (patch) | |
tree | 97babf0dbda5b2bbcf9b8e5a54bb0c4608419c98 /ext/webidl/00_webidl.js | |
parent | 84c9300aff08a9a1dcb214356f022315cc6736fb (diff) |
fix(ext/web): writability of `ReadableStream.from` (#20836)
Fixes a WPT in `URL` and `ReadableStream`.
Some unrelated WPT expectation changes due to WPT update.
Diffstat (limited to 'ext/webidl/00_webidl.js')
-rw-r--r-- | ext/webidl/00_webidl.js | 28 |
1 files changed, 17 insertions, 11 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, |