diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-01-18 00:13:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 00:13:14 +0100 |
commit | b10563cb2083f7af9d4320662d6aa1897b6db23e (patch) | |
tree | 9c1d83c7806aad7783e2ac7bbff3b26b92fa3065 /cli | |
parent | bc666e42a89f2f6ab104e5f1c1298ec590a99ce9 (diff) |
fix(runtime): don't crash when window is deleted (#13392)
This commit fixes an error when user deletes "window" global JS
variable. Instead of relying on "window" or "globalThis" to dispatch
"load" and "unload" events, we are default to global scope of the
worker.
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/integration/run_tests.rs | 5 | ||||
-rw-r--r-- | cli/tests/testdata/delete_window.js | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 2f32fd67f..74a03e055 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -2480,6 +2480,11 @@ itest!(import_assertions_type_check { exit_code: 1, }); +itest!(delete_window { + args: "run delete_window.js", + output_str: Some("true\n"), +}); + itest!(colors_without_global_this { args: "run colors_without_globalThis.js", output_str: Some("true\n"), diff --git a/cli/tests/testdata/delete_window.js b/cli/tests/testdata/delete_window.js new file mode 100644 index 000000000..f2f16820d --- /dev/null +++ b/cli/tests/testdata/delete_window.js @@ -0,0 +1 @@ +console.log(delete globalThis.window); |