mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 1245861 - Ensure ShellRuntime's PersistentRooteds are always initialized. r=jonco
This commit is contained in:
parent
6246516299
commit
63eecc3ef2
3
js/src/jit-test/tests/basic/evalInWorker-interrupt.js
Normal file
3
js/src/jit-test/tests/basic/evalInWorker-interrupt.js
Normal file
@ -0,0 +1,3 @@
|
||||
if (helperThreadCount() === 0)
|
||||
quit();
|
||||
evalInWorker("setInterruptCallback(function() {}); timeout(1000);");
|
@ -139,7 +139,7 @@ static const double MAX_TIMEOUT_INTERVAL = 1800.0;
|
||||
// Per-runtime shell state.
|
||||
struct ShellRuntime
|
||||
{
|
||||
ShellRuntime();
|
||||
explicit ShellRuntime(JSRuntime* rt);
|
||||
|
||||
bool isWorker;
|
||||
double timeoutInterval;
|
||||
@ -287,12 +287,14 @@ extern JS_EXPORT_API(void) add_history(char* line);
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
ShellRuntime::ShellRuntime()
|
||||
ShellRuntime::ShellRuntime(JSRuntime* rt)
|
||||
: isWorker(false),
|
||||
timeoutInterval(-1.0),
|
||||
serviceInterrupt(false),
|
||||
haveInterruptFunc(false),
|
||||
interruptFunc(rt, NullValue()),
|
||||
lastWarningEnabled(false),
|
||||
lastWarning(rt, NullValue()),
|
||||
watchdogLock(nullptr),
|
||||
watchdogWakeup(nullptr),
|
||||
watchdogThread(nullptr),
|
||||
@ -2771,7 +2773,7 @@ WorkerMain(void* arg)
|
||||
return;
|
||||
}
|
||||
|
||||
UniquePtr<ShellRuntime> sr = MakeUnique<ShellRuntime>();
|
||||
UniquePtr<ShellRuntime> sr = MakeUnique<ShellRuntime>(rt);
|
||||
if (!sr) {
|
||||
JS_DestroyRuntime(rt);
|
||||
js_delete(input);
|
||||
@ -2825,6 +2827,9 @@ WorkerMain(void* arg)
|
||||
JS::SetLargeAllocationFailureCallback(rt, nullptr, nullptr);
|
||||
|
||||
DestroyContext(cx, false);
|
||||
|
||||
KillWatchdog(rt);
|
||||
|
||||
JS_DestroyRuntime(rt);
|
||||
|
||||
js_delete(input);
|
||||
@ -6994,7 +6999,7 @@ main(int argc, char** argv, char** envp)
|
||||
if (!rt)
|
||||
return 1;
|
||||
|
||||
UniquePtr<ShellRuntime> sr = MakeUnique<ShellRuntime>();
|
||||
UniquePtr<ShellRuntime> sr = MakeUnique<ShellRuntime>(rt);
|
||||
if (!sr)
|
||||
return 1;
|
||||
|
||||
@ -7006,9 +7011,6 @@ main(int argc, char** argv, char** envp)
|
||||
if (!SetRuntimeOptions(rt, op))
|
||||
return 1;
|
||||
|
||||
sr->interruptFunc.init(rt, NullValue());
|
||||
sr->lastWarning.init(rt, NullValue());
|
||||
|
||||
JS_SetGCParameter(rt, JSGC_MAX_BYTES, 0xffffffff);
|
||||
|
||||
size_t availMem = op.getIntOption("available-memory");
|
||||
|
Loading…
Reference in New Issue
Block a user