Bug 1363208 part 5. Remove now-unnecessary named subframe handling from XrayWrapper. r=peterv
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 21 Jan 2019 03:33:14 +0000
changeset 454668 7faa84f9f73a76f37d605a6b07d46c24e516e576
parent 454667 2e31b4d57c6af6b9fb934a694440f9264b65a3b3
child 454669 c825004b9059681860fdfe283698d813217e6f9d
push id111317
push userrmaries@mozilla.com
push dateMon, 21 Jan 2019 18:01:55 +0000
treeherdermozilla-inbound@19db0edfbc10 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1363208
milestone66.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 1363208 part 5. Remove now-unnecessary named subframe handling from XrayWrapper. r=peterv Differential Revision: https://phabricator.services.mozilla.com/D15429
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -1907,49 +1907,17 @@ bool XrayWrapper<Base, Traits>::getPrope
 
   // Check the holder.
   if (!desc.object() &&
       !JS_GetOwnPropertyDescriptorById(cx, holder, id, desc)) {
     return false;
   }
   if (desc.object()) {
     desc.object().set(wrapper);
-    return true;
   }
-
-  // We need to handle named access on the Window somewhere other than
-  // Traits::resolveOwnProperty, because per spec it happens on the Global
-  // Scope Polluter and thus the resulting properties are non-|own|. However,
-  // we're set up (above) to cache (on the holder),
-  // which we don't want for something dynamic like named access.
-  // So we just handle it separately here.  Note that this is
-  // only relevant for CrossOriginXrayWrapper, which calls
-  // getPropertyDescriptor from getOwnPropertyDescriptor.
-  nsGlobalWindowInner* win = nullptr;
-  if (!desc.object() && JSID_IS_STRING(id) && (win = AsWindow(cx, wrapper))) {
-    nsAutoJSString name;
-    if (!name.init(cx, JSID_TO_STRING(id))) {
-      return false;
-    }
-    RefPtr<BrowsingContext> childDOMWin(win->GetChildWindow(name));
-    if (childDOMWin) {
-      auto* cwin = nsGlobalWindowOuter::Cast(childDOMWin->GetDOMWindow());
-      JSObject* childObj = cwin->FastGetGlobalJSObject();
-      if (MOZ_UNLIKELY(!childObj)) {
-        return xpc::Throw(cx, NS_ERROR_FAILURE);
-      }
-      ExposeObjectToActiveJS(childObj);
-      FillPropertyDescriptor(desc, wrapper, ObjectValue(*childObj),
-                             /* readOnly = */ true);
-      return JS_WrapPropertyDescriptor(cx, desc);
-    }
-  }
-
-  // We found nothing, we're done.
-  MOZ_ASSERT(!desc.object());
   return true;
 }
 
 template <typename Base, typename Traits>
 bool XrayWrapper<Base, Traits>::getOwnPropertyDescriptor(
     JSContext* cx, HandleObject wrapper, HandleId id,
     JS::MutableHandle<PropertyDescriptor> desc) const {
   assertEnteredPolicy(cx, wrapper, id,