bug 312278: Protect some objects from getting GC'd before we could root them. r=brendan
git-svn-id: svn://10.0.0.236/trunk@182667 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -985,6 +985,11 @@ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp)
|
||||
return JS_FALSE;
|
||||
cx->creatingException = JS_TRUE;
|
||||
|
||||
/* Protect the newly-created strings below from nesting GCs. */
|
||||
ok = js_EnterLocalRootScope(cx);
|
||||
if (!ok)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Try to get an appropriate prototype by looking up the corresponding
|
||||
* exception constructor name in the scope chain of the current context's
|
||||
@@ -1047,6 +1052,7 @@ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp)
|
||||
reportp->flags |= JSREPORT_EXCEPTION;
|
||||
|
||||
out:
|
||||
js_LeaveLocalRootScope(cx);
|
||||
cx->creatingException = JS_FALSE;
|
||||
return ok;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user