Bug 1414974 - Part 7: Remove nsGlobalWindow::Cast in favor of nsGlobalWindow{Inner,Outer}::Cast, r=smaug
authorNika Layzell <nika@thelayzells.com>
Tue, 07 Nov 2017 11:40:21 -0500
changeset 444274 eadac792a9e36ff1bca0aad5edb790953d9525df
parent 444273 cd4b951a1f54bdab2e8c5adfc1bf699e5cc6b10c
child 444275 2c41a712dff22de4fb2bbfd7c5a418fbc3a26f11
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1414974
milestone58.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 1414974 - Part 7: Remove nsGlobalWindow::Cast in favor of nsGlobalWindow{Inner,Outer}::Cast, r=smaug MozReview-Commit-ID: DCyyvQ0xKOj
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -887,17 +887,17 @@ public:
   }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IdleRequestTimeoutHandler,
                                            TimeoutHandler)
 
   nsresult Call() override
   {
-    return nsGlobalWindow::Cast(mWindow)->RunIdleRequest(mIdleRequest, 0.0, true);
+    return nsGlobalWindowInner::Cast(mWindow)->RunIdleRequest(mIdleRequest, 0.0, true);
   }
 
 private:
   ~IdleRequestTimeoutHandler() override {}
 
   RefPtr<IdleRequest> mIdleRequest;
   nsCOMPtr<nsPIDOMWindowInner> mWindow;
 };
@@ -1422,17 +1422,17 @@ nsOuterWindowProxy::GetSubframeWindow(JS
   nsCOMPtr<nsPIDOMWindowOuter> frame = GetSubframeWindow(cx, proxy, id);
   if (!frame) {
     found = false;
     return true;
   }
 
   found = true;
   // Just return the window's global
-  nsGlobalWindow* global = nsGlobalWindow::Cast(frame);
+  nsGlobalWindowOuter* global = nsGlobalWindowOuter::Cast(frame);
   frame->EnsureInnerWindow();
   JSObject* obj = global->FastGetGlobalJSObject();
   // This null check fixes a hard-to-reproduce crash that occurs when we
   // get here when we're mid-call to nsDocShell::Destroy. See bug 640904
   // comment 105.
   if (MOZ_UNLIKELY(!obj)) {
     return xpc::Throw(cx, NS_ERROR_FAILURE);
   }
@@ -1744,17 +1744,17 @@ nsGlobalWindow::~nsGlobalWindow()
 
       // Data URLs can be very long, so truncate to avoid flooding the log.
       const uint32_t maxURLLength = 1000;
       if (url.Length() > maxURLLength) {
         url.Truncate(maxURLLength);
       }
     }
 
-    nsGlobalWindow* outer = nsGlobalWindow::Cast(mOuterWindow);
+    nsGlobalWindowOuter* outer = nsGlobalWindowOuter::Cast(mOuterWindow);
     printf_stderr("--DOMWINDOW == %d (%p) [pid = %d] [serial = %d] [outer = %p] [url = %s]\n",
                   gRefCnt,
                   static_cast<void*>(ToCanonicalSupports(this)),
                   getpid(),
                   mSerial,
                   static_cast<void*>(ToCanonicalSupports(outer)),
                   url.get());
   }
@@ -2353,17 +2353,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mServiceWorkerRegistrationTable)
 
 #ifdef MOZ_WEBSPEECH
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mSpeechSynthesis)
 #endif
 
   if (tmp->mOuterWindow) {
-    nsGlobalWindow::Cast(tmp->mOuterWindow)->MaybeClearInnerWindow(tmp);
+    nsGlobalWindowOuter::Cast(tmp->mOuterWindow)->MaybeClearInnerWindow(tmp);
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mOuterWindow)
   }
 
   if (tmp->mListenerManager) {
     tmp->mListenerManager->Disconnect();
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mListenerManager)
   }
 
@@ -2790,35 +2790,35 @@ nsGlobalWindow::ComputeIsSecureContext(n
 
   // Implement https://w3c.github.io/webappsec-secure-contexts/#settings-object
   // With some modifications to allow for aFlags.
 
   bool hadNonSecureContextCreator = false;
 
   nsPIDOMWindowOuter* parentOuterWin = GetScriptableParent();
   MOZ_ASSERT(parentOuterWin, "How can we get here? No docShell somehow?");
-  if (nsGlobalWindow::Cast(parentOuterWin) != this) {
+  if (nsGlobalWindowOuter::Cast(parentOuterWin) != this) {
     // There may be a small chance that parentOuterWin has navigated in
     // the time that it took us to start loading this sub-document.  If that
     // were the case then parentOuterWin->GetCurrentInnerWindow() wouldn't
     // return the window for the document that is embedding us.  For this
     // reason we only use the GetScriptableParent call above to check that we
     // have a same-type parent, but actually get the inner window via the
     // document that we know is embedding us.
     nsIDocument* creatorDoc = aDocument->GetParentDocument();
     if (!creatorDoc) {
       return false; // we must be tearing down
     }
-    nsGlobalWindow* parentWin =
-      nsGlobalWindow::Cast(creatorDoc->GetInnerWindow());
+    nsGlobalWindowInner* parentWin =
+      nsGlobalWindowInner::Cast(creatorDoc->GetInnerWindow());
     if (!parentWin) {
       return false; // we must be tearing down
     }
     MOZ_ASSERT(parentWin ==
-               nsGlobalWindow::Cast(parentOuterWin->GetCurrentInnerWindow()),
+               nsGlobalWindowInner::Cast(parentOuterWin->GetCurrentInnerWindow()),
                "Creator window mismatch while setting Secure Context state");
     if (aFlags != SecureContextFlags::eIgnoreOpener) {
       hadNonSecureContextCreator = !parentWin->IsSecureContext();
     } else {
       hadNonSecureContextCreator = !parentWin->IsSecureContextIfOpenerIgnored();
     }
   } else if (mHadOriginalOpener) {
     if (aFlags != SecureContextFlags::eIgnoreOpener) {
@@ -2881,17 +2881,17 @@ SelectZoneGroup(nsGlobalWindow* aNewInne
   if (XRE_IsParentProcess()) {
     return aOptions.setNewZoneInSystemZoneGroup();
   }
 
   // Otherwise, find a zone group from the TabGroup. Typically we only have to
   // go through one iteration of this loop.
   RefPtr<TabGroup> tabGroup = aNewInner->TabGroup();
   for (nsPIDOMWindowOuter* outer : tabGroup->GetWindows()) {
-    nsGlobalWindow* window = nsGlobalWindow::Cast(outer);
+    nsGlobalWindowOuter* window = nsGlobalWindowOuter::Cast(outer);
     if (JSObject* global = window->GetGlobalJSObject()) {
       return aOptions.setNewZoneInExistingZoneGroup(global);
     }
   }
 
   return aOptions.setNewZoneInNewZoneGroup();
 }
 
@@ -3488,17 +3488,18 @@ nsGlobalWindow::SetDocShell(nsIDocShell*
 
   if (aDocShell == mDocShell) {
     return;
   }
 
   mDocShell = aDocShell; // Weak Reference
 
   nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull();
-  MOZ_RELEASE_ASSERT(!parentWindow || !mTabGroup || mTabGroup == Cast(parentWindow)->mTabGroup);
+  MOZ_RELEASE_ASSERT(!parentWindow || !mTabGroup ||
+                     mTabGroup == nsGlobalWindowOuter::Cast(parentWindow)->mTabGroup);
 
   mTopLevelOuterContentWindow =
     !mIsChrome && GetScriptableTopInternal() == this;
 
   NS_ASSERTION(!mNavigator, "Non-null mNavigator in outer window!");
 
   if (mFrames) {
     mFrames->SetDocShell(aDocShell);
@@ -3620,17 +3621,17 @@ nsGlobalWindow::SetOpenerWindow(nsPIDOMW
   // Check that the js visible opener matches! We currently don't depend on this
   // being true outside of nightly, so we disable the assertion in optimized
   // release / beta builds.
   nsPIDOMWindowOuter* contentOpener = GetSanitizedOpener(aOpener);
 
   // contentOpener is not used when the DIAGNOSTIC_ASSERT is compiled out.
   mozilla::Unused << contentOpener;
   MOZ_DIAGNOSTIC_ASSERT(!contentOpener || !mTabGroup ||
-    mTabGroup == Cast(contentOpener)->mTabGroup);
+    mTabGroup == nsGlobalWindowOuter::Cast(contentOpener)->mTabGroup);
 
   if (aOriginalOpener) {
     MOZ_ASSERT(!mHadOriginalOpener,
                "Probably too late to call ComputeIsSecureContext again");
     mHadOriginalOpener = true;
     mOriginalOpenerWasSecureContext =
       aOpener->GetCurrentInnerWindow()->IsSecureContext();
   }
@@ -4322,53 +4323,53 @@ nsPIDOMWindowInner::CreatePerformanceObj
   if (timing) {
     mPerformance = Performance::CreateForMainThread(this, timing, timedChannel);
   }
 }
 
 bool
 nsPIDOMWindowInner::IsSecureContext() const
 {
-  return nsGlobalWindow::Cast(this)->IsSecureContext();
+  return nsGlobalWindowInner::Cast(this)->IsSecureContext();
 }
 
 bool
 nsPIDOMWindowInner::IsSecureContextIfOpenerIgnored() const
 {
-  return nsGlobalWindow::Cast(this)->IsSecureContextIfOpenerIgnored();
+  return nsGlobalWindowInner::Cast(this)->IsSecureContextIfOpenerIgnored();
 }
 
 void
 nsPIDOMWindowInner::Suspend()
 {
-  nsGlobalWindow::Cast(this)->Suspend();
+  nsGlobalWindowInner::Cast(this)->Suspend();
 }
 
 void
 nsPIDOMWindowInner::Resume()
 {
-  nsGlobalWindow::Cast(this)->Resume();
+  nsGlobalWindowInner::Cast(this)->Resume();
 }
 
 void
 nsPIDOMWindowInner::Freeze()
 {
-  nsGlobalWindow::Cast(this)->Freeze();
+  nsGlobalWindowInner::Cast(this)->Freeze();
 }
 
 void
 nsPIDOMWindowInner::Thaw()
 {
-  nsGlobalWindow::Cast(this)->Thaw();
+  nsGlobalWindowInner::Cast(this)->Thaw();
 }
 
 void
 nsPIDOMWindowInner::SyncStateFromParentWindow()
 {
-  nsGlobalWindow::Cast(this)->SyncStateFromParentWindow();
+  nsGlobalWindowInner::Cast(this)->SyncStateFromParentWindow();
 }
 
 void
 nsGlobalWindow::UpdateTopInnerWindow()
 {
   if (!IsInnerWindow() || AsInner()->IsTopInnerWindow() || !mTopInnerWindow) {
     return;
   }
@@ -4451,17 +4452,17 @@ nsPIDOMWindowInner::TryToCacheTopInnerWi
   if (mHasTriedToCacheTopInnerWindow) {
     return;
   }
 
   MOZ_ASSERT(!mInnerObjectsFreed);
 
   mHasTriedToCacheTopInnerWindow = true;
 
-  nsGlobalWindow* window = nsGlobalWindow::Cast(AsInner());
+  nsGlobalWindow* window = nsGlobalWindowInner::Cast(AsInner());
 
   MOZ_ASSERT(window);
 
   if (nsCOMPtr<nsPIDOMWindowOuter> topOutter = window->GetScriptableTop()) {
     mTopInnerWindow = topOutter->GetCurrentInnerWindow();
   }
 }
 
@@ -4793,17 +4794,17 @@ nsGlobalWindow::GetScriptableParent()
  * if GetScriptableParent would return this window.
  */
 nsPIDOMWindowOuter*
 nsGlobalWindow::GetScriptableParentOrNull()
 {
   FORWARD_TO_OUTER(GetScriptableParentOrNull, (), nullptr);
 
   nsPIDOMWindowOuter* parent = GetScriptableParent();
-  return (Cast(parent) == this) ? nullptr : parent;
+  return (nsGlobalWindowOuter::Cast(parent) == this) ? nullptr : parent;
 }
 
 /**
  * nsPIDOMWindow::GetParent (when called from C++) is just a wrapper around
  * GetRealParent.
  */
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindow::GetParent()
@@ -5425,17 +5426,17 @@ nsGlobalWindow::GetControllers(nsIContro
 
 nsPIDOMWindowOuter*
 nsGlobalWindow::GetSanitizedOpener(nsPIDOMWindowOuter* aOpener)
 {
   if (!aOpener) {
     return nullptr;
   }
 
-  nsGlobalWindow* win = nsGlobalWindow::Cast(aOpener);
+  nsGlobalWindow* win = nsGlobalWindowOuter::Cast(aOpener);
 
   // First, ensure that we're not handing back a chrome window to content:
   if (win->IsChromeWindow()) {
     return nullptr;
   }
 
   // We don't want to reveal the opener if the opener is a mail window,
   // because opener can be used to spoof the contents of a message (bug 105050).
@@ -5468,17 +5469,17 @@ nsGlobalWindow::GetOpenerWindowOuter()
   if (!opener) {
     return nullptr;
   }
 
   // First, check if we were called from a privileged chrome script
   if (nsContentUtils::LegacyIsCallerChromeOrNativeCode()) {
     // Catch the case where we're chrome but the opener is not...
     if (GetPrincipal() == nsContentUtils::GetSystemPrincipal() &&
-        nsGlobalWindow::Cast(opener)->GetPrincipal() != nsContentUtils::GetSystemPrincipal()) {
+        nsGlobalWindowOuter::Cast(opener)->GetPrincipal() != nsContentUtils::GetSystemPrincipal()) {
       return nullptr;
     }
     return opener;
   }
 
   return GetSanitizedOpener(opener);
 }
 
@@ -6267,17 +6268,17 @@ double
 nsGlobalWindow::GetDevicePixelRatio(CallerType aCallerType, ErrorResult& aError)
 {
   FORWARD_TO_OUTER_OR_THROW(GetDevicePixelRatioOuter, (aCallerType), aError, 0.0);
 }
 
 float
 nsPIDOMWindowOuter::GetDevicePixelRatio(CallerType aCallerType)
 {
-  return nsGlobalWindow::Cast(this)->GetDevicePixelRatioOuter(aCallerType);
+  return nsGlobalWindowOuter::Cast(this)->GetDevicePixelRatioOuter(aCallerType);
 }
 
 uint64_t
 nsGlobalWindow::GetMozPaintCountOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
@@ -6540,17 +6541,17 @@ nsGlobalWindow::CheckSecurityLeftAndTop(
   // Check security state for use in determing window dimensions
 
   if (aCallerType != CallerType::System) {
 #ifdef MOZ_XUL
     // if attempting to move the window, hide any open popups
     nsContentUtils::HidePopupsInDocument(mDoc);
 #endif
 
-    if (nsGlobalWindow* rootWindow = nsGlobalWindow::Cast(GetPrivateRoot())) {
+    if (nsGlobalWindowOuter* rootWindow = nsGlobalWindowOuter::Cast(GetPrivateRoot())) {
       rootWindow->FlushPendingNotifications(FlushType::Layout);
     }
 
     nsCOMPtr<nsIBaseWindow> treeOwner = GetTreeOwnerWindow();
 
     nsCOMPtr<nsIDOMScreen> screen = GetScreen();
 
     if (treeOwner && screen) {
@@ -7110,17 +7111,17 @@ NS_IMETHODIMP
 FullscreenTransitionTask::Observer::Observe(nsISupports* aSubject,
                                             const char* aTopic,
                                             const char16_t* aData)
 {
   bool shouldContinue = false;
   if (strcmp(aTopic, FullscreenTransitionTask::kPaintedTopic) == 0) {
     nsCOMPtr<nsPIDOMWindowInner> win(do_QueryInterface(aSubject));
     nsCOMPtr<nsIWidget> widget = win ?
-      nsGlobalWindow::Cast(win)->GetMainWidget() : nullptr;
+      nsGlobalWindowInner::Cast(win)->GetMainWidget() : nullptr;
     if (widget == mTask->mWidget) {
       // The paint notification arrives first. Cancel the timer.
       mTask->mTimer->Cancel();
       shouldContinue = true;
       PROFILER_ADD_MARKER("Fullscreen toggle end");
     }
   } else {
 #ifdef DEBUG
@@ -7393,17 +7394,17 @@ nsGlobalWindow::FullScreen() const
       return widget->SizeMode() == nsSizeMode_Fullscreen;
     }
     return false;
   }
 
   nsCOMPtr<nsPIDOMWindowOuter> window = rootItem->GetWindow();
   NS_ENSURE_TRUE(window, mFullScreen);
 
-  return nsGlobalWindow::Cast(window)->FullScreen();
+  return nsGlobalWindowOuter::Cast(window)->FullScreen();
 }
 
 bool
 nsGlobalWindow::GetFullScreenOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   return FullScreen();
 }
@@ -8836,17 +8837,17 @@ nsGlobalWindow::PopupWhitelisted()
     return true;
 
   nsCOMPtr<nsPIDOMWindowOuter> parent = GetParent();
   if (parent == AsOuter())
   {
     return false;
   }
 
-  return nsGlobalWindow::Cast(parent)->PopupWhitelisted();
+  return nsGlobalWindowOuter::Cast(parent)->PopupWhitelisted();
 }
 
 /*
  * Examine the current document state to see if we're in a way that is
  * typically abused by web designers. The window.open code uses this
  * routine to determine whether to allow the new window.
  * Returns a value from the PopupControlState enum.
  */
@@ -11217,17 +11218,17 @@ nsGlobalWindow::GetComputedStyleHelperOu
     return nullptr;
   }
 
   nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
 
   if (!presShell) {
     // Try flushing frames on our parent in case there's a pending
     // style change that will create the presshell.
-    auto* parent = nsGlobalWindow::Cast(GetPrivateParent());
+    auto* parent = nsGlobalWindowOuter::Cast(GetPrivateParent());
     if (!parent) {
       return nullptr;
     }
 
     parent->FlushPendingNotifications(FlushType::Frames);
 
     // Might have killed mDocShell
     if (!mDocShell) {
@@ -12623,18 +12624,18 @@ nsGlobalWindow::SyncStateFromParentWindo
   MOZ_ASSERT(AsInner()->IsCurrentInnerWindow());
   nsPIDOMWindowOuter* outer = GetOuterWindow();
   MOZ_ASSERT(outer);
 
   // Attempt to find our parent windows.
   nsCOMPtr<Element> frame = outer->GetFrameElementInternal();
   nsPIDOMWindowOuter* parentOuter = frame ? frame->OwnerDoc()->GetWindow()
                                           : nullptr;
-  nsGlobalWindow* parentInner =
-    parentOuter ? nsGlobalWindow::Cast(parentOuter->GetCurrentInnerWindow())
+  nsGlobalWindowInner* parentInner =
+    parentOuter ? nsGlobalWindowInner::Cast(parentOuter->GetCurrentInnerWindow())
                 : nullptr;
 
   // If our outer is in a modal state, but our parent is not in a modal
   // state, then we must apply the suspend directly.  If our parent is
   // in a modal state then we should get the suspend automatically
   // via the parentSuspendDepth application below.
   if ((!parentInner || !parentInner->IsInModalState()) && IsInModalState()) {
     Suspend();
@@ -12680,18 +12681,18 @@ nsGlobalWindow::CallOnChildren(Method aM
     docShell->GetChildAt(i, getter_AddRefs(childShell));
     NS_ASSERTION(childShell, "null child shell");
 
     nsCOMPtr<nsPIDOMWindowOuter> pWin = childShell->GetWindow();
     if (!pWin) {
       continue;
     }
 
-    auto* win = nsGlobalWindow::Cast(pWin);
-    nsGlobalWindow* inner = win->GetCurrentInnerWindowInternal();
+    auto* win = nsGlobalWindowOuter::Cast(pWin);
+    nsGlobalWindowInner* inner = win->GetCurrentInnerWindowInternal();
 
     // This is a bit hackish. Only freeze/suspend windows which are truly our
     // subwindows.
     nsCOMPtr<Element> frame = pWin->GetFrameElementInternal();
     if (!mDoc || !frame || mDoc != frame->OwnerDoc() || !inner) {
       continue;
     }
 
@@ -12727,17 +12728,17 @@ nsGlobalWindow::FireDelayedDOMEvents()
     docShell->GetChildCount(&childCount);
 
     for (int32_t i = 0; i < childCount; ++i) {
       nsCOMPtr<nsIDocShellTreeItem> childShell;
       docShell->GetChildAt(i, getter_AddRefs(childShell));
       NS_ASSERTION(childShell, "null child shell");
 
       if (nsCOMPtr<nsPIDOMWindowOuter> pWin = childShell->GetWindow()) {
-        auto* win = nsGlobalWindow::Cast(pWin);
+        auto* win = nsGlobalWindowOuter::Cast(pWin);
         win->FireDelayedDOMEvents();
       }
     }
   }
 
   return NS_OK;
 }
 
@@ -13354,17 +13355,17 @@ nsGlobalWindow::GetScrollFrame()
 nsresult
 nsGlobalWindow::SecurityCheckURL(const char *aURL)
 {
   nsCOMPtr<nsPIDOMWindowInner> sourceWindow = do_QueryInterface(GetEntryGlobal());
   if (!sourceWindow) {
     sourceWindow = AsOuter()->GetCurrentInnerWindow();
   }
   AutoJSContext cx;
-  nsGlobalWindow* sourceWin = nsGlobalWindow::Cast(sourceWindow);
+  nsGlobalWindowInner* sourceWin = nsGlobalWindowInner::Cast(sourceWindow);
   JSAutoCompartment ac(cx, sourceWin->GetGlobalJSObject());
 
   // Resolve the baseURI, which could be relative to the calling window.
   //
   // Note the algorithm to get the base URI should match the one
   // used to actually kick off the load in nsWindowWatcher.cpp.
   nsCOMPtr<nsIDocument> doc = sourceWindow->GetDoc();
   nsIURI* baseURI = nullptr;
@@ -13406,17 +13407,17 @@ nsGlobalWindow::FlushPendingNotification
 void
 nsGlobalWindow::EnsureSizeAndPositionUpToDate()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   // If we're a subframe, make sure our size is up to date.  It's OK that this
   // crosses the content/chrome boundary, since chrome can have pending reflows
   // too.
-  nsGlobalWindow *parent = nsGlobalWindow::Cast(GetPrivateParent());
+  nsGlobalWindow *parent = nsGlobalWindowOuter::Cast(GetPrivateParent());
   if (parent) {
     parent->FlushPendingNotifications(FlushType::Layout);
   }
 }
 
 already_AddRefed<nsISupports>
 nsGlobalWindow::SaveWindowState()
 {
@@ -14550,23 +14551,23 @@ nsPIDOMWindowOuter::SetLargeAllocStatus(
 {
   MOZ_ASSERT(mLargeAllocStatus == LargeAllocStatus::NONE);
   mLargeAllocStatus = aStatus;
 }
 
 bool
 nsPIDOMWindowOuter::IsTopLevelWindow()
 {
-  return nsGlobalWindow::Cast(this)->IsTopLevelWindow();
+  return nsGlobalWindowOuter::Cast(this)->IsTopLevelWindow();
 }
 
 bool
 nsPIDOMWindowOuter::HadOriginalOpener() const
 {
-  return nsGlobalWindow::Cast(this)->HadOriginalOpener();
+  return nsGlobalWindowOuter::Cast(this)->HadOriginalOpener();
 }
 
 void
 nsGlobalWindow::ReportLargeAllocStatus()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   uint32_t errorFlags = nsIScriptError::warningFlag;
@@ -14889,17 +14890,18 @@ nsGlobalWindow::TabGroupOuter()
     if (mIsChrome) {
       MOZ_ASSERT(mTabGroup == TabGroup::GetChromeTabGroup());
     } else {
       // Sanity check that our tabgroup matches our opener or parent.
       RefPtr<nsPIDOMWindowOuter> parent = GetScriptableParentOrNull();
       MOZ_ASSERT_IF(parent, parent->TabGroup() == mTabGroup);
       nsCOMPtr<nsPIDOMWindowOuter> piOpener = do_QueryReferent(mOpener);
       nsPIDOMWindowOuter* opener = GetSanitizedOpener(piOpener);
-      MOZ_ASSERT_IF(opener && Cast(opener) != this, opener->TabGroup() == mTabGroup);
+      MOZ_ASSERT_IF(opener && nsGlobalWindowOuter::Cast(opener) != this,
+                    opener->TabGroup() == mTabGroup);
     }
     mIsValidatingTabGroup = false;
   }
 #endif
 
   return mTabGroup;
 }
 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -279,39 +279,16 @@ public:
   static void
   AssertIsOnMainThread()
 #ifdef DEBUG
   ;
 #else
   { }
 #endif
 
-  static nsGlobalWindow* Cast(nsPIDOMWindowInner* aPIWin) {
-    return static_cast<nsGlobalWindow*>(
-                        reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
-  }
-  static const nsGlobalWindow* Cast(const nsPIDOMWindowInner* aPIWin) {
-    return static_cast<const nsGlobalWindow*>(
-                        reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
-  }
-  static nsGlobalWindow* Cast(mozIDOMWindow* aWin) {
-    return Cast(nsPIDOMWindowInner::From(aWin));
-  }
-  static nsGlobalWindow* Cast(nsPIDOMWindowOuter* aPIWin) {
-    return static_cast<nsGlobalWindow*>(
-                        reinterpret_cast<nsPIDOMWindow<nsISupports>*>(aPIWin));
-  }
-  static const nsGlobalWindow* Cast(const nsPIDOMWindowOuter* aPIWin) {
-    return static_cast<const nsGlobalWindow*>(
-                        reinterpret_cast<const nsPIDOMWindow<nsISupports>*>(aPIWin));
-  }
-  static nsGlobalWindow* Cast(mozIDOMWindowProxy* aWin) {
-    return Cast(nsPIDOMWindowOuter::From(aWin));
-  }
-
   nsGlobalWindowInner* AssertInner();
   nsGlobalWindowOuter* AssertOuter();
 
   // public methods
   nsPIDOMWindowOuter* GetPrivateParent();
 
   // callback for close event
   void ReallyCloseWindow();