Bug 987111 - Handle the Object.prototype case in Xray getPrototypeOf. r=gabor
☠☠ backed out by fe14647a422d ☠ ☠
authorBobby Holley <bobbyholley@gmail.com>
Wed, 04 Jun 2014 15:12:26 -0700
changeset 207006 0a4d18d6306f5bccae307ad6edf1ca47e799b0c9
parent 207005 e7b7548867d998b0e6a9e534860cac5506314a7d
child 207007 e7140ccf7e09c75f713fb96af78c655175a4efe4
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
@@ -341,18 +341,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);
     }