mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 990806, part 2 - Fix "Assertion failure: gGotError, at js/src/shell/js.cpp:448" after OOM in the shell by setting gGotError from an out-of-memory callback. r=terrence.
This commit is contained in:
parent
78905a389b
commit
a2779e00d1
@ -4923,6 +4923,16 @@ my_ErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
my_OOMCallback(JSContext *cx)
|
||||
{
|
||||
// If a script is running, the engine is about to throw the string "out of
|
||||
// memory", which may or may not be caught. Otherwise the engine will just
|
||||
// unwind and return null/false, with no exception set.
|
||||
if (!JS_IsRunning(cx))
|
||||
gGotError = true;
|
||||
}
|
||||
|
||||
static bool
|
||||
global_enumerate(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
@ -6154,6 +6164,7 @@ main(int argc, char **argv, char **envp)
|
||||
if (!rt)
|
||||
return 1;
|
||||
|
||||
JS::SetOutOfMemoryCallback(rt, my_OOMCallback);
|
||||
if (!SetRuntimeOptions(rt, op))
|
||||
return 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user