Bug 630772. Fix compartment mismatch in evalInSandbox(). r=jst@mozilla.com. a=blocker

This commit is contained in:
Andreas Gal 2011-02-02 19:47:34 -08:00
Родитель c28587e2c5
Коммит 430fc45b00
1 изменённых файлов: 1 добавлений и 4 удалений

Просмотреть файл

@ -3703,13 +3703,12 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
// exception into a string.
str = JS_ValueToString(sandcx->GetJSContext(), exn);
JSAutoRequest req(cx);
if (str) {
// We converted the exception to a string. Use that
// as the value exception.
exn = STRING_TO_JSVAL(str);
if (JS_WrapValue(cx, &exn)) {
JS_SetPendingException(cx, STRING_TO_JSVAL(str));
JS_SetPendingException(cx, exn);
} else {
JS_ClearPendingException(cx);
rv = NS_ERROR_FAILURE;
@ -3719,8 +3718,6 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
rv = NS_ERROR_FAILURE;
}
} else {
JSAutoRequest req(cx);
if (JS_WrapValue(cx, &exn)) {
JS_SetPendingException(cx, exn);
}