Bug 627943 - Bad ordering of exception save/wrap/restore, r=gal
☠☠ backed out by bee0e6e72ca5 ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Fri, 21 Jan 2011 17:32:00 -0800
changeset 61234 e13f3b909fa222ad57ae6f3c7e7b5e1785ea1674
parent 61233 4031baed59f75e5b39c1b7ba2d86216000cfaaec
child 61235 6dcf1547ea08ef0e7c4c028fd8e7d06c701cf781
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
reviewersgal
bugs627943
milestone2.0b10pre
Bug 627943 - Bad ordering of exception save/wrap/restore, r=gal
js/src/xpconnect/src/xpcwrappedjsclass.cpp
--- a/js/src/xpconnect/src/xpcwrappedjsclass.cpp
+++ b/js/src/xpconnect/src/xpcwrappedjsclass.cpp
@@ -1300,23 +1300,24 @@ nsXPCWrappedJSClass::CallMethod(nsXPCWra
         cx = ccx.GetJSContext();
     }
     else
     {
         xpcc = nsnull;
         cx = nsnull;
     }
 
+    js::AutoValueVector args(cx);
+    /* This must come before AutoScriptEvaluate */
+    JSAutoEnterCompartment ac;
     AutoScriptEvaluate scriptEval(cx);
-    js::AutoValueVector args(cx);
     ContextPrincipalGuard principalGuard(ccx);
 
     obj = thisObj = wrapper->GetJSObject();
 
-    JSAutoEnterCompartment ac;
     if (!ac.enter(ccx, obj))
         goto pre_call_clean_up;
 
     // XXX ASSUMES that retval is last arg. The xpidl compiler ensures this.
     paramCount = info->num_args;
     argc = paramCount -
         (paramCount && XPT_PD_IS_RETVAL(info->params[paramCount-1].flags) ? 1 : 0);