Bug 630772. Fix compartment mismatch in evalInSandbox(). r=jst@mozilla.com. a=blocker
authorAndreas Gal <gal@uci.edu>
Wed, 02 Feb 2011 19:47:34 -0800
changeset 61824 bdb4c38c56dee48ca514f6e3294f4895e2a6aa44
parent 61823 d8fda3716eaec78f6ba1d63640712acccdec2d8e
child 61825 82709dbd2c96ee46881aabdd13ebb34d2dfb7fb1
push id18509
push userjst@mozilla.com
push dateThu, 03 Feb 2011 03:48:04 +0000
treeherdermozilla-central@bdb4c38c56de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst, blocker
bugs630772
milestone2.0b12pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 630772. Fix compartment mismatch in evalInSandbox(). r=jst@mozilla.com. a=blocker
js/src/xpconnect/src/xpccomponents.cpp
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -3698,34 +3698,31 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec
             if (JS_GetPendingException(sandcx->GetJSContext(), &exn)) {
                 JS_ClearPendingException(sandcx->GetJSContext());
 
                 if (returnStringOnly) {
                     // The caller asked for strings only, convert the
                     // 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;
                         }
                     } else {
                         JS_ClearPendingException(cx);
                         rv = NS_ERROR_FAILURE;
                     }
                 } else {
-                    JSAutoRequest req(cx);
-
                     if (JS_WrapValue(cx, &exn)) {
                         JS_SetPendingException(cx, exn);
                     }
                 }
 
 
                 // Clear str so we don't confuse callers.
                 str = nsnull;