diff options
author | Andreu Botella <abb@randomunok.com> | 2021-10-11 09:50:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-11 18:50:18 +0200 |
commit | fbcbbd7ae3fa2d57e8ad026a1f9f01c6d07fd80b (patch) | |
tree | 807662617f36ec1da967c4c56733307fffe25a81 /cli/tests/integration/run_tests.rs | |
parent | c40d5040cd577aa4ebe552242a06163fbcbc3d4b (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 'cli/tests/integration/run_tests.rs')
-rw-r--r-- | cli/tests/integration/run_tests.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index f247aa93f..f469bb364 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -1185,6 +1185,13 @@ itest!(error_import_map_unable_to_load { exit_code: 1, }); +// Test that setting `self` in the main thread to some other value doesn't break +// the world. +itest!(replace_self { + args: "run replace_self.js", + output: "replace_self.js.out", +}); + itest!(worker_event_handler_test { args: "run --quiet --reload --allow-read worker_event_handler_test.js", output: "worker_event_handler_test.js.out", |