From 18ac7d40c87b380ce5ed617bd7c59e344730a883 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 21 Jan 2021 16:44:48 +0900 Subject: fix(runtime): fix recursive dispatches of unload event (#9207) --- cli/tests/078_unload_on_exit.ts | 5 +++++ cli/tests/integration_tests.rs | 1 + 2 files changed, 6 insertions(+) (limited to 'cli') diff --git a/cli/tests/078_unload_on_exit.ts b/cli/tests/078_unload_on_exit.ts index e8288ef31..43d33eb25 100644 --- a/cli/tests/078_unload_on_exit.ts +++ b/cli/tests/078_unload_on_exit.ts @@ -1,4 +1,9 @@ window.onunload = () => { console.log("onunload is called"); + // This second exit call doesn't trigger unload event, + // and therefore actually stops the process. + Deno.exit(1); + console.log("This doesn't show up in console"); }; +// This exit call triggers the above unload event handler. Deno.exit(0); diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index be7bb63c5..428d1ff30 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2665,6 +2665,7 @@ itest!(_077_fetch_empty { itest!(_078_unload_on_exit { args: "run 078_unload_on_exit.ts", output: "078_unload_on_exit.ts.out", + exit_code: 1, }); itest!(_079_location_authentication { -- cgit v1.2.3