mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(runtime): fix recursive dispatches of unload event (#9207)
This commit is contained in:
parent
8bef29fd74
commit
18ac7d40c8
4 changed files with 21 additions and 3 deletions
|
@ -305,6 +305,15 @@ delete Object.prototype.__proto__;
|
|||
defineEventHandler(window, "load", null);
|
||||
defineEventHandler(window, "unload", null);
|
||||
|
||||
const isUnloadDispatched = Symbol.for("isUnloadDispatched");
|
||||
// Stores the flag for checking whether unload is dispatched or not.
|
||||
// This prevents the recursive dispatches of unload events.
|
||||
// See https://github.com/denoland/deno/issues/9201.
|
||||
window[isUnloadDispatched] = false;
|
||||
window.addEventListener("unload", () => {
|
||||
window[isUnloadDispatched] = true;
|
||||
});
|
||||
|
||||
runtimeStart(runtimeOptions);
|
||||
const {
|
||||
args,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue