fix: prevent Deno.exit to fail when dispatchEvent tampered (#14665)

Co-authored-by: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Yoshiya Hinosawa 2022-05-20 11:57:05 +09:00 committed by GitHub
parent 0a96cb62a8
commit e7c894e8f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 1 deletions

View file

@ -8,6 +8,8 @@
SymbolFor,
} = window.__bootstrap.primordials;
const windowDispatchEvent = window.dispatchEvent.bind(window);
function loadavg() {
return core.opSync("op_loadavg");
}
@ -51,7 +53,7 @@
if (!window[SymbolFor("isUnloadDispatched")]) {
// Invokes the `unload` hooks before exiting
// ref: https://github.com/denoland/deno/issues/3603
window.dispatchEvent(new Event("unload"));
windowDispatchEvent(new Event("unload"));
}
if (exitHandler) {