Bug 611401 - Avoid potential problems by doing this wrapping ourselves. r=gal a=blocking-betaN
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 22 Dec 2010 19:42:01 -0500
changeset 59624 09103345873cc7fa2a71ea14f61d16bdd5f5517a
parent 59623 43bdb3403733bee141369b949f19e84937bd77bf
child 59625 4772228b45e1e0b6d785d5b819662665a261d4cd
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersgal, blocking-betaN
bugs611401
milestone2.0b9pre
Bug 611401 - Avoid potential problems by doing this wrapping ourselves. r=gal a=blocking-betaN
js/src/xpconnect/src/xpccomponents.cpp
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -3240,20 +3240,19 @@ xpc_CreateSandboxObject(JSContext * cx, 
             return NS_ERROR_XPC_UNEXPECTED;
 
         if (proto) {
             bool ok = JS_WrapObject(cx, &proto);
             if (!ok)
                 return NS_ERROR_XPC_UNEXPECTED;
 
             if (xpc::WrapperFactory::IsXrayWrapper(proto) && !wantXrays) {
-                jsval v;
-                if (!JS_GetProperty(cx, proto, "wrappedJSObject", &v))
-                    return NS_ERROR_XPC_UNEXPECTED;
-
+                jsval v = OBJECT_TO_JSVAL(proto);
+                if (!xpc::WrapperFactory::WaiveXrayAndWrap(cx, &v))
+                    return NS_ERROR_FAILURE;
                 proto = JSVAL_TO_OBJECT(v);
             }
 
             ok = JS_SetPrototype(cx, sandbox, proto);
             if (!ok)
                 return NS_ERROR_XPC_UNEXPECTED;
         }