From 430fc45b00e3cca47ba6d0810b9cbab993c2e89c Mon Sep 17 00:00:00 2001 From: Andreas Gal Date: Wed, 2 Feb 2011 19:47:34 -0800 Subject: [PATCH] Bug 630772. Fix compartment mismatch in evalInSandbox(). r=jst@mozilla.com. a=blocker --- js/src/xpconnect/src/xpccomponents.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/js/src/xpconnect/src/xpccomponents.cpp b/js/src/xpconnect/src/xpccomponents.cpp index e1a6e7abd9bb..1d56358e1427 100644 --- a/js/src/xpconnect/src/xpccomponents.cpp +++ b/js/src/xpconnect/src/xpccomponents.cpp @@ -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); }