Bug 868675 - Allow waiving on non-native objects. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Tue, 07 May 2013 10:09:02 -0700
changeset 142090 e690c384582ad4e97e721f1ad32ce59555d31baf
parent 142089 8821628e2a68bbb3505e513a83e6e1a950c93beb
child 142091 90a789485fbb1de06bdf811f5b9e657360f8de02
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs868675
milestone23.0a1
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 868675 - Allow waiving on non-native objects. r=gabor
js/xpconnect/src/XPCWrapper.cpp
--- a/js/xpconnect/src/XPCWrapper.cpp
+++ b/js/xpconnect/src/XPCWrapper.cpp
@@ -29,19 +29,19 @@ UnwrapNW(JSContext *cx, unsigned argc, j
   }
 
   JS::RootedValue v(cx, JS_ARGV(cx, vp)[0]);
   if (!v.isObject() || !js::IsWrapper(&v.toObject())) {
     JS_SET_RVAL(cx, vp, v);
     return true;
   }
 
-  JS::RootedObject obj(cx, JSVAL_TO_OBJECT(v));
-  if (WrapperFactory::IsXrayWrapper(obj) && AccessCheck::wrapperSubsumes(obj)) {
-    return JS_GetProperty(cx, obj, "wrappedJSObject", vp);
+  if (AccessCheck::wrapperSubsumes(&v.toObject())) {
+    bool ok = xpc::WrapperFactory::WaiveXrayAndWrap(cx, v.address());
+    NS_ENSURE_TRUE(ok, false);
   }
 
   JS_SET_RVAL(cx, vp, v);
   return true;
 }
 
 static JSBool
 XrayWrapperConstructor(JSContext *cx, unsigned argc, jsval *vp)