Bug 1481229 part 1 - Remove unnecessary realm entering in JavaScriptShared::findObjectById. r=evilpie
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 07 Aug 2018 14:06:45 +0200
changeset 430343 de88f2fd6d4d8895a8c3d174e630fbec58e628d1
parent 430342 f865653db6dc62c8d1eee995966dcdcff40ac0bb
child 430344 7791fe11b664cf5a1a19e99b32c92e228d8d0c27
push id34401
push useraiakab@mozilla.com
push dateTue, 07 Aug 2018 15:42:55 +0000
treeherdermozilla-central@936c5d6bd40b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs1481229
milestone63.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 1481229 part 1 - Remove unnecessary realm entering in JavaScriptShared::findObjectById. r=evilpie ToWindowProxyIfWindow does not rely on the current realm in any way.
js/ipc/JavaScriptShared.cpp
--- a/js/ipc/JavaScriptShared.cpp
+++ b/js/ipc/JavaScriptShared.cpp
@@ -533,21 +533,18 @@ JavaScriptShared::findObjectById(JSConte
     }
 
     // Each process has a dedicated compartment for CPOW targets. All CPOWs
     // from the other process point to objects in this scope. From there, they
     // can access objects in other compartments using cross-compartment
     // wrappers.
     JSAutoRealm ar(cx, scopeForTargetObjects());
     if (objId.hasXrayWaiver()) {
-        {
-            JSAutoRealmAllowCCW ar2(cx, obj);
-            obj = js::ToWindowProxyIfWindow(obj);
-            MOZ_ASSERT(obj);
-        }
+        obj = js::ToWindowProxyIfWindow(obj);
+        MOZ_ASSERT(obj);
         if (!xpc::WrapperFactory::WaiveXrayAndWrap(cx, &obj))
             return nullptr;
     } else {
         if (!JS_WrapObject(cx, &obj))
             return nullptr;
     }
     return obj;
 }