summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorAndreu Botella <abb@randomunok.com>2021-10-11 09:50:18 -0700
committerGitHub <noreply@github.com>2021-10-11 18:50:18 +0200
commitfbcbbd7ae3fa2d57e8ad026a1f9f01c6d07fd80b (patch)
tree807662617f36ec1da967c4c56733307fffe25a81 /runtime/js
parentc40d5040cd577aa4ebe552242a06163fbcbc3d4b (diff)
fix(runtime): Declare `Window.self` and `DedicatedWorkerGlobalScope.name` with `util.writable()` (#12378)
`Window`'s `self` property and `DedicatedWorkerGlobalScope`'s `name` property are defined as Web IDL read-only attributes with the `[Replaceable]` extended attribute, meaning that their setter will redefine the property as a data property with the set value, rather than changing some internal state. Deno currently defines them as read-only data properties instead. Given that Web IDL requires all attributes to be accessor properties rather than data properties, but Deno exposes almost all of those properties as either read-only or writable data properties, it makes sense to expose `[Replaceable]` properties as writable as well – as is already the case with `WindowOrWorkerGlobalScope`'s `performance` property.
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 32732923b..a895b0c57 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -475,7 +475,7 @@ delete Object.prototype.__proto__;
location: location.locationDescriptor,
Window: globalInterfaces.windowConstructorDescriptor,
window: util.readOnly(globalThis),
- self: util.readOnly(globalThis),
+ self: util.writable(globalThis),
Navigator: util.nonEnumerable(Navigator),
navigator: {
configurable: true,
@@ -628,7 +628,7 @@ delete Object.prototype.__proto__;
ObjectDefineProperties(globalThis, unstableWindowOrWorkerGlobalScope);
}
ObjectDefineProperties(globalThis, workerRuntimeGlobalProperties);
- ObjectDefineProperties(globalThis, { name: util.readOnly(name) });
+ ObjectDefineProperties(globalThis, { name: util.writable(name) });
if (runtimeOptions.enableTestingFeaturesFlag) {
ObjectDefineProperty(
globalThis,