Backed out changeset 5d9a6384bf51 (bug 1378207) for frequently timing out in devtools' browser_addons_debug_webextension_popup.js and browser_addons_remove.js on Windows. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 17 Jul 2017 17:59:14 +0200
changeset 369278 e55488c64a0ba4acbb5989febcdb9b167425bdb8
parent 369277 7fc8b6cff9a42e0e3b63adecfae62a254bfa6625
child 369279 565499a7bd59e716a5bf3ed3441ba39eff751ffd
push id46631
push userkwierso@gmail.com
push dateTue, 18 Jul 2017 00:38:28 +0000
treeherderautoland@216a5bf264b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1378207
milestone56.0a1
backs out5d9a6384bf513139ca33f54825db4f035ebdbdab
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
Backed out changeset 5d9a6384bf51 (bug 1378207) for frequently timing out in devtools' browser_addons_debug_webextension_popup.js and browser_addons_remove.js on Windows. r=backout
js/xpconnect/src/XPCJSID.cpp
--- a/js/xpconnect/src/XPCJSID.cpp
+++ b/js/xpconnect/src/XPCJSID.cpp
@@ -451,36 +451,37 @@ nsJSIID::Enumerate(nsIXPConnectWrappedNa
  *     there's chrome code that relies on this.
  *
  * This static method handles both complexities, returning either an XPCWN, a
  * DOM object, or null. The object may well be cross-compartment from |cx|.
  */
 static nsresult
 FindObjectForHasInstance(JSContext* cx, HandleObject objArg, MutableHandleObject target)
 {
-    using namespace mozilla::jsipc;
     RootedObject obj(cx, objArg), proto(cx);
-    while (true) {
-        // Try the object, or the wrappee if allowed.
-        JSObject* o = js::IsWrapper(obj) ? js::CheckedUnwrap(obj, false) : obj;
-        if (o && (IS_WN_REFLECTOR(o) || IsDOMObject(o) || IsCPOW(o))) {
-            target.set(o);
-            return NS_OK;
+
+    while (obj && !IS_WN_REFLECTOR(obj) &&
+           !IsDOMObject(obj) && !mozilla::jsipc::IsCPOW(obj))
+    {
+        if (js::IsWrapper(obj)) {
+            obj = js::CheckedUnwrap(obj, /* stopAtWindowProxy = */ false);
+            continue;
         }
 
-        // Walk the prototype chain from the perspective of the callee (i.e.
-        // respecting Xrays if they exist).
-        if (!js::GetObjectProto(cx, obj, &proto))
-            return NS_ERROR_FAILURE;
-        if (!proto) {
-            target.set(nullptr);
-            return NS_OK;
+        {
+            JSAutoCompartment ac(cx, obj);
+            if (!js::GetObjectProto(cx, obj, &proto))
+                return NS_ERROR_FAILURE;
         }
+
         obj = proto;
     }
+
+    target.set(obj);
+    return NS_OK;
 }
 
 nsresult
 xpc::HasInstance(JSContext* cx, HandleObject objArg, const nsID* iid, bool* bp)
 {
     *bp = false;
 
     RootedObject obj(cx);