зеркало из https://github.com/mozilla/pjs.git
bug 312278: Protect some objects from getting GC'd before we could root them. r=brendan
This commit is contained in:
Родитель
6c725ffd16
Коммит
d3fc37107b
|
@ -985,6 +985,11 @@ js_ErrorToException(JSContext *cx, const char *message, JSErrorReport *reportp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
cx->creatingException = JS_TRUE;
|
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
|
* Try to get an appropriate prototype by looking up the corresponding
|
||||||
* exception constructor name in the scope chain of the current context's
|
* 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;
|
reportp->flags |= JSREPORT_EXCEPTION;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
js_LeaveLocalRootScope(cx);
|
||||||
cx->creatingException = JS_FALSE;
|
cx->creatingException = JS_FALSE;
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче