Bug 987111 - Handle the Object.prototype case in Xray getPrototypeOf. r=gabor
authorBobby Holley <bobbyholley@gmail.com>
Thu, 05 Jun 2014 22:32:38 -0700
changeset 207330 3d93bce9a4563e6d8b38e3bdfab1b9a6bf9a6404
parent 207329 3a1f67c7f2236d21592f107a1ff65e9077589564
child 207331 d9788144b427606456bfa6bbc5206c88bac76ac4
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgabor
bugs987111
milestone32.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 987111 - Handle the Object.prototype case in Xray getPrototypeOf. r=gabor
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -342,18 +342,25 @@ public:
 
     typedef ResolvingIdDummy ResolvingIdImpl;
 
     bool getPrototypeOf(JSContext *cx, JS::HandleObject wrapper,
                                JS::HandleObject target,
                                JS::MutableHandleObject protop)
     {
         RootedObject holder(cx, ensureHolder(cx, wrapper));
-        JSProtoKey key = isPrototype(holder) ? JSProto_Object
-                                             : getProtoKey(holder);
+        JSProtoKey key = getProtoKey(holder);
+        if (isPrototype(holder)) {
+            if (key == JSProto_Object) {
+                protop.set(nullptr);
+                return true;
+            }
+            key = JSProto_Object;
+        }
+
         {
             JSAutoCompartment ac(cx, target);
             if (!JS_GetClassPrototype(cx, key, protop))
                 return nullptr;
         }
         return JS_WrapObject(cx, protop);
     }