From 274e156b9f80acd4eda9d4dbc7903915abd1eb33 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Tue, 2 Apr 2013 12:16:13 -0700 Subject: [PATCH] Bug 857050 - Remove a value root before shutting down. r=jimb --HG-- extra : rebase_source : 314b43c30c5d65cf7ba05d21e743b8904fe7602f --- .../basic/properly-remove-timeout-root-before-shutdown.js | 5 +++++ js/src/shell/js.cpp | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 js/src/jit-test/tests/basic/properly-remove-timeout-root-before-shutdown.js diff --git a/js/src/jit-test/tests/basic/properly-remove-timeout-root-before-shutdown.js b/js/src/jit-test/tests/basic/properly-remove-timeout-root-before-shutdown.js new file mode 100644 index 000000000000..cca2196e5c27 --- /dev/null +++ b/js/src/jit-test/tests/basic/properly-remove-timeout-root-before-shutdown.js @@ -0,0 +1,5 @@ +// Bug 857050: Remove the timeout function root before shutting down. +function timeoutfunc() {} +timeout(1, timeoutfunc); +var g = newGlobal('new-compartment'); +var dbg = Debugger(g); diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 6cde51edd0d9..6e61a1c237da 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -121,7 +121,7 @@ static uintptr_t gStackBase; static double MAX_TIMEOUT_INTERVAL = 1800.0; static double gTimeoutInterval = -1.0; static volatile bool gTimedOut = false; -static js::Value gTimeoutFunc; +static JS::Value gTimeoutFunc; static bool enableMethodJit = true; static bool enableTypeInference = true; @@ -5350,6 +5350,9 @@ main(int argc, char **argv, char **envp) printf("OOM max count: %u\n", OOM_counter); #endif + gTimeoutFunc = NullValue(); + JS_RemoveValueRootRT(rt, &gTimeoutFunc); + DestroyContext(cx, true); KillWatchdog();