Bug 627959, part 2 - wrap exception in XPCThrower::ThrowExceptionObject (r=gal)
authorLuke Wagner <lw@mozilla.com>
Mon, 24 Jan 2011 16:30:16 -0800
changeset 61431 8e7cf978049e68ec87d9191ca328361b25ba43e6
parent 61430 f3e687a7fe94fe550e3e2ced62940ca8b10e2b92
child 61432 5836983f910a010986365d46809ee3696096ccda
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersgal
bugs627959
milestone2.0b10pre
Bug 627959, part 2 - wrap exception in XPCThrower::ThrowExceptionObject (r=gal)
js/src/xpconnect/src/xpcthrower.cpp
--- a/js/src/xpconnect/src/xpcthrower.cpp
+++ b/js/src/xpconnect/src/xpcthrower.cpp
@@ -305,16 +305,18 @@ XPCThrower::ThrowExceptionObject(JSConte
 
         // If we stored the original thrown JS value in the exception
         // (see XPCConvert::ConstructException) and we are in a web
         // context (i.e., not chrome), rethrow the original value.
         if(!IsCallerChrome(cx) &&
            (xpcEx = do_QueryInterface(e)) &&
            NS_SUCCEEDED(xpcEx->StealJSVal(&thrown)))
         {
+            if (!JS_WrapValue(cx, &thrown))
+                return JS_FALSE;
             JS_SetPendingException(cx, thrown);
             success = JS_TRUE;
         }
         else if((xpc = nsXPConnect::GetXPConnect()))
         {
             JSObject* glob = JS_GetScopeChain(cx);
             if(!glob)
                 return JS_FALSE;