Bug 1416384 - Part 5: Eliminate inner window only methods from nsGlobalWindowOuter, r=smaug
authorNika Layzell <nika@thelayzells.com>
Wed, 15 Nov 2017 11:34:20 -0500
changeset 392033 aaed1999291a6622a030f20f5f7469fa59f622e5
parent 392032 2d5ba51ff7e36562bb2534ed47e99af3b4e8c98d
child 392034 10eb6ec39ef1a34243c212c64047c7097499f8f8
push id32909
push usercbrindusan@mozilla.com
push dateWed, 15 Nov 2017 22:25:14 +0000
treeherdermozilla-central@f41930a869a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1416384
milestone59.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 1416384 - Part 5: Eliminate inner window only methods from nsGlobalWindowOuter, r=smaug MozReview-Commit-ID: FzaGKmdDtmy
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsGlobalWindowOuter.h
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -1,60 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-// XXX(nika): Temporary redefines
-#define FORWARD_TO_OUTER(method, args, err_rval)                              \
-  PR_BEGIN_MACRO                                                              \
-  if (IsInnerWindow()) {                                                      \
-    nsGlobalWindowOuter *outer = GetOuterWindowInternal();                    \
-    if (!AsInner()->HasActiveDocument()) {                                    \
-      NS_WARNING(outer ?                                                      \
-                 "Inner window does not have active document." :              \
-                 "No outer window available!");                               \
-      return err_rval;                                                        \
-    }                                                                         \
-    return outer->method args;                                                \
-  }                                                                           \
-  PR_END_MACRO
-
-#define FORWARD_TO_OUTER_OR_THROW(method, args, errorresult, err_rval)        \
-  PR_BEGIN_MACRO                                                              \
-  MOZ_RELEASE_ASSERT(IsInnerWindow());                                        \
-  nsGlobalWindowOuter *outer = GetOuterWindowInternal();                      \
-  if (MOZ_LIKELY(AsInner()->HasActiveDocument())) {                           \
-    return outer->method args;                                                \
-  }                                                                           \
-  if (!outer) {                                                               \
-    NS_WARNING("No outer window available!");                                 \
-    errorresult.Throw(NS_ERROR_NOT_INITIALIZED);                              \
-  } else {                                                                    \
-    errorresult.Throw(NS_ERROR_XPC_SECURITY_MANAGER_VETO);                    \
-  }                                                                           \
-  return err_rval;                                                            \
-  PR_END_MACRO
-
-#define FORWARD_TO_OUTER_VOID(method, args)                                   \
-  PR_BEGIN_MACRO                                                              \
-  if (IsInnerWindow()) {                                                      \
-    nsGlobalWindowOuter *outer = GetOuterWindowInternal();                    \
-    if (!AsInner()->HasActiveDocument()) {                                    \
-      NS_WARNING(outer ?                                                      \
-                 "Inner window does not have active document." :              \
-                 "No outer window available!");                               \
-      return;                                                                 \
-    }                                                                         \
-    outer->method args;                                                       \
-    return;                                                                   \
-  }                                                                           \
-  PR_END_MACRO
-
 #define FORWARD_TO_INNER(method, args, err_rval)                        \
   PR_BEGIN_MACRO                                                        \
   MOZ_RELEASE_ASSERT(IsOuterWindow());                                  \
   if (!mInnerWindow) {                                                  \
     NS_WARNING("No inner window available!");                           \
     return err_rval;                                                    \
   }                                                                     \
   return GetCurrentInnerWindowInternal()->method args;                  \
@@ -120,41 +74,16 @@ DialogValueHolder::Get(JSContext* aCx, J
 {
   if (aSubject->Subsumes(mOrigin)) {
     aError = nsContentUtils::XPConnect()->VariantToJS(aCx, aScope,
                                                       mValue, aResult);
   } else {
     aResult.setUndefined();
   }
 }
-
-void
-nsGlobalWindowOuter::ScheduleIdleRequestDispatch()
-{
-  MOZ_CRASH("Inner Window Only");
-}
-
-void
-nsGlobalWindowOuter::SuspendIdleRequests()
-{
-  MOZ_CRASH("Inner window only");
-}
-
-void
-nsGlobalWindowOuter::ResumeIdleRequests()
-{
-  MOZ_CRASH("Inner window only");
-}
-
-void
-nsGlobalWindowOuter::InsertIdleCallback(IdleRequest* aRequest)
-{
-  MOZ_CRASH("Inner Window Only");
-}
-
 void
 nsGlobalWindowOuter::RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest)
 {
   AssertIsOnMainThread();
 
   if (aRequest->HasTimeout()) {
     mTimeoutManager->ClearTimeout(aRequest->GetTimeoutHandle(),
                                   Timeout::Reason::eIdleCallbackTimeout);
@@ -170,50 +99,16 @@ nsGlobalWindowOuter::RunIdleRequest(Idle
                                bool aDidTimeout)
 {
   AssertIsOnMainThread();
   RefPtr<IdleRequest> request(aRequest);
   RemoveIdleCallback(request);
   return request->IdleRun(AsInner(), aDeadline, aDidTimeout);
 }
 
-nsresult
-nsGlobalWindowOuter::ExecuteIdleRequest(TimeStamp aDeadline)
-{
-  MOZ_CRASH("Inner window only");
-}
-
-uint32_t
-nsGlobalWindowOuter::RequestIdleCallback(JSContext* aCx,
-                                    IdleRequestCallback& aCallback,
-                                    const IdleRequestOptions& aOptions,
-                                    ErrorResult& aError)
-{
-  MOZ_CRASH("Inner window only");
-}
-
-void
-nsGlobalWindowOuter::CancelIdleCallback(uint32_t aHandle)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  for (IdleRequest* r : mIdleRequestCallbacks) {
-    if (r->Handle() == aHandle) {
-      RemoveIdleCallback(r);
-      break;
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::DisableIdleCallbackRequests()
-{
-  MOZ_CRASH("Inner window only");
-}
-
 bool
 nsGlobalWindowOuter::IsBackgroundInternal() const
 {
   return !mOuterWindow || mOuterWindow->IsBackground();
 }
 
 /* static */
 nsPIDOMWindowOuter*
@@ -873,30 +768,20 @@ nsGlobalWindowOuter::~nsGlobalWindowOute
     if (mChromeFields.mMessageManager) {
       static_cast<nsFrameMessageManager *>(
         mChromeFields.mMessageManager.get())->Disconnect();
     }
 
     mCleanMessageManager = false;
   }
 
-  DisconnectEventTargetObjects();
-
-  if (IsOuterWindow()) {
-    if (nsGlobalWindowOuter::sOuterWindowsById) {
-      MOZ_ASSERT(nsGlobalWindowOuter::sOuterWindowsById->Get(mWindowID),
-                 "This window should be in the hash table");
-      nsGlobalWindowOuter::sOuterWindowsById->Remove(mWindowID);
-    }
-  } else {
-    if (nsGlobalWindowInner::sInnerWindowsById) {
-      MOZ_ASSERT(nsGlobalWindowInner::sInnerWindowsById->Get(mWindowID),
-                 "This window should be in the hash table");
-      nsGlobalWindowInner::sInnerWindowsById->Remove(mWindowID);
-    }
+  if (sOuterWindowsById) {
+    MOZ_ASSERT(sOuterWindowsById->Get(mWindowID),
+                "This window should be in the hash table");
+    sOuterWindowsById->Remove(mWindowID);
   }
 
   --gRefCnt;
 
 #ifdef DEBUG
   if (!PR_GetEnv("MOZ_QUIET")) {
     nsAutoCString url;
     if (mLastOpenedURI) {
@@ -917,107 +802,52 @@ nsGlobalWindowOuter::~nsGlobalWindowOute
                   mSerial,
                   static_cast<void*>(ToCanonicalSupports(outer)),
                   url.get());
   }
 #endif
 
   MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug, ("DOMWINDOW %p destroyed", this));
 
-  if (IsOuterWindow()) {
-    JSObject *proxy = GetWrapperMaybeDead();
-    if (proxy) {
-      js::SetProxyReservedSlot(proxy, 0, js::PrivateValue(nullptr));
-    }
-
-    // An outer window is destroyed with inner windows still possibly
-    // alive, iterate through the inner windows and null out their
-    // back pointer to this outer, and pull them out of the list of
-    // inner windows.
-    //
-    // Our linked list of inner windows both contains (an nsGlobalWindowOuter),
-    // and our inner windows (nsGlobalWindowInners). This means that we need to
-    // use PRCList*. We can then compare that PRCList* to `this` to see if its an
-    // inner or outer window.
-    PRCList* w;
-    while ((w = PR_LIST_HEAD(this)) != this) {
-      PR_REMOVE_AND_INIT_LINK(w);
-    }
-
-    DropOuterWindowDocs();
-  } else {
-    Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
-                          mMutationBits ? 1 : 0);
-
-    if (mListenerManager) {
-      mListenerManager->Disconnect();
-      mListenerManager = nullptr;
-    }
-
-    // An inner window is destroyed, pull it out of the outer window's
-    // list if inner windows.
-
-    PR_REMOVE_LINK(this);
-
-    // If our outer window's inner window is this window, null out the
-    // outer window's reference to this window that's being deleted.
-    nsGlobalWindowOuter *outer = GetOuterWindowInternal();
-    if (outer) {
-      outer->MaybeClearInnerWindow(AssertInner());
-    }
-  }
-
-  // We don't have to leave the tab group if we are an inner window.
-  if (mTabGroup && IsOuterWindow()) {
+  JSObject *proxy = GetWrapperMaybeDead();
+  if (proxy) {
+    js::SetProxyReservedSlot(proxy, 0, js::PrivateValue(nullptr));
+  }
+
+  // An outer window is destroyed with inner windows still possibly
+  // alive, iterate through the inner windows and null out their
+  // back pointer to this outer, and pull them out of the list of
+  // inner windows.
+  //
+  // Our linked list of inner windows both contains (an nsGlobalWindowOuter),
+  // and our inner windows (nsGlobalWindowInners). This means that we need to
+  // use PRCList*. We can then compare that PRCList* to `this` to see if its an
+  // inner or outer window.
+  PRCList* w;
+  while ((w = PR_LIST_HEAD(this)) != this) {
+    PR_REMOVE_AND_INIT_LINK(w);
+  }
+
+  DropOuterWindowDocs();
+
+  if (mTabGroup) {
     mTabGroup->Leave(AsOuter());
   }
 
   // Outer windows are always supposed to call CleanUp before letting themselves
-  // be destroyed. And while CleanUp generally seems to be intended to clean up
-  // outers, we've historically called it for both. Changing this would probably
-  // involve auditing all of the references that inners and outers can have, and
-  // separating the handling into CleanUp() and FreeInnerObjects.
-  if (IsInnerWindow()) {
-    CleanUp();
-  } else {
-    MOZ_ASSERT(mCleanedUp);
-  }
+  // be destroyed.
+  MOZ_ASSERT(mCleanedUp);
 
   nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
   if (ac)
     ac->RemoveWindowAsListener(this);
 
   nsLayoutStatics::Release();
 }
 
-void
-nsGlobalWindowOuter::AddEventTargetObject(DOMEventTargetHelper* aObject)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  mEventTargetObjects.PutEntry(aObject);
-}
-
-void
-nsGlobalWindowOuter::RemoveEventTargetObject(DOMEventTargetHelper* aObject)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  mEventTargetObjects.RemoveEntry(aObject);
-}
-
-void
-nsGlobalWindowOuter::DisconnectEventTargetObjects()
-{
-  for (auto iter = mEventTargetObjects.ConstIter(); !iter.Done();
-       iter.Next()) {
-    RefPtr<DOMEventTargetHelper> target = iter.Get()->GetKey();
-    target->DisconnectFromOwner();
-  }
-  mEventTargetObjects.Clear();
-}
-
 // static
 void
 nsGlobalWindowOuter::ShutDown()
 {
   AssertIsOnMainThread();
 
   if (gDumpFile && gDumpFile != stdout) {
     fclose(gDumpFile);
@@ -1036,18 +866,17 @@ nsGlobalWindowOuter::CleanupCachedXBLHan
       mCachedXBLPrototypeHandlers->Count() > 0) {
     mCachedXBLPrototypeHandlers->Clear();
   }
 }
 
 void
 nsGlobalWindowOuter::MaybeForgiveSpamCount()
 {
-  if (IsOuterWindow() &&
-      IsPopupSpamWindow()) {
+  if (IsPopupSpamWindow()) {
     SetIsPopupSpamWindow(false);
   }
 }
 
 void
 nsGlobalWindowOuter::SetIsPopupSpamWindow(bool aIsPopupSpam)
 {
   MOZ_ASSERT(IsOuterWindow());
@@ -1076,18 +905,16 @@ nsGlobalWindowOuter::CleanUp()
 {
   // Guarantee idempotence.
   if (mCleanedUp)
     return;
   mCleanedUp = true;
 
   StartDying();
 
-  DisconnectEventTargetObjects();
-
   MOZ_RELEASE_ASSERT(!mObserver, "mObserver should only be set on the inner window");
 
   if (mNavigator) {
     mNavigator->Invalidate();
     mNavigator = nullptr;
   }
 
   mScreen = nullptr;
@@ -1127,34 +954,24 @@ nsGlobalWindowOuter::CleanUp()
 
   mOpener = nullptr;             // Forces Release
   if (mContext) {
     mContext = nullptr;            // Forces Release
   }
   mChromeEventHandler = nullptr; // Forces Release
   mParentTarget = nullptr;
 
-  if (IsOuterWindow()) {
-    nsGlobalWindowInner* inner = GetCurrentInnerWindowInternal();
-    if (inner) {
-      inner->CleanUp();
-    }
-  }
-
-  if (IsInnerWindow()) {
-    DisableGamepadUpdates();
-    mHasGamepad = false;
-    DisableVRUpdates();
-    mHasVREvents = false;
-    mHasVRDisplayActivateEvents = false;
-  } else {
-    MOZ_ASSERT(!mHasGamepad);
-    MOZ_ASSERT(!mHasVREvents);
-    MOZ_ASSERT(!mHasVRDisplayActivateEvents);
-  }
+  nsGlobalWindowInner* inner = GetCurrentInnerWindowInternal();
+  if (inner) {
+    inner->CleanUp();
+  }
+
+  MOZ_ASSERT(!mHasGamepad);
+  MOZ_ASSERT(!mHasVREvents);
+  MOZ_ASSERT(!mHasVRDisplayActivateEvents);
 
   if (mCleanMessageManager) {
     MOZ_ASSERT(mIsChrome, "only chrome should have msg manager cleaned");
     if (mChromeFields.mMessageManager) {
       static_cast<nsFrameMessageManager*>(
         mChromeFields.mMessageManager.get())->Disconnect();
     }
   }
@@ -1193,137 +1010,31 @@ nsGlobalWindowOuter::ClearControllers()
       if (context)
         context->SetCommandContext(nullptr);
     }
 
     mControllers = nullptr;
   }
 }
 
-void
-nsGlobalWindowOuter::FreeInnerObjects()
-{
-  NS_ASSERTION(IsInnerWindow(), "Don't free inner objects on an outer window");
-
-  // Make sure that this is called before we null out the document and
-  // other members that the window destroyed observers could
-  // re-create.
-  NotifyDOMWindowDestroyed(AssertInner());
-  if (auto* reporter = nsWindowMemoryReporter::Get()) {
-    reporter->ObserveDOMWindowDetached(AssertInner());
-  }
-
-  mInnerObjectsFreed = true;
-
-  // Kill all of the workers for this window.
-  mozilla::dom::workers::CancelWorkersForWindow(AsInner());
-
-  if (mTimeoutManager) {
-    mTimeoutManager->ClearAllTimeouts();
-  }
-
-  if (mIdleTimer) {
-    mIdleTimer->Cancel();
-    mIdleTimer = nullptr;
-  }
-
-  mIdleObservers.Clear();
-
-  mChromeEventHandler = nullptr;
-
-  if (mListenerManager) {
-    mListenerManager->Disconnect();
-    mListenerManager = nullptr;
-  }
-
-  mHistory = nullptr;
-  mCustomElements = nullptr;
-
-  if (mNavigator) {
-    mNavigator->OnNavigation();
-    mNavigator->Invalidate();
-    mNavigator = nullptr;
-  }
-
-  if (mScreen) {
-    mScreen = nullptr;
-  }
-
-#if defined(MOZ_WIDGET_ANDROID)
-  mOrientationChangeObserver = nullptr;
-#endif
-
-  if (mDoc) {
-    // Remember the document's principal and URI.
-    mDocumentPrincipal = mDoc->NodePrincipal();
-    mDocumentURI = mDoc->GetDocumentURI();
-    mDocBaseURI = mDoc->GetDocBaseURI();
-
-    while (mDoc->EventHandlingSuppressed()) {
-      mDoc->UnsuppressEventHandlingAndFireEvents(false);
-    }
-  }
-
-  // Remove our reference to the document and the document principal.
-  mFocusedNode = nullptr;
-
-  if (mApplicationCache) {
-    static_cast<nsDOMOfflineResourceList*>(mApplicationCache.get())->Disconnect();
-    mApplicationCache = nullptr;
-  }
-
-  mIndexedDB = nullptr;
-
-  UnlinkHostObjectURIs();
-
-  NotifyWindowIDDestroyed("inner-window-destroyed");
-
-  CleanupCachedXBLHandlers();
-
-  for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
-    mAudioContexts[i]->Shutdown();
-  }
-  mAudioContexts.Clear();
-
-  DisableGamepadUpdates();
-  mHasGamepad = false;
-  mGamepads.Clear();
-  DisableVRUpdates();
-  mHasVREvents = false;
-  mHasVRDisplayActivateEvents = false;
-  mVRDisplays.Clear();
-
-  if (mTabChild) {
-    while (mBeforeUnloadListenerCount-- > 0) {
-      mTabChild->BeforeUnloadRemoved();
-    }
-  }
-}
-
 //*****************************************************************************
 // nsGlobalWindowOuter::nsISupports
 //*****************************************************************************
 
 // QueryInterface implementation for nsGlobalWindowOuter
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindowOuter)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   // Make sure this matches the cast in nsGlobalWindowOuter::FromWrapper()
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
   NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
   NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
-  if (aIID.Equals(NS_GET_IID(nsPIDOMWindowInner))) {
-    foundInterface = AsInner();
-  } else
-  if (aIID.Equals(NS_GET_IID(mozIDOMWindow)) && IsInnerWindow()) {
-    foundInterface = AsInner();
-  } else
   if (aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
     foundInterface = AsOuter();
   } else
   if (aIID.Equals(NS_GET_IID(mozIDOMWindowProxy)) && IsOuterWindow()) {
     foundInterface = AsOuter();
   } else
   if (aIID.Equals(NS_GET_IID(nsIDOMChromeWindow)) && IsChromeWindow()) {
     foundInterface = static_cast<nsIDOMChromeWindow*>(this);
@@ -1492,17 +1203,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mOuterWindow)
   }
 
   if (tmp->mListenerManager) {
     tmp->mListenerManager->Disconnect();
     NS_IMPL_CYCLE_COLLECTION_UNLINK(mListenerManager)
   }
 
-  tmp->UpdateTopInnerWindow();
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mTopInnerWindow)
 
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocation)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mHistory)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCustomElements)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mLocalStorage)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mSessionStorage)
   if (tmp->mApplicationCache) {
@@ -1920,31 +1630,16 @@ nsresult
 nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
                                nsISupports* aState,
                                bool aForceReuseInnerWindow)
 {
   NS_PRECONDITION(mDocumentPrincipal == nullptr,
                   "mDocumentPrincipal prematurely set!");
   MOZ_ASSERT(aDocument);
 
-  if (IsInnerWindow()) {
-    if (!mOuterWindow) {
-      return NS_ERROR_NOT_INITIALIZED;
-    }
-
-    // Refuse to set a new document if the call came from an inner
-    // window that's not the current inner window.
-    if (mOuterWindow->GetCurrentInnerWindow() != AsInner()) {
-      return NS_ERROR_NOT_AVAILABLE;
-    }
-
-    return GetOuterWindowInternal()->SetNewDocument(aDocument, aState,
-                                                    aForceReuseInnerWindow);
-  }
-
   NS_PRECONDITION(IsOuterWindow(), "Must only be called on outer windows");
 
   // Bail out early if we're in process of closing down the window.
   NS_ENSURE_STATE(!mCleanedUp);
 
   NS_ASSERTION(!AsOuter()->GetCurrentInnerWindow() ||
                AsOuter()->GetCurrentInnerWindow()->GetExtantDoc() == mDoc,
                "Uh, mDoc doesn't match the current inner window "
@@ -2400,46 +2095,16 @@ nsGlobalWindowOuter::DispatchDOMWindowCr
 
 void
 nsGlobalWindowOuter::ClearStatus()
 {
   SetStatusOuter(EmptyString());
 }
 
 void
-nsGlobalWindowOuter::InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument)
-{
-  NS_PRECONDITION(IsInnerWindow(), "Must only be called on inner windows");
-  MOZ_ASSERT(aDocument);
-
-  if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) {
-    nsIURI *uri = aDocument->GetDocumentURI();
-    MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
-            ("DOMWINDOW %p SetNewDocument %s",
-             this, uri ? uri->GetSpecOrDefault().get() : ""));
-  }
-
-  mDoc = aDocument;
-  ClearDocumentDependentSlots(aCx);
-  mFocusedNode = nullptr;
-  mLocalStorage = nullptr;
-  mSessionStorage = nullptr;
-
-#ifdef DEBUG
-  mLastOpenedURI = aDocument->GetDocumentURI();
-#endif
-
-  Telemetry::Accumulate(Telemetry::INNERWINDOWS_WITH_MUTATION_LISTENERS,
-                        mMutationBits ? 1 : 0);
-
-  // Clear our mutation bitfield.
-  mMutationBits = 0;
-}
-
-void
 nsGlobalWindowOuter::SetDocShell(nsIDocShell* aDocShell)
 {
   NS_ASSERTION(IsOuterWindow(), "Uh, SetDocShell() called on inner window!");
   MOZ_ASSERT(aDocShell);
 
   if (aDocShell == mDocShell) {
     return;
   }
@@ -2555,18 +2220,16 @@ nsGlobalWindowOuter::DetachFromDocShell(
   MaybeForgiveSpamCount();
   CleanUp();
 }
 
 void
 nsGlobalWindowOuter::SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
                                 bool aOriginalOpener)
 {
-  FORWARD_TO_OUTER_VOID(SetOpenerWindow, (aOpener, aOriginalOpener));
-
   nsWeakPtr opener = do_GetWeakReference(aOpener);
   if (opener == mOpener) {
     return;
   }
 
   NS_ASSERTION(!aOriginalOpener || !mSetOpenerWindowCalled,
                "aOriginalOpener is true, but not first call to "
                "SetOpenerWindow!");
@@ -2646,56 +2309,17 @@ nsresult
 nsGlobalWindowOuter::WillHandleEvent(EventChainPostVisitor& aVisitor)
 {
   return NS_OK;
 }
 
 nsresult
 nsGlobalWindowOuter::GetEventTargetParent(EventChainPreVisitor& aVisitor)
 {
-  NS_PRECONDITION(IsInnerWindow(),
-                  "GetEventTargetParent is used on outer window!?");
-  EventMessage msg = aVisitor.mEvent->mMessage;
-
-  aVisitor.mCanHandle = true;
-  aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
-  if (msg == eResize && aVisitor.mEvent->IsTrusted()) {
-    // QIing to window so that we can keep the old behavior also in case
-    // a child window is handling resize.
-    nsCOMPtr<nsPIDOMWindowInner> window =
-      do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
-    if (window) {
-      mIsHandlingResizeEvent = true;
-    }
-  } else if (msg == eMouseDown && aVisitor.mEvent->IsTrusted()) {
-    gMouseDown = true;
-  } else if ((msg == eMouseUp || msg == eDragEnd) &&
-             aVisitor.mEvent->IsTrusted()) {
-    gMouseDown = false;
-    if (gDragServiceDisabled) {
-      nsCOMPtr<nsIDragService> ds =
-        do_GetService("@mozilla.org/widget/dragservice;1");
-      if (ds) {
-        gDragServiceDisabled = false;
-        ds->Unsuppress();
-      }
-    }
-  }
-
-  aVisitor.mParentTarget = GetParentTarget();
-
-  // Handle 'active' event.
-  if (!mIdleObservers.IsEmpty() &&
-      aVisitor.mEvent->IsTrusted() &&
-      (aVisitor.mEvent->HasMouseEventMessage() ||
-       aVisitor.mEvent->HasDragEventMessage())) {
-    mAddActiveEventFuzzTime = false;
-  }
-
-  return NS_OK;
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 bool
 nsGlobalWindowOuter::ShouldPromptToBlockDialogs()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   nsGlobalWindowOuter *topWindowOuter = GetScriptableTopInternal();
@@ -2750,22 +2374,16 @@ nsGlobalWindowOuter::AreDialogsEnabled()
   if (!mDoc || (mDoc->GetSandboxFlags() & SANDBOXED_MODALS)) {
     return false;
   }
 
   return topWindow->mAreDialogsEnabled;
 }
 
 bool
-nsGlobalWindowOuter::DialogsAreBeingAbused()
-{
-  MOZ_CRASH("Inner window only");
-}
-
-bool
 nsGlobalWindowOuter::ConfirmDialogIfNeeded()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   NS_ENSURE_TRUE(mDocShell, false);
   nsCOMPtr<nsIPromptService> promptSvc =
     do_GetService("@mozilla.org/embedcomp/prompt-service;1");
 
@@ -2823,108 +2441,17 @@ nsGlobalWindowOuter::EnableDialogs()
   if (topWindow) {
     topWindow->mAreDialogsEnabled = true;
   }
 }
 
 nsresult
 nsGlobalWindowOuter::PostHandleEvent(EventChainPostVisitor& aVisitor)
 {
-  NS_PRECONDITION(IsInnerWindow(), "PostHandleEvent is used on outer window!?");
-
-  // Return early if there is nothing to do.
-  switch (aVisitor.mEvent->mMessage) {
-    case eResize:
-    case eUnload:
-    case eLoad:
-      break;
-    default:
-      return NS_OK;
-  }
-
-  /* mChromeEventHandler and mContext go dangling in the middle of this
-   function under some circumstances (events that destroy the window)
-   without this addref. */
-  nsCOMPtr<nsIDOMEventTarget> kungFuDeathGrip1(mChromeEventHandler);
-  mozilla::Unused << kungFuDeathGrip1; // These aren't referred to through the function
-  nsCOMPtr<nsIScriptContext> kungFuDeathGrip2(GetContextInternal());
-  mozilla::Unused << kungFuDeathGrip2; // These aren't referred to through the function
-
-
-  if (aVisitor.mEvent->mMessage == eResize) {
-    mIsHandlingResizeEvent = false;
-  } else if (aVisitor.mEvent->mMessage == eUnload &&
-             aVisitor.mEvent->IsTrusted()) {
-
-    // If any VR display presentation is active at unload, the next page
-    // will receive a vrdisplayactive event to indicate that it should
-    // immediately begin vr presentation. This should occur when navigating
-    // forwards, navigating backwards, and on page reload.
-    for (const auto& display : mVRDisplays) {
-      if (display->IsPresenting()) {
-        // Save this VR display ID to trigger vrdisplayactivate event
-        // after the next load event.
-        nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-        if (outer) {
-          outer->SetAutoActivateVRDisplayID(display->DisplayId());
-        }
-
-        // XXX The WebVR 1.1 spec does not define which of multiple VR
-        // presenting VR displays will be chosen during navigation.
-        // As the underlying platform VR API's currently only allow a single
-        // VR display, it is safe to choose the first VR display for now.
-        break;
-      }
-    }
-    // Execute bindingdetached handlers before we tear ourselves
-    // down.
-    if (mDoc) {
-      mDoc->BindingManager()->ExecuteDetachedHandlers();
-    }
-    mIsDocumentLoaded = false;
-  } else if (aVisitor.mEvent->mMessage == eLoad &&
-             aVisitor.mEvent->IsTrusted()) {
-    // This is page load event since load events don't propagate to |window|.
-    // @see nsDocument::GetEventTargetParent.
-    mIsDocumentLoaded = true;
-
-    mTimeoutManager->OnDocumentLoaded();
-
-    nsCOMPtr<Element> element = GetOuterWindow()->GetFrameElementInternal();
-    nsIDocShell* docShell = GetDocShell();
-    if (element && GetParentInternal() &&
-        docShell && docShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
-      // If we're not in chrome, or at a chrome boundary, fire the
-      // onload event for the frame element.
-
-      nsEventStatus status = nsEventStatus_eIgnore;
-      WidgetEvent event(aVisitor.mEvent->IsTrusted(), eLoad);
-      event.mFlags.mBubbles = false;
-      event.mFlags.mCancelable = false;
-
-      // Most of the time we could get a pres context to pass in here,
-      // but not always (i.e. if this window is not shown there won't
-      // be a pres context available). Since we're not firing a GUI
-      // event we don't need a pres context anyway so we just pass
-      // null as the pres context all the time here.
-      EventDispatcher::Dispatch(element, nullptr, &event, nullptr, &status);
-    }
-
-    uint32_t autoActivateVRDisplayID = 0;
-    nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-    if (outer) {
-      autoActivateVRDisplayID = outer->GetAutoActivateVRDisplayID();
-    }
-    if (autoActivateVRDisplayID) {
-      DispatchVRDisplayActivate(autoActivateVRDisplayID,
-                                VRDisplayEventReason::Navigation);
-    }
-  }
-
-  return NS_OK;
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 void
 nsGlobalWindowOuter::PoisonOuterWindowProxy(JSObject *aObject)
 {
   MOZ_ASSERT(IsOuterWindow());
   if (aObject == GetWrapperMaybeDead()) {
     PoisonWrapper();
@@ -2953,28 +2480,16 @@ nsGlobalWindowOuter::SetArguments(nsIArr
 
   mArguments = aArguments;
   rv = currentInner->DefineArgumentsProperty(aArguments);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-nsresult
-nsGlobalWindowOuter::DefineArgumentsProperty(nsIArray *aArguments)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  nsIScriptContext *ctx = GetOuterWindowInternal()->mContext;
-  NS_ENSURE_TRUE(aArguments && ctx, NS_ERROR_NOT_INITIALIZED);
-
-  JS::Rooted<JSObject*> obj(RootingCx(), GetWrapperPreserveColor());
-  return ctx->SetProperty(obj, "arguments", aArguments);
-}
-
 //*****************************************************************************
 // nsGlobalWindowOuter::nsIScriptObjectPrincipal
 //*****************************************************************************
 
 nsIPrincipal*
 nsGlobalWindowOuter::GetPrincipal()
 {
   if (mDoc) {
@@ -3047,151 +2562,57 @@ nsPIDOMWindowOuter::GetFrameElementInter
 
 void
 nsPIDOMWindowOuter::SetFrameElementInternal(Element* aFrameElement)
 {
   MOZ_ASSERT(IsOuterWindow());
   mFrameElement = aFrameElement;
 }
 
-nsGlobalWindowInner*
-nsGlobalWindowOuter::Window()
-{
-  return AssertInner();
-}
-
-nsGlobalWindowInner*
-nsGlobalWindowOuter::Self()
-{
-  return AssertInner();
-}
-
-Navigator*
-nsGlobalWindowOuter::Navigator()
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mNavigator) {
-    mNavigator = new mozilla::dom::Navigator(AsInner());
-  }
-
-  return mNavigator;
-}
-
 nsIDOMNavigator*
 nsGlobalWindowOuter::GetNavigator()
 {
   FORWARD_TO_INNER(GetNavigator, (), nullptr);
-
-  return Navigator();
-}
-
-nsScreen*
-nsGlobalWindowOuter::GetScreen(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mScreen) {
-    mScreen = nsScreen::Create(AsInner());
-    if (!mScreen) {
-      aError.Throw(NS_ERROR_UNEXPECTED);
-      return nullptr;
-    }
-  }
-
-  return mScreen;
 }
 
 nsIDOMScreen*
 nsGlobalWindowOuter::GetScreen()
 {
   FORWARD_TO_INNER(GetScreen, (), nullptr);
-
-  ErrorResult dummy;
-  nsIDOMScreen* screen = GetScreen(dummy);
-  dummy.SuppressException();
-  return screen;
-}
-
-nsHistory*
-nsGlobalWindowOuter::GetHistory(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mHistory) {
-    mHistory = new nsHistory(AsInner());
-  }
-
-  return mHistory;
 }
 
 CustomElementRegistry*
 nsGlobalWindowOuter::CustomElements()
 {
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mCustomElements) {
-    mCustomElements = new CustomElementRegistry(AsInner());
-  }
-
-  return mCustomElements;
-}
-
-Performance*
-nsGlobalWindowOuter::GetPerformance()
-{
-  return AsInner()->GetPerformance();
-}
-
-void
-nsGlobalWindowOuter::UpdateTopInnerWindow()
-{
-  if (!IsInnerWindow() || AsInner()->IsTopInnerWindow() || !mTopInnerWindow) {
-    return;
-  }
-
-  mTopInnerWindow->UpdateWebSocketCount(-(int32_t)mNumOfOpenWebSockets);
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 void
 nsPIDOMWindowOuter::MaybeActiveMediaComponents()
 {
-  if (IsInnerWindow()) {
-    return mOuterWindow->MaybeActiveMediaComponents();
-  }
-
   if (mMediaSuspend != nsISuspendedTypes::SUSPENDED_BLOCK) {
     return;
   }
 
   MOZ_LOG(AudioChannelService::GetAudioChannelLog(), LogLevel::Debug,
          ("nsPIDOMWindowOuter, MaybeActiveMediaComponents, "
           "resume the window from blocked, this = %p\n", this));
 
   SetMediaSuspend(nsISuspendedTypes::NONE_SUSPENDED);
 }
 
 SuspendTypes
 nsPIDOMWindowOuter::GetMediaSuspend() const
 {
-  if (IsInnerWindow()) {
-    return mOuterWindow->GetMediaSuspend();
-  }
-
   return mMediaSuspend;
 }
 
 void
 nsPIDOMWindowOuter::SetMediaSuspend(SuspendTypes aSuspend)
 {
-  if (IsInnerWindow()) {
-    mOuterWindow->SetMediaSuspend(aSuspend);
-    return;
-  }
-
   if (!IsDisposableSuspend(aSuspend)) {
     MaybeNotifyMediaResumedFromBlock(aSuspend);
     mMediaSuspend = aSuspend;
   }
 
   RefreshMediaElementsSuspend(aSuspend);
 }
 
@@ -3205,56 +2626,39 @@ nsPIDOMWindowOuter::MaybeNotifyMediaResu
       service->NotifyMediaResumedFromBlock(GetOuterWindow());
     }
   }
 }
 
 bool
 nsPIDOMWindowOuter::GetAudioMuted() const
 {
-  if (IsInnerWindow()) {
-    return mOuterWindow->GetAudioMuted();
-  }
-
   return mAudioMuted;
 }
 
 void
 nsPIDOMWindowOuter::SetAudioMuted(bool aMuted)
 {
-  if (IsInnerWindow()) {
-    mOuterWindow->SetAudioMuted(aMuted);
-    return;
-  }
-
   if (mAudioMuted == aMuted) {
     return;
   }
 
   mAudioMuted = aMuted;
   RefreshMediaElementsVolume();
 }
 
 float
 nsPIDOMWindowOuter::GetAudioVolume() const
 {
-  if (IsInnerWindow()) {
-    return mOuterWindow->GetAudioVolume();
-  }
-
   return mAudioVolume;
 }
 
 nsresult
 nsPIDOMWindowOuter::SetAudioVolume(float aVolume)
 {
-  if (IsInnerWindow()) {
-    return mOuterWindow->SetAudioVolume(aVolume);
-  }
-
   if (aVolume < 0.0) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
   if (mAudioVolume == aVolume) {
     return NS_OK;
   }
 
@@ -3308,45 +2712,16 @@ nsPIDOMWindowOuter::GetServiceWorkersTes
   // iframes get the correct devtools setting.
   nsCOMPtr<nsPIDOMWindowOuter> topWindow = GetScriptableTop();
   if (!topWindow) {
     return false;
   }
   return topWindow->mServiceWorkersTestingEnabled;
 }
 
-// nsISpeechSynthesisGetter
-
-#ifdef MOZ_WEBSPEECH
-SpeechSynthesis*
-nsGlobalWindowOuter::GetSpeechSynthesis(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mSpeechSynthesis) {
-    mSpeechSynthesis = new SpeechSynthesis(AsInner());
-  }
-
-  return mSpeechSynthesis;
-}
-
-bool
-nsGlobalWindowOuter::HasActiveSpeechSynthesis()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (mSpeechSynthesis) {
-    return !mSpeechSynthesis->HasEmptyQueue();
-  }
-
-  return false;
-}
-
-#endif
-
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::GetParentOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
     return nullptr;
   }
@@ -3356,47 +2731,37 @@ nsGlobalWindowOuter::GetParentOuter()
     parent = AsOuter();
   } else {
     parent = GetParent();
   }
 
   return parent.forget();
 }
 
-already_AddRefed<nsPIDOMWindowOuter>
-nsGlobalWindowOuter::GetParent(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetParentOuter, (), aError, nullptr);
-}
-
 /**
  * GetScriptableParent is called when script reads window.parent.
  *
  * In contrast to GetRealParent, GetScriptableParent respects <iframe
  * mozbrowser> boundaries, so if |this| is contained by an <iframe
  * mozbrowser>, we will return |this| as its own parent.
  */
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetScriptableParent()
 {
-  FORWARD_TO_OUTER(GetScriptableParent, (), nullptr);
-
   nsCOMPtr<nsPIDOMWindowOuter> parent = GetParentOuter();
   return parent.get();
 }
 
 /**
  * Behavies identically to GetScriptableParent extept that it returns null
  * if GetScriptableParent would return this window.
  */
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetScriptableParentOrNull()
 {
-  FORWARD_TO_OUTER(GetScriptableParentOrNull, (), nullptr);
-
   nsPIDOMWindowOuter* parent = GetScriptableParent();
   return (nsGlobalWindowOuter::Cast(parent) == this) ? nullptr : parent;
 }
 
 /**
  * nsPIDOMWindow::GetParent (when called from C++) is just a wrapper around
  * GetRealParent.
  */
@@ -3461,17 +2826,16 @@ GetTopImpl(nsGlobalWindowOuter* aWin, ns
  *
  * In contrast to GetRealTop, GetScriptableTop respects <iframe mozbrowser>
  * boundaries.  If we encounter a window owned by an <iframe mozbrowser> while
  * walking up the window hierarchy, we'll stop and return that window.
  */
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetScriptableTop()
 {
-  FORWARD_TO_OUTER(GetScriptableTop, (), nullptr);
   nsCOMPtr<nsPIDOMWindowOuter> window;
   GetTopImpl(AssertOuter(), getter_AddRefs(window), /* aScriptable = */ true);
   return window.get();
 }
 
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::GetTop()
 {
@@ -3504,26 +2868,16 @@ nsGlobalWindowOuter::GetContentOuter(JSC
 
     aRetval.set(&val.toObject());
     return;
   }
 
   aRetval.set(nullptr);
 }
 
-void
-nsGlobalWindowOuter::GetContent(JSContext* aCx,
-                           JS::MutableHandle<JSObject*> aRetval,
-                           CallerType aCallerType,
-                           ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetContentOuter,
-                            (aCx, aRetval, aCallerType, aError), aError, );
-}
-
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::GetContentInternal(ErrorResult& aError, CallerType aCallerType)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   // First check for a named frame named "content"
   nsCOMPtr<nsPIDOMWindowOuter> domWindow =
     GetChildWindow(NS_LITERAL_STRING("content"));
@@ -3571,140 +2925,39 @@ nsGlobalWindowOuter::GetContentInternal(
   if (!primaryContent) {
     return nullptr;
   }
 
   domWindow = primaryContent->GetWindow();
   return domWindow.forget();
 }
 
-MozSelfSupport*
-nsGlobalWindowOuter::GetMozSelfSupport(ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (mMozSelfSupport) {
-    return mMozSelfSupport;
-  }
-
-  // We're called from JS and want to use out existing JSContext (and,
-  // importantly, its compartment!) here.
-  AutoJSContext cx;
-  GlobalObject global(cx, FastGetGlobalJSObject());
-  mMozSelfSupport = MozSelfSupport::Constructor(global, cx, aError);
-  return mMozSelfSupport;
-}
-
 nsresult
 nsGlobalWindowOuter::GetPrompter(nsIPrompt** aPrompt)
 {
-  if (IsInnerWindow()) {
-    nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-    if (!outer) {
-      NS_WARNING("No outer window available!");
-      return NS_ERROR_NOT_INITIALIZED;
-    }
-    return outer->GetPrompter(aPrompt);
-  }
-
   if (!mDocShell)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIPrompt> prompter(do_GetInterface(mDocShell));
   NS_ENSURE_TRUE(prompter, NS_ERROR_NO_INTERFACE);
 
   prompter.forget(aPrompt);
   return NS_OK;
 }
 
-BarProp*
-nsGlobalWindowOuter::GetMenubar(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mMenubar) {
-    mMenubar = new MenubarProp(AssertInner());
-  }
-
-  return mMenubar;
-}
-
-BarProp*
-nsGlobalWindowOuter::GetToolbar(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mToolbar) {
-    mToolbar = new ToolbarProp(AssertInner());
-  }
-
-  return mToolbar;
-}
-
-BarProp*
-nsGlobalWindowOuter::GetLocationbar(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mLocationbar) {
-    mLocationbar = new LocationbarProp(AssertInner());
-  }
-  return mLocationbar;
-}
-
-BarProp*
-nsGlobalWindowOuter::GetPersonalbar(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mPersonalbar) {
-    mPersonalbar = new PersonalbarProp(AssertInner());
-  }
-  return mPersonalbar;
-}
-
-BarProp*
-nsGlobalWindowOuter::GetStatusbar(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mStatusbar) {
-    mStatusbar = new StatusbarProp(AssertInner());
-  }
-  return mStatusbar;
-}
-
-BarProp*
-nsGlobalWindowOuter::GetScrollbars(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mScrollbars) {
-    mScrollbars = new ScrollbarsProp(AssertInner());
-  }
-
-  return mScrollbars;
-}
-
 bool
 nsGlobalWindowOuter::GetClosedOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   // If someone called close(), or if we don't have a docshell, we're closed.
   return mIsClosed || !mDocShell;
 }
 
 bool
-nsGlobalWindowOuter::GetClosed(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetClosedOuter, (), aError, false);
-}
-
-bool
 nsGlobalWindowOuter::Closed()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   return GetClosedOuter();
 }
 
 nsDOMWindowList*
@@ -3717,258 +2970,35 @@ nsGlobalWindowOuter::GetWindowList()
   }
 
   return mFrames;
 }
 
 already_AddRefed<nsIDOMWindowCollection>
 nsGlobalWindowOuter::GetFrames()
 {
-  FORWARD_TO_OUTER(GetFrames, (), nullptr);
-
   nsCOMPtr<nsIDOMWindowCollection> frames = GetWindowList();
   return frames.forget();
 }
 
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::IndexedGetterOuter(uint32_t aIndex)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   nsDOMWindowList* windows = GetWindowList();
   NS_ENSURE_TRUE(windows, nullptr);
 
   return windows->IndexedGetter(aIndex);
 }
 
-already_AddRefed<nsPIDOMWindowOuter>
-nsGlobalWindowOuter::IndexedGetter(uint32_t aIndex)
-{
-  FORWARD_TO_OUTER(IndexedGetterOuter, (aIndex), nullptr);
-  MOZ_CRASH();
-}
-
-bool
-nsGlobalWindowOuter::DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
-                          JS::Handle<jsid> aId,
-                          JS::MutableHandle<JS::PropertyDescriptor> aDesc)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // Note: Keep this in sync with MayResolve.
-
-  // Note: The infallibleInit call in GlobalResolve depends on this check.
-  if (!JSID_IS_STRING(aId)) {
-    return true;
-  }
-
-  bool found;
-  if (!WebIDLGlobalNameHash::DefineIfEnabled(aCx, aObj, aId, aDesc, &found)) {
-    return false;
-  }
-
-  if (found) {
-    return true;
-  }
-
-  nsresult rv = nsWindowSH::GlobalResolve(AssertInner(), aCx, aObj, aId, aDesc);
-  if (NS_FAILED(rv)) {
-    return Throw(aCx, rv);
-  }
-
-  return true;
-}
-
-/* static */
-bool
-nsGlobalWindowOuter::MayResolve(jsid aId)
-{
-  // Note: This function does not fail and may not have any side-effects.
-  // Note: Keep this in sync with DoResolve.
-  if (!JSID_IS_STRING(aId)) {
-    return false;
-  }
-
-  if (aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_COMPONENTS)) {
-    return true;
-  }
-
-  if (aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS) ||
-      aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_CONTROLLERS_CLASS)) {
-    // We only resolve .controllers/.Controllers in release builds and on non-chrome
-    // windows, but let's not worry about any of that stuff.
-    return true;
-  }
-
-  if (WebIDLGlobalNameHash::MayResolve(aId)) {
-    return true;
-  }
-
-  nsScriptNameSpaceManager *nameSpaceManager = PeekNameSpaceManager();
-  if (!nameSpaceManager) {
-    // Really shouldn't happen.  Fail safe.
-    return true;
-  }
-
-  nsAutoString name;
-  AssignJSFlatString(name, JSID_TO_FLAT_STRING(aId));
-
-  return nameSpaceManager->LookupName(name);
-}
-
-void
-nsGlobalWindowOuter::GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
-                                    bool aEnumerableOnly, ErrorResult& aRv)
-{
-  if (aEnumerableOnly) {
-    // The names we would return from here get defined on the window via one of
-    // two codepaths.  The ones coming from the WebIDLGlobalNameHash will end up
-    // in the DefineConstructor function in BindingUtils, which always defines
-    // things as non-enumerable.  The ones coming from the script namespace
-    // manager get defined by nsDOMClassInfo::PostCreatePrototype calling
-    // ResolvePrototype and using the resulting descriptot to define the
-    // property.  ResolvePrototype always passes 0 to the FillPropertyDescriptor
-    // for the property attributes, so all those are non-enumerable as well.
-    //
-    // So in the aEnumerableOnly case we have nothing to do.
-    return;
-  }
-
-  MOZ_ASSERT(IsInnerWindow());
-  // "Components" is marked as enumerable but only resolved on demand :-/.
-  //aNames.AppendElement(NS_LITERAL_STRING("Components"));
-
-  nsScriptNameSpaceManager* nameSpaceManager = GetNameSpaceManager();
-  if (nameSpaceManager) {
-    JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
-
-    // There are actually two ways we can get called here: For normal
-    // enumeration or for Xray enumeration.  In the latter case, we want to
-    // return all possible WebIDL names, because we don't really support
-    // deleting these names off our Xray; trying to resolve them will just make
-    // them come back.  In the former case, we want to avoid returning deleted
-    // names.  But the JS engine already knows about the non-deleted
-    // already-resolved names, so we can just return the so-far-unresolved ones.
-    //
-    // We can tell which case we're in by whether aCx is in our wrapper's
-    // compartment.  If not, we're in the Xray case.
-    WebIDLGlobalNameHash::NameType nameType =
-      js::IsObjectInContextCompartment(wrapper, aCx) ?
-        WebIDLGlobalNameHash::UnresolvedNamesOnly :
-        WebIDLGlobalNameHash::AllNames;
-    if (!WebIDLGlobalNameHash::GetNames(aCx, wrapper, nameType, aNames)) {
-      aRv.NoteJSContextException(aCx);
-    }
-
-    for (auto i = nameSpaceManager->GlobalNameIter(); !i.Done(); i.Next()) {
-      const GlobalNameMapEntry* entry = i.Get();
-      if (nsWindowSH::NameStructEnabled(aCx, AssertInner(), entry->mKey,
-                                        entry->mGlobalName)) {
-        // Just append all of these; even if they get deleted our resolve hook
-        // just goes ahead and recreates them.
-        JSString* str = JS_AtomizeUCStringN(aCx,
-                                            entry->mKey.BeginReading(),
-                                            entry->mKey.Length());
-        if (!str || !aNames.append(NON_INTEGER_ATOM_TO_JSID(str))) {
-          aRv.NoteJSContextException(aCx);
-          return;
-        }
-      }
-    }
-  }
-}
-
-/* static */ bool
-nsGlobalWindowOuter::IsPrivilegedChromeWindow(JSContext* aCx, JSObject* aObj)
-{
-  // For now, have to deal with XPConnect objects here.
-  return xpc::WindowOrNull(aObj)->IsChromeWindow() &&
-         nsContentUtils::ObjectPrincipal(aObj) == nsContentUtils::GetSystemPrincipal();
-}
-
-/* static */ bool
-nsGlobalWindowOuter::IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* aObj)
-{
-  // The requestIdleCallback should always be enabled for system code.
-  return nsContentUtils::RequestIdleCallbackEnabled() ||
-         nsContentUtils::IsSystemCaller(aCx);
-}
-
-nsIDOMOfflineResourceList*
-nsGlobalWindowOuter::GetApplicationCache(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mApplicationCache) {
-    nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetDocShell()));
-    if (!webNav || !mDoc) {
-      aError.Throw(NS_ERROR_FAILURE);
-      return nullptr;
-    }
-
-    nsCOMPtr<nsIURI> uri;
-    aError = webNav->GetCurrentURI(getter_AddRefs(uri));
-    if (aError.Failed()) {
-      return nullptr;
-    }
-
-    nsCOMPtr<nsIURI> manifestURI;
-    nsContentUtils::GetOfflineAppManifest(mDoc, getter_AddRefs(manifestURI));
-
-    RefPtr<nsDOMOfflineResourceList> applicationCache =
-      new nsDOMOfflineResourceList(manifestURI, uri, mDoc->NodePrincipal(),
-                                   AsInner());
-
-    applicationCache->Init();
-
-    mApplicationCache = applicationCache;
-  }
-
-  return mApplicationCache;
-}
-
 already_AddRefed<nsIDOMOfflineResourceList>
 nsGlobalWindowOuter::GetApplicationCache()
 {
   FORWARD_TO_INNER(GetApplicationCache, (), nullptr);
-
-  ErrorResult dummy;
-  nsCOMPtr<nsIDOMOfflineResourceList> applicationCache =
-    GetApplicationCache(dummy);
-  dummy.SuppressException();
-  return applicationCache.forget();
-}
-
-Crypto*
-nsGlobalWindowOuter::GetCrypto(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mCrypto) {
-    mCrypto = new Crypto();
-    mCrypto->Init(this);
-  }
-  return mCrypto;
-}
-
-mozilla::dom::U2F*
-nsGlobalWindowOuter::GetU2f(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mU2F) {
-    RefPtr<U2F> u2f = new U2F(AsInner());
-    u2f->Init(aError);
-    if (NS_WARN_IF(aError.Failed())) {
-      return nullptr;
-    }
-
-    mU2F = u2f;
-  }
-  return mU2F;
 }
 
 nsIControllers*
 nsGlobalWindowOuter::GetControllersOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mControllers) {
@@ -3995,32 +3025,20 @@ nsGlobalWindowOuter::GetControllersOuter
     }
 
     controllerContext->SetCommandContext(static_cast<nsIDOMWindow*>(this));
   }
 
   return mControllers;
 }
 
-nsIControllers*
-nsGlobalWindowOuter::GetControllers(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetControllersOuter, (aError), aError, nullptr);
-}
-
 nsresult
 nsGlobalWindowOuter::GetControllers(nsIControllers** aResult)
 {
   FORWARD_TO_INNER(GetControllers, (aResult), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  nsCOMPtr<nsIControllers> controllers = GetControllers(rv);
-  controllers.forget(aResult);
-
-  return rv.StealNSResult();
 }
 
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetSanitizedOpener(nsPIDOMWindowOuter* aOpener)
 {
   if (!aOpener) {
     return nullptr;
   }
@@ -4072,113 +3090,32 @@ nsGlobalWindowOuter::GetOpenerWindowOute
       return nullptr;
     }
     return opener;
   }
 
   return GetSanitizedOpener(opener);
 }
 
-nsPIDOMWindowOuter*
-nsGlobalWindowOuter::GetOpenerWindow(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetOpenerWindowOuter, (), aError, nullptr);
-}
-
-void
-nsGlobalWindowOuter::GetOpener(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
-                          ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsPIDOMWindowOuter> opener = GetOpenerWindow(aError);
-  if (aError.Failed() || !opener) {
-    aRetval.setNull();
-    return;
-  }
-
-  aError = nsContentUtils::WrapNative(aCx, opener, aRetval);
-}
-
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::GetOpener()
 {
-  FORWARD_TO_OUTER(GetOpener, (), nullptr);
-
   nsCOMPtr<nsPIDOMWindowOuter> opener = GetOpenerWindowOuter();
   return opener.forget();
 }
 
 void
-nsGlobalWindowOuter::SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
-                          ErrorResult& aError)
-{
-  // Check if we were called from a privileged chrome script.  If not, and if
-  // aOpener is not null, just define aOpener on our inner window's JS object,
-  // wrapped into the current compartment so that for Xrays we define on the
-  // Xray expando object, but don't set it on the outer window, so that it'll
-  // get reset on navigation.  This is just like replaceable properties, but
-  // we're not quite readonly.
-  if (!aOpener.isNull() && !nsContentUtils::IsCallerChrome()) {
-    RedefineProperty(aCx, "opener", aOpener, aError);
-    return;
-  }
-
-  if (!aOpener.isObjectOrNull()) {
-    // Chrome code trying to set some random value as opener
-    aError.Throw(NS_ERROR_INVALID_ARG);
-    return;
-  }
-
-  nsPIDOMWindowInner* win = nullptr;
-  if (aOpener.isObject()) {
-    JSObject* unwrapped = js::CheckedUnwrap(&aOpener.toObject(),
-                                            /* stopAtWindowProxy = */ false);
-    if (!unwrapped) {
-      aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
-      return;
-    }
-
-    auto* globalWindow = xpc::WindowOrNull(unwrapped);
-    if (!globalWindow) {
-      // Wasn't a window
-      aError.Throw(NS_ERROR_INVALID_ARG);
-      return;
-    }
-
-    win = globalWindow->AsInner();
-  }
-
-  nsPIDOMWindowOuter* outer = nullptr;
-  if (win) {
-    if (!win->IsCurrentInnerWindow()) {
-      aError.Throw(NS_ERROR_FAILURE);
-      return;
-    }
-    outer = win->GetOuterWindow();
-  }
-
-  SetOpenerWindow(outer, false);
-}
-
-void
 nsGlobalWindowOuter::GetStatusOuter(nsAString& aStatus)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   aStatus = mStatus;
 }
 
 void
-nsGlobalWindowOuter::GetStatus(nsAString& aStatus, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetStatusOuter, (aStatus), aError, );
-}
-
-void
 nsGlobalWindowOuter::SetStatusOuter(const nsAString& aStatus)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   mStatus = aStatus;
 
   /*
    * If caller is not chrome and dom.disable_window_status_change is true,
@@ -4192,53 +3129,35 @@ nsGlobalWindowOuter::SetStatusOuter(cons
   nsCOMPtr<nsIWebBrowserChrome> browserChrome = GetWebBrowserChrome();
   if (browserChrome) {
     browserChrome->SetStatus(nsIWebBrowserChrome::STATUS_SCRIPT,
                              PromiseFlatString(aStatus).get());
   }
 }
 
 void
-nsGlobalWindowOuter::SetStatus(const nsAString& aStatus, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetStatusOuter, (aStatus), aError, );
-}
-
-void
 nsGlobalWindowOuter::GetNameOuter(nsAString& aName)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (mDocShell) {
     mDocShell->GetName(aName);
   }
 }
 
 void
-nsGlobalWindowOuter::GetName(nsAString& aName, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetNameOuter, (aName), aError, );
-}
-
-void
 nsGlobalWindowOuter::SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (mDocShell) {
     aError = mDocShell->SetName(aName);
   }
 }
 
-void
-nsGlobalWindowOuter::SetName(const nsAString& aName, mozilla::ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetNameOuter, (aName, aError), aError, );
-}
-
 // Helper functions used by many methods below.
 int32_t
 nsGlobalWindowOuter::DevToCSSIntPixels(int32_t px)
 {
   if (!mDocShell)
     return px; // assume 1:1
 
   RefPtr<nsPresContext> presContext;
@@ -4339,46 +3258,20 @@ nsGlobalWindowOuter::GetInnerWidthOuter(
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   CSSIntSize size;
   aError = GetInnerSize(size);
   return size.width;
 }
 
-int32_t
-nsGlobalWindowOuter::GetInnerWidth(CallerType aCallerType, ErrorResult& aError)
-{
-  // We ignore aCallerType; we only have that argument because some other things
-  // called by GetReplaceableWindowCoord need it.  If this ever changes, fix
-  //   nsresult nsGlobalWindowOuter::GetInnerWidth(int32_t* aInnerWidth)
-  // to actually take a useful CallerType and pass it in here.
-  FORWARD_TO_OUTER_OR_THROW(GetInnerWidthOuter, (aError), aError, 0);
-}
-
-void
-nsGlobalWindowOuter::GetInnerWidth(JSContext* aCx,
-                              JS::MutableHandle<JS::Value> aValue,
-                              CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  GetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::GetInnerWidth, aValue,
-                            aCallerType, aError);
-}
-
 nsresult
 nsGlobalWindowOuter::GetInnerWidth(int32_t* aInnerWidth)
 {
   FORWARD_TO_INNER(GetInnerWidth, (aInnerWidth), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  // Callee doesn't care about the caller type, but play it safe.
-  *aInnerWidth = GetInnerWidth(CallerType::NonSystem, rv);
-
-  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindowOuter::SetInnerWidthOuter(int32_t aInnerWidth,
                                    CallerType aCallerType,
                                    ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
@@ -4409,73 +3302,30 @@ nsGlobalWindowOuter::SetInnerWidthOuter(
   int32_t height = 0;
   int32_t unused  = 0;
 
   nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
   docShellAsWin->GetSize(&unused, &height);
   aError = SetDocShellWidthAndHeight(CSSToDevIntPixels(aInnerWidth), height);
 }
 
-void
-nsGlobalWindowOuter::SetInnerWidth(int32_t aInnerWidth, CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetInnerWidthOuter,
-                            (aInnerWidth, aCallerType, aError), aError, );
-}
-
-void
-nsGlobalWindowOuter::SetInnerWidth(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                              CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  SetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::SetInnerWidth,
-                            aValue, "innerWidth", aCallerType, aError);
-}
-
 int32_t
 nsGlobalWindowOuter::GetInnerHeightOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   CSSIntSize size;
   aError = GetInnerSize(size);
   return size.height;
 }
 
-int32_t
-nsGlobalWindowOuter::GetInnerHeight(CallerType aCallerType, ErrorResult& aError)
-{
-  // We ignore aCallerType; we only have that argument because some other things
-  // called by GetReplaceableWindowCoord need it.  If this ever changes, fix
-  //   nsresult nsGlobalWindowOuter::GetInnerHeight(int32_t* aInnerWidth)
-  // to actually take a useful CallerType and pass it in here.
-  FORWARD_TO_OUTER_OR_THROW(GetInnerHeightOuter, (aError), aError, 0);
-}
-
-void
-nsGlobalWindowOuter::GetInnerHeight(JSContext* aCx,
-                              JS::MutableHandle<JS::Value> aValue,
-                              CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  GetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::GetInnerHeight, aValue,
-                            aCallerType, aError);
-}
-
 nsresult
 nsGlobalWindowOuter::GetInnerHeight(int32_t* aInnerHeight)
 {
   FORWARD_TO_INNER(GetInnerHeight, (aInnerHeight), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  // Callee doesn't care about the caller type, but play it safe.
-  *aInnerHeight = GetInnerHeight(CallerType::NonSystem, rv);
-
-  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindowOuter::SetInnerHeightOuter(int32_t aInnerHeight,
                                     CallerType aCallerType,
                                     ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
@@ -4505,33 +3355,16 @@ nsGlobalWindowOuter::SetInnerHeightOuter
   int32_t width  = 0;
 
   nsCOMPtr<nsIBaseWindow> docShellAsWin(do_QueryInterface(mDocShell));
   docShellAsWin->GetSize(&width, &height);
   CheckSecurityWidthAndHeight(nullptr, &aInnerHeight, aCallerType);
   aError = SetDocShellWidthAndHeight(width, CSSToDevIntPixels(aInnerHeight));
 }
 
-void
-nsGlobalWindowOuter::SetInnerHeight(int32_t aInnerHeight,
-                               CallerType aCallerType,
-                               ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetInnerHeightOuter,
-                            (aInnerHeight, aCallerType, aError), aError, );
-}
-
-void
-nsGlobalWindowOuter::SetInnerHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                               CallerType aCallerType, ErrorResult& aError)
-{
-  SetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::SetInnerHeight,
-                            aValue, "innerHeight", aCallerType, aError);
-}
-
 nsIntSize
 nsGlobalWindowOuter::GetOuterSize(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (nsContentUtils::ResistFingerprinting(aCallerType)) {
     CSSIntSize size;
     aError = GetInnerSize(size);
@@ -4556,56 +3389,22 @@ nsGlobalWindowOuter::GetOuterSize(Caller
 int32_t
 nsGlobalWindowOuter::GetOuterWidthOuter(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   return GetOuterSize(aCallerType, aError).width;
 }
 
 int32_t
-nsGlobalWindowOuter::GetOuterWidth(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetOuterWidthOuter, (aCallerType, aError),
-                            aError, 0);
-}
-
-void
-nsGlobalWindowOuter::GetOuterWidth(JSContext* aCx,
-                              JS::MutableHandle<JS::Value> aValue,
-                              CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  GetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::GetOuterWidth, aValue,
-                            aCallerType, aError);
-}
-
-int32_t
 nsGlobalWindowOuter::GetOuterHeightOuter(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   return GetOuterSize(aCallerType, aError).height;
 }
 
-int32_t
-nsGlobalWindowOuter::GetOuterHeight(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetOuterHeightOuter, (aCallerType, aError),
-                            aError, 0);
-}
-
-void
-nsGlobalWindowOuter::GetOuterHeight(JSContext* aCx,
-                               JS::MutableHandle<JS::Value> aValue,
-                               CallerType aCallerType,
-                               ErrorResult& aError)
-{
-  GetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::GetOuterHeight, aValue,
-                            aCallerType, aError);
-}
-
 void
 nsGlobalWindowOuter::SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
                              CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
   if (!treeOwnerAsWin) {
@@ -4640,61 +3439,25 @@ nsGlobalWindowOuter::SetOuterWidthOuter(
                                    ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   SetOuterSize(aOuterWidth, true, aCallerType, aError);
 }
 
 void
-nsGlobalWindowOuter::SetOuterWidth(int32_t aOuterWidth,
-                              CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetOuterWidthOuter,
-                            (aOuterWidth, aCallerType, aError), aError, );
-}
-
-void
-nsGlobalWindowOuter::SetOuterWidth(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                              CallerType aCallerType,
-                              ErrorResult& aError)
-{
-  SetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::SetOuterWidth,
-                            aValue, "outerWidth", aCallerType, aError);
-}
-
-void
 nsGlobalWindowOuter::SetOuterHeightOuter(int32_t aOuterHeight,
                                     CallerType aCallerType,
                                     ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   SetOuterSize(aOuterHeight, false, aCallerType, aError);
 }
 
-void
-nsGlobalWindowOuter::SetOuterHeight(int32_t aOuterHeight,
-                               CallerType aCallerType,
-                               ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetOuterHeightOuter,
-                            (aOuterHeight, aCallerType, aError), aError, );
-}
-
-void
-nsGlobalWindowOuter::SetOuterHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                               CallerType aCallerType,
-                               ErrorResult& aError)
-{
-  SetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::SetOuterHeight,
-                            aValue, "outerHeight", aCallerType, aError);
-}
-
 CSSIntPoint
 nsGlobalWindowOuter::GetScreenXY(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   // When resisting fingerprinting, always return (0,0)
   if (nsContentUtils::ResistFingerprinting(aCallerType)) {
     return CSSIntPoint(0, 0);
@@ -4741,32 +3504,16 @@ nsGlobalWindowOuter::GetScreenXY(CallerT
 int32_t
 nsGlobalWindowOuter::GetScreenXOuter(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   return GetScreenXY(aCallerType, aError).x;
 }
 
-int32_t
-nsGlobalWindowOuter::GetScreenX(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetScreenXOuter, (aCallerType, aError), aError, 0);
-}
-
-void
-nsGlobalWindowOuter::GetScreenX(JSContext* aCx,
-                           JS::MutableHandle<JS::Value> aValue,
-                           CallerType aCallerType,
-                           ErrorResult& aError)
-{
-  GetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::GetScreenX, aValue,
-                            aCallerType, aError);
-}
-
 nsRect
 nsGlobalWindowOuter::GetInnerScreenRect()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
     return nsRect();
   }
@@ -4799,41 +3546,29 @@ nsGlobalWindowOuter::GetMozInnerScreenXO
     return 0.0;
   }
 
   nsRect r = GetInnerScreenRect();
   return nsPresContext::AppUnitsToFloatCSSPixels(r.x);
 }
 
 float
-nsGlobalWindowOuter::GetMozInnerScreenX(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetMozInnerScreenXOuter, (aCallerType), aError, 0);
-}
-
-float
 nsGlobalWindowOuter::GetMozInnerScreenYOuter(CallerType aCallerType)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   // Return 0 to prevent fingerprinting.
   if (nsContentUtils::ResistFingerprinting(aCallerType)) {
     return 0.0;
   }
 
   nsRect r = GetInnerScreenRect();
   return nsPresContext::AppUnitsToFloatCSSPixels(r.y);
 }
 
-float
-nsGlobalWindowOuter::GetMozInnerScreenY(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetMozInnerScreenYOuter, (aCallerType), aError, 0);
-}
-
 double
 nsGlobalWindowOuter::GetDevicePixelRatioOuter(CallerType aCallerType)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
     return 1.0;
   }
@@ -4853,22 +3588,16 @@ nsGlobalWindowOuter::GetDevicePixelRatio
   if (overrideDPPX > 0) {
     return overrideDPPX;
   }
 
   return double(nsPresContext::AppUnitsPerCSSPixel()) /
          double(presContext->AppUnitsPerDevPixel());
 }
 
-double
-nsGlobalWindowOuter::GetDevicePixelRatio(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetDevicePixelRatioOuter, (aCallerType), aError, 0.0);
-}
-
 float
 nsPIDOMWindowOuter::GetDevicePixelRatio(CallerType aCallerType)
 {
   return nsGlobalWindowOuter::Cast(this)->GetDevicePixelRatioOuter(aCallerType);
 }
 
 uint64_t
 nsGlobalWindowOuter::GetMozPaintCountOuter()
@@ -4878,78 +3607,29 @@ nsGlobalWindowOuter::GetMozPaintCountOut
   if (!mDocShell) {
     return 0;
   }
 
   nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
   return presShell ? presShell->GetPaintCount() : 0;
 }
 
-uint64_t
-nsGlobalWindowOuter::GetMozPaintCount(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetMozPaintCountOuter, (), aError, 0);
-}
-
-int32_t
-nsGlobalWindowOuter::RequestAnimationFrame(FrameRequestCallback& aCallback,
-                                      ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mDoc) {
-    return 0;
-  }
-
-  if (GetWrapperPreserveColor()) {
-    js::NotifyAnimationActivity(GetWrapperPreserveColor());
-  }
-
-  int32_t handle;
-  aError = mDoc->ScheduleFrameRequestCallback(aCallback, &handle);
-  return handle;
-}
-
-void
-nsGlobalWindowOuter::CancelAnimationFrame(int32_t aHandle, ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mDoc) {
-    return;
-  }
-
-  mDoc->CancelFrameRequestCallback(aHandle);
-}
-
 already_AddRefed<MediaQueryList>
 nsGlobalWindowOuter::MatchMediaOuter(const nsAString& aMediaQueryList,
                                 CallerType aCallerType)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDoc) {
     return nullptr;
   }
 
   return mDoc->MatchMedia(aMediaQueryList, aCallerType);
 }
 
-already_AddRefed<MediaQueryList>
-nsGlobalWindowOuter::MatchMedia(const nsAString& aMediaQueryList,
-                           CallerType aCallerType,
-                           ErrorResult& aError)
-{
-  // FIXME: This whole forward-to-outer and then get a pres
-  // shell/context off the docshell dance is sort of silly; it'd make
-  // more sense to forward to the inner, but it's what everyone else
-  // (GetSelection, GetScrollXY, etc.) does around here.
-  FORWARD_TO_OUTER_OR_THROW(MatchMediaOuter, (aMediaQueryList, aCallerType), aError, nullptr);
-}
-
 void
 nsGlobalWindowOuter::SetScreenXOuter(int32_t aScreenX,
                                 CallerType aCallerType,
                                 ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
@@ -4967,55 +3647,24 @@ nsGlobalWindowOuter::SetScreenXOuter(int
   CheckSecurityLeftAndTop(&aScreenX, nullptr, aCallerType);
   x = CSSToDevIntPixels(aScreenX);
 
   aError = treeOwnerAsWin->SetPosition(x, y);
 
   CheckForDPIChange();
 }
 
-void
-nsGlobalWindowOuter::SetScreenX(int32_t aScreenX,
-                           CallerType aCallerType,
-                           ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetScreenXOuter,
-                            (aScreenX, aCallerType, aError), aError, );
-}
-
-void
-nsGlobalWindowOuter::SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                           CallerType aCallerType, ErrorResult& aError)
-{
-  SetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::SetScreenX,
-                            aValue, "screenX", aCallerType, aError);
-}
-
 int32_t
 nsGlobalWindowOuter::GetScreenYOuter(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   return GetScreenXY(aCallerType, aError).y;
 }
 
-int32_t
-nsGlobalWindowOuter::GetScreenY(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetScreenYOuter, (aCallerType, aError), aError, 0);
-}
-
-void
-nsGlobalWindowOuter::GetScreenY(JSContext* aCx,
-                           JS::MutableHandle<JS::Value> aValue,
-                           CallerType aCallerType, ErrorResult& aError)
-{
-  GetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::GetScreenY, aValue,
-                            aCallerType, aError);
-}
 
 void
 nsGlobalWindowOuter::SetScreenYOuter(int32_t aScreenY,
                                 CallerType aCallerType,
                                 ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
@@ -5034,34 +3683,16 @@ nsGlobalWindowOuter::SetScreenYOuter(int
   CheckSecurityLeftAndTop(nullptr, &aScreenY, aCallerType);
   y = CSSToDevIntPixels(aScreenY);
 
   aError = treeOwnerAsWin->SetPosition(x, y);
 
   CheckForDPIChange();
 }
 
-void
-nsGlobalWindowOuter::SetScreenY(int32_t aScreenY,
-                           CallerType aCallerType,
-                           ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetScreenYOuter,
-                            (aScreenY, aCallerType, aError), aError, );
-}
-
-void
-nsGlobalWindowOuter::SetScreenY(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                           CallerType aCallerType,
-                           ErrorResult& aError)
-{
-  SetReplaceableWindowCoord(aCx, &nsGlobalWindowOuter::SetScreenY,
-                            aValue, "screenY", aCallerType, aError);
-}
-
 // NOTE: Arguments to this function should have values scaled to
 // CSS pixels, not device pixels.
 void
 nsGlobalWindowOuter::CheckSecurityWidthAndHeight(int32_t* aWidth, int32_t* aHeight,
                                             CallerType aCallerType)
 {
   MOZ_ASSERT(IsOuterWindow());
 
@@ -5209,44 +3840,16 @@ nsGlobalWindowOuter::GetScrollBoundaryOu
   FlushPendingNotifications(FlushType::Layout);
   if (nsIScrollableFrame *sf = GetScrollFrame()) {
     return nsPresContext::
       AppUnitsToIntCSSPixels(sf->GetScrollRange().Edge(aSide));
   }
   return 0;
 }
 
-int32_t
-nsGlobalWindowOuter::GetScrollMinX(ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  FORWARD_TO_OUTER_OR_THROW(GetScrollBoundaryOuter, (eSideLeft), aError, 0);
-}
-
-int32_t
-nsGlobalWindowOuter::GetScrollMinY(ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  FORWARD_TO_OUTER_OR_THROW(GetScrollBoundaryOuter, (eSideTop), aError, 0);
-}
-
-int32_t
-nsGlobalWindowOuter::GetScrollMaxX(ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  FORWARD_TO_OUTER_OR_THROW(GetScrollBoundaryOuter, (eSideRight), aError, 0);
-}
-
-int32_t
-nsGlobalWindowOuter::GetScrollMaxY(ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  FORWARD_TO_OUTER_OR_THROW(GetScrollBoundaryOuter, (eSideBottom), aError, 0);
-}
-
 CSSPoint
 nsGlobalWindowOuter::GetScrollXY(bool aDoFlush)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (aDoFlush) {
     FlushPendingNotifications(FlushType::Layout);
   } else {
@@ -5272,59 +3875,39 @@ nsGlobalWindowOuter::GetScrollXY(bool aD
 double
 nsGlobalWindowOuter::GetScrollXOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   return GetScrollXY(false).x;
 }
 
 double
-nsGlobalWindowOuter::GetScrollX(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetScrollXOuter, (), aError, 0);
-}
-
-double
 nsGlobalWindowOuter::GetScrollYOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   return GetScrollXY(false).y;
 }
 
-double
-nsGlobalWindowOuter::GetScrollY(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetScrollYOuter, (), aError, 0);
-}
-
 uint32_t
 nsGlobalWindowOuter::Length()
 {
-  FORWARD_TO_OUTER(Length, (), 0);
-
   nsDOMWindowList* windows = GetWindowList();
 
   return windows ? windows->GetLength() : 0;
 }
 
 already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::GetTopOuter()
 {
   MOZ_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsPIDOMWindowOuter> top = GetScriptableTop();
   return top.forget();
 }
 
-already_AddRefed<nsPIDOMWindowOuter>
-nsGlobalWindowOuter::GetTop(mozilla::ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetTopOuter, (), aError, nullptr);
-}
-
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetChildWindow(const nsAString& aName)
 {
   nsCOMPtr<nsIDocShell> docShell(GetDocShell());
   NS_ENSURE_TRUE(docShell, nullptr);
 
   nsCOMPtr<nsIDocShellTreeItem> child;
   docShell->FindChildWithName(aName, false, true, nullptr, nullptr,
@@ -5391,25 +3974,16 @@ nsGlobalWindowOuter::DispatchResizeEvent
   domEvent->SetTarget(target);
 
   bool defaultActionEnabled = true;
   target->DispatchEvent(domEvent, &defaultActionEnabled);
 
   return defaultActionEnabled;
 }
 
-void
-nsGlobalWindowOuter::RefreshCompartmentPrincipal()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  JS_SetCompartmentPrincipals(js::GetObjectCompartment(GetWrapperPreserveColor()),
-                              nsJSPrincipals::get(mDoc->NodePrincipal()));
-}
-
 static already_AddRefed<nsIDocShellTreeItem>
 GetCallerDocShellTreeItem()
 {
   nsCOMPtr<nsIWebNavigation> callerWebNav = do_GetInterface(GetEntryGlobal());
   nsCOMPtr<nsIDocShellTreeItem> callerItem = do_QueryInterface(callerWebNav);
 
   return callerItem.forget();
 }
@@ -5442,18 +4016,16 @@ nsGlobalWindowOuter::WindowExists(const 
                               /* aSkipTabGroup = */ false,
                               getter_AddRefs(namedItem));
   return namedItem != nullptr;
 }
 
 already_AddRefed<nsIWidget>
 nsGlobalWindowOuter::GetMainWidget()
 {
-  FORWARD_TO_OUTER(GetMainWidget, (), nullptr);
-
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
 
   nsCOMPtr<nsIWidget> widget;
 
   if (treeOwnerAsWin) {
     treeOwnerAsWin->GetMainWidget(getter_AddRefs(widget));
   }
 
@@ -5475,27 +4047,19 @@ nsGlobalWindowOuter::GetNearestWidget() 
 void
 nsGlobalWindowOuter::SetFullScreenOuter(bool aFullScreen, mozilla::ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   aError = SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullScreen);
 }
 
-void
-nsGlobalWindowOuter::SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetFullScreenOuter, (aFullScreen, aError), aError, /* void */);
-}
-
 nsresult
 nsGlobalWindowOuter::SetFullScreen(bool aFullScreen)
 {
-  FORWARD_TO_OUTER(SetFullScreen, (aFullScreen), NS_ERROR_NOT_INITIALIZED);
-
   return SetFullscreenInternal(FullscreenReason::ForFullscreenMode, aFullScreen);
 }
 
 static void
 FinishDOMFullscreenChange(nsIDocument* aDoc, bool aInDOMFullscreen)
 {
   if (aInDOMFullscreen) {
     // Ask the document to handle any pending DOM fullscreen change.
@@ -5999,64 +4563,19 @@ nsGlobalWindowOuter::FullScreen() const
 bool
 nsGlobalWindowOuter::GetFullScreenOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   return FullScreen();
 }
 
 bool
-nsGlobalWindowOuter::GetFullScreen(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetFullScreenOuter, (), aError, false);
-}
-
-bool
 nsGlobalWindowOuter::GetFullScreen()
 {
   FORWARD_TO_INNER(GetFullScreen, (), false);
-
-  ErrorResult dummy;
-  bool fullscreen = GetFullScreen(dummy);
-  dummy.SuppressException();
-  return fullscreen;
-}
-
-void
-nsGlobalWindowOuter::Dump(const nsAString& aStr)
-{
-  if (!nsContentUtils::DOMWindowDumpEnabled()) {
-    return;
-  }
-
-  char *cstr = ToNewUTF8String(aStr);
-
-#if defined(XP_MACOSX)
-  // have to convert \r to \n so that printing to the console works
-  char *c = cstr, *cEnd = cstr + strlen(cstr);
-  while (c < cEnd) {
-    if (*c == '\r')
-      *c = '\n';
-    c++;
-  }
-#endif
-
-  if (cstr) {
-    MOZ_LOG(nsContentUtils::DOMDumpLog(), LogLevel::Debug, ("[Window.Dump] %s", cstr));
-#ifdef XP_WIN
-    PrintToDebugger(cstr);
-#endif
-#ifdef ANDROID
-    __android_log_write(ANDROID_LOG_INFO, "GeckoDump", cstr);
-#endif
-    FILE *fp = gDumpFile ? gDumpFile : stdout;
-    fputs(cstr, fp);
-    fflush(fp);
-    free(cstr);
-  }
 }
 
 void
 nsGlobalWindowOuter::EnsureReflowFlushAndPaint()
 {
   MOZ_ASSERT(IsOuterWindow());
   NS_ASSERTION(mDocShell, "EnsureReflowFlushAndPaint() called with no "
                "docshell!");
@@ -6270,69 +4789,35 @@ nsGlobalWindowOuter::AlertOrConfirm(bool
                prompt->Alert(title.get(), final.get()) :
                prompt->Confirm(title.get(), final.get(), &result);
   }
 
   return result;
 }
 
 void
-nsGlobalWindowOuter::Alert(nsIPrincipal& aSubjectPrincipal,
-                      ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  Alert(EmptyString(), aSubjectPrincipal, aError);
-}
-
-void
 nsGlobalWindowOuter::AlertOuter(const nsAString& aMessage,
                            nsIPrincipal& aSubjectPrincipal,
                            ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   AlertOrConfirm(/* aAlert = */ true, aMessage, aSubjectPrincipal, aError);
 }
 
-void
-nsGlobalWindowOuter::Alert(const nsAString& aMessage,
-                      nsIPrincipal& aSubjectPrincipal,
-                      ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(AlertOuter, (aMessage, aSubjectPrincipal, aError),
-                            aError, );
-}
-
 bool
 nsGlobalWindowOuter::ConfirmOuter(const nsAString& aMessage,
                              nsIPrincipal& aSubjectPrincipal,
                              ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   return AlertOrConfirm(/* aAlert = */ false, aMessage, aSubjectPrincipal,
                         aError);
 }
 
-bool
-nsGlobalWindowOuter::Confirm(const nsAString& aMessage,
-                        nsIPrincipal& aSubjectPrincipal,
-                        ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(ConfirmOuter, (aMessage, aSubjectPrincipal, aError),
-                            aError, false);
-}
-
-already_AddRefed<Promise>
-nsGlobalWindowOuter::Fetch(const RequestOrUSVString& aInput,
-                      const RequestInit& aInit,
-                      CallerType aCallerType, ErrorResult& aRv)
-{
-  return FetchRequest(this, aInput, aInit, aCallerType, aRv);
-}
-
 void
 nsGlobalWindowOuter::PromptOuter(const nsAString& aMessage,
                             const nsAString& aInitial,
                             nsAString& aReturn,
                             nsIPrincipal& aSubjectPrincipal,
                             ErrorResult& aError)
 {
   // XXX This method is very similar to nsGlobalWindowOuter::AlertOrConfirm, make
@@ -6413,28 +4898,16 @@ nsGlobalWindowOuter::PromptOuter(const n
   outValue.Adopt(inoutValue);
 
   if (ok && inoutValue) {
     aReturn.Assign(outValue);
   }
 }
 
 void
-nsGlobalWindowOuter::Prompt(const nsAString& aMessage, const nsAString& aInitial,
-                       nsAString& aReturn,
-                       nsIPrincipal& aSubjectPrincipal,
-                       ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(PromptOuter,
-                            (aMessage, aInitial, aReturn, aSubjectPrincipal,
-                             aError),
-                            aError, );
-}
-
-void
 nsGlobalWindowOuter::FocusOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   nsIFocusManager* fm = nsFocusManager::GetFocusManager();
   if (!fm) {
     return;
   }
@@ -6532,31 +5005,20 @@ nsGlobalWindowOuter::FocusOuter(ErrorRes
   if (canFocus) {
     // if there is no parent, this must be a toplevel window, so raise the
     // window if canFocus is true. If this is a child process, the raise
     // window request will get forwarded to the parent by the puppet widget.
     aError = fm->SetActiveWindow(AsOuter());
   }
 }
 
-void
-nsGlobalWindowOuter::Focus(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(FocusOuter, (aError), aError, );
-}
-
 nsresult
 nsGlobalWindowOuter::Focus()
 {
   FORWARD_TO_INNER(Focus, (), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  Focus(rv);
-
-  return rv.StealNSResult();
 }
 
 void
 nsGlobalWindowOuter::BlurOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   // If dom.disable_window_flip == true, then content should not be allowed
@@ -6583,62 +5045,44 @@ nsGlobalWindowOuter::BlurOuter()
       if (content == mDoc->GetRootElement()) {
         fm->ClearFocus(AsOuter());
       }
     }
   }
 }
 
 void
-nsGlobalWindowOuter::Blur(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(BlurOuter, (), aError, );
-}
-
-void
 nsGlobalWindowOuter::BackOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
   if (!webNav) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   aError = webNav->GoBack();
 }
 
 void
-nsGlobalWindowOuter::Back(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(BackOuter, (aError), aError, );
-}
-
-void
 nsGlobalWindowOuter::ForwardOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
   if (!webNav) {
     aError.Throw(NS_ERROR_FAILURE);
     return;
   }
 
   aError = webNav->GoForward();
 }
 
 void
-nsGlobalWindowOuter::Forward(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(ForwardOuter, (aError), aError, );
-}
-
-void
 nsGlobalWindowOuter::HomeOuter(nsIPrincipal& aSubjectPrincipal, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
     return;
   }
 
@@ -6682,52 +5126,27 @@ nsGlobalWindowOuter::HomeOuter(nsIPrinci
                            nsIWebNavigation::LOAD_FLAGS_NONE,
                            nullptr,
                            nullptr,
                            nullptr,
                            &aSubjectPrincipal);
 }
 
 void
-nsGlobalWindowOuter::Home(nsIPrincipal& aSubjectPrincipal, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(HomeOuter, (aSubjectPrincipal, aError), aError, );
-}
-
-void
 nsGlobalWindowOuter::StopOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mDocShell));
   if (webNav) {
     aError = webNav->Stop(nsIWebNavigation::STOP_ALL);
   }
 }
 
 void
-nsGlobalWindowOuter::Stop(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(StopOuter, (aError), aError, );
-}
-
-/* static */
-bool
-nsGlobalWindowOuter::IsWindowPrintEnabled(JSContext*, JSObject*)
-{
-  static bool called = false;
-  static bool printDisabled = false;
-  if (!called) {
-    called = true;
-    Preferences::AddBoolVarCache(&printDisabled, "dom.disable_window_print");
-  }
-  return !printDisabled;
-}
-
-void
 nsGlobalWindowOuter::PrintOuter(ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
 #ifdef NS_PRINTING
   if (!AreDialogsEnabled()) {
     // We probably want to keep throwing here; silently doing nothing is a bit
     // weird given the typical use cases of print().
@@ -6805,22 +5224,16 @@ nsGlobalWindowOuter::PrintOuter(ErrorRes
       webBrowserPrint->GetGlobalPrintSettings(getter_AddRefs(printSettings));
       webBrowserPrint->Print(printSettings, nullptr);
     }
   }
 #endif //NS_PRINTING
 }
 
 void
-nsGlobalWindowOuter::Print(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(PrintOuter, (aError), aError, );
-}
-
-void
 nsGlobalWindowOuter::MoveToOuter(int32_t aXPos, int32_t aYPos,
                             CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   /*
    * If caller is not chrome and the user has not explicitly exempted the site,
    * prevent window.moveTo() by exiting early
    */
@@ -6870,24 +5283,16 @@ nsGlobalWindowOuter::MoveToOuter(int32_t
     LayoutDevicePoint devPos = cssPos * CSSToLayoutDeviceScale(1.0);
     aError = treeOwnerAsWin->SetPosition(devPos.x, devPos.y);
   }
 
   CheckForDPIChange();
 }
 
 void
-nsGlobalWindowOuter::MoveTo(int32_t aXPos, int32_t aYPos,
-                       CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(MoveToOuter,
-                            (aXPos, aYPos, aCallerType, aError), aError, );
-}
-
-void
 nsGlobalWindowOuter::MoveByOuter(int32_t aXDif, int32_t aYDif,
                             CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   /*
    * If caller is not chrome and the user has not explicitly exempted the site,
    * prevent window.moveBy() by exiting early
@@ -6923,29 +5328,19 @@ nsGlobalWindowOuter::MoveByOuter(int32_t
 
   nsIntSize newDevPos(CSSToDevIntPixels(cssPos));
 
   aError = treeOwnerAsWin->SetPosition(newDevPos.width, newDevPos.height);
 
   CheckForDPIChange();
 }
 
-void
-nsGlobalWindowOuter::MoveBy(int32_t aXDif, int32_t aYDif,
-                       CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(MoveByOuter,
-                            (aXDif, aYDif, aCallerType, aError), aError, );
-}
-
 nsresult
 nsGlobalWindowOuter::MoveBy(int32_t aXDif, int32_t aYDif)
 {
-  FORWARD_TO_OUTER(MoveBy, (aXDif, aYDif), NS_ERROR_UNEXPECTED);
-
   ErrorResult rv;
   MoveByOuter(aXDif, aYDif, CallerType::System, rv);
 
   return rv.StealNSResult();
 }
 
 void
 nsGlobalWindowOuter::ResizeToOuter(int32_t aWidth, int32_t aHeight,
@@ -6988,24 +5383,16 @@ nsGlobalWindowOuter::ResizeToOuter(int32
   nsIntSize devSz(CSSToDevIntPixels(cssSize));
 
   aError = treeOwnerAsWin->SetSize(devSz.width, devSz.height, true);
 
   CheckForDPIChange();
 }
 
 void
-nsGlobalWindowOuter::ResizeTo(int32_t aWidth, int32_t aHeight,
-                         CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(ResizeToOuter,
-                            (aWidth, aHeight, aCallerType, aError), aError, );
-}
-
-void
 nsGlobalWindowOuter::ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
                               CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   /*
    * If caller is a browser-element then dispatch a resize event to
    * parent.
@@ -7061,25 +5448,16 @@ nsGlobalWindowOuter::ResizeByOuter(int32
   nsIntSize newDevSize(CSSToDevIntPixels(cssSize));
 
   aError = treeOwnerAsWin->SetSize(newDevSize.width, newDevSize.height, true);
 
   CheckForDPIChange();
 }
 
 void
-nsGlobalWindowOuter::ResizeBy(int32_t aWidthDif, int32_t aHeightDif,
-                         CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(ResizeByOuter,
-                            (aWidthDif, aHeightDif, aCallerType, aError),
-                            aError, );
-}
-
-void
 nsGlobalWindowOuter::SizeToContentOuter(CallerType aCallerType, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
     return;
   }
 
@@ -7119,259 +5497,28 @@ nsGlobalWindowOuter::SizeToContentOuter(
   CheckSecurityWidthAndHeight(&cssSize.width, &cssSize.height, aCallerType);
 
   nsIntSize newDevSize(CSSToDevIntPixels(cssSize));
 
   aError = treeOwner->SizeShellTo(mDocShell, newDevSize.width,
                                   newDevSize.height);
 }
 
-void
-nsGlobalWindowOuter::SizeToContent(CallerType aCallerType, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SizeToContentOuter, (aCallerType, aError),
-                            aError, );
-}
-
 already_AddRefed<nsPIWindowRoot>
 nsGlobalWindowOuter::GetTopWindowRoot()
 {
   nsPIDOMWindowOuter* piWin = GetPrivateRoot();
   if (!piWin) {
     return nullptr;
   }
 
   nsCOMPtr<nsPIWindowRoot> window = do_QueryInterface(piWin->GetChromeEventHandler());
   return window.forget();
 }
 
-void
-nsGlobalWindowOuter::Scroll(double aXScroll, double aYScroll)
-{
-  // Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast.
-  auto scrollPos = CSSIntPoint::Truncate(mozilla::ToZeroIfNonfinite(aXScroll),
-                                         mozilla::ToZeroIfNonfinite(aYScroll));
-  ScrollTo(scrollPos, ScrollOptions());
-}
-
-void
-nsGlobalWindowOuter::ScrollTo(double aXScroll, double aYScroll)
-{
-  // Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast.
-  auto scrollPos = CSSIntPoint::Truncate(mozilla::ToZeroIfNonfinite(aXScroll),
-                                         mozilla::ToZeroIfNonfinite(aYScroll));
-  ScrollTo(scrollPos, ScrollOptions());
-}
-
-void
-nsGlobalWindowOuter::ScrollTo(const ScrollToOptions& aOptions)
-{
-  // When scrolling to a non-zero offset, we need to determine whether that
-  // position is within our scrollable range, so we need updated layout
-  // information which requires a layout flush, otherwise all we need is to
-  // flush frames to be able to access our scrollable frame here.
-  FlushType flushType = ((aOptions.mLeft.WasPassed() &&
-                          aOptions.mLeft.Value() > 0) ||
-                         (aOptions.mTop.WasPassed() &&
-                          aOptions.mTop.Value() > 0)) ?
-                          FlushType::Layout :
-                          FlushType::Frames;
-  FlushPendingNotifications(flushType);
-  nsIScrollableFrame *sf = GetScrollFrame();
-
-  if (sf) {
-    CSSIntPoint scrollPos = sf->GetScrollPositionCSSPixels();
-    if (aOptions.mLeft.WasPassed()) {
-      scrollPos.x = mozilla::ToZeroIfNonfinite(aOptions.mLeft.Value());
-    }
-    if (aOptions.mTop.WasPassed()) {
-      scrollPos.y = mozilla::ToZeroIfNonfinite(aOptions.mTop.Value());
-    }
-
-    ScrollTo(scrollPos, aOptions);
-  }
-}
-
-void
-nsGlobalWindowOuter::Scroll(const ScrollToOptions& aOptions)
-{
-  ScrollTo(aOptions);
-}
-
-void
-nsGlobalWindowOuter::ScrollTo(const CSSIntPoint& aScroll,
-                         const ScrollOptions& aOptions)
-{
-  // When scrolling to a non-zero offset, we need to determine whether that
-  // position is within our scrollable range, so we need updated layout
-  // information which requires a layout flush, otherwise all we need is to
-  // flush frames to be able to access our scrollable frame here.
-  FlushType flushType = (aScroll.x || aScroll.y) ?
-                          FlushType::Layout :
-                          FlushType::Frames;
-  FlushPendingNotifications(flushType);
-  nsIScrollableFrame *sf = GetScrollFrame();
-
-  if (sf) {
-    // Here we calculate what the max pixel value is that we can
-    // scroll to, we do this by dividing maxint with the pixel to
-    // twips conversion factor, and subtracting 4, the 4 comes from
-    // experimenting with this value, anything less makes the view
-    // code not scroll correctly, I have no idea why. -- jst
-    const int32_t maxpx = nsPresContext::AppUnitsToIntCSSPixels(0x7fffffff) - 4;
-
-    CSSIntPoint scroll(aScroll);
-    if (scroll.x > maxpx) {
-      scroll.x = maxpx;
-    }
-
-    if (scroll.y > maxpx) {
-      scroll.y = maxpx;
-    }
-
-    bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
-
-    sf->ScrollToCSSPixels(scroll, smoothScroll
-                            ? nsIScrollableFrame::SMOOTH_MSD
-                            : nsIScrollableFrame::INSTANT);
-  }
-}
-
-void
-nsGlobalWindowOuter::ScrollBy(double aXScrollDif, double aYScrollDif)
-{
-  FlushPendingNotifications(FlushType::Layout);
-  nsIScrollableFrame *sf = GetScrollFrame();
-
-  if (sf) {
-    // Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast.
-    auto scrollDif = CSSIntPoint::Truncate(mozilla::ToZeroIfNonfinite(aXScrollDif),
-                                           mozilla::ToZeroIfNonfinite(aYScrollDif));
-    // It seems like it would make more sense for ScrollBy to use
-    // SMOOTH mode, but tests seem to depend on the synchronous behaviour.
-    // Perhaps Web content does too.
-    ScrollTo(sf->GetScrollPositionCSSPixels() + scrollDif, ScrollOptions());
-  }
-}
-
-void
-nsGlobalWindowOuter::ScrollBy(const ScrollToOptions& aOptions)
-{
-  FlushPendingNotifications(FlushType::Layout);
-  nsIScrollableFrame *sf = GetScrollFrame();
-
-  if (sf) {
-    CSSIntPoint scrollPos = sf->GetScrollPositionCSSPixels();
-    if (aOptions.mLeft.WasPassed()) {
-      scrollPos.x += mozilla::ToZeroIfNonfinite(aOptions.mLeft.Value());
-    }
-    if (aOptions.mTop.WasPassed()) {
-      scrollPos.y += mozilla::ToZeroIfNonfinite(aOptions.mTop.Value());
-    }
-
-    ScrollTo(scrollPos, aOptions);
-  }
-}
-
-void
-nsGlobalWindowOuter::ScrollByLines(int32_t numLines,
-                              const ScrollOptions& aOptions)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  FlushPendingNotifications(FlushType::Layout);
-  nsIScrollableFrame *sf = GetScrollFrame();
-  if (sf) {
-    // It seems like it would make more sense for ScrollByLines to use
-    // SMOOTH mode, but tests seem to depend on the synchronous behaviour.
-    // Perhaps Web content does too.
-    bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
-
-    sf->ScrollBy(nsIntPoint(0, numLines), nsIScrollableFrame::LINES,
-                 smoothScroll
-                   ? nsIScrollableFrame::SMOOTH_MSD
-                   : nsIScrollableFrame::INSTANT);
-  }
-}
-
-void
-nsGlobalWindowOuter::ScrollByPages(int32_t numPages,
-                              const ScrollOptions& aOptions)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  FlushPendingNotifications(FlushType::Layout);
-  nsIScrollableFrame *sf = GetScrollFrame();
-  if (sf) {
-    // It seems like it would make more sense for ScrollByPages to use
-    // SMOOTH mode, but tests seem to depend on the synchronous behaviour.
-    // Perhaps Web content does too.
-    bool smoothScroll = sf->GetScrollbarStyles().IsSmoothScroll(aOptions.mBehavior);
-
-    sf->ScrollBy(nsIntPoint(0, numPages), nsIScrollableFrame::PAGES,
-                 smoothScroll
-                   ? nsIScrollableFrame::SMOOTH_MSD
-                   : nsIScrollableFrame::INSTANT);
-  }
-}
-
-void
-nsGlobalWindowOuter::MozScrollSnap()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  FlushPendingNotifications(FlushType::Layout);
-  nsIScrollableFrame *sf = GetScrollFrame();
-  if (sf) {
-    sf->ScrollSnap();
-  }
-}
-
-void
-nsGlobalWindowOuter::ClearTimeout(int32_t aHandle)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (aHandle > 0) {
-    mTimeoutManager->ClearTimeout(aHandle, Timeout::Reason::eTimeoutOrInterval);
-  }
-}
-
-void
-nsGlobalWindowOuter::ClearInterval(int32_t aHandle)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (aHandle > 0) {
-    mTimeoutManager->ClearTimeout(aHandle, Timeout::Reason::eTimeoutOrInterval);
-  }
-}
-
-void
-nsGlobalWindowOuter::SetResizable(bool aResizable) const
-{
-  // nop
-}
-
-void
-nsGlobalWindowOuter::CaptureEvents()
-{
-  if (mDoc) {
-    mDoc->WarnOnceAbout(nsIDocument::eUseOfCaptureEvents);
-  }
-}
-
-void
-nsGlobalWindowOuter::ReleaseEvents()
-{
-  if (mDoc) {
-    mDoc->WarnOnceAbout(nsIDocument::eUseOfReleaseEvents);
-  }
-}
-
 static
 bool IsPopupBlocked(nsIDocument* aDoc)
 {
   nsCOMPtr<nsIPopupWindowManager> pm =
     do_GetService(NS_POPUPWINDOWMANAGER_CONTRACTID);
 
   if (!pm) {
     return false;
@@ -7538,33 +5685,21 @@ nsGlobalWindowOuter::OpenOuter(const nsA
                           const nsAString& aOptions, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   nsCOMPtr<nsPIDOMWindowOuter> window;
   aError = OpenJS(aUrl, aName, aOptions, getter_AddRefs(window));
   return window.forget();
 }
 
-
-already_AddRefed<nsPIDOMWindowOuter>
-nsGlobalWindowOuter::Open(const nsAString& aUrl, const nsAString& aName,
-                     const nsAString& aOptions, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(OpenOuter, (aUrl, aName, aOptions, aError), aError,
-                            nullptr);
-}
-
 nsresult
 nsGlobalWindowOuter::Open(const nsAString& aUrl, const nsAString& aName,
                      const nsAString& aOptions, nsIDocShellLoadInfo* aLoadInfo,
                      bool aForceNoOpener, nsPIDOMWindowOuter **_retval)
 {
-  FORWARD_TO_OUTER(Open, (aUrl, aName, aOptions, aLoadInfo, aForceNoOpener,
-                          _retval),
-                   NS_ERROR_NOT_INITIALIZED);
   return OpenInternal(aUrl, aName, aOptions,
                       false,          // aDialog
                       false,          // aContentModal
                       true,           // aCalledNoScript
                       false,          // aDoJSFixups
                       true,           // aNavigate
                       nullptr, nullptr,  // No args
                       aLoadInfo,
@@ -7657,40 +5792,23 @@ nsGlobalWindowOuter::OpenDialogOuter(JSC
                         argvArray, nullptr,  // Arguments
                         nullptr,          // aLoadInfo
                         false,            // aForceNoOpener
                         getter_AddRefs(dialog));
   return dialog.forget();
 }
 
 already_AddRefed<nsPIDOMWindowOuter>
-nsGlobalWindowOuter::OpenDialog(JSContext* aCx, const nsAString& aUrl,
-                           const nsAString& aName, const nsAString& aOptions,
-                           const Sequence<JS::Value>& aExtraArgument,
-                           ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(OpenDialogOuter,
-                            (aCx, aUrl, aName, aOptions, aExtraArgument, aError),
-                            aError, nullptr);
-}
-
-already_AddRefed<nsPIDOMWindowOuter>
 nsGlobalWindowOuter::GetFramesOuter()
 {
   RefPtr<nsPIDOMWindowOuter> frames(AsOuter());
   FlushPendingNotifications(FlushType::ContentAndNotify);
   return frames.forget();
 }
 
-already_AddRefed<nsPIDOMWindowOuter>
-nsGlobalWindowOuter::GetFrames(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetFramesOuter, (), aError, nullptr);
-}
-
 nsGlobalWindowInner*
 nsGlobalWindowOuter::CallerInnerWindow()
 {
   JSContext *cx = nsContentUtils::GetCurrentJSContext();
   NS_ENSURE_TRUE(cx, nullptr);
   nsIGlobalObject* global = GetIncumbentGlobal();
   NS_ENSURE_TRUE(global, nullptr);
   JS::Rooted<JSObject*> scope(cx, global->GetGlobalJSObject());
@@ -7868,48 +5986,16 @@ nsGlobalWindowOuter::PostMessageMozOuter
   event->Write(aCx, message, transfer, JS::CloneDataPolicy(), aError);
   if (NS_WARN_IF(aError.Failed())) {
     return;
   }
 
   aError = Dispatch(TaskCategory::Other, event.forget());
 }
 
-void
-nsGlobalWindowOuter::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
-                               const nsAString& aTargetOrigin,
-                               JS::Handle<JS::Value> aTransfer,
-                               nsIPrincipal& aSubjectPrincipal,
-                               ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(PostMessageMozOuter,
-                            (aCx, aMessage, aTargetOrigin, aTransfer,
-                             aSubjectPrincipal, aError),
-                            aError, );
-}
-
-void
-nsGlobalWindowOuter::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
-                               const nsAString& aTargetOrigin,
-                               const Sequence<JSObject*>& aTransfer,
-                               nsIPrincipal& aSubjectPrincipal,
-                               ErrorResult& aRv)
-{
-  JS::Rooted<JS::Value> transferArray(aCx, JS::UndefinedValue());
-
-  aRv = nsContentUtils::CreateJSValueFromSequenceOfObject(aCx, aTransfer,
-                                                          &transferArray);
-  if (NS_WARN_IF(aRv.Failed())) {
-    return;
-  }
-
-  PostMessageMoz(aCx, aMessage, aTargetOrigin, transferArray,
-                 aSubjectPrincipal, aRv);
-}
-
 class nsCloseEvent : public Runnable {
 
   RefPtr<nsGlobalWindowOuter> mWindow;
   bool mIndirect;
 
   nsCloseEvent(nsGlobalWindowOuter* aWindow, bool aIndirect)
     : mozilla::Runnable("nsCloseEvent")
     , mWindow(aWindow)
@@ -8050,26 +6136,19 @@ nsGlobalWindowOuter::CloseOuter(bool aTr
 
     mInClose = wasInClose;
     return;
   }
 
   FinalClose();
 }
 
-void
-nsGlobalWindowOuter::Close(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(CloseOuter, (nsContentUtils::IsCallerChrome()), aError, );
-}
-
 nsresult
 nsGlobalWindowOuter::Close()
 {
-  FORWARD_TO_OUTER(Close, (), NS_ERROR_UNEXPECTED);
   CloseOuter(/* aTrustedCaller = */ true);
   return NS_OK;
 }
 
 void
 nsGlobalWindowOuter::ForceClose()
 {
   MOZ_ASSERT(IsOuterWindow());
@@ -8130,18 +6209,16 @@ nsGlobalWindowOuter::FinalClose()
     mHavePendingClose = true;
   }
 }
 
 
 void
 nsGlobalWindowOuter::ReallyCloseWindow()
 {
-  FORWARD_TO_OUTER_VOID(ReallyCloseWindow, ());
-
   // Make sure we never reenter this method.
   mHavePendingClose = true;
 
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
 
   // If there's no treeOwnerAsWin, this window must already be closed.
 
   if (treeOwnerAsWin) {
@@ -8308,71 +6385,27 @@ nsGlobalWindowOuter::IsInModalState()
     // IsInModalState() getting called w/o a reachable top window is a bit
     // iffy, but valid enough not to make noise about it.  See bug 404828
     return false;
   }
 
   return topWin->mModalStateDepth != 0;
 }
 
-// static
-void
-nsGlobalWindowOuter::NotifyDOMWindowDestroyed(nsGlobalWindowInner* aWindow) {
-  nsCOMPtr<nsIObserverService> observerService =
-    services::GetObserverService();
-  if (observerService) {
-    observerService->
-      NotifyObservers(ToSupports(aWindow),
-                      DOM_WINDOW_DESTROYED_TOPIC, nullptr);
-  }
-}
-
 void
 nsGlobalWindowOuter::NotifyWindowIDDestroyed(const char* aTopic)
 {
-  nsCOMPtr<nsIRunnable> runnable;
-  if (IsInnerWindow()) {
-    runnable = new WindowDestroyedEvent(AssertInner(), mWindowID, aTopic);
-  } else {
-    runnable = new WindowDestroyedEvent(AssertOuter(), mWindowID, aTopic);
-  }
+  nsCOMPtr<nsIRunnable> runnable =
+    new WindowDestroyedEvent(this, mWindowID, aTopic);
   nsresult rv = Dispatch(TaskCategory::Other, runnable.forget());
   if (NS_SUCCEEDED(rv)) {
     mNotifiedIDDestroyed = true;
   }
 }
 
-// static
-void
-nsGlobalWindowOuter::NotifyDOMWindowFrozen(nsGlobalWindowInner* aWindow) {
-  if (aWindow) {
-    nsCOMPtr<nsIObserverService> observerService =
-      services::GetObserverService();
-    if (observerService) {
-      observerService->
-        NotifyObservers(ToSupports(aWindow),
-                        DOM_WINDOW_FROZEN_TOPIC, nullptr);
-    }
-  }
-}
-
-// static
-void
-nsGlobalWindowOuter::NotifyDOMWindowThawed(nsGlobalWindowInner* aWindow) {
-  if (aWindow) {
-    nsCOMPtr<nsIObserverService> observerService =
-      services::GetObserverService();
-    if (observerService) {
-      observerService->
-        NotifyObservers(ToSupports(aWindow),
-                        DOM_WINDOW_THAWED_TOPIC, nullptr);
-    }
-  }
-}
-
 JSObject*
 nsGlobalWindowOuter::GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey)
 {
   JS::Rooted<JSObject*> handler(RootingCx());
   if (mCachedXBLPrototypeHandlers) {
     mCachedXBLPrototypeHandlers->Get(aKey, handler.address());
   }
   return handler;
@@ -8408,24 +6441,16 @@ nsGlobalWindowOuter::GetFrameElementOute
   if (!aSubjectPrincipal.SubsumesConsideringDomain(element->NodePrincipal())) {
     return nullptr;
   }
 
   return element;
 }
 
 Element*
-nsGlobalWindowOuter::GetFrameElement(nsIPrincipal& aSubjectPrincipal,
-                                ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetFrameElementOuter, (aSubjectPrincipal), aError,
-                            nullptr);
-}
-
-Element*
 nsGlobalWindowOuter::GetRealFrameElementOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   if (!mDocShell) {
     return nullptr;
   }
 
@@ -8436,161 +6461,24 @@ nsGlobalWindowOuter::GetRealFrameElement
     // We're at a chrome boundary, don't expose the chrome iframe
     // element to content code.
     return nullptr;
   }
 
   return mFrameElement;
 }
 
-Element*
-nsGlobalWindowOuter::GetRealFrameElement(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetRealFrameElementOuter, (), aError, nullptr);
-}
-
 /**
  * nsIGlobalWindow::GetFrameElement (when called from C++) is just a wrapper
  * around GetRealFrameElement.
  */
 already_AddRefed<nsIDOMElement>
 nsGlobalWindowOuter::GetFrameElement()
 {
   FORWARD_TO_INNER(GetFrameElement, (), nullptr);
-
-  ErrorResult dummy;
-  nsCOMPtr<nsIDOMElement> frameElement =
-    do_QueryInterface(GetRealFrameElement(dummy));
-  dummy.SuppressException();
-  return frameElement.forget();
-}
-
-/* static */ bool
-nsGlobalWindowOuter::TokenizeDialogOptions(nsAString& aToken,
-                                      nsAString::const_iterator& aIter,
-                                      nsAString::const_iterator aEnd)
-{
-  while (aIter != aEnd && nsCRT::IsAsciiSpace(*aIter)) {
-    ++aIter;
-  }
-
-  if (aIter == aEnd) {
-    return false;
-  }
-
-  if (*aIter == ';' || *aIter == ':' || *aIter == '=') {
-    aToken.Assign(*aIter);
-    ++aIter;
-    return true;
-  }
-
-  nsAString::const_iterator start = aIter;
-
-  // Skip characters until we find whitespace, ';', ':', or '='
-  while (aIter != aEnd && !nsCRT::IsAsciiSpace(*aIter) &&
-         *aIter != ';' &&
-         *aIter != ':' &&
-         *aIter != '=') {
-    ++aIter;
-  }
-
-  aToken.Assign(Substring(start, aIter));
-  return true;
-}
-
-// Helper for converting window.showModalDialog() options (list of ';'
-// separated name (:|=) value pairs) to a format that's parsable by
-// our normal window opening code.
-
-/* static */
-void
-nsGlobalWindowOuter::ConvertDialogOptions(const nsAString& aOptions,
-                                     nsAString& aResult)
-{
-  nsAString::const_iterator end;
-  aOptions.EndReading(end);
-
-  nsAString::const_iterator iter;
-  aOptions.BeginReading(iter);
-
-  nsAutoString token;
-  nsAutoString name;
-  nsAutoString value;
-
-  while (true) {
-    if (!TokenizeDialogOptions(name, iter, end)) {
-      break;
-    }
-
-    // Invalid name.
-    if (name.EqualsLiteral("=") ||
-        name.EqualsLiteral(":") ||
-        name.EqualsLiteral(";")) {
-      break;
-    }
-
-    if (!TokenizeDialogOptions(token, iter, end)) {
-      break;
-    }
-
-    if (!token.EqualsLiteral(":") && !token.EqualsLiteral("=")) {
-      continue;
-    }
-
-    // We found name followed by ':' or '='. Look for a value.
-    if (!TokenizeDialogOptions(value, iter, end)) {
-      break;
-    }
-
-    if (name.LowerCaseEqualsLiteral("center")) {
-      if (value.LowerCaseEqualsLiteral("on")  ||
-          value.LowerCaseEqualsLiteral("yes") ||
-          value.LowerCaseEqualsLiteral("1")) {
-        aResult.AppendLiteral(",centerscreen=1");
-      }
-    } else if (name.LowerCaseEqualsLiteral("dialogwidth")) {
-      if (!value.IsEmpty()) {
-        aResult.AppendLiteral(",width=");
-        aResult.Append(value);
-      }
-    } else if (name.LowerCaseEqualsLiteral("dialogheight")) {
-      if (!value.IsEmpty()) {
-        aResult.AppendLiteral(",height=");
-        aResult.Append(value);
-      }
-    } else if (name.LowerCaseEqualsLiteral("dialogtop")) {
-      if (!value.IsEmpty()) {
-        aResult.AppendLiteral(",top=");
-        aResult.Append(value);
-      }
-    } else if (name.LowerCaseEqualsLiteral("dialogleft")) {
-      if (!value.IsEmpty()) {
-        aResult.AppendLiteral(",left=");
-        aResult.Append(value);
-      }
-    } else if (name.LowerCaseEqualsLiteral("resizable")) {
-      if (value.LowerCaseEqualsLiteral("on")  ||
-          value.LowerCaseEqualsLiteral("yes") ||
-          value.LowerCaseEqualsLiteral("1")) {
-        aResult.AppendLiteral(",resizable=1");
-      }
-    } else if (name.LowerCaseEqualsLiteral("scroll")) {
-      if (value.LowerCaseEqualsLiteral("off")  ||
-          value.LowerCaseEqualsLiteral("no") ||
-          value.LowerCaseEqualsLiteral("0")) {
-        aResult.AppendLiteral(",scrollbars=0");
-      }
-    }
-
-    if (iter == end ||
-        !TokenizeDialogOptions(token, iter, end) ||
-        !token.EqualsLiteral(";")) {
-      break;
-    }
-  }
 }
 
 nsresult
 nsGlobalWindowOuter::UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason)
 {
   // If this is a child process, redirect to the parent process.
   if (nsIDocShell* docShell = GetDocShell()) {
     if (nsCOMPtr<nsITabChild> child = docShell->GetTabChild()) {
@@ -8638,22 +6526,16 @@ nsGlobalWindowOuter::GetSelectionOuter()
   if (!presShell) {
     return nullptr;
   }
   nsISelection* domSelection =
     presShell->GetCurrentSelection(SelectionType::eNormal);
   return domSelection ? domSelection->AsSelection() : nullptr;
 }
 
-Selection*
-nsGlobalWindowOuter::GetSelection(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetSelectionOuter, (), aError, nullptr);
-}
-
 already_AddRefed<nsISelection>
 nsGlobalWindowOuter::GetSelection()
 {
   nsCOMPtr<nsISelection> selection = GetSelectionOuter();
   return selection.forget();
 }
 
 bool
@@ -8703,63 +6585,24 @@ nsGlobalWindowOuter::FindOuter(const nsA
   }
 
   // Launch the search with the passed in search string
   bool didFind = false;
   aError = finder->FindNext(&didFind);
   return didFind;
 }
 
-bool
-nsGlobalWindowOuter::Find(const nsAString& aString, bool aCaseSensitive,
-                     bool aBackwards, bool aWrapAround, bool aWholeWord,
-                     bool aSearchInFrames, bool aShowDialog,
-                     ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(FindOuter,
-                            (aString, aCaseSensitive, aBackwards, aWrapAround,
-                             aWholeWord, aSearchInFrames, aShowDialog, aError),
-                            aError, false);
-}
-
-void
-nsGlobalWindowOuter::GetOrigin(nsAString& aOrigin)
-{
-  MOZ_DIAGNOSTIC_ASSERT(IsInnerWindow());
-  nsContentUtils::GetUTFOrigin(GetPrincipal(), aOrigin);
-}
-
-void
-nsGlobalWindowOuter::Atob(const nsAString& aAsciiBase64String,
-                     nsAString& aBinaryData, ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  aError = nsContentUtils::Atob(aAsciiBase64String, aBinaryData);
-}
-
-void
-nsGlobalWindowOuter::Btoa(const nsAString& aBinaryData,
-                     nsAString& aAsciiBase64String, ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  aError = nsContentUtils::Btoa(aBinaryData, aAsciiBase64String);
-}
-
 //*****************************************************************************
 // nsGlobalWindowOuter::nsIDOMEventTarget
 //*****************************************************************************
 
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetOwnerGlobalForBindings()
 {
-  if (IsOuterWindow()) {
-    return AsOuter();
-  }
-
-  return nsPIDOMWindowOuter::GetFromCurrentInner(AsInner());
+  return this;
 }
 
 NS_IMETHODIMP
 nsGlobalWindowOuter::RemoveEventListener(const nsAString& aType,
                                     nsIDOMEventListener* aListener,
                                     bool aUseCapture)
 {
   if (RefPtr<EventListenerManager> elm = GetExistingListenerManager()) {
@@ -8769,41 +6612,16 @@ nsGlobalWindowOuter::RemoveEventListener
 }
 
 NS_IMPL_REMOVE_SYSTEM_EVENT_LISTENER(nsGlobalWindowOuter)
 
 NS_IMETHODIMP
 nsGlobalWindowOuter::DispatchEvent(nsIDOMEvent* aEvent, bool* aRetVal)
 {
   FORWARD_TO_INNER(DispatchEvent, (aEvent, aRetVal), NS_OK);
-
-  if (!AsInner()->IsCurrentInnerWindow()) {
-    NS_WARNING("DispatchEvent called on non-current inner window, dropping. "
-               "Please check the window in the caller instead.");
-    return NS_ERROR_FAILURE;
-  }
-
-  if (!mDoc) {
-    return NS_ERROR_FAILURE;
-  }
-
-  // Obtain a presentation shell
-  nsIPresShell *shell = mDoc->GetShell();
-  RefPtr<nsPresContext> presContext;
-  if (shell) {
-    // Retrieve the context
-    presContext = shell->GetPresContext();
-  }
-
-  nsEventStatus status = nsEventStatus_eIgnore;
-  nsresult rv = EventDispatcher::DispatchDOMEvent(AsInner(), nullptr, aEvent,
-                                                  presContext, &status);
-
-  *aRetVal = (status != nsEventStatus_eConsumeNoDefault);
-  return rv;
 }
 
 NS_IMETHODIMP
 nsGlobalWindowOuter::AddEventListener(const nsAString& aType,
                                  nsIDOMEventListener *aListener,
                                  bool aUseCapture, bool aWantsUntrusted,
                                  uint8_t aOptionalArgc)
 {
@@ -8825,18 +6643,17 @@ nsGlobalWindowOuter::AddEventListener(co
 
 void
 nsGlobalWindowOuter::AddEventListener(const nsAString& aType,
                                  EventListener* aListener,
                                  const AddEventListenerOptionsOrBoolean& aOptions,
                                  const Nullable<bool>& aWantsUntrusted,
                                  ErrorResult& aRv)
 {
-  if (IsOuterWindow() && mInnerWindow &&
-      !nsContentUtils::CanCallerAccess(mInnerWindow)) {
+  if (mInnerWindow && !nsContentUtils::CanCallerAccess(mInnerWindow)) {
     aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
     return;
   }
 
   bool wantsUntrusted;
   if (aWantsUntrusted.IsNull()) {
     wantsUntrusted = !nsContentUtils::IsChromeDoc(mDoc);
   } else {
@@ -8859,17 +6676,17 @@ nsGlobalWindowOuter::AddSystemEventListe
                                        bool aWantsUntrusted,
                                        uint8_t aOptionalArgc)
 {
   NS_ASSERTION(!aWantsUntrusted || aOptionalArgc > 1,
                "Won't check if this is chrome, you want to set "
                "aWantsUntrusted to false or make the aWantsUntrusted "
                "explicit by making optional_argc non-zero.");
 
-  if (IsOuterWindow() && mInnerWindow &&
+  if (mInnerWindow &&
       !nsContentUtils::LegacyIsCallerNativeCode() &&
       !nsContentUtils::CanCallerAccess(mInnerWindow)) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   if (!aWantsUntrusted &&
       (aOptionalArgc < 2 && !nsContentUtils::IsChromeDoc(mDoc))) {
     aWantsUntrusted = true;
@@ -8878,38 +6695,28 @@ nsGlobalWindowOuter::AddSystemEventListe
   return NS_AddSystemEventListener(this, aType, aListener, aUseCapture,
                                    aWantsUntrusted);
 }
 
 EventListenerManager*
 nsGlobalWindowOuter::GetOrCreateListenerManager()
 {
   FORWARD_TO_INNER_CREATE(GetOrCreateListenerManager, (), nullptr);
-
-  if (!mListenerManager) {
-    mListenerManager =
-      new EventListenerManager(static_cast<EventTarget*>(this));
-  }
-
-  return mListenerManager;
 }
 
 EventListenerManager*
 nsGlobalWindowOuter::GetExistingListenerManager() const
 {
   FORWARD_TO_INNER(GetExistingListenerManager, (), nullptr);
-
-  return mListenerManager;
 }
 
 nsIScriptContext*
 nsGlobalWindowOuter::GetContextForEventHandlers(nsresult* aRv)
 {
   *aRv = NS_ERROR_UNEXPECTED;
-  NS_ENSURE_TRUE(!IsInnerWindow() || AsInner()->IsCurrentInnerWindow(), nullptr);
 
   nsIScriptContext* scx;
   if ((scx = GetContext())) {
     *aRv = NS_OK;
     return scx;
   }
   return nullptr;
 }
@@ -8938,25 +6745,16 @@ nsGlobalWindowOuter::GetPrivateParent()
   }
 
   return parent;
 }
 
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetPrivateRoot()
 {
-  if (IsInnerWindow()) {
-    nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-    if (!outer) {
-      NS_WARNING("No outer window available!");
-      return nullptr;
-    }
-    return outer->GetPrivateRoot();
-  }
-
   nsCOMPtr<nsPIDOMWindowOuter> top = GetTop();
 
   nsCOMPtr<nsIContent> chromeElement(do_QueryInterface(mChromeEventHandler));
   if (chromeElement) {
     nsIDocument* doc = chromeElement->GetComposedDoc();
     if (doc) {
       nsCOMPtr<nsPIDOMWindowOuter> parent = doc->GetWindow();
       if (parent) {
@@ -8968,24 +6766,16 @@ nsGlobalWindowOuter::GetPrivateRoot()
   return top;
 }
 
 Location*
 nsGlobalWindowOuter::GetLocation()
 {
   // This method can be called on the outer window as well.
   FORWARD_TO_INNER(GetLocation, (), nullptr);
-
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mLocation) {
-    mLocation = new dom::Location(AsInner(), GetDocShell());
-  }
-
-  return mLocation;
 }
 
 void
 nsGlobalWindowOuter::ActivateOrDeactivate(bool aActivate)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   if (!mDoc) {
@@ -9111,81 +6901,16 @@ nsGlobalWindowOuter::SetIsBackgroundInte
   }
   mIsBackground = aIsBackground;
 }
 
 void
 nsGlobalWindowOuter::MaybeUpdateTouchState()
 {
   FORWARD_TO_INNER_VOID(MaybeUpdateTouchState, ());
-
-  if (mMayHaveTouchEventListener) {
-    nsCOMPtr<nsIObserverService> observerService =
-      services::GetObserverService();
-
-    if (observerService) {
-      observerService->NotifyObservers(static_cast<nsIDOMWindow*>(this),
-                                       DOM_TOUCH_LISTENER_ADDED,
-                                       nullptr);
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::EnableGamepadUpdates()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (mHasGamepad) {
-    RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
-    if (gamepadManager) {
-      gamepadManager->AddListener(AssertInner());
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::DisableGamepadUpdates()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (mHasGamepad) {
-    RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
-    if (gamepadManager) {
-      gamepadManager->RemoveListener(AssertInner());
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::EnableVRUpdates()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (mHasVREvents && !mVREventObserver) {
-    mVREventObserver = new VREventObserver(AssertInner());
-  }
-}
-
-void
-nsGlobalWindowOuter::DisableVRUpdates()
-{
-  MOZ_ASSERT(IsInnerWindow());
-  if (mVREventObserver) {
-    mVREventObserver->DisconnectFromOwner();
-    mVREventObserver = nullptr;
-  }
-}
-
-void
-nsGlobalWindowOuter::ResetVRTelemetry(bool aUpdate)
-{
-  if (mVREventObserver) {
-    mVREventObserver->UpdateSpentTimeIn2DTelemetry(aUpdate);
-  }
 }
 
 void
 nsGlobalWindowOuter::SetChromeEventHandler(EventTarget* aChromeEventHandler)
 {
   MOZ_ASSERT(IsOuterWindow());
 
   SetChromeEventHandlerInternal(aChromeEventHandler);
@@ -9204,76 +6929,28 @@ nsGlobalWindowOuter::SetChromeEventHandl
 }
 
 void
 nsGlobalWindowOuter::SetFocusedNode(nsIContent* aNode,
                                uint32_t aFocusMethod,
                                bool aNeedsFocus)
 {
   FORWARD_TO_INNER_VOID(SetFocusedNode, (aNode, aFocusMethod, aNeedsFocus));
-
-  if (aNode && aNode->GetComposedDoc() != mDoc) {
-    NS_WARNING("Trying to set focus to a node from a wrong document");
-    return;
-  }
-
-  if (mCleanedUp) {
-    NS_ASSERTION(!aNode, "Trying to focus cleaned up window!");
-    aNode = nullptr;
-    aNeedsFocus = false;
-  }
-  if (mFocusedNode != aNode) {
-    UpdateCanvasFocus(false, aNode);
-    mFocusedNode = aNode;
-    mFocusMethod = aFocusMethod & FOCUSMETHOD_MASK;
-    mShowFocusRingForContent = false;
-  }
-
-  if (mFocusedNode) {
-    // if a node was focused by a keypress, turn on focus rings for the
-    // window.
-    if (mFocusMethod & nsIFocusManager::FLAG_BYKEY) {
-      mFocusByKeyOccurred = true;
-    } else if (
-      // otherwise, we set mShowFocusRingForContent, as we don't want this to
-      // be permanent for the window. On Windows, focus rings are only shown
-      // when the FLAG_SHOWRING flag is used. On other platforms, focus rings
-      // are only visible on some elements.
-#ifndef XP_WIN
-      !(mFocusMethod & nsIFocusManager::FLAG_BYMOUSE) ||
-      ShouldShowFocusRingIfFocusedByMouse(aNode) ||
-#endif
-      aFocusMethod & nsIFocusManager::FLAG_SHOWRING) {
-        mShowFocusRingForContent = true;
-    }
-  }
-
-  if (aNeedsFocus)
-    mNeedsFocus = aNeedsFocus;
 }
 
 uint32_t
 nsGlobalWindowOuter::GetFocusMethod()
 {
   FORWARD_TO_INNER(GetFocusMethod, (), 0);
-
-  return mFocusMethod;
 }
 
 bool
 nsGlobalWindowOuter::ShouldShowFocusRing()
 {
   FORWARD_TO_INNER(ShouldShowFocusRing, (), false);
-
-  if (mShowFocusRingForContent || mFocusByKeyOccurred) {
-    return true;
-  }
-
-  nsCOMPtr<nsPIWindowRoot> root = GetTopWindowRoot();
-  return root ? root->ShowFocusRings() : false;
 }
 
 void
 nsGlobalWindowOuter::SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
                                       UIStateChangeType aShowFocusRings)
 {
   MOZ_ASSERT(IsOuterWindow());
 
@@ -9315,216 +6992,47 @@ nsGlobalWindowOuter::SetKeyboardIndicato
     }
   }
 }
 
 bool
 nsGlobalWindowOuter::TakeFocus(bool aFocus, uint32_t aFocusMethod)
 {
   FORWARD_TO_INNER(TakeFocus, (aFocus, aFocusMethod), false);
-
-  if (mCleanedUp) {
-    return false;
-  }
-
-  if (aFocus)
-    mFocusMethod = aFocusMethod & FOCUSMETHOD_MASK;
-
-  if (mHasFocus != aFocus) {
-    mHasFocus = aFocus;
-    UpdateCanvasFocus(true, mFocusedNode);
-  }
-
-  // if mNeedsFocus is true, then the document has not yet received a
-  // document-level focus event. If there is a root content node, then return
-  // true to tell the calling focus manager that a focus event is expected. If
-  // there is no root content node, the document hasn't loaded enough yet, or
-  // there isn't one and there is no point in firing a focus event.
-  if (aFocus && mNeedsFocus && mDoc && mDoc->GetRootElement() != nullptr) {
-    mNeedsFocus = false;
-    return true;
-  }
-
-  mNeedsFocus = false;
-  return false;
 }
 
 void
 nsGlobalWindowOuter::SetReadyForFocus()
 {
   FORWARD_TO_INNER_VOID(SetReadyForFocus, ());
-
-  bool oldNeedsFocus = mNeedsFocus;
-  mNeedsFocus = false;
-
-  nsIFocusManager* fm = nsFocusManager::GetFocusManager();
-  if (fm) {
-    fm->WindowShown(GetOuterWindow(), oldNeedsFocus);
-  }
 }
 
 void
 nsGlobalWindowOuter::PageHidden()
 {
   FORWARD_TO_INNER_VOID(PageHidden, ());
-
-  // the window is being hidden, so tell the focus manager that the frame is
-  // no longer valid. Use the persisted field to determine if the document
-  // is being destroyed.
-
-  nsIFocusManager* fm = nsFocusManager::GetFocusManager();
-  if (fm) {
-    fm->WindowHidden(GetOuterWindow());
-  }
-
-  mNeedsFocus = true;
 }
 
 nsresult
 nsGlobalWindowOuter::DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI)
 {
-  MOZ_CRASH("Inner window only");
-}
-
-nsresult
-nsGlobalWindowOuter::FireHashchange(const nsAString &aOldURL,
-                               const nsAString &aNewURL)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // Don't do anything if the window is frozen.
-  if (IsFrozen()) {
-    return NS_OK;
-  }
-
-  // Get a presentation shell for use in creating the hashchange event.
-  NS_ENSURE_STATE(AsInner()->IsCurrentInnerWindow());
-
-  nsIPresShell *shell = mDoc->GetShell();
-  RefPtr<nsPresContext> presContext;
-  if (shell) {
-    presContext = shell->GetPresContext();
-  }
-
-  HashChangeEventInit init;
-  init.mBubbles = true;
-  init.mCancelable = false;
-  init.mNewURL = aNewURL;
-  init.mOldURL = aOldURL;
-
-  RefPtr<HashChangeEvent> event =
-    HashChangeEvent::Constructor(this, NS_LITERAL_STRING("hashchange"),
-                                 init);
-
-  event->SetTrusted(true);
-
-  bool dummy;
-  return DispatchEvent(event, &dummy);
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 nsresult
 nsGlobalWindowOuter::DispatchSyncPopState()
 {
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-  NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
-               "Must be safe to run script here.");
-
-  nsresult rv = NS_OK;
-
-  // Bail if the window is frozen.
-  if (IsFrozen()) {
-    return NS_OK;
-  }
-
-  // Get the document's pending state object -- it contains the data we're
-  // going to send along with the popstate event.  The object is serialized
-  // using structured clone.
-  nsCOMPtr<nsIVariant> stateObj;
-  rv = mDoc->GetStateObject(getter_AddRefs(stateObj));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // Obtain a presentation shell for use in creating a popstate event.
-  nsIPresShell *shell = mDoc->GetShell();
-  RefPtr<nsPresContext> presContext;
-  if (shell) {
-    presContext = shell->GetPresContext();
-  }
-
-  bool result = true;
-  AutoJSAPI jsapi;
-  result = jsapi.Init(AsInner());
-  NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
-
-  JSContext* cx = jsapi.cx();
-  JS::Rooted<JS::Value> stateJSValue(cx, JS::NullValue());
-  result = stateObj ? VariantToJsval(cx, stateObj, &stateJSValue) : true;
-  NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
-
-  RootedDictionary<PopStateEventInit> init(cx);
-  init.mBubbles = true;
-  init.mCancelable = false;
-  init.mState = stateJSValue;
-
-  RefPtr<PopStateEvent> event =
-    PopStateEvent::Constructor(this, NS_LITERAL_STRING("popstate"),
-                               init);
-  event->SetTrusted(true);
-  event->SetTarget(this);
-
-  bool dummy; // default action
-  return DispatchEvent(event, &dummy);
-}
-
-//-------------------------------------------------------
-// Tells the HTMLFrame/CanvasFrame that is now has focus
-void
-nsGlobalWindowOuter::UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent)
-{
-  MOZ_CRASH("Inner window only");
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 already_AddRefed<nsICSSDeclaration>
 nsGlobalWindowOuter::GetComputedStyle(Element& aElt, const nsAString& aPseudoElt,
                                  ErrorResult& aError)
 {
-  MOZ_ASSERT(IsInnerWindow());
-  return GetComputedStyleHelper(aElt, aPseudoElt, false, aError);
-}
-
-already_AddRefed<nsICSSDeclaration>
-nsGlobalWindowOuter::GetDefaultComputedStyle(Element& aElt,
-                                        const nsAString& aPseudoElt,
-                                        ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  return GetComputedStyleHelper(aElt, aPseudoElt, true, aError);
-}
-
-nsresult
-nsGlobalWindowOuter::GetComputedStyleHelper(nsIDOMElement* aElt,
-                                       const nsAString& aPseudoElt,
-                                       bool aDefaultStylesOnly,
-                                       nsIDOMCSSStyleDeclaration** aReturn)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  NS_ENSURE_ARG_POINTER(aReturn);
-  *aReturn = nullptr;
-
-  nsCOMPtr<dom::Element> element = do_QueryInterface(aElt);
-  if (!element) {
-    return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
-  }
-
-  ErrorResult rv;
-  nsCOMPtr<nsIDOMCSSStyleDeclaration> declaration =
-    GetComputedStyleHelper(*element, aPseudoElt, aDefaultStylesOnly, rv);
-  declaration.forget(aReturn);
-
-  return rv.StealNSResult();
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 already_AddRefed<nsICSSDeclaration>
 nsGlobalWindowOuter::GetComputedStyleHelperOuter(Element& aElt,
                                             const nsAString& aPseudoElt,
                                             bool aDefaultStylesOnly)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
@@ -9559,171 +7067,16 @@ nsGlobalWindowOuter::GetComputedStyleHel
   RefPtr<nsComputedDOMStyle> compStyle =
     NS_NewComputedDOMStyle(&aElt, aPseudoElt, presShell,
                            aDefaultStylesOnly ? nsComputedDOMStyle::eDefaultOnly :
                                                 nsComputedDOMStyle::eAll);
 
   return compStyle.forget();
 }
 
-already_AddRefed<nsICSSDeclaration>
-nsGlobalWindowOuter::GetComputedStyleHelper(Element& aElt,
-                                       const nsAString& aPseudoElt,
-                                       bool aDefaultStylesOnly,
-                                       ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetComputedStyleHelperOuter,
-                            (aElt, aPseudoElt, aDefaultStylesOnly),
-                            aError, nullptr);
-}
-
-Storage*
-nsGlobalWindowOuter::GetSessionStorage(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  nsIPrincipal *principal = GetPrincipal();
-  nsIDocShell* docShell = GetDocShell();
-
-  if (!principal || !docShell || !Preferences::GetBool(kStorageEnabled)) {
-    return nullptr;
-  }
-
-  if (mSessionStorage) {
-    MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
-            ("nsGlobalWindowOuter %p has %p sessionStorage", this, mSessionStorage.get()));
-    bool canAccess = principal->Subsumes(mSessionStorage->Principal());
-    NS_ASSERTION(canAccess,
-                 "This window owned sessionStorage "
-                 "that could not be accessed!");
-    if (!canAccess) {
-      mSessionStorage = nullptr;
-    }
-  }
-
-  if (!mSessionStorage) {
-    nsString documentURI;
-    if (mDoc) {
-      aError = mDoc->GetDocumentURI(documentURI);
-      if (NS_WARN_IF(aError.Failed())) {
-        return nullptr;
-      }
-    }
-
-    // If the document has the sandboxed origin flag set
-    // don't allow access to sessionStorage.
-    if (!mDoc) {
-      aError.Throw(NS_ERROR_FAILURE);
-      return nullptr;
-    }
-
-    if (mDoc->GetSandboxFlags() & SANDBOXED_ORIGIN) {
-      aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
-      return nullptr;
-    }
-
-    nsresult rv;
-
-    nsCOMPtr<nsIDOMStorageManager> storageManager = do_QueryInterface(docShell, &rv);
-    if (NS_FAILED(rv)) {
-      aError.Throw(rv);
-      return nullptr;
-    }
-
-    nsCOMPtr<nsIDOMStorage> storage;
-    aError = storageManager->CreateStorage(AsInner(), principal, documentURI,
-                                           IsPrivateBrowsing(),
-                                           getter_AddRefs(storage));
-    if (aError.Failed()) {
-      return nullptr;
-    }
-
-    mSessionStorage = static_cast<Storage*>(storage.get());
-    MOZ_ASSERT(mSessionStorage);
-
-    MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
-            ("nsGlobalWindowOuter %p tried to get a new sessionStorage %p", this, mSessionStorage.get()));
-
-    if (!mSessionStorage) {
-      aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
-      return nullptr;
-    }
-  }
-
-  MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
-          ("nsGlobalWindowOuter %p returns %p sessionStorage", this, mSessionStorage.get()));
-
-  return mSessionStorage;
-}
-
-Storage*
-nsGlobalWindowOuter::GetLocalStorage(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!Preferences::GetBool(kStorageEnabled)) {
-    return nullptr;
-  }
-
-  if (!mLocalStorage) {
-    if (nsContentUtils::StorageAllowedForWindow(AsInner()) ==
-          nsContentUtils::StorageAccess::eDeny) {
-      aError.Throw(NS_ERROR_DOM_SECURITY_ERR);
-      return nullptr;
-    }
-
-    nsIPrincipal *principal = GetPrincipal();
-    if (!principal) {
-      return nullptr;
-    }
-
-    nsresult rv;
-    nsCOMPtr<nsIDOMStorageManager> storageManager =
-      do_GetService("@mozilla.org/dom/localStorage-manager;1", &rv);
-    if (NS_FAILED(rv)) {
-      aError.Throw(rv);
-      return nullptr;
-    }
-
-    nsString documentURI;
-    if (mDoc) {
-      aError = mDoc->GetDocumentURI(documentURI);
-      if (NS_WARN_IF(aError.Failed())) {
-        return nullptr;
-      }
-    }
-
-    nsCOMPtr<nsIDOMStorage> storage;
-    aError = storageManager->CreateStorage(AsInner(), principal, documentURI,
-                                           IsPrivateBrowsing(),
-                                           getter_AddRefs(storage));
-    if (aError.Failed()) {
-      return nullptr;
-    }
-
-    mLocalStorage = static_cast<Storage*>(storage.get());
-    MOZ_ASSERT(mLocalStorage);
-  }
-
-  return mLocalStorage;
-}
-
-IDBFactory*
-nsGlobalWindowOuter::GetIndexedDB(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-  if (!mIndexedDB) {
-    // This may keep mIndexedDB null without setting an error.
-    aError = IDBFactory::CreateForWindow(AsInner(),
-                                         getter_AddRefs(mIndexedDB));
-  }
-
-  return mIndexedDB;
-}
-
 //*****************************************************************************
 // nsGlobalWindowOuter::nsIInterfaceRequestor
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsGlobalWindowOuter::GetInterface(const nsIID & aIID, void **aSink)
 {
   NS_ENSURE_ARG_POINTER(aSink);
@@ -9786,1066 +7139,63 @@ nsGlobalWindowOuter::GetInterface(const 
   }
   else {
     return QueryInterface(aIID, aSink);
   }
 
   return *aSink ? NS_OK : NS_ERROR_NO_INTERFACE;
 }
 
-void
-nsGlobalWindowOuter::GetInterface(JSContext* aCx, nsIJSID* aIID,
-                             JS::MutableHandle<JS::Value> aRetval,
-                             ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  dom::GetInterface(aCx, this, aIID, aRetval, aError);
-}
-
-already_AddRefed<CacheStorage>
-nsGlobalWindowOuter::GetCaches(ErrorResult& aRv)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (!mCacheStorage) {
-    bool forceTrustedOrigin =
-      GetOuterWindow()->GetServiceWorkersTestingEnabled();
-
-    nsContentUtils::StorageAccess access =
-      nsContentUtils::StorageAllowedForWindow(AsInner());
-
-    // We don't block the cache API when being told to only allow storage for the
-    // current session.
-    bool storageBlocked = access <= nsContentUtils::StorageAccess::ePrivateBrowsing;
-
-    mCacheStorage = CacheStorage::CreateOnMainThread(cache::DEFAULT_NAMESPACE,
-                                                     this, GetPrincipal(),
-                                                     storageBlocked,
-                                                     forceTrustedOrigin, aRv);
-  }
-
-  RefPtr<CacheStorage> ref = mCacheStorage;
-  return ref.forget();
-}
-
-void
-nsGlobalWindowOuter::FireOfflineStatusEventIfChanged()
-{
-  if (!AsInner()->IsCurrentInnerWindow())
-    return;
-
-  // Don't fire an event if the status hasn't changed
-  if (mWasOffline == NS_IsOffline()) {
-    return;
-  }
-
-  mWasOffline = !mWasOffline;
-
-  nsAutoString name;
-  if (mWasOffline) {
-    name.AssignLiteral("offline");
-  } else {
-    name.AssignLiteral("online");
-  }
-  // The event is fired at the body element, or if there is no body element,
-  // at the document.
-  nsCOMPtr<EventTarget> eventTarget = mDoc.get();
-  nsHTMLDocument* htmlDoc = mDoc->AsHTMLDocument();
-  if (htmlDoc) {
-    Element* body = htmlDoc->GetBody();
-    if (body) {
-      eventTarget = body;
-    }
-  } else {
-    Element* documentElement = mDoc->GetDocumentElement();
-    if (documentElement) {
-      eventTarget = documentElement;
-    }
-  }
-  nsContentUtils::DispatchTrustedEvent(mDoc, eventTarget, name, true, false);
-}
-
-void
-nsGlobalWindowOuter::NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder,
-                                   bool aCallOnidle)
-{
-  MOZ_CRASH("Inner window only");
-}
-
-bool
-nsGlobalWindowOuter::ContainsIdleObserver(nsIIdleObserver* aIdleObserver, uint32_t aTimeInS)
-{
-  MOZ_ASSERT(aIdleObserver, "Idle observer not instantiated.");
-  bool found = false;
-  nsTObserverArray<IdleObserverHolder>::ForwardIterator iter(mIdleObservers);
-  while (iter.HasMore()) {
-    IdleObserverHolder& idleObserver = iter.GetNext();
-    if (idleObserver.mIdleObserver == aIdleObserver &&
-        idleObserver.mTimeInS == aTimeInS) {
-      found = true;
-      break;
-    }
-  }
-  return found;
-}
-
-void
-nsGlobalWindowOuter::HandleIdleObserverCallback()
-{
-  MOZ_ASSERT(IsInnerWindow(), "Must be an inner window!");
-  MOZ_ASSERT(static_cast<uint32_t>(mIdleCallbackIndex) < mIdleObservers.Length(),
-                                  "Idle callback index exceeds array bounds!");
-  IdleObserverHolder& idleObserver = mIdleObservers.ElementAt(mIdleCallbackIndex);
-  NotifyIdleObserver(&idleObserver, true);
-  mIdleCallbackIndex++;
-  if (NS_FAILED(ScheduleNextIdleObserverCallback())) {
-    NS_WARNING("Failed to set next idle observer callback.");
-  }
-}
-
-nsresult
-nsGlobalWindowOuter::ScheduleNextIdleObserverCallback()
-{
-  MOZ_CRASH("Inner window only");
-}
-
-uint32_t
-nsGlobalWindowOuter::GetFuzzTimeMS()
-{
-  MOZ_ASSERT(IsInnerWindow(), "Must be an inner window!");
-
-  if (gIdleObserversAPIFuzzTimeDisabled) {
-    return 0;
-  }
-
-  uint32_t randNum = MAX_IDLE_FUZZ_TIME_MS;
-  size_t nbytes = PR_GetRandomNoise(&randNum, sizeof(randNum));
-  if (nbytes != sizeof(randNum)) {
-    NS_WARNING("PR_GetRandomNoise(...) Not implemented or no available noise!");
-    return MAX_IDLE_FUZZ_TIME_MS;
-  }
-
-  if (randNum > MAX_IDLE_FUZZ_TIME_MS) {
-    randNum %= MAX_IDLE_FUZZ_TIME_MS;
-  }
-
-  return randNum;
-}
-
-nsresult
-nsGlobalWindowOuter::ScheduleActiveTimerCallback()
-{
-  MOZ_CRASH("Inner window only");
-}
-
-nsresult
-nsGlobalWindowOuter::HandleIdleActiveEvent()
-{
-  MOZ_ASSERT(IsInnerWindow(), "Must be an inner window!");
-
-  if (mCurrentlyIdle) {
-    mIdleCallbackIndex = 0;
-    mIdleFuzzFactor = GetFuzzTimeMS();
-    nsresult rv = ScheduleNextIdleObserverCallback();
-    NS_ENSURE_SUCCESS(rv, rv);
-    return NS_OK;
-  }
-
-  mIdleCallbackIndex = -1;
-  MOZ_ASSERT(mIdleTimer);
-  mIdleTimer->Cancel();
-  nsTObserverArray<IdleObserverHolder>::ForwardIterator iter(mIdleObservers);
-  while (iter.HasMore()) {
-    IdleObserverHolder& idleObserver = iter.GetNext();
-    if (idleObserver.mPrevNotificationIdle) {
-      NotifyIdleObserver(&idleObserver, false);
-    }
-  }
-
-  return NS_OK;
-}
-
-nsGlobalWindowOuter::SlowScriptResponse
-nsGlobalWindowOuter::ShowSlowScriptDialog(const nsString& aAddonId)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  nsresult rv;
-  AutoJSContext cx;
-
-  if (Preferences::GetBool("dom.always_stop_slow_scripts")) {
-    return KillSlowScript;
-  }
-
-  // If it isn't safe to run script, then it isn't safe to bring up the prompt
-  // (since that spins the event loop). In that (rare) case, we just kill the
-  // script and report a warning.
-  if (!nsContentUtils::IsSafeToRunScript()) {
-    JS_ReportWarningASCII(cx, "A long running script was terminated");
-    return KillSlowScript;
-  }
-
-  // If our document is not active, just kill the script: we've been unloaded
-  if (!AsInner()->HasActiveDocument()) {
-    return KillSlowScript;
-  }
-
-  // Check if we should offer the option to debug
-  JS::AutoFilename filename;
-  unsigned lineno;
-  // Computing the line number can be very expensive (see bug 1330231 for
-  // example), and we don't use the line number anywhere except than in the
-  // parent process, so we avoid computing it elsewhere.  This gives us most of
-  // the wins we are interested in, since the source of the slowness here is
-  // minified scripts which is more common in Web content that is loaded in the
-  // content process.
-  unsigned* linenop = XRE_IsParentProcess() ? &lineno : nullptr;
-  bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, linenop);
-
-  // Record the slow script event if we haven't done so already for this inner window
-  // (which represents a particular page to the user).
-  if (!mHasHadSlowScript) {
-    Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_PAGE_COUNT, 1);
-  }
-  mHasHadSlowScript = true;
-
-  if (XRE_IsContentProcess() &&
-      ProcessHangMonitor::Get()) {
-    ProcessHangMonitor::SlowScriptAction action;
-    RefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();
-    nsIDocShell* docShell = GetDocShell();
-    nsCOMPtr<nsITabChild> child = docShell ? docShell->GetTabChild() : nullptr;
-    action = monitor->NotifySlowScript(child,
-                                       filename.get(),
-                                       aAddonId);
-    if (action == ProcessHangMonitor::Terminate) {
-      return KillSlowScript;
-    }
-    if (action == ProcessHangMonitor::TerminateGlobal) {
-      return KillScriptGlobal;
-    }
-
-    if (action == ProcessHangMonitor::StartDebugger) {
-      // Spin a nested event loop so that the debugger in the parent can fetch
-      // any information it needs. Once the debugger has started, return to the
-      // script.
-      RefPtr<nsGlobalWindowOuter> outer = GetOuterWindowInternal();
-      outer->EnterModalState();
-      SpinEventLoopUntil([&]() { return monitor->IsDebuggerStartupComplete(); });
-      outer->LeaveModalState();
-      return ContinueSlowScript;
-    }
-
-    return ContinueSlowScriptAndKeepNotifying;
-  }
-
-  // Reached only on non-e10s - once per slow script dialog.
-  // On e10s - we probe once at ProcessHangsMonitor.jsm
-  Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_NOTICE_COUNT, 1);
-
-  // Get the nsIPrompt interface from the docshell
-  nsCOMPtr<nsIDocShell> ds = GetDocShell();
-  NS_ENSURE_TRUE(ds, KillSlowScript);
-  nsCOMPtr<nsIPrompt> prompt = do_GetInterface(ds);
-  NS_ENSURE_TRUE(prompt, KillSlowScript);
-
-  // Prioritize the SlowScriptDebug interface over JSD1.
-  nsCOMPtr<nsISlowScriptDebugCallback> debugCallback;
-
-  if (hasFrame) {
-    const char *debugCID = "@mozilla.org/dom/slow-script-debug;1";
-    nsCOMPtr<nsISlowScriptDebug> debugService = do_GetService(debugCID, &rv);
-    if (NS_SUCCEEDED(rv)) {
-      debugService->GetActivationHandler(getter_AddRefs(debugCallback));
-    }
-  }
-
-  bool failed = false;
-  auto getString = [&] (const char* name,
-                        nsContentUtils::PropertiesFile propFile = nsContentUtils::eDOM_PROPERTIES) {
-    nsAutoString result;
-    nsresult rv = nsContentUtils::GetLocalizedString(
-      propFile, name, result);
-
-    // GetStringFromName can return NS_OK and still give nullptr string
-    failed = failed || NS_FAILED(rv) || result.IsEmpty();
-    return Move(result);
-  };
-
-  bool isAddonScript = !aAddonId.IsEmpty();
-  bool showDebugButton = debugCallback && !isAddonScript;
-
-  // Get localizable strings
-
-  nsAutoString title, checkboxMsg, debugButton, msg;
-  if (isAddonScript) {
-    title = getString("KillAddonScriptTitle");
-    checkboxMsg = getString("KillAddonScriptGlobalMessage");
-
-    auto appName = getString("brandShortName", nsContentUtils::eBRAND_PROPERTIES);
-
-    nsCOMPtr<nsIAddonPolicyService> aps = do_GetService("@mozilla.org/addons/policy-service;1");
-    nsString addonName;
-    if (!aps || NS_FAILED(aps->GetExtensionName(aAddonId, addonName))) {
-      addonName = aAddonId;
-    }
-
-    const char16_t* params[] = {addonName.get(), appName.get()};
-    rv = nsContentUtils::FormatLocalizedString(
-        nsContentUtils::eDOM_PROPERTIES, "KillAddonScriptMessage",
-        params, msg);
-
-    failed = failed || NS_FAILED(rv);
-  } else {
-    title = getString("KillScriptTitle");
-    checkboxMsg = getString("DontAskAgain");
-
-    if (showDebugButton) {
-      debugButton = getString("DebugScriptButton");
-      msg = getString("KillScriptWithDebugMessage");
-    } else {
-      msg = getString("KillScriptMessage");
-    }
-  }
-
-  auto stopButton = getString("StopScriptButton");
-  auto waitButton = getString("WaitForScriptButton");
-
-  if (failed) {
-    NS_ERROR("Failed to get localized strings.");
-    return ContinueSlowScript;
-  }
-
-  // Append file and line number information, if available
-  if (filename.get()) {
-    nsAutoString scriptLocation;
-    // We want to drop the middle part of too-long locations.  We'll
-    // define "too-long" as longer than 60 UTF-16 code units.  Just
-    // have to be a bit careful about unpaired surrogates.
-    NS_ConvertUTF8toUTF16 filenameUTF16(filename.get());
-    if (filenameUTF16.Length() > 60) {
-      // XXXbz Do we need to insert any bidi overrides here?
-      size_t cutStart = 30;
-      size_t cutLength = filenameUTF16.Length() - 60;
-      MOZ_ASSERT(cutLength > 0);
-      if (NS_IS_LOW_SURROGATE(filenameUTF16[cutStart])) {
-        // Don't truncate before the low surrogate, in case it's preceded by a
-        // high surrogate and forms a single Unicode character.  Instead, just
-        // include the low surrogate.
-        ++cutStart;
-        --cutLength;
-      }
-      if (NS_IS_LOW_SURROGATE(filenameUTF16[cutStart + cutLength])) {
-        // Likewise, don't drop a trailing low surrogate here.  We want to
-        // increase cutLength, since it might be 0 already so we can't very well
-        // decrease it.
-        ++cutLength;
-      }
-
-      // Insert U+2026 HORIZONTAL ELLIPSIS
-      filenameUTF16.ReplaceLiteral(cutStart, cutLength, u"\x2026");
-    }
-    const char16_t *formatParams[] = { filenameUTF16.get() };
-    rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
-                                               "KillScriptLocation",
-                                               formatParams,
-                                               scriptLocation);
-
-    if (NS_SUCCEEDED(rv)) {
-      msg.AppendLiteral("\n\n");
-      msg.Append(scriptLocation);
-      msg.Append(':');
-      msg.AppendInt(lineno);
-    }
-  }
-
-  uint32_t buttonFlags = nsIPrompt::BUTTON_POS_1_DEFAULT +
-                         (nsIPrompt::BUTTON_TITLE_IS_STRING *
-                          (nsIPrompt::BUTTON_POS_0 + nsIPrompt::BUTTON_POS_1));
-
-  // Add a third button if necessary.
-  if (showDebugButton)
-    buttonFlags += nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2;
-
-  bool checkboxValue = false;
-  int32_t buttonPressed = 0; // In case the user exits dialog by clicking X.
-  {
-    // Null out the operation callback while we're re-entering JS here.
-    AutoDisableJSInterruptCallback disabler(cx);
-
-    // Open the dialog.
-    rv = prompt->ConfirmEx(title.get(), msg.get(), buttonFlags,
-                           waitButton.get(), stopButton.get(),
-                           debugButton.get(), checkboxMsg.get(),
-                           &checkboxValue, &buttonPressed);
-  }
-
-  if (buttonPressed == 0) {
-    if (checkboxValue && !isAddonScript && NS_SUCCEEDED(rv))
-      return AlwaysContinueSlowScript;
-    return ContinueSlowScript;
-  }
-
-  if (buttonPressed == 2) {
-    MOZ_RELEASE_ASSERT(debugCallback);
-
-    rv = debugCallback->HandleSlowScriptDebug(this);
-    return NS_SUCCEEDED(rv) ? ContinueSlowScript : KillSlowScript;
-  }
-
-  JS_ClearPendingException(cx);
-
-  if (checkboxValue && isAddonScript)
-    return KillScriptGlobal;
-  return KillSlowScript;
-}
-
-uint32_t
-nsGlobalWindowOuter::FindInsertionIndex(IdleObserverHolder* aIdleObserver)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  MOZ_ASSERT(aIdleObserver, "Idle observer not instantiated.");
-
-  uint32_t i = 0;
-  nsTObserverArray<IdleObserverHolder>::ForwardIterator iter(mIdleObservers);
-  while (iter.HasMore()) {
-    IdleObserverHolder& idleObserver = iter.GetNext();
-    if (idleObserver.mTimeInS > aIdleObserver->mTimeInS) {
-      break;
-    }
-    i++;
-    MOZ_ASSERT(i <= mIdleObservers.Length(), "Array index out of bounds error.");
-  }
-
-  return i;
-}
-
 nsresult
 nsGlobalWindowOuter::RegisterIdleObserver(nsIIdleObserver* aIdleObserver)
 {
-  MOZ_CRASH("Inner window only");
-}
-
-nsresult
-nsGlobalWindowOuter::FindIndexOfElementToRemove(nsIIdleObserver* aIdleObserver,
-                                           int32_t* aRemoveElementIndex)
-{
-  MOZ_ASSERT(IsInnerWindow(), "Must be an inner window!");
-  MOZ_ASSERT(aIdleObserver, "Idle observer not instantiated.");
-
-  *aRemoveElementIndex = 0;
-  if (mIdleObservers.IsEmpty()) {
-    return NS_ERROR_FAILURE;
-  }
-
-  uint32_t aIdleObserverTimeInS;
-  nsresult rv = aIdleObserver->GetTime(&aIdleObserverTimeInS);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_ARG_MIN(aIdleObserverTimeInS, MIN_IDLE_NOTIFICATION_TIME_S);
-
-  nsTObserverArray<IdleObserverHolder>::ForwardIterator iter(mIdleObservers);
-  while (iter.HasMore()) {
-    IdleObserverHolder& idleObserver = iter.GetNext();
-    if (idleObserver.mTimeInS == aIdleObserverTimeInS &&
-        idleObserver.mIdleObserver == aIdleObserver ) {
-      break;
-    }
-    (*aRemoveElementIndex)++;
-  }
-  return static_cast<uint32_t>(*aRemoveElementIndex) >= mIdleObservers.Length() ?
-    NS_ERROR_FAILURE : NS_OK;
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 nsresult
 nsGlobalWindowOuter::UnregisterIdleObserver(nsIIdleObserver* aIdleObserver)
 {
-  MOZ_CRASH("Inner window only");
-}
-
-nsresult
-nsGlobalWindowOuter::Observe(nsISupports* aSubject, const char* aTopic,
-                        const char16_t* aData)
-{
-  if (!nsCRT::strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) {
-    if (!IsFrozen()) {
-        // Fires an offline status event if the offline status has changed
-        FireOfflineStatusEventIfChanged();
-    }
-    return NS_OK;
-  }
-
-  if (!nsCRT::strcmp(aTopic, MEMORY_PRESSURE_OBSERVER_TOPIC)) {
-    if (mPerformance) {
-      mPerformance->MemoryPressure();
-    }
-    return NS_OK;
-  }
-
-  if (!nsCRT::strcmp(aTopic, OBSERVER_TOPIC_IDLE)) {
-    mCurrentlyIdle = true;
-    if (IsFrozen()) {
-      // need to fire only one idle event while the window is frozen.
-      mNotifyIdleObserversIdleOnThaw = true;
-      mNotifyIdleObserversActiveOnThaw = false;
-    } else if (AsInner()->IsCurrentInnerWindow()) {
-      HandleIdleActiveEvent();
-    }
-    return NS_OK;
-  }
-
-  if (!nsCRT::strcmp(aTopic, OBSERVER_TOPIC_ACTIVE)) {
-    mCurrentlyIdle = false;
-    if (IsFrozen()) {
-      mNotifyIdleObserversActiveOnThaw = true;
-      mNotifyIdleObserversIdleOnThaw = false;
-    } else if (AsInner()->IsCurrentInnerWindow()) {
-      MOZ_ASSERT(IsInnerWindow());
-      ScheduleActiveTimerCallback();
-    }
-    return NS_OK;
-  }
-
-  if (!nsCRT::strcmp(aTopic, "offline-cache-update-added")) {
-    if (mApplicationCache)
-      return NS_OK;
-
-    // Instantiate the application object now. It observes update belonging to
-    // this window's document and correctly updates the applicationCache object
-    // state.
-    nsCOMPtr<nsIDOMOfflineResourceList> applicationCache = GetApplicationCache();
-    nsCOMPtr<nsIObserver> observer = do_QueryInterface(applicationCache);
-    if (observer)
-      observer->Observe(aSubject, aTopic, aData);
-
-    return NS_OK;
-  }
-
-  if (!nsCRT::strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
-    MOZ_ASSERT(!NS_strcmp(aData, u"intl.accept_languages"));
-    MOZ_ASSERT(IsInnerWindow());
-
-    // The user preferred languages have changed, we need to fire an event on
-    // Window object and invalidate the cache for navigator.languages. It is
-    // done for every change which can be a waste of cycles but those should be
-    // fairly rare.
-    // We MUST invalidate navigator.languages before sending the event in the
-    // very likely situation where an event handler will try to read its value.
-
-    if (mNavigator) {
-      NavigatorBinding::ClearCachedLanguageValue(mNavigator);
-      NavigatorBinding::ClearCachedLanguagesValue(mNavigator);
-    }
-
-    // The event has to be dispatched only to the current inner window.
-    if (!AsInner()->IsCurrentInnerWindow()) {
-      return NS_OK;
-    }
-
-    RefPtr<Event> event = NS_NewDOMEvent(this, nullptr, nullptr);
-    event->InitEvent(NS_LITERAL_STRING("languagechange"), false, false);
-    event->SetTrusted(true);
-
-    bool dummy;
-    return DispatchEvent(event, &dummy);
-  }
-
-  NS_WARNING("unrecognized topic in nsGlobalWindowOuter::Observe");
-  return NS_ERROR_FAILURE;
-}
-
-void
-nsGlobalWindowOuter::ObserveStorageNotification(StorageEvent* aEvent,
-                                           const char16_t* aStorageType,
-                                           bool aPrivateBrowsing)
-{
-  MOZ_ASSERT(aEvent);
-
-  // The private browsing check must be done here again because this window
-  // could have changed its state before the notification check and now. This
-  // happens in case this window did have a docShell at that time.
-  if (aPrivateBrowsing != IsPrivateBrowsing()) {
-    return;
-  }
-
-  // LocalStorage can only exist on an inner window, and we don't want to
-  // generate events on frozen or otherwise-navigated-away from windows.
-  // (Actually, this code used to try and buffer events for frozen windows,
-  // but it never worked, so we've removed it.  See bug 1285898.)
-  if (!IsInnerWindow() || !AsInner()->IsCurrentInnerWindow() || IsFrozen()) {
-    return;
-  }
-
-  nsIPrincipal *principal = GetPrincipal();
-  if (!principal) {
-    return;
-  }
-
-  bool fireMozStorageChanged = false;
-  nsAutoString eventType;
-  eventType.AssignLiteral("storage");
-
-  if (!NS_strcmp(aStorageType, u"sessionStorage")) {
-    nsCOMPtr<nsIDOMStorage> changingStorage = aEvent->GetStorageArea();
-    MOZ_ASSERT(changingStorage);
-
-    bool check = false;
-
-    nsCOMPtr<nsIDOMStorageManager> storageManager = do_QueryInterface(GetDocShell());
-    if (storageManager) {
-      nsresult rv = storageManager->CheckStorage(principal, changingStorage,
-                                                 &check);
-      if (NS_FAILED(rv)) {
-        return;
-      }
-    }
-
-    if (!check) {
-      // This storage event is not coming from our storage or is coming
-      // from a different docshell, i.e. it is a clone, ignore this event.
-      return;
-    }
-
-    MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug,
-            ("nsGlobalWindowOuter %p with sessionStorage %p passing event from %p",
-             this, mSessionStorage.get(), changingStorage.get()));
-
-    fireMozStorageChanged = mSessionStorage == changingStorage;
-    if (fireMozStorageChanged) {
-      eventType.AssignLiteral("MozSessionStorageChanged");
-    }
-  }
-
-  else {
-    MOZ_ASSERT(!NS_strcmp(aStorageType, u"localStorage"));
-
-    MOZ_DIAGNOSTIC_ASSERT(StorageUtils::PrincipalsEqual(aEvent->GetPrincipal(),
-                                                        principal));
-
-    fireMozStorageChanged = mLocalStorage == aEvent->GetStorageArea();
-
-    if (fireMozStorageChanged) {
-      eventType.AssignLiteral("MozLocalStorageChanged");
-    }
-  }
-
-  // Clone the storage event included in the observer notification. We want
-  // to dispatch clones rather than the original event.
-  IgnoredErrorResult error;
-  RefPtr<StorageEvent> clonedEvent =
-    CloneStorageEvent(eventType, aEvent, error);
-  if (error.Failed()) {
-    return;
-  }
-
-  clonedEvent->SetTrusted(true);
-
-  if (fireMozStorageChanged) {
-    WidgetEvent* internalEvent = clonedEvent->WidgetEventPtr();
-    internalEvent->mFlags.mOnlyChromeDispatch = true;
-  }
-
-  bool defaultActionEnabled;
-  DispatchEvent(clonedEvent, &defaultActionEnabled);
-}
-
-already_AddRefed<StorageEvent>
-nsGlobalWindowOuter::CloneStorageEvent(const nsAString& aType,
-                                  const RefPtr<StorageEvent>& aEvent,
-                                  ErrorResult& aRv)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  StorageEventInit dict;
-
-  dict.mBubbles = aEvent->Bubbles();
-  dict.mCancelable = aEvent->Cancelable();
-  aEvent->GetKey(dict.mKey);
-  aEvent->GetOldValue(dict.mOldValue);
-  aEvent->GetNewValue(dict.mNewValue);
-  aEvent->GetUrl(dict.mUrl);
-
-  RefPtr<Storage> storageArea = aEvent->GetStorageArea();
-
-  RefPtr<Storage> storage;
-
-  // If null, this is a localStorage event received by IPC.
-  if (!storageArea) {
-    storage = GetLocalStorage(aRv);
-    if (aRv.Failed() || !storage) {
-      return nullptr;
-    }
-
-    MOZ_ASSERT(storage->Type() == Storage::eLocalStorage);
-    RefPtr<LocalStorage> localStorage =
-      static_cast<LocalStorage*>(storage.get());
-
-    // We must apply the current change to the 'local' localStorage.
-    localStorage->ApplyEvent(aEvent);
-  } else if (storageArea->Type() == Storage::eSessionStorage) {
-    storage = GetSessionStorage(aRv);
-  } else {
-    MOZ_ASSERT(storageArea->Type() == Storage::eLocalStorage);
-    storage = GetLocalStorage(aRv);
-  }
-
-  if (aRv.Failed() || !storage) {
-    return nullptr;
-  }
-
-  MOZ_ASSERT(storage);
-  MOZ_ASSERT_IF(storageArea, storage->IsForkOf(storageArea));
-
-  dict.mStorageArea = storage;
-
-  RefPtr<StorageEvent> event = StorageEvent::Constructor(this, aType, dict);
-  return event.forget();
-}
-
-void
-nsGlobalWindowOuter::Suspend()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_DIAGNOSTIC_ASSERT(IsInnerWindow());
-
-  // We can only safely suspend windows that are the current inner window.  If
-  // its not the current inner, then we are in one of two different cases.
-  // Either we are in the bfcache or we are doomed window that is going away.
-  // When a window becomes inactive we purposely avoid placing already suspended
-  // windows into the bfcache.  It only expects windows suspended due to the
-  // Freeze() method which occurs while the window is still the current inner.
-  // So we must not call Suspend() on bfcache windows at this point or this
-  // invariant will be broken.  If the window is doomed there is no point in
-  // suspending it since it will soon be gone.
-  if (!AsInner()->IsCurrentInnerWindow()) {
-    return;
-  }
-
-  // All children are also suspended.  This ensure mSuspendDepth is
-  // set properly and the timers are properly canceled for each child.
-  CallOnChildren(&nsGlobalWindowInner::Suspend);
-
-  mSuspendDepth += 1;
-  if (mSuspendDepth != 1) {
-    return;
-  }
-
-  nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
-  if (ac) {
-    for (uint32_t i = 0; i < mEnabledSensors.Length(); i++)
-      ac->RemoveWindowListener(mEnabledSensors[i], this);
-  }
-  DisableGamepadUpdates();
-  DisableVRUpdates();
-
-  mozilla::dom::workers::SuspendWorkersForWindow(AsInner());
-
-  SuspendIdleRequests();
-
-  mTimeoutManager->Suspend();
-
-  // Suspend all of the AudioContexts for this window
-  for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
-    ErrorResult dummy;
-    RefPtr<Promise> d = mAudioContexts[i]->Suspend(dummy);
-  }
-}
-
-void
-nsGlobalWindowOuter::Resume()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_DIAGNOSTIC_ASSERT(IsInnerWindow());
-
-  // We can only safely resume a window if its the current inner window.  If
-  // its not the current inner, then we are in one of two different cases.
-  // Either we are in the bfcache or we are doomed window that is going away.
-  // If a window is suspended when it becomes inactive we purposely do not
-  // put it in the bfcache, so Resume should never be needed in that case.
-  // If the window is doomed then there is no point in resuming it.
-  if (!AsInner()->IsCurrentInnerWindow()) {
-    return;
-  }
-
-  // Resume all children.  This restores timers recursively canceled
-  // in Suspend() and ensures all children have the correct mSuspendDepth.
-  CallOnChildren(&nsGlobalWindowInner::Resume);
-
-  MOZ_ASSERT(mSuspendDepth != 0);
-  mSuspendDepth -= 1;
-  if (mSuspendDepth != 0) {
-    return;
-  }
-
-  // We should not be able to resume a frozen window.  It must be Thaw()'d first.
-  MOZ_ASSERT(mFreezeDepth == 0);
-
-  nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
-  if (ac) {
-    for (uint32_t i = 0; i < mEnabledSensors.Length(); i++)
-      ac->AddWindowListener(mEnabledSensors[i], this);
-  }
-  EnableGamepadUpdates();
-  EnableVRUpdates();
-
-  // Resume all of the AudioContexts for this window
-  for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
-    ErrorResult dummy;
-    RefPtr<Promise> d = mAudioContexts[i]->Resume(dummy);
-  }
-
-  mTimeoutManager->Resume();
-
-  ResumeIdleRequests();
-
-  // Resume all of the workers for this window.  We must do this
-  // after timeouts since workers may have queued events that can trigger
-  // a setTimeout().
-  mozilla::dom::workers::ResumeWorkersForWindow(AsInner());
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 bool
 nsGlobalWindowOuter::IsSuspended() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   // No inner means we are effectively suspended
-  if (IsOuterWindow()) {
-    if (!mInnerWindow) {
-      return true;
-    }
-    return mInnerWindow->IsSuspended();
-  }
-  return mSuspendDepth != 0;
-}
-
-void
-nsGlobalWindowOuter::Freeze()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  Suspend();
-  FreezeInternal();
-}
-
-void
-nsGlobalWindowOuter::FreezeInternal()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_DIAGNOSTIC_ASSERT(IsInnerWindow());
-  MOZ_DIAGNOSTIC_ASSERT(AsInner()->IsCurrentInnerWindow());
-  MOZ_DIAGNOSTIC_ASSERT(IsSuspended());
-
-  CallOnChildren(&nsGlobalWindowInner::FreezeInternal);
-
-  mFreezeDepth += 1;
-  MOZ_ASSERT(mSuspendDepth >= mFreezeDepth);
-  if (mFreezeDepth != 1) {
-    return;
-  }
-
-  mozilla::dom::workers::FreezeWorkersForWindow(AsInner());
-
-  mTimeoutManager->Freeze();
-
-  if (IsInnerWindow()) {
-    NotifyDOMWindowFrozen(AssertInner());
-  }
-}
-
-void
-nsGlobalWindowOuter::Thaw()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  ThawInternal();
-  Resume();
-}
-
-void
-nsGlobalWindowOuter::ThawInternal()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_DIAGNOSTIC_ASSERT(IsInnerWindow());
-  MOZ_DIAGNOSTIC_ASSERT(AsInner()->IsCurrentInnerWindow());
-  MOZ_DIAGNOSTIC_ASSERT(IsSuspended());
-
-  CallOnChildren(&nsGlobalWindowInner::ThawInternal);
-
-  MOZ_ASSERT(mFreezeDepth != 0);
-  mFreezeDepth -= 1;
-  MOZ_ASSERT(mSuspendDepth >= mFreezeDepth);
-  if (mFreezeDepth != 0) {
-    return;
-  }
-
-  mTimeoutManager->Thaw();
-
-  mozilla::dom::workers::ThawWorkersForWindow(AsInner());
-
-  if (IsInnerWindow()) {
-    NotifyDOMWindowThawed(AssertInner());
-  }
+  if (!mInnerWindow) {
+    return true;
+  }
+  return mInnerWindow->IsSuspended();
 }
 
 bool
 nsGlobalWindowOuter::IsFrozen() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   // No inner means we are effectively frozen
-  if (IsOuterWindow()) {
-    if (!mInnerWindow) {
-      return true;
-    }
-    return mInnerWindow->IsFrozen();
-  }
-  bool frozen = mFreezeDepth != 0;
-  MOZ_ASSERT_IF(frozen, IsSuspended());
-  return frozen;
-}
-
-void
-nsGlobalWindowOuter::SyncStateFromParentWindow()
-{
-  // This method should only be called on an inner window that has been
-  // assigned to an outer window already.
-  MOZ_ASSERT(IsInnerWindow());
-  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;
-  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();
-  }
-
-  uint32_t parentFreezeDepth = parentInner ? parentInner->mFreezeDepth : 0;
-  uint32_t parentSuspendDepth = parentInner ? parentInner->mSuspendDepth : 0;
-
-  // Since every Freeze() calls Suspend(), the suspend count must
-  // be equal or greater to the freeze count.
-  MOZ_ASSERT(parentFreezeDepth <= parentSuspendDepth);
-
-  // First apply the Freeze() calls.
-  for (uint32_t i = 0; i < parentFreezeDepth; ++i) {
-    Freeze();
-  }
-
-  // Now apply only the number of Suspend() calls to reach the target
-  // suspend count after applying the Freeze() calls.
-  for (uint32_t i = 0; i < (parentSuspendDepth - parentFreezeDepth); ++i) {
-    Suspend();
-  }
-}
-
-template<typename Method>
-void
-nsGlobalWindowOuter::CallOnChildren(Method aMethod)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(IsInnerWindow());
-  MOZ_ASSERT(AsInner()->IsCurrentInnerWindow());
-
-  nsCOMPtr<nsIDocShell> docShell = GetDocShell();
-  if (!docShell) {
-    return;
-  }
-
-  int32_t childCount = 0;
-  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");
-
-    nsCOMPtr<nsPIDOMWindowOuter> pWin = childShell->GetWindow();
-    if (!pWin) {
-      continue;
-    }
-
-    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;
-    }
-
-    (inner->*aMethod)();
-  }
+  if (!mInnerWindow) {
+    return true;
+  }
+  return mInnerWindow->IsFrozen();
 }
 
 nsresult
 nsGlobalWindowOuter::FireDelayedDOMEvents()
 {
   FORWARD_TO_INNER(FireDelayedDOMEvents, (), NS_ERROR_UNEXPECTED);
-
-  if (mApplicationCache) {
-    static_cast<nsDOMOfflineResourceList*>(mApplicationCache.get())->FirePendingEvents();
-  }
-
-  // Fires an offline status event if the offline status has changed
-  FireOfflineStatusEventIfChanged();
-
-  if (mNotifyIdleObserversIdleOnThaw) {
-    mNotifyIdleObserversIdleOnThaw = false;
-    HandleIdleActiveEvent();
-  }
-
-  if (mNotifyIdleObserversActiveOnThaw) {
-    mNotifyIdleObserversActiveOnThaw = false;
-    ScheduleActiveTimerCallback();
-  }
-
-  nsCOMPtr<nsIDocShell> docShell = GetDocShell();
-  if (docShell) {
-    int32_t childCount = 0;
-    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 = nsGlobalWindowOuter::Cast(pWin);
-        win->FireDelayedDOMEvents();
-      }
-    }
-  }
-
-  return NS_OK;
 }
 
 //*****************************************************************************
 // nsGlobalWindowOuter: Window Control Functions
 //*****************************************************************************
 
 nsPIDOMWindowOuter*
 nsGlobalWindowOuter::GetParentInternal()
 {
-  if (IsInnerWindow()) {
-    nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-    if (!outer) {
-      // No outer window available!
-      return nullptr;
-    }
-    return outer->GetParentInternal();
-  }
-
   nsCOMPtr<nsPIDOMWindowOuter> parent = GetParent();
 
   if (parent && parent != AsOuter()) {
     return parent;
   }
 
   return nullptr;
 }
@@ -11078,269 +7428,22 @@ nsGlobalWindowOuter::OpenInternal(const 
       Unused << doc;
     }
   }
 
   return rv;
 }
 
 //*****************************************************************************
-// nsGlobalWindowOuter: Timeout Functions
-//*****************************************************************************
-
-nsGlobalWindowInner*
-nsGlobalWindowOuter::InnerForSetTimeoutOrInterval(ErrorResult& aError)
-{
-  nsGlobalWindowInner* currentInner;
-  nsGlobalWindowInner* forwardTo;
-  if (IsInnerWindow()) {
-    nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-    currentInner = outer ? outer->GetCurrentInnerWindowInternal() : AssertInner();
-
-    forwardTo = AssertInner();
-  } else {
-    currentInner = GetCurrentInnerWindowInternal();
-
-    // This needs to forward to the inner window, but since the current
-    // inner may not be the inner in the calling scope, we need to treat
-    // this specially here as we don't want timeouts registered in a
-    // dying inner window to get registered and run on the current inner
-    // window. To get this right, we need to forward this call to the
-    // inner window that's calling window.setTimeout().
-
-    forwardTo = CallerInnerWindow();
-    if (!forwardTo && nsContentUtils::IsCallerChrome()) {
-      forwardTo = currentInner;
-    }
-    if (!forwardTo) {
-      aError.Throw(NS_ERROR_NOT_AVAILABLE);
-      return nullptr;
-    }
-
-    // If the caller and the callee share the same outer window, forward to the
-    // caller inner. Else, we forward to the current inner (e.g. someone is
-    // calling setTimeout() on a reference to some other window).
-    if (forwardTo->GetOuterWindow() != AsOuter() ||
-        !forwardTo->IsInnerWindow()) {
-      if (!currentInner) {
-        NS_WARNING("No inner window available!");
-        aError.Throw(NS_ERROR_NOT_INITIALIZED);
-        return nullptr;
-      }
-
-      return currentInner;
-    }
-  }
-
-  // If forwardTo is not the window with an active document then we want the
-  // call to setTimeout/Interval to be a noop, so return null but don't set an
-  // error.
-  return forwardTo->AsInner()->HasActiveDocument() ? currentInner : nullptr;
-}
-
-int32_t
-nsGlobalWindowOuter::SetTimeout(JSContext* aCx, Function& aFunction,
-                           int32_t aTimeout,
-                           const Sequence<JS::Value>& aArguments,
-                           ErrorResult& aError)
-{
-  return SetTimeoutOrInterval(aCx, aFunction, aTimeout, aArguments, false,
-                              aError);
-}
-
-int32_t
-nsGlobalWindowOuter::SetTimeout(JSContext* aCx, const nsAString& aHandler,
-                           int32_t aTimeout,
-                           const Sequence<JS::Value>& /* unused */,
-                           ErrorResult& aError)
-{
-  return SetTimeoutOrInterval(aCx, aHandler, aTimeout, false, aError);
-}
-
-int32_t
-nsGlobalWindowOuter::SetInterval(JSContext* aCx, Function& aFunction,
-                            const Optional<int32_t>& aTimeout,
-                            const Sequence<JS::Value>& aArguments,
-                            ErrorResult& aError)
-{
-  int32_t timeout;
-  bool isInterval = IsInterval(aTimeout, timeout);
-  return SetTimeoutOrInterval(aCx, aFunction, timeout, aArguments, isInterval,
-                              aError);
-}
-
-int32_t
-nsGlobalWindowOuter::SetInterval(JSContext* aCx, const nsAString& aHandler,
-                            const Optional<int32_t>& aTimeout,
-                            const Sequence<JS::Value>& /* unused */,
-                            ErrorResult& aError)
-{
-  int32_t timeout;
-  bool isInterval = IsInterval(aTimeout, timeout);
-  return SetTimeoutOrInterval(aCx, aHandler, timeout, isInterval, aError);
-}
-
-int32_t
-nsGlobalWindowOuter::SetTimeoutOrInterval(JSContext *aCx, Function& aFunction,
-                                     int32_t aTimeout,
-                                     const Sequence<JS::Value>& aArguments,
-                                     bool aIsInterval, ErrorResult& aError)
-{
-  nsGlobalWindowInner* inner = InnerForSetTimeoutOrInterval(aError);
-  if (!inner) {
-    return -1;
-  }
-
-  return inner->SetTimeoutOrInterval(aCx, aFunction, aTimeout, aArguments,
-                                      aIsInterval, aError);
-}
-
-int32_t
-nsGlobalWindowOuter::SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
-                                     int32_t aTimeout, bool aIsInterval,
-                                     ErrorResult& aError)
-{
-  nsGlobalWindowInner* inner = InnerForSetTimeoutOrInterval(aError);
-  if (!inner) {
-    return -1;
-  }
-
-  return inner->SetTimeoutOrInterval(aCx, aHandler, aTimeout, aIsInterval,
-                                      aError);
-}
-
-bool
-nsGlobalWindowOuter::RunTimeoutHandler(Timeout* aTimeout,
-                                  nsIScriptContext* aScx)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // Hold on to the timeout in case mExpr or mFunObj releases its
-  // doc.
-  RefPtr<Timeout> timeout = aTimeout;
-  Timeout* last_running_timeout = mTimeoutManager->BeginRunningTimeout(timeout);
-  timeout->mRunning = true;
-
-  // Push this timeout's popup control state, which should only be
-  // eabled the first time a timeout fires that was created while
-  // popups were enabled and with a delay less than
-  // "dom.disable_open_click_delay".
-  nsAutoPopupStatePusher popupStatePusher(timeout->mPopupState);
-
-  // Clear the timeout's popup state, if any, to prevent interval
-  // timeouts from repeatedly opening poups.
-  timeout->mPopupState = openAbused;
-
-  bool trackNestingLevel = !timeout->mIsInterval;
-  uint32_t nestingLevel;
-  if (trackNestingLevel) {
-    nestingLevel = TimeoutManager::GetNestingLevel();
-    TimeoutManager::SetNestingLevel(timeout->mNestingLevel);
-  }
-
-  const char *reason;
-  if (timeout->mIsInterval) {
-    reason = "setInterval handler";
-  } else {
-    reason = "setTimeout handler";
-  }
-
-  bool abortIntervalHandler = false;
-  nsCOMPtr<nsIScriptTimeoutHandler> handler(do_QueryInterface(timeout->mScriptHandler));
-  if (handler) {
-    RefPtr<Function> callback = handler->GetCallback();
-
-    if (!callback) {
-      // Evaluate the timeout expression.
-      const nsAString& script = handler->GetHandlerText();
-
-      const char* filename = nullptr;
-      uint32_t lineNo = 0, dummyColumn = 0;
-      handler->GetLocation(&filename, &lineNo, &dummyColumn);
-
-      // New script entry point required, due to the "Create a script" sub-step of
-      // http://www.whatwg.org/specs/web-apps/current-work/#timer-initialisation-steps
-      nsAutoMicroTask mt;
-      AutoEntryScript aes(this, reason, true);
-      JS::CompileOptions options(aes.cx());
-      options.setFileAndLine(filename, lineNo).setVersion(JSVERSION_DEFAULT);
-      options.setNoScriptRval(true);
-      JS::Rooted<JSObject*> global(aes.cx(), FastGetGlobalJSObject());
-      nsresult rv = NS_OK;
-      {
-        nsJSUtils::ExecutionContext exec(aes.cx(), global);
-        rv = exec.CompileAndExec(options, script);
-      }
-
-      if (rv == NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE) {
-        abortIntervalHandler = true;
-      }
-    } else {
-      // Hold strong ref to ourselves while we call the callback.
-      nsCOMPtr<nsISupports> me(static_cast<nsIDOMWindow*>(this));
-      ErrorResult rv;
-      JS::Rooted<JS::Value> ignoredVal(RootingCx());
-      callback->Call(me, handler->GetArgs(), &ignoredVal, rv, reason);
-      if (rv.IsUncatchableException()) {
-        abortIntervalHandler = true;
-      }
-
-      rv.SuppressException();
-    }
-  } else {
-    nsCOMPtr<nsITimeoutHandler> basicHandler(timeout->mScriptHandler);
-    nsCOMPtr<nsISupports> kungFuDeathGrip(static_cast<nsIDOMWindow*>(this));
-    mozilla::Unused << kungFuDeathGrip;
-    basicHandler->Call();
-  }
-
-  // If we received an uncatchable exception, do not schedule the timeout again.
-  // This allows the slow script dialog to break easy DoS attacks like
-  // setInterval(function() { while(1); }, 100);
-  if (abortIntervalHandler) {
-    // If it wasn't an interval timer to begin with, this does nothing.  If it
-    // was, we'll treat it as a timeout that we just ran and discard it when
-    // we return.
-    timeout->mIsInterval = false;
-   }
-
-  // We ignore any failures from calling EvaluateString() on the context or
-  // Call() on a Function here since we're in a loop
-  // where we're likely to be running timeouts whose OS timers
-  // didn't fire in time and we don't want to not fire those timers
-  // now just because execution of one timer failed. We can't
-  // propagate the error to anyone who cares about it from this
-  // point anyway, and the script context should have already reported
-  // the script error in the usual way - so we just drop it.
-
-  // Since we might be processing more timeouts, go ahead and flush the promise
-  // queue now before we do that.  We need to do that while we're still in our
-  // "running JS is safe" state (e.g. mRunningTimeout is set, timeout->mRunning
-  // is false).
-  Promise::PerformMicroTaskCheckpoint();
-
-  if (trackNestingLevel) {
-    TimeoutManager::SetNestingLevel(nestingLevel);
-  }
-
-  mTimeoutManager->EndRunningTimeout(last_running_timeout);
-  timeout->mRunning = false;
-
-  return timeout->mCleared;
-}
-
-//*****************************************************************************
 // nsGlobalWindowOuter: Helper Functions
 //*****************************************************************************
 
 already_AddRefed<nsIDocShellTreeOwner>
 nsGlobalWindowOuter::GetTreeOwner()
 {
-  FORWARD_TO_OUTER(GetTreeOwner, (), nullptr);
-
   // If there's no docShellAsItem, this window must have been closed,
   // in that case there is no tree owner.
 
   if (!mDocShell) {
     return nullptr;
   }
 
   nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
@@ -11373,18 +7476,16 @@ nsGlobalWindowOuter::GetWebBrowserChrome
 
   nsCOMPtr<nsIWebBrowserChrome> browserChrome = do_GetInterface(treeOwner);
   return browserChrome.forget();
 }
 
 nsIScrollableFrame *
 nsGlobalWindowOuter::GetScrollFrame()
 {
-  FORWARD_TO_OUTER(GetScrollFrame, (), nullptr);
-
   if (!mDocShell) {
     return nullptr;
   }
 
   nsCOMPtr<nsIPresShell> presShell = mDocShell->GetPresShell();
   if (presShell) {
     return presShell->GetRootScrollFrameAsScrollable();
   }
@@ -11523,219 +7624,73 @@ nsGlobalWindowOuter::RestoreWindowState(
   holder->DidRestoreWindow();
 
   return NS_OK;
 }
 
 void
 nsGlobalWindowOuter::EnableDeviceSensor(uint32_t aType)
 {
-  MOZ_ASSERT(IsInnerWindow());
-
-  bool alreadyEnabled = false;
-  for (uint32_t i = 0; i < mEnabledSensors.Length(); i++) {
-    if (mEnabledSensors[i] == aType) {
-      alreadyEnabled = true;
-      break;
-    }
-  }
-
-  mEnabledSensors.AppendElement(aType);
-
-  if (alreadyEnabled) {
-    return;
-  }
-
-  nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
-  if (ac) {
-    ac->AddWindowListener(aType, this);
-  }
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 void
 nsGlobalWindowOuter::DisableDeviceSensor(uint32_t aType)
 {
-  MOZ_ASSERT(IsInnerWindow());
-
-  int32_t doomedElement = -1;
-  int32_t listenerCount = 0;
-  for (uint32_t i = 0; i < mEnabledSensors.Length(); i++) {
-    if (mEnabledSensors[i] == aType) {
-      doomedElement = i;
-      listenerCount++;
-    }
-  }
-
-  if (doomedElement == -1) {
-    return;
-  }
-
-  mEnabledSensors.RemoveElementAt(doomedElement);
-
-  if (listenerCount > 1) {
-    return;
-  }
-
-  nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
-  if (ac) {
-    ac->RemoveWindowListener(aType, this);
-  }
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 #if defined(MOZ_WIDGET_ANDROID)
 void
 nsGlobalWindowOuter::EnableOrientationChangeListener()
 {
-  MOZ_ASSERT(IsInnerWindow());
-  if (!nsContentUtils::ShouldResistFingerprinting(mDocShell) &&
-      !mOrientationChangeObserver) {
-    mOrientationChangeObserver =
-      MakeUnique<WindowOrientationObserver>(AssertInner());
-  }
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 void
 nsGlobalWindowOuter::DisableOrientationChangeListener()
 {
-  MOZ_ASSERT(IsInnerWindow());
-
-  mOrientationChangeObserver = nullptr;
+  MOZ_CRASH("Virtual inner window only function");
 }
 #endif
 
 void
 nsGlobalWindowOuter::SetHasGamepadEventListener(bool aHasGamepad/* = true*/)
 {
-  MOZ_ASSERT(IsInnerWindow());
-  mHasGamepad = aHasGamepad;
-  if (aHasGamepad) {
-    EnableGamepadUpdates();
-  }
-}
-
-
+  MOZ_CRASH("Virtual inner window only function");
+}
+
+// XXX(nika): Can we remove these?
 void
 nsGlobalWindowOuter::EventListenerAdded(nsAtom* aType)
 {
-  if (aType == nsGkAtoms::onvrdisplayactivate ||
-      aType == nsGkAtoms::onvrdisplayconnect ||
-      aType == nsGkAtoms::onvrdisplaydeactivate ||
-      aType == nsGkAtoms::onvrdisplaydisconnect ||
-      aType == nsGkAtoms::onvrdisplaypresentchange) {
-    NotifyVREventListenerAdded();
-  }
-
-  if (aType == nsGkAtoms::onvrdisplayactivate) {
-    mHasVRDisplayActivateEvents = true;
-  }
-
-  if (aType == nsGkAtoms::onbeforeunload &&
-      mTabChild &&
-      (!mDoc || !(mDoc->GetSandboxFlags() & SANDBOXED_MODALS))) {
-    MOZ_ASSERT(IsInnerWindow());
-    mBeforeUnloadListenerCount++;
-    MOZ_ASSERT(mBeforeUnloadListenerCount > 0);
-    mTabChild->BeforeUnloadAdded();
-  }
-
-  // We need to initialize localStorage in order to receive notifications.
-  if (aType == nsGkAtoms::onstorage) {
-    ErrorResult rv;
-    GetLocalStorage(rv);
-    rv.SuppressException();
-  }
 }
 
 void
 nsGlobalWindowOuter::EventListenerRemoved(nsAtom* aType)
 {
-  if (aType == nsGkAtoms::onbeforeunload &&
-      mTabChild &&
-      (!mDoc || !(mDoc->GetSandboxFlags() & SANDBOXED_MODALS))) {
-    MOZ_ASSERT(IsInnerWindow());
-    mBeforeUnloadListenerCount--;
-    MOZ_ASSERT(mBeforeUnloadListenerCount >= 0);
-    mTabChild->BeforeUnloadRemoved();
-  }
-}
-
-void
-nsGlobalWindowOuter::NotifyVREventListenerAdded()
-{
-  MOZ_ASSERT(IsInnerWindow());
-  mHasVREvents = true;
-  EnableVRUpdates();
-}
-
-bool
-nsGlobalWindowOuter::HasUsedVR() const
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // Returns true only if any WebVR API call or related event
-  // has been used
-  return mHasVREvents;
-}
-
-bool
-nsGlobalWindowOuter::IsVRContentDetected() const
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // Returns true only if the content will respond to
-  // the VRDisplayActivate event.
-  return mHasVRDisplayActivateEvents;
-}
-
-bool
-nsGlobalWindowOuter::IsVRContentPresenting() const
-{
-  for (const auto& display : mVRDisplays) {
-    if (display->IsAnyPresenting(gfx::kVRGroupAll)) {
-      return true;
-    }
-  }
-  return false;
 }
 
 void
 nsGlobalWindowOuter::EnableTimeChangeNotifications()
 {
-  mozilla::time::AddWindowListener(AsInner());
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 void
 nsGlobalWindowOuter::DisableTimeChangeNotifications()
 {
-  mozilla::time::RemoveWindowListener(AsInner());
+  MOZ_CRASH("Virtual inner window only function");
 }
 
 void
 nsGlobalWindowOuter::AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const
 {
   aWindowSizes.mDOMOtherSize += aWindowSizes.mState.mMallocSizeOf(this);
 
-  if (IsInnerWindow()) {
-    EventListenerManager* elm = GetExistingListenerManager();
-    if (elm) {
-      aWindowSizes.mDOMOtherSize +=
-        elm->SizeOfIncludingThis(aWindowSizes.mState.mMallocSizeOf);
-      aWindowSizes.mDOMEventListenersCount += elm->ListenerCount();
-    }
-    if (mDoc) {
-      // Multiple global windows can share a document. So only measure the
-      // document if it (a) doesn't have a global window, or (b) it's the
-      // primary document for the window.
-      if (!mDoc->GetInnerWindow() ||
-          mDoc->GetInnerWindow() == AsInner()) {
-        mDoc->DocAddSizeOfIncludingThis(aWindowSizes);
-      }
-    }
-  }
-
   if (mNavigator) {
     aWindowSizes.mDOMOtherSize +=
       mNavigator->SizeOfIncludingThis(aWindowSizes.mState.mMallocSizeOf);
   }
 
   aWindowSizes.mDOMEventTargetsSize +=
     mEventTargetObjects.ShallowSizeOfExcludingThis(
       aWindowSizes.mState.mMallocSizeOf);
@@ -11747,142 +7702,22 @@ nsGlobalWindowOuter::AddSizeOfIncludingT
         iSizeOf->SizeOfEventTargetIncludingThis(
           aWindowSizes.mState.mMallocSizeOf);
     }
     if (EventListenerManager* elm = et->GetExistingListenerManager()) {
       aWindowSizes.mDOMEventListenersCount += elm->ListenerCount();
     }
     ++aWindowSizes.mDOMEventTargetsCount;
   }
-
-  if (IsInnerWindow() && mPerformance) {
-    aWindowSizes.mDOMPerformanceUserEntries =
-      mPerformance->SizeOfUserEntries(aWindowSizes.mState.mMallocSizeOf);
-    aWindowSizes.mDOMPerformanceResourceEntries =
-      mPerformance->SizeOfResourceEntries(aWindowSizes.mState.mMallocSizeOf);
-  }
-}
-
-void
-nsGlobalWindowOuter::AddGamepad(uint32_t aIndex, Gamepad* aGamepad)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  // Create the index we will present to content based on which indices are
-  // already taken, as required by the spec.
-  // https://w3c.github.io/gamepad/gamepad.html#widl-Gamepad-index
-  int index = 0;
-  while(mGamepadIndexSet.Contains(index)) {
-    ++index;
-  }
-  mGamepadIndexSet.Put(index);
-  aGamepad->SetIndex(index);
-  mGamepads.Put(aIndex, aGamepad);
-}
-
-void
-nsGlobalWindowOuter::RemoveGamepad(uint32_t aIndex)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  RefPtr<Gamepad> gamepad;
-  if (!mGamepads.Get(aIndex, getter_AddRefs(gamepad))) {
-    return;
-  }
-  // Free up the index we were using so it can be reused
-  mGamepadIndexSet.Remove(gamepad->Index());
-  mGamepads.Remove(aIndex);
-}
-
-void
-nsGlobalWindowOuter::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  aGamepads.Clear();
-
-  // navigator.getGamepads() always returns an empty array when
-  // privacy.resistFingerprinting is true.
-  if (nsContentUtils::ShouldResistFingerprinting()) {
-    return;
-  }
-
-  // mGamepads.Count() may not be sufficient, but it's not harmful.
-  aGamepads.SetCapacity(mGamepads.Count());
-  for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
-    Gamepad* gamepad = iter.UserData();
-    aGamepads.EnsureLengthAtLeast(gamepad->Index() + 1);
-    aGamepads[gamepad->Index()] = gamepad;
-  }
-}
-
-already_AddRefed<Gamepad>
-nsGlobalWindowOuter::GetGamepad(uint32_t aIndex)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  RefPtr<Gamepad> gamepad;
-
-  if (mGamepads.Get(aIndex, getter_AddRefs(gamepad))) {
-    return gamepad.forget();
-  }
-
-  return nullptr;
-}
-
-void
-nsGlobalWindowOuter::SetHasSeenGamepadInput(bool aHasSeen)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  mHasSeenGamepadInput = aHasSeen;
-}
-
-bool
-nsGlobalWindowOuter::HasSeenGamepadInput()
-{
-  MOZ_ASSERT(IsInnerWindow());
-  return mHasSeenGamepadInput;
-}
-
-void
-nsGlobalWindowOuter::SyncGamepadState()
-{
-  MOZ_ASSERT(IsInnerWindow());
-  if (mHasSeenGamepadInput) {
-    RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
-    for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
-      gamepadManager->SyncGamepadState(iter.Key(), iter.UserData());
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::StopGamepadHaptics()
-{
-  MOZ_ASSERT(IsInnerWindow());
-  if (mHasSeenGamepadInput) {
-    RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
-    gamepadManager->StopHaptics();
-  }
 }
 
 bool
 nsGlobalWindowOuter::UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDevices)
 {
   FORWARD_TO_INNER(UpdateVRDisplays, (aDevices), false);
-
-  VRDisplay::UpdateVRDisplays(mVRDisplays, AsInner());
-  aDevices = mVRDisplays;
-  return true;
-}
-
-void
-nsGlobalWindowOuter::NotifyActiveVRDisplaysChanged()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  if (mNavigator) {
-    mNavigator->NotifyActiveVRDisplaysChanged();
-  }
 }
 
 uint32_t
 nsGlobalWindowOuter::GetAutoActivateVRDisplayID()
 {
   MOZ_ASSERT(IsOuterWindow());
   uint32_t retVal = mAutoActivateVRDisplayID;
   mAutoActivateVRDisplayID = 0;
@@ -11891,298 +7726,24 @@ nsGlobalWindowOuter::GetAutoActivateVRDi
 
 void
 nsGlobalWindowOuter::SetAutoActivateVRDisplayID(uint32_t aAutoActivateVRDisplayID)
 {
   MOZ_ASSERT(IsOuterWindow());
   mAutoActivateVRDisplayID = aAutoActivateVRDisplayID;
 }
 
-void
-nsGlobalWindowOuter::DispatchVRDisplayActivate(uint32_t aDisplayID,
-                                          mozilla::dom::VRDisplayEventReason aReason)
-{
-  // Search for the display identified with aDisplayID and fire the
-  // event if found.
-  for (const auto& display : mVRDisplays) {
-    if (display->DisplayId() == aDisplayID) {
-      if (aReason != VRDisplayEventReason::Navigation &&
-          display->IsAnyPresenting(gfx::kVRGroupContent)) {
-        // We only want to trigger this event if nobody is presenting to the
-        // display already or when a page is loaded by navigating away
-        // from a page with an active VR Presentation.
-        continue;
-      }
-
-      VRDisplayEventInit init;
-      init.mBubbles = false;
-      init.mCancelable = false;
-      init.mDisplay = display;
-      init.mReason.Construct(aReason);
-
-      RefPtr<VRDisplayEvent> event =
-        VRDisplayEvent::Constructor(this,
-                                    NS_LITERAL_STRING("vrdisplayactivate"),
-                                    init);
-      // vrdisplayactivate is a trusted event, allowing VRDisplay.requestPresent
-      // to be used in response to link traversal, user request (chrome UX), and
-      // HMD mounting detection sensors.
-      event->SetTrusted(true);
-      bool defaultActionEnabled;
-      // VRDisplay.requestPresent normally requires a user gesture; however, an
-      // exception is made to allow it to be called in response to vrdisplayactivate
-      // during VR link traversal.
-      display->StartHandlingVRNavigationEvent();
-      Unused << DispatchEvent(event, &defaultActionEnabled);
-      display->StopHandlingVRNavigationEvent();
-      // Once we dispatch the event, we must not access any members as an event
-      // listener can do anything, including closing windows.
-      return;
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::DispatchVRDisplayDeactivate(uint32_t aDisplayID,
-                                            mozilla::dom::VRDisplayEventReason aReason)
-{
-  // Search for the display identified with aDisplayID and fire the
-  // event if found.
-  for (const auto& display : mVRDisplays) {
-    if (display->DisplayId() == aDisplayID && display->IsPresenting()) {
-      // We only want to trigger this event to content that is presenting to
-      // the display already.
-
-      VRDisplayEventInit init;
-      init.mBubbles = false;
-      init.mCancelable = false;
-      init.mDisplay = display;
-      init.mReason.Construct(aReason);
-
-      RefPtr<VRDisplayEvent> event =
-        VRDisplayEvent::Constructor(this,
-                                    NS_LITERAL_STRING("vrdisplaydeactivate"),
-                                    init);
-      event->SetTrusted(true);
-      bool defaultActionEnabled;
-      Unused << DispatchEvent(event, &defaultActionEnabled);
-      // Once we dispatch the event, we must not access any members as an event
-      // listener can do anything, including closing windows.
-      return;
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::DispatchVRDisplayConnect(uint32_t aDisplayID)
-{
-  // Search for the display identified with aDisplayID and fire the
-  // event if found.
-  for (const auto& display : mVRDisplays) {
-    if (display->DisplayId() == aDisplayID) {
-      // Fire event even if not presenting to the display.
-      VRDisplayEventInit init;
-      init.mBubbles = false;
-      init.mCancelable = false;
-      init.mDisplay = display;
-      // VRDisplayEvent.reason is not set for vrdisplayconnect
-
-      RefPtr<VRDisplayEvent> event =
-        VRDisplayEvent::Constructor(this,
-                                    NS_LITERAL_STRING("vrdisplayconnect"),
-                                    init);
-      event->SetTrusted(true);
-      bool defaultActionEnabled;
-      Unused << DispatchEvent(event, &defaultActionEnabled);
-      // Once we dispatch the event, we must not access any members as an event
-      // listener can do anything, including closing windows.
-      return;
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::DispatchVRDisplayDisconnect(uint32_t aDisplayID)
-{
-  // Search for the display identified with aDisplayID and fire the
-  // event if found.
-  for (const auto& display : mVRDisplays) {
-    if (display->DisplayId() == aDisplayID) {
-      // Fire event even if not presenting to the display.
-      VRDisplayEventInit init;
-      init.mBubbles = false;
-      init.mCancelable = false;
-      init.mDisplay = display;
-      // VRDisplayEvent.reason is not set for vrdisplaydisconnect
-
-      RefPtr<VRDisplayEvent> event =
-        VRDisplayEvent::Constructor(this,
-                                    NS_LITERAL_STRING("vrdisplaydisconnect"),
-                                    init);
-      event->SetTrusted(true);
-      bool defaultActionEnabled;
-      Unused << DispatchEvent(event, &defaultActionEnabled);
-      // Once we dispatch the event, we must not access any members as an event
-      // listener can do anything, including closing windows.
-      return;
-    }
-  }
-}
-
-void
-nsGlobalWindowOuter::DispatchVRDisplayPresentChange(uint32_t aDisplayID)
-{
-  // Search for the display identified with aDisplayID and fire the
-  // event if found.
-  for (const auto& display : mVRDisplays) {
-    if (display->DisplayId() == aDisplayID) {
-      // Fire event even if not presenting to the display.
-      VRDisplayEventInit init;
-      init.mBubbles = false;
-      init.mCancelable = false;
-      init.mDisplay = display;
-      // VRDisplayEvent.reason is not set for vrdisplaypresentchange
-      RefPtr<VRDisplayEvent> event =
-        VRDisplayEvent::Constructor(this,
-                                    NS_LITERAL_STRING("vrdisplaypresentchange"),
-                                    init);
-      event->SetTrusted(true);
-      bool defaultActionEnabled;
-      Unused << DispatchEvent(event, &defaultActionEnabled);
-      // Once we dispatch the event, we must not access any members as an event
-      // listener can do anything, including closing windows.
-      return;
-    }
-  }
-}
-
-uint16_t
-nsGlobalWindowOuter::WindowState()
-{
-  MOZ_CRASH("Inner window only");
-}
-
-bool
-nsGlobalWindowOuter::IsFullyOccluded()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIWidget> widget = GetMainWidget();
-  return widget && widget->IsFullyOccluded();
-}
-
-void
-nsGlobalWindowOuter::Maximize()
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIWidget> widget = GetMainWidget();
-
-  if (widget) {
-    widget->SetSizeMode(nsSizeMode_Maximized);
-  }
-}
-
-void
-nsGlobalWindowOuter::Minimize()
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIWidget> widget = GetMainWidget();
-
-  if (widget) {
-    widget->SetSizeMode(nsSizeMode_Minimized);
-  }
-}
-
-void
-nsGlobalWindowOuter::Restore()
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIWidget> widget = GetMainWidget();
-
-  if (widget) {
-    widget->SetSizeMode(nsSizeMode_Normal);
-  }
-}
-
-void
-nsGlobalWindowOuter::GetAttention(ErrorResult& aResult)
-{
-  MOZ_ASSERT(IsInnerWindow());
-  return GetAttentionWithCycleCount(-1, aResult);
-}
-
-void
-nsGlobalWindowOuter::GetAttentionWithCycleCount(int32_t aCycleCount,
-                                           ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIWidget> widget = GetMainWidget();
-
-  if (widget) {
-    aError = widget->GetAttention(aCycleCount);
-  }
-}
-
-void
-nsGlobalWindowOuter::BeginWindowMove(Event& aMouseDownEvent, Element* aPanel,
-                                ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIWidget> widget;
-
-  // if a panel was supplied, use its widget instead.
-#ifdef MOZ_XUL
-  if (aPanel) {
-    nsIFrame* frame = aPanel->GetPrimaryFrame();
-    if (!frame || !frame->IsMenuPopupFrame()) {
-      return;
-    }
-
-    widget = (static_cast<nsMenuPopupFrame*>(frame))->GetWidget();
-  }
-  else {
-#endif
-    widget = GetMainWidget();
-#ifdef MOZ_XUL
-  }
-#endif
-
-  if (!widget) {
-    return;
-  }
-
-  WidgetMouseEvent* mouseEvent =
-    aMouseDownEvent.WidgetEventPtr()->AsMouseEvent();
-  if (!mouseEvent || mouseEvent->mClass != eMouseEventClass) {
-    aError.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-
-  aError = widget->BeginMoveDrag(mouseEvent);
-}
-
 already_AddRefed<nsWindowRoot>
 nsGlobalWindowOuter::GetWindowRootOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   nsCOMPtr<nsPIWindowRoot> root = GetTopWindowRoot();
   return root.forget().downcast<nsWindowRoot>();
 }
 
-already_AddRefed<nsWindowRoot>
-nsGlobalWindowOuter::GetWindowRoot(mozilla::ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetWindowRootOuter, (), aError, nullptr);
-}
-
 //Note: This call will lock the cursor, it will not change as it moves.
 //To unlock, the cursor must be set back to CURSOR_AUTO.
 void
 nsGlobalWindowOuter::SetCursorOuter(const nsAString& aCursor, ErrorResult& aError)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
 
   int32_t cursor;
@@ -12229,167 +7790,51 @@ nsGlobalWindowOuter::SetCursorOuter(cons
 
     // Call esm and set cursor.
     aError = presContext->EventStateManager()->SetCursor(cursor, nullptr,
                                                          false, 0.0f, 0.0f,
                                                          widget, true);
   }
 }
 
-void
-nsGlobalWindowOuter::SetCursor(const nsAString& aCursor, ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetCursorOuter, (aCursor, aError), aError, );
-}
-
 NS_IMETHODIMP
 nsGlobalWindowOuter::GetBrowserDOMWindow(nsIBrowserDOMWindow **aBrowserWindow)
 {
   MOZ_RELEASE_ASSERT(IsChromeWindow());
   FORWARD_TO_INNER(GetBrowserDOMWindow, (aBrowserWindow), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  NS_IF_ADDREF(*aBrowserWindow = GetBrowserDOMWindow(rv));
-  return rv.StealNSResult();
 }
 
 nsIBrowserDOMWindow*
 nsGlobalWindowOuter::GetBrowserDOMWindowOuter()
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   MOZ_ASSERT(IsChromeWindow());
   return mChromeFields.mBrowserDOMWindow;
 }
 
-nsIBrowserDOMWindow*
-nsGlobalWindowOuter::GetBrowserDOMWindow(ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(GetBrowserDOMWindowOuter, (), aError, nullptr);
-}
-
 void
 nsGlobalWindowOuter::SetBrowserDOMWindowOuter(nsIBrowserDOMWindow* aBrowserWindow)
 {
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   MOZ_ASSERT(IsChromeWindow());
   mChromeFields.mBrowserDOMWindow = aBrowserWindow;
 }
 
-void
-nsGlobalWindowOuter::SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserWindow,
-                                    ErrorResult& aError)
-{
-  FORWARD_TO_OUTER_OR_THROW(SetBrowserDOMWindowOuter, (aBrowserWindow), aError, );
-}
-
-void
-nsGlobalWindowOuter::NotifyDefaultButtonLoaded(Element& aDefaultButton,
-                                          ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-#ifdef MOZ_XUL
-  // Don't snap to a disabled button.
-  nsCOMPtr<nsIDOMXULControlElement> xulControl =
-                                      do_QueryInterface(&aDefaultButton);
-  if (!xulControl) {
-    aError.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-  bool disabled;
-  aError = xulControl->GetDisabled(&disabled);
-  if (aError.Failed() || disabled) {
-    return;
-  }
-
-  // Get the button rect in screen coordinates.
-  nsIFrame *frame = aDefaultButton.GetPrimaryFrame();
-  if (!frame) {
-    aError.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-  LayoutDeviceIntRect buttonRect =
-    LayoutDeviceIntRect::FromAppUnitsToNearest(
-      frame->GetScreenRectInAppUnits(),
-      frame->PresContext()->AppUnitsPerDevPixel());
-
-  // Get the widget rect in screen coordinates.
-  nsIWidget *widget = GetNearestWidget();
-  if (!widget) {
-    aError.Throw(NS_ERROR_FAILURE);
-    return;
-  }
-  LayoutDeviceIntRect widgetRect = widget->GetScreenBounds();
-
-  // Convert the buttonRect coordinates from screen to the widget.
-  buttonRect -= widgetRect.TopLeft();
-  nsresult rv = widget->OnDefaultButtonLoaded(buttonRect);
-  if (NS_FAILED(rv) && rv != NS_ERROR_NOT_IMPLEMENTED) {
-    aError.Throw(rv);
-  }
-#else
-  aError.Throw(NS_ERROR_NOT_IMPLEMENTED);
-#endif
-}
-
 NS_IMETHODIMP
 nsGlobalWindowOuter::GetMessageManager(nsIMessageBroadcaster** aManager)
 {
   FORWARD_TO_INNER(GetMessageManager, (aManager), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  NS_IF_ADDREF(*aManager = GetMessageManager(rv));
-  return rv.StealNSResult();
-}
-
-nsIMessageBroadcaster*
-nsGlobalWindowOuter::GetMessageManager(ErrorResult& aError)
-{
-  MOZ_ASSERT(IsChromeWindow());
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-  if (!mChromeFields.mMessageManager) {
-    nsCOMPtr<nsIMessageBroadcaster> globalMM =
-      do_GetService("@mozilla.org/globalmessagemanager;1");
-    mChromeFields.mMessageManager =
-      new nsFrameMessageManager(nullptr,
-                                static_cast<nsFrameMessageManager*>(globalMM.get()),
-                                MM_CHROME | MM_BROADCASTER);
-  }
-  return mChromeFields.mMessageManager;
 }
 
 NS_IMETHODIMP
 nsGlobalWindowOuter::GetGroupMessageManager(const nsAString& aGroup,
                                        nsIMessageBroadcaster** aManager)
 {
   MOZ_RELEASE_ASSERT(IsChromeWindow());
   FORWARD_TO_INNER(GetGroupMessageManager, (aGroup, aManager), NS_ERROR_UNEXPECTED);
-
-  ErrorResult rv;
-  NS_IF_ADDREF(*aManager = GetGroupMessageManager(aGroup, rv));
-  return rv.StealNSResult();
-}
-
-nsIMessageBroadcaster*
-nsGlobalWindowOuter::GetGroupMessageManager(const nsAString& aGroup,
-                                       ErrorResult& aError)
-{
-  MOZ_ASSERT(IsChromeWindow());
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  nsCOMPtr<nsIMessageBroadcaster> messageManager =
-    mChromeFields.mGroupMessageManagers.LookupForAdd(aGroup).OrInsert(
-      [this, &aError] () {
-        nsFrameMessageManager* parent =
-          static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
-
-        return new nsFrameMessageManager(nullptr,
-                                         parent,
-                                         MM_CHROME | MM_BROADCASTER);
-      });
-  return messageManager;
 }
 
 nsresult
 nsGlobalWindowOuter::SetOpenerForInitialContentBrowser(mozIDOMWindowProxy* aOpenerWindow)
 {
   MOZ_RELEASE_ASSERT(IsChromeWindow());
   MOZ_RELEASE_ASSERT(IsOuterWindow());
   MOZ_ASSERT(!mChromeFields.mOpenerForInitialContentBrowser);
@@ -12417,114 +7862,16 @@ nsGlobalWindowOuter::InitWasOffline()
 int16_t
 nsGlobalWindowOuter::Orientation(CallerType aCallerType) const
 {
   return nsContentUtils::ResistFingerprinting(aCallerType) ?
            0 : WindowOrientationObserver::OrientationAngle();
 }
 #endif
 
-Console*
-nsGlobalWindowOuter::GetConsole(ErrorResult& aRv)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mConsole) {
-    mConsole = Console::Create(AsInner(), aRv);
-    if (NS_WARN_IF(aRv.Failed())) {
-      return nullptr;
-    }
-  }
-
-  return mConsole;
-}
-
-bool
-nsGlobalWindowOuter::IsSecureContext() const
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  return JS_GetIsSecureContext(js::GetObjectCompartment(GetWrapperPreserveColor()));
-}
-
-bool
-nsGlobalWindowOuter::IsSecureContextIfOpenerIgnored() const
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  return mIsSecureContextIfOpenerIgnored;
-}
-
-already_AddRefed<External>
-nsGlobalWindowOuter::GetExternal(ErrorResult& aRv)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-#ifdef HAVE_SIDEBAR
-  if (!mExternal) {
-    AutoJSContext cx;
-    JS::Rooted<JSObject*> jsImplObj(cx);
-    ConstructJSImplementation("@mozilla.org/sidebar;1", this, &jsImplObj, aRv);
-    if (aRv.Failed()) {
-      return nullptr;
-    }
-    mExternal = new External(jsImplObj, this);
-  }
-
-  RefPtr<External> external = static_cast<External*>(mExternal.get());
-  return external.forget();
-#else
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-  return nullptr;
-#endif
-}
-
-void
-nsGlobalWindowOuter::GetSidebar(OwningExternalOrWindowProxy& aResult,
-                           ErrorResult& aRv)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-#ifdef HAVE_SIDEBAR
-  // First check for a named frame named "sidebar"
-  nsCOMPtr<nsPIDOMWindowOuter> domWindow = GetChildWindow(NS_LITERAL_STRING("sidebar"));
-  if (domWindow) {
-    aResult.SetAsWindowProxy() = domWindow.forget();
-    return;
-  }
-
-  RefPtr<External> external = GetExternal(aRv);
-  if (external) {
-    aResult.SetAsExternal() = external;
-  }
-#else
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-#endif
-}
-
-void
-nsGlobalWindowOuter::ClearDocumentDependentSlots(JSContext* aCx)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // If JSAPI OOMs here, there is basically nothing we can do to recover safely.
-  if (!WindowBinding::ClearCachedDocumentValue(aCx, AssertInner()) ||
-      !WindowBinding::ClearCachedPerformanceValue(aCx, AssertInner())) {
-    MOZ_CRASH("Unhandlable OOM while clearing document dependent slots.");
-  }
-}
-
-/* static */
-JSObject*
-nsGlobalWindowOuter::CreateNamedPropertiesObject(JSContext *aCx,
-                                            JS::Handle<JSObject*> aProto)
-{
-  return WindowNamedPropertiesHandler::Create(aCx, aProto);
-}
-
 bool
 nsGlobalWindowOuter::GetIsPrerendered()
 {
   nsIDocShell* docShell = GetDocShell();
   return docShell && docShell->GetIsPrerendered();
 }
 
 void
@@ -12597,221 +7944,20 @@ nsGlobalWindowOuter::RedefineProperty(JS
   }
 
   if (!JS_WrapObject(aCx, &thisObj) ||
       !JS_DefineProperty(aCx, thisObj, aPropName, aValue, JSPROP_ENUMERATE)) {
     aError.Throw(NS_ERROR_FAILURE);
   }
 }
 
-void
-nsGlobalWindowOuter::GetReplaceableWindowCoord(JSContext* aCx,
-                                          nsGlobalWindowOuter::WindowCoordGetter aGetter,
-                                          JS::MutableHandle<JS::Value> aRetval,
-                                          CallerType aCallerType,
-                                          ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  int32_t coord = (this->*aGetter)(aCallerType, aError);
-  if (!aError.Failed() &&
-      !ToJSValue(aCx, coord, aRetval)) {
-    aError.Throw(NS_ERROR_FAILURE);
-  }
-}
-
-void
-nsGlobalWindowOuter::SetReplaceableWindowCoord(JSContext* aCx,
-                                          nsGlobalWindowOuter::WindowCoordSetter aSetter,
-                                          JS::Handle<JS::Value> aValue,
-                                          const char* aPropName,
-                                          CallerType aCallerType,
-                                          ErrorResult& aError)
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  /*
-   * If caller is not chrome and the user has not explicitly exempted the site,
-   * just treat this the way we would an IDL replaceable property.
-   */
-  nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-  if (!outer ||
-      !outer->CanMoveResizeWindows(aCallerType) ||
-      outer->IsFrame()) {
-    RedefineProperty(aCx, aPropName, aValue, aError);
-    return;
-  }
-
-  int32_t value;
-  if (!ValueToPrimitive<int32_t, eDefault>(aCx, aValue, &value)) {
-    aError.Throw(NS_ERROR_UNEXPECTED);
-    return;
-  }
-
-  if (nsContentUtils::ShouldResistFingerprinting(GetDocShell())) {
-    bool innerWidthSpecified = false;
-    bool innerHeightSpecified = false;
-    bool outerWidthSpecified = false;
-    bool outerHeightSpecified = false;
-
-    if (strcmp(aPropName, "innerWidth") == 0) {
-      innerWidthSpecified = true;
-    } else if (strcmp(aPropName, "innerHeight") == 0) {
-      innerHeightSpecified = true;
-    } else if (strcmp(aPropName, "outerWidth") == 0) {
-      outerWidthSpecified = true;
-    } else if (strcmp(aPropName, "outerHeight") == 0) {
-      outerHeightSpecified = true;
-    }
-
-    if (innerWidthSpecified || innerHeightSpecified ||
-        outerWidthSpecified || outerHeightSpecified)
-    {
-      nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = outer->GetTreeOwnerWindow();
-      nsCOMPtr<nsIScreen> screen;
-      nsCOMPtr<nsIScreenManager> screenMgr(
-        do_GetService("@mozilla.org/gfx/screenmanager;1"));
-      int32_t winLeft   = 0;
-      int32_t winTop    = 0;
-      int32_t winWidth  = 0;
-      int32_t winHeight = 0;
-      double scale = 1.0;
-
-
-      if (treeOwnerAsWin && screenMgr) {
-        // Acquire current window size.
-        treeOwnerAsWin->GetUnscaledDevicePixelsPerCSSPixel(&scale);
-        treeOwnerAsWin->GetPositionAndSize(&winLeft, &winTop, &winWidth, &winHeight);
-        winLeft = NSToIntRound(winHeight / scale);
-        winTop = NSToIntRound(winWidth / scale);
-        winWidth = NSToIntRound(winWidth / scale);
-        winHeight = NSToIntRound(winHeight / scale);
-
-        // Acquire content window size.
-        CSSIntSize contentSize;
-        outer->GetInnerSize(contentSize);
-
-        screenMgr->ScreenForRect(winLeft, winTop, winWidth, winHeight,
-                                 getter_AddRefs(screen));
-
-        if (screen) {
-          int32_t* targetContentWidth  = nullptr;
-          int32_t* targetContentHeight = nullptr;
-          int32_t screenWidth  = 0;
-          int32_t screenHeight = 0;
-          int32_t chromeWidth  = 0;
-          int32_t chromeHeight = 0;
-          int32_t inputWidth   = 0;
-          int32_t inputHeight  = 0;
-          int32_t unused = 0;
-
-          // Get screen dimensions (in device pixels)
-          screen->GetAvailRect(&unused, &unused, &screenWidth,
-                               &screenHeight);
-          // Convert them to CSS pixels
-          screenWidth = NSToIntRound(screenWidth / scale);
-          screenHeight = NSToIntRound(screenHeight / scale);
-
-          // Calculate the chrome UI size.
-          chromeWidth = winWidth - contentSize.width;
-          chromeHeight = winHeight - contentSize.height;
-
-          if (innerWidthSpecified || outerWidthSpecified) {
-            inputWidth = value;
-            targetContentWidth = &value;
-            targetContentHeight = &unused;
-          } else if (innerHeightSpecified || outerHeightSpecified) {
-            inputHeight = value;
-            targetContentWidth = &unused;
-            targetContentHeight = &value;
-          }
-
-          nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting(
-            chromeWidth,
-            chromeHeight,
-            screenWidth,
-            screenHeight,
-            inputWidth,
-            inputHeight,
-            outerWidthSpecified,
-            outerHeightSpecified,
-            targetContentWidth,
-            targetContentHeight
-          );
-        }
-      }
-    }
-  }
-
-  (this->*aSetter)(value, aCallerType, aError);
-}
-
-void
-nsGlobalWindowOuter::FireOnNewGlobalObject()
-{
-  MOZ_ASSERT(IsInnerWindow());
-
-  // AutoEntryScript required to invoke debugger hook, which is a
-  // Gecko-specific concept at present.
-  AutoEntryScript aes(this, "nsGlobalWindowOuter report new global");
-  JS::Rooted<JSObject*> global(aes.cx(), GetWrapper());
-  JS_FireOnNewGlobalObject(aes.cx(), global);
-}
-
 #ifdef _WINDOWS_
 #error "Never include windows.h in this file!"
 #endif
 
-already_AddRefed<Promise>
-nsGlobalWindowOuter::CreateImageBitmap(JSContext* aCx,
-                                  const ImageBitmapSource& aImage,
-                                  ErrorResult& aRv)
-{
-  if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) {
-    aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-    return nullptr;
-  }
-
-  return ImageBitmap::Create(this, aImage, Nothing(), aRv);
-}
-
-already_AddRefed<Promise>
-nsGlobalWindowOuter::CreateImageBitmap(JSContext* aCx,
-                                  const ImageBitmapSource& aImage,
-                                  int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh,
-                                  ErrorResult& aRv)
-{
-  if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) {
-    aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-    return nullptr;
-  }
-
-  return ImageBitmap::Create(this, aImage, Some(gfx::IntRect(aSx, aSy, aSw, aSh)), aRv);
-}
-
-already_AddRefed<mozilla::dom::Promise>
-nsGlobalWindowOuter::CreateImageBitmap(JSContext* aCx,
-                                  const ImageBitmapSource& aImage,
-                                  int32_t aOffset, int32_t aLength,
-                                  ImageBitmapFormat aFormat,
-                                  const Sequence<ChannelPixelLayout>& aLayout,
-                                  ErrorResult& aRv)
-{
-  if (!ImageBitmap::ExtensionsEnabled(aCx)) {
-    aRv.Throw(NS_ERROR_TYPE_ERR);
-    return nullptr;
-  }
-  if (aImage.IsArrayBuffer() || aImage.IsArrayBufferView()) {
-    return ImageBitmap::Create(this, aImage, aOffset, aLength, aFormat, aLayout,
-                               aRv);
-  }
-  aRv.Throw(NS_ERROR_TYPE_ERR);
-  return nullptr;
-}
-
 // Helper called by methods that move/resize the window,
 // to ensure the presContext (if any) is aware of resolution
 // change that may happen in multi-monitor configuration.
 void
 nsGlobalWindowOuter::CheckForDPIChange()
 {
   if (mDocShell) {
     RefPtr<nsPresContext> presContext;
@@ -12881,46 +8027,16 @@ nsGlobalWindowOuter::TabGroupOuter()
     }
     mIsValidatingTabGroup = false;
   }
 #endif
 
   return mTabGroup;
 }
 
-mozilla::dom::TabGroup*
-nsGlobalWindowOuter::TabGroupInner()
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  // If we don't have a TabGroup yet, try to get it from the outer window and
-  // cache it.
-  if (!mTabGroup) {
-    nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-    // This will never be called without either an outer window, or a cached tab group.
-    // This is because of the following:
-    // * This method is only called on inner windows
-    // * This method is called as a document is attached to it's script global
-    //   by the document
-    // * Inner windows are created in nsGlobalWindowouter::SetNewDocument, which
-    //   immediately sets a document, which will call this method, causing
-    //   the TabGroup to be cached.
-    MOZ_RELEASE_ASSERT(outer, "Inner window without outer window has no cached tab group!");
-    mTabGroup = outer->TabGroup();
-  }
-  MOZ_ASSERT(mTabGroup);
-
-#ifdef DEBUG
-  nsGlobalWindowOuter* outer = GetOuterWindowInternal();
-  MOZ_ASSERT_IF(outer, outer->TabGroup() == mTabGroup);
-#endif
-
-  return mTabGroup;
-}
-
 nsresult
 nsGlobalWindowOuter::Dispatch(TaskCategory aCategory,
                          already_AddRefed<nsIRunnable>&& aRunnable)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   if (GetDocGroup()) {
     return GetDocGroup()->Dispatch(aCategory, Move(aRunnable));
   }
@@ -12972,83 +8088,20 @@ nsGlobalWindowOuter::TemporarilyDisableD
 
 nsGlobalWindowOuter::TemporarilyDisableDialogs::~TemporarilyDisableDialogs()
 {
   if (mTopWindow) {
     mTopWindow->mAreDialogsEnabled = mSavedDialogsEnabled;
   }
 }
 
-Worklet*
-nsGlobalWindowOuter::GetAudioWorklet(ErrorResult& aRv)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mAudioWorklet) {
-    nsIPrincipal* principal = GetPrincipal();
-    if (!principal) {
-      aRv.Throw(NS_ERROR_FAILURE);
-      return nullptr;
-    }
-
-    mAudioWorklet = new Worklet(AsInner(), principal, Worklet::eAudioWorklet);
-  }
-
-  return mAudioWorklet;
-}
-
-Worklet*
-nsGlobalWindowOuter::GetPaintWorklet(ErrorResult& aRv)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mPaintWorklet) {
-    nsIPrincipal* principal = GetPrincipal();
-    if (!principal) {
-      aRv.Throw(NS_ERROR_FAILURE);
-      return nullptr;
-    }
-
-    mPaintWorklet = new Worklet(AsInner(), principal, Worklet::ePaintWorklet);
-  }
-
-  return mPaintWorklet;
-}
-
-void
-nsGlobalWindowOuter::GetRegionalPrefsLocales(nsTArray<nsString>& aLocales)
-{
-  AutoTArray<nsCString, 10> rpLocales;
-  mozilla::intl::LocaleService::GetInstance()->GetRegionalPrefsLocales(rpLocales);
-
-  for (const auto& loc : rpLocales) {
-    aLocales.AppendElement(NS_ConvertUTF8toUTF16(loc));
-  }
-}
-
-IntlUtils*
-nsGlobalWindowOuter::GetIntlUtils(ErrorResult& aError)
-{
-  MOZ_RELEASE_ASSERT(IsInnerWindow());
-
-  if (!mIntlUtils) {
-    mIntlUtils = new IntlUtils(AsInner());
-  }
-
-  return mIntlUtils;
-}
-
 /* static */ already_AddRefed<nsGlobalWindowOuter>
 nsGlobalWindowOuter::Create(bool aIsChrome)
 {
   RefPtr<nsGlobalWindowOuter> window = new nsGlobalWindowOuter();
   if (aIsChrome) {
     window->mIsChrome = true;
     window->mCleanMessageManager = true;
   }
 
   window->InitWasOffline();
   return window.forget();
 }
-
-#undef FORWARD_TO_OUTER
-#undef FORWARD_TO_OUTER_OR_THROW
-#undef FORWARD_TO_OUTER_VOID
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -281,17 +281,17 @@ public:
   void ReallyCloseWindow();
 
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
 
   // nsWrapperCache
   virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override
   {
-    return IsInnerWindow() || AsOuter()->EnsureInnerWindow() ? GetWrapper() : nullptr;
+    return EnsureInnerWindow() ? GetWrapper() : nullptr;
   }
 
   // nsIGlobalJSObjectHolder
   virtual JSObject* GetGlobalJSObject() override;
 
   // nsIScriptGlobalObject
   JSObject *FastGetGlobalJSObject() const
   {
@@ -315,20 +315,16 @@ public:
   NS_DECL_NSIDOMWINDOW
 
   // nsIDOMChromeWindow (only implemented on chrome windows)
   NS_DECL_NSIDOMCHROMEWINDOW
 
   nsresult
   OpenJS(const nsAString& aUrl, const nsAString& aName,
          const nsAString& aOptions, nsPIDOMWindowOuter **_retval);
-  void CaptureEvents();
-  void ReleaseEvents();
-  void Dump(const nsAString& aStr);
-  void SetResizable(bool aResizable) const;
 
   // nsIDOMEventTarget
   NS_DECL_NSIDOMEVENTTARGET
 
   virtual mozilla::EventListenerManager*
     GetExistingListenerManager() const override;
 
   virtual mozilla::EventListenerManager*
@@ -359,23 +355,18 @@ public:
 
   virtual PopupControlState PushPopupControlState(PopupControlState state, bool aForce) const override;
   virtual void PopPopupControlState(PopupControlState state) const override;
   virtual PopupControlState GetPopupControlState() const override;
 
   virtual already_AddRefed<nsISupports> SaveWindowState() override;
   virtual nsresult RestoreWindowState(nsISupports *aState) override;
 
-  void Suspend();
-  void Resume();
   virtual bool IsSuspended() const override;
-  void Freeze();
-  void Thaw();
   virtual bool IsFrozen() const override;
-  void SyncStateFromParentWindow();
 
   virtual nsresult FireDelayedDOMEvents() override;
 
   // Outer windows only.
   bool WouldReuseInnerWindow(nsIDocument* aNewDocument);
 
   void SetDocShell(nsIDocShell* aDocShell);
   void DetachFromDocShell();
@@ -401,65 +392,40 @@ public:
   virtual void ForceClose() override;
 
   virtual void MaybeUpdateTouchState() override;
 
   // Outer windows only.
   virtual bool DispatchCustomEvent(const nsAString& aEventName) override;
   bool DispatchResizeEvent(const mozilla::CSSIntSize& aSize);
 
-  // Inner windows only.
-  void RefreshCompartmentPrincipal();
-
   // For accessing protected field mFullScreen
   friend class FullscreenTransitionTask;
 
   // Outer windows only.
   virtual nsresult SetFullscreenInternal(
     FullscreenReason aReason, bool aIsFullscreen) override final;
   virtual void FullscreenWillChange(bool aIsFullscreen) override final;
   virtual void FinishFullscreenChange(bool aIsFullscreen) override final;
   bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
                            nsIWidget* aWidget, nsIScreen* aScreen);
   bool FullScreen() const;
 
   // Inner windows only.
   virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override;
-  void NotifyVREventListenerAdded();
-  bool HasUsedVR() const;
-  bool IsVRContentDetected() const;
-  bool IsVRContentPresenting() const;
 
   using EventTarget::EventListenerAdded;
   virtual void EventListenerAdded(nsAtom* aType) override;
   using EventTarget::EventListenerRemoved;
   virtual void EventListenerRemoved(nsAtom* aType) override;
 
   // nsIInterfaceRequestor
   NS_DECL_NSIINTERFACEREQUESTOR
 
-  // WebIDL interface.
   already_AddRefed<nsPIDOMWindowOuter> IndexedGetterOuter(uint32_t aIndex);
-  already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex);
-
-  static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj);
-
-  static bool IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* /* unused */);
-
-  static bool IsWindowPrintEnabled(JSContext* /* unused */, JSObject* /* unused */);
-
-  bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj,
-                 JS::Handle<jsid> aId,
-                 JS::MutableHandle<JS::PropertyDescriptor> aDesc);
-  // The return value is whether DoResolve might end up resolving the given id.
-  // If in doubt, return true.
-  static bool MayResolve(jsid aId);
-
-  void GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames,
-                           bool aEnumerableOnly, mozilla::ErrorResult& aRv);
 
   already_AddRefed<nsPIDOMWindowOuter> GetTop() override;
   nsPIDOMWindowOuter* GetScriptableTop() override;
   inline nsGlobalWindowOuter *GetTopInternal();
 
   inline nsGlobalWindowOuter* GetScriptableTopInternal();
 
   nsPIDOMWindowOuter* GetChildWindow(const nsAString& aName);
@@ -469,18 +435,16 @@ public:
   //
   // DialogsAreBeingAbused must be called on the scriptable top inner window.
   //
   // ShouldPromptToBlockDialogs is implemented in terms of
   // DialogsAreBeingAbused, and will get the scriptable top inner window
   // automatically.
   // Outer windows only.
   bool ShouldPromptToBlockDialogs();
-  // Inner windows only.
-  bool DialogsAreBeingAbused();
 
   // These functions are used for controlling and determining whether dialogs
   // (alert, prompt, confirm) are currently allowed in this window.  If you want
   // to temporarily disable dialogs, please use TemporarilyDisableDialogs, not
   // EnableDialogs/DisableDialogs, because correctly determining whether to
   // re-enable dialogs is actually quite difficult.
   void EnableDialogs();
   void DisableDialogs();
@@ -525,23 +489,16 @@ public:
   {
     return mIsChrome;
   }
 
   // GetScrollFrame does not flush.  Callers should do it themselves as needed,
   // depending on which info they actually want off the scrollable frame.
   nsIScrollableFrame *GetScrollFrame();
 
-  nsresult Observe(nsISupports* aSubject, const char* aTopic,
-                   const char16_t* aData);
-
-  void ObserveStorageNotification(mozilla::dom::StorageEvent* aEvent,
-                                  const char16_t* aStorageType,
-                                  bool aPrivateBrowsing);
-
   // Outer windows only.
   void UnblockScriptedClosing();
 
   static void Init();
   static void ShutDown();
   static bool IsCallerChrome();
 
   void CleanupCachedXBLHandlers();
@@ -614,84 +571,29 @@ public:
                         const nsAString& aPopupWindowFeatures) override;
 
   virtual uint32_t GetSerial() override {
     return mSerial;
   }
 
   void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const;
 
-  // Inner windows only.
-  void AddEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
-  void RemoveEventTargetObject(mozilla::DOMEventTargetHelper* aObject);
-
-  void NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder,
-                          bool aCallOnidle);
-  nsresult HandleIdleActiveEvent();
-  bool ContainsIdleObserver(nsIIdleObserver* aIdleObserver, uint32_t timeInS);
-  void HandleIdleObserverCallback();
-
   void AllowScriptsToClose()
   {
     mAllowScriptsToClose = true;
   }
 
-  enum SlowScriptResponse {
-    ContinueSlowScript = 0,
-    ContinueSlowScriptAndKeepNotifying,
-    AlwaysContinueSlowScript,
-    KillSlowScript,
-    KillScriptGlobal
-  };
-  SlowScriptResponse ShowSlowScriptDialog(const nsString& aAddonId);
-
-  // Inner windows only.
-  void AddGamepad(uint32_t aIndex, mozilla::dom::Gamepad* aGamepad);
-  void RemoveGamepad(uint32_t aIndex);
-  void GetGamepads(nsTArray<RefPtr<mozilla::dom::Gamepad> >& aGamepads);
-  already_AddRefed<mozilla::dom::Gamepad> GetGamepad(uint32_t aIndex);
-  void SetHasSeenGamepadInput(bool aHasSeen);
-  bool HasSeenGamepadInput();
-  void SyncGamepadState();
-  void StopGamepadHaptics();
-
-  // Inner windows only.
-  // Enable/disable updates for gamepad input.
-  void EnableGamepadUpdates();
-  void DisableGamepadUpdates();
-
-  // Inner windows only.
-  // Enable/disable updates for VR
-  void EnableVRUpdates();
-  void DisableVRUpdates();
-  // Reset telemetry data when switching windows.
-  // aUpdate, true for accumulating the result to the histogram.
-  // false for only resetting the timestamp.
-  void ResetVRTelemetry(bool aUpdate);
-
   // Update the VR displays for this window
   bool UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDisplays);
 
-  // Inner windows only.
-  // Called to inform that the set of active VR displays has changed.
-  void NotifyActiveVRDisplaysChanged();
-
   // Outer windows only.
   uint32_t GetAutoActivateVRDisplayID();
   // Outer windows only.
   void SetAutoActivateVRDisplayID(uint32_t aAutoActivateVRDisplayID);
 
-  void DispatchVRDisplayActivate(uint32_t aDisplayID,
-                                 mozilla::dom::VRDisplayEventReason aReason);
-  void DispatchVRDisplayDeactivate(uint32_t aDisplayID,
-                                   mozilla::dom::VRDisplayEventReason aReason);
-  void DispatchVRDisplayConnect(uint32_t aDisplayID);
-  void DispatchVRDisplayDisconnect(uint32_t aDisplayID);
-  void DispatchVRDisplayPresentChange(uint32_t aDisplayID);
-
 #define EVENT(name_, id_, type_, struct_)                                     \
   mozilla::dom::EventHandlerNonNull* GetOn##name_()                           \
   {                                                                           \
     mozilla::EventListenerManager* elm = GetExistingListenerManager();        \
     return elm ? elm->GetEventHandler(nsGkAtoms::on##name_, EmptyString())    \
                : nullptr;                                                     \
   }                                                                           \
   void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler)               \
@@ -736,461 +638,172 @@ public:
 #undef ERROR_EVENT
 #undef EVENT
 
   nsISupports* GetParentObject()
   {
     return nullptr;
   }
 
-  static JSObject*
-    CreateNamedPropertiesObject(JSContext *aCx, JS::Handle<JSObject*> aProto);
-
-  nsGlobalWindowInner* Window();
-  nsGlobalWindowInner* Self();
   nsIDocument* GetDocument()
   {
     return GetDoc();
   }
   void GetNameOuter(nsAString& aName);
-  void GetName(nsAString& aName, mozilla::ErrorResult& aError);
   void SetNameOuter(const nsAString& aName, mozilla::ErrorResult& aError);
-  void SetName(const nsAString& aName, mozilla::ErrorResult& aError);
   mozilla::dom::Location* GetLocation() override;
-  nsHistory* GetHistory(mozilla::ErrorResult& aError);
   mozilla::dom::CustomElementRegistry* CustomElements() override;
-  mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError);
-  mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError);
-  mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError);
-  mozilla::dom::BarProp* GetScrollbars(mozilla::ErrorResult& aError);
-  mozilla::dom::BarProp* GetStatusbar(mozilla::ErrorResult& aError);
-  mozilla::dom::BarProp* GetToolbar(mozilla::ErrorResult& aError);
   void GetStatusOuter(nsAString& aStatus);
-  void GetStatus(nsAString& aStatus, mozilla::ErrorResult& aError);
   void SetStatusOuter(const nsAString& aStatus);
-  void SetStatus(const nsAString& aStatus, mozilla::ErrorResult& aError);
   void CloseOuter(bool aTrustedCaller);
-  void Close(mozilla::ErrorResult& aError);
   nsresult Close() override;
   bool GetClosedOuter();
-  bool GetClosed(mozilla::ErrorResult& aError);
   bool Closed() override;
   void StopOuter(mozilla::ErrorResult& aError);
-  void Stop(mozilla::ErrorResult& aError);
   void FocusOuter(mozilla::ErrorResult& aError);
-  void Focus(mozilla::ErrorResult& aError);
   nsresult Focus() override;
   void BlurOuter();
-  void Blur(mozilla::ErrorResult& aError);
   already_AddRefed<nsPIDOMWindowOuter> GetFramesOuter();
   already_AddRefed<nsIDOMWindowCollection> GetFrames() override;
-  already_AddRefed<nsPIDOMWindowOuter> GetFrames(mozilla::ErrorResult& aError);
   uint32_t Length();
   already_AddRefed<nsPIDOMWindowOuter> GetTopOuter();
-  already_AddRefed<nsPIDOMWindowOuter> GetTop(mozilla::ErrorResult& aError);
 
   nsresult GetPrompter(nsIPrompt** aPrompt) override;
 protected:
   explicit nsGlobalWindowOuter();
   nsPIDOMWindowOuter* GetOpenerWindowOuter();
   // Initializes the mWasOffline member variable
   void InitWasOffline();
 public:
   nsPIDOMWindowOuter*
   GetSanitizedOpener(nsPIDOMWindowOuter* aOpener);
 
-  nsPIDOMWindowOuter* GetOpenerWindow(mozilla::ErrorResult& aError);
-  void GetOpener(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
-                 mozilla::ErrorResult& aError);
   already_AddRefed<nsPIDOMWindowOuter> GetOpener() override;
-  void SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener,
-                 mozilla::ErrorResult& aError);
   already_AddRefed<nsPIDOMWindowOuter> GetParentOuter();
-  already_AddRefed<nsPIDOMWindowOuter> GetParent(mozilla::ErrorResult& aError);
   already_AddRefed<nsPIDOMWindowOuter> GetParent() override;
   nsPIDOMWindowOuter* GetScriptableParent() override;
   nsPIDOMWindowOuter* GetScriptableParentOrNull() override;
   mozilla::dom::Element*
   GetFrameElementOuter(nsIPrincipal& aSubjectPrincipal);
-  mozilla::dom::Element*
-  GetFrameElement(nsIPrincipal& aSubjectPrincipal,
-                  mozilla::ErrorResult& aError);
   already_AddRefed<nsIDOMElement> GetFrameElement() override;
   already_AddRefed<nsPIDOMWindowOuter>
   OpenOuter(const nsAString& aUrl,
             const nsAString& aName,
             const nsAString& aOptions,
             mozilla::ErrorResult& aError);
-  already_AddRefed<nsPIDOMWindowOuter>
-  Open(const nsAString& aUrl,
-       const nsAString& aName,
-       const nsAString& aOptions,
-       mozilla::ErrorResult& aError);
   nsresult Open(const nsAString& aUrl, const nsAString& aName,
                 const nsAString& aOptions,
                 nsIDocShellLoadInfo* aLoadInfo,
                 bool aForceNoOpener,
                 nsPIDOMWindowOuter **_retval) override;
-  mozilla::dom::Navigator* Navigator();
   nsIDOMNavigator* GetNavigator() override;
-  nsIDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError);
   already_AddRefed<nsIDOMOfflineResourceList> GetApplicationCache() override;
 
 #if defined(MOZ_WIDGET_ANDROID)
   int16_t Orientation(mozilla::dom::CallerType aCallerType) const;
 #endif
 
-  mozilla::dom::Console* GetConsole(mozilla::ErrorResult& aRv);
-
-  // https://w3c.github.io/webappsec-secure-contexts/#dom-window-issecurecontext
-  bool IsSecureContext() const;
-  bool IsSecureContextIfOpenerIgnored() const;
-
-  void GetSidebar(mozilla::dom::OwningExternalOrWindowProxy& aResult,
-                  mozilla::ErrorResult& aRv);
-  already_AddRefed<mozilla::dom::External> GetExternal(mozilla::ErrorResult& aRv);
-
-  // Exposed only for testing
-  static bool
-  TokenizeDialogOptions(nsAString& aToken, nsAString::const_iterator& aIter,
-                        nsAString::const_iterator aEnd);
-  static void
-  ConvertDialogOptions(const nsAString& aOptions, nsAString& aResult);
-
-  mozilla::dom::Worklet*
-  GetAudioWorklet(mozilla::ErrorResult& aRv);
-
-  mozilla::dom::Worklet*
-  GetPaintWorklet(mozilla::ErrorResult& aRv);
-
-  void
-  GetRegionalPrefsLocales(nsTArray<nsString>& aLocales);
-
-  mozilla::dom::IntlUtils*
-  GetIntlUtils(mozilla::ErrorResult& aRv);
-
 protected:
   bool AlertOrConfirm(bool aAlert, const nsAString& aMessage,
                       nsIPrincipal& aSubjectPrincipal,
                       mozilla::ErrorResult& aError);
 
 public:
-  void Alert(nsIPrincipal& aSubjectPrincipal,
-             mozilla::ErrorResult& aError);
   void AlertOuter(const nsAString& aMessage,
                   nsIPrincipal& aSubjectPrincipal,
                   mozilla::ErrorResult& aError);
-  void Alert(const nsAString& aMessage,
-             nsIPrincipal& aSubjectPrincipal,
-             mozilla::ErrorResult& aError);
   bool ConfirmOuter(const nsAString& aMessage,
                     nsIPrincipal& aSubjectPrincipal,
                     mozilla::ErrorResult& aError);
-  bool Confirm(const nsAString& aMessage,
-               nsIPrincipal& aSubjectPrincipal,
-               mozilla::ErrorResult& aError);
   void PromptOuter(const nsAString& aMessage, const nsAString& aInitial,
                    nsAString& aReturn,
                    nsIPrincipal& aSubjectPrincipal,
                    mozilla::ErrorResult& aError);
-  void Prompt(const nsAString& aMessage, const nsAString& aInitial,
-              nsAString& aReturn,
-              nsIPrincipal& aSubjectPrincipal,
-              mozilla::ErrorResult& aError);
-  already_AddRefed<mozilla::dom::cache::CacheStorage> GetCaches(mozilla::ErrorResult& aRv);
-  already_AddRefed<mozilla::dom::Promise> Fetch(const mozilla::dom::RequestOrUSVString& aInput,
-                                                const mozilla::dom::RequestInit& aInit,
-                                                mozilla::dom::CallerType aCallerType,
-                                                mozilla::ErrorResult& aRv);
   void PrintOuter(mozilla::ErrorResult& aError);
-  void Print(mozilla::ErrorResult& aError);
-  void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
-                      const nsAString& aTargetOrigin,
-                      const mozilla::dom::Sequence<JSObject*>& aTransfer,
-                      nsIPrincipal& aSubjectPrincipal,
-                      mozilla::ErrorResult& aError);
-  int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction,
-                     int32_t aTimeout,
-                     const mozilla::dom::Sequence<JS::Value>& aArguments,
-                     mozilla::ErrorResult& aError);
-  int32_t SetTimeout(JSContext* aCx, const nsAString& aHandler,
-                     int32_t aTimeout,
-                     const mozilla::dom::Sequence<JS::Value>& /* unused */,
-                     mozilla::ErrorResult& aError);
-  void ClearTimeout(int32_t aHandle);
-  int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction,
-                      const mozilla::dom::Optional<int32_t>& aTimeout,
-                      const mozilla::dom::Sequence<JS::Value>& aArguments,
-                      mozilla::ErrorResult& aError);
-  int32_t SetInterval(JSContext* aCx, const nsAString& aHandler,
-                      const mozilla::dom::Optional<int32_t>& aTimeout,
-                      const mozilla::dom::Sequence<JS::Value>& /* unused */,
-                      mozilla::ErrorResult& aError);
-  void ClearInterval(int32_t aHandle);
-  void GetOrigin(nsAString& aOrigin);
-  void Atob(const nsAString& aAsciiBase64String, nsAString& aBinaryData,
-            mozilla::ErrorResult& aError);
-  void Btoa(const nsAString& aBinaryData, nsAString& aAsciiBase64String,
-            mozilla::ErrorResult& aError);
-  mozilla::dom::Storage* GetSessionStorage(mozilla::ErrorResult& aError);
-  mozilla::dom::Storage*
-  GetLocalStorage(mozilla::ErrorResult& aError);
   mozilla::dom::Selection* GetSelectionOuter();
-  mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aError);
   already_AddRefed<nsISelection> GetSelection() override;
-  mozilla::dom::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError);
   already_AddRefed<nsICSSDeclaration>
     GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt,
                      mozilla::ErrorResult& aError) override;
   already_AddRefed<mozilla::dom::MediaQueryList> MatchMediaOuter(
     const nsAString& aQuery,
     mozilla::dom::CallerType aCallerType);
-  already_AddRefed<mozilla::dom::MediaQueryList> MatchMedia(
-    const nsAString& aQuery,
-    mozilla::dom::CallerType aCallerType,
-    mozilla::ErrorResult& aError);
-  nsScreen* GetScreen(mozilla::ErrorResult& aError);
   nsIDOMScreen* GetScreen() override;
   void MoveToOuter(int32_t aXPos, int32_t aYPos,
                    mozilla::dom::CallerType aCallerType,
                    mozilla::ErrorResult& aError);
-  void MoveTo(int32_t aXPos, int32_t aYPos,
-              mozilla::dom::CallerType aCallerType,
-              mozilla::ErrorResult& aError);
   void MoveByOuter(int32_t aXDif, int32_t aYDif,
                    mozilla::dom::CallerType aCallerType,
                    mozilla::ErrorResult& aError);
-  void MoveBy(int32_t aXDif, int32_t aYDif,
-              mozilla::dom::CallerType aCallerType,
-              mozilla::ErrorResult& aError);
   nsresult MoveBy(int32_t aXDif, int32_t aYDif) override;
   void ResizeToOuter(int32_t aWidth, int32_t aHeight,
                      mozilla::dom::CallerType aCallerType,
                      mozilla::ErrorResult& aError);
-  void ResizeTo(int32_t aWidth, int32_t aHeight,
-                mozilla::dom::CallerType aCallerType,
-                mozilla::ErrorResult& aError);
   void ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
                      mozilla::dom::CallerType aCallerType,
                      mozilla::ErrorResult& aError);
-  void ResizeBy(int32_t aWidthDif, int32_t aHeightDif,
-                mozilla::dom::CallerType aCallerType,
-                mozilla::ErrorResult& aError);
-  void Scroll(double aXScroll, double aYScroll);
-  void Scroll(const mozilla::dom::ScrollToOptions& aOptions);
-  void ScrollTo(double aXScroll, double aYScroll);
-  void ScrollTo(const mozilla::dom::ScrollToOptions& aOptions);
-  void ScrollBy(double aXScrollDif, double aYScrollDif);
-  void ScrollBy(const mozilla::dom::ScrollToOptions& aOptions);
-  void ScrollByLines(int32_t numLines,
-                     const mozilla::dom::ScrollOptions& aOptions);
-  void ScrollByPages(int32_t numPages,
-                     const mozilla::dom::ScrollOptions& aOptions);
-  void MozScrollSnap();
-  void GetInnerWidth(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-                     mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
-  void SetInnerWidth(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                     mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
-  void GetInnerHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-                      mozilla::dom::CallerType aCallerType,
-                      mozilla::ErrorResult& aError);
-  void SetInnerHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                      mozilla::dom::CallerType aCallerType,
-                      mozilla::ErrorResult& aError);
   double GetScrollXOuter();
-  double GetScrollX(mozilla::ErrorResult& aError);
-  double GetPageXOffset(mozilla::ErrorResult& aError)
-  {
-    return GetScrollX(aError);
-  }
   double GetScrollYOuter();
-  double GetScrollY(mozilla::ErrorResult& aError);
-  double GetPageYOffset(mozilla::ErrorResult& aError)
-  {
-    return GetScrollY(aError);
-  }
-  void GetScreenX(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
-  void SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
-  void GetScreenY(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
-  void SetScreenY(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
-  void GetOuterWidth(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-                     mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
-  void SetOuterWidth(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                     mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
-  void GetOuterHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue,
-                      mozilla::dom::CallerType aCallerType,
-                      mozilla::ErrorResult& aError);
-  void SetOuterHeight(JSContext* aCx, JS::Handle<JS::Value> aValue,
-                      mozilla::dom::CallerType aCallerType,
-                      mozilla::ErrorResult& aError);
-  int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
-                                mozilla::ErrorResult& aError);
-  void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
 
-  uint32_t RequestIdleCallback(JSContext* aCx,
-                               mozilla::dom::IdleRequestCallback& aCallback,
-                               const mozilla::dom::IdleRequestOptions& aOptions,
-                               mozilla::ErrorResult& aError);
-  void CancelIdleCallback(uint32_t aHandle);
-
-#ifdef MOZ_WEBSPEECH
-  mozilla::dom::SpeechSynthesis*
-    GetSpeechSynthesis(mozilla::ErrorResult& aError);
-  bool HasActiveSpeechSynthesis();
-#endif
-  already_AddRefed<nsICSSDeclaration>
-    GetDefaultComputedStyle(mozilla::dom::Element& aElt,
-                            const nsAString& aPseudoElt,
-                            mozilla::ErrorResult& aError);
   void SizeToContentOuter(mozilla::dom::CallerType aCallerType,
                           mozilla::ErrorResult& aError);
-  void SizeToContent(mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
-  mozilla::dom::Crypto* GetCrypto(mozilla::ErrorResult& aError);
-  mozilla::dom::U2F* GetU2f(mozilla::ErrorResult& aError);
   nsIControllers* GetControllersOuter(mozilla::ErrorResult& aError);
-  nsIControllers* GetControllers(mozilla::ErrorResult& aError);
   nsresult GetControllers(nsIControllers** aControllers) override;
   mozilla::dom::Element* GetRealFrameElementOuter();
-  mozilla::dom::Element* GetRealFrameElement(mozilla::ErrorResult& aError);
   float GetMozInnerScreenXOuter(mozilla::dom::CallerType aCallerType);
-  float GetMozInnerScreenX(mozilla::dom::CallerType aCallerType,
-                           mozilla::ErrorResult& aError);
   float GetMozInnerScreenYOuter(mozilla::dom::CallerType aCallerType);
-  float GetMozInnerScreenY(mozilla::dom::CallerType aCallerType,
-                           mozilla::ErrorResult& aError);
   double GetDevicePixelRatioOuter(mozilla::dom::CallerType aCallerType);
-  double GetDevicePixelRatio(mozilla::dom::CallerType aCallerType,
-                             mozilla::ErrorResult& aError);
-  int32_t GetScrollMinX(mozilla::ErrorResult& aError);
-  int32_t GetScrollMinY(mozilla::ErrorResult& aError);
-  int32_t GetScrollMaxX(mozilla::ErrorResult& aError);
-  int32_t GetScrollMaxY(mozilla::ErrorResult& aError);
   bool GetFullScreenOuter();
-  bool GetFullScreen(mozilla::ErrorResult& aError);
   bool GetFullScreen() override;
   void SetFullScreenOuter(bool aFullScreen, mozilla::ErrorResult& aError);
-  void SetFullScreen(bool aFullScreen, mozilla::ErrorResult& aError);
   nsresult SetFullScreen(bool aFullScreen) override;
   void BackOuter(mozilla::ErrorResult& aError);
-  void Back(mozilla::ErrorResult& aError);
   void ForwardOuter(mozilla::ErrorResult& aError);
-  void Forward(mozilla::ErrorResult& aError);
   void HomeOuter(nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
-  void Home(nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aError);
   bool FindOuter(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
                  bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
                  bool aShowDialog, mozilla::ErrorResult& aError);
-  bool Find(const nsAString& aString, bool aCaseSensitive, bool aBackwards,
-            bool aWrapAround, bool aWholeWord, bool aSearchInFrames,
-            bool aShowDialog, mozilla::ErrorResult& aError);
   uint64_t GetMozPaintCountOuter();
-  uint64_t GetMozPaintCount(mozilla::ErrorResult& aError);
 
   bool ShouldResistFingerprinting();
 
-  mozilla::dom::MozSelfSupport* GetMozSelfSupport(mozilla::ErrorResult& aError);
-
   already_AddRefed<nsPIDOMWindowOuter>
   OpenDialogOuter(JSContext* aCx,
                   const nsAString& aUrl,
                   const nsAString& aName,
                   const nsAString& aOptions,
                   const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
                   mozilla::ErrorResult& aError);
-  already_AddRefed<nsPIDOMWindowOuter>
-  OpenDialog(JSContext* aCx,
-             const nsAString& aUrl,
-             const nsAString& aName,
-             const nsAString& aOptions,
-             const mozilla::dom::Sequence<JS::Value>& aExtraArgument,
-             mozilla::ErrorResult& aError);
   nsresult OpenDialog(const nsAString& aUrl, const nsAString& aName,
                       const nsAString& aOptions,
                       nsISupports* aExtraArgument,
                       nsPIDOMWindowOuter** _retval) override;
   nsresult UpdateCommands(const nsAString& anAction, nsISelection* aSel, int16_t aReason) override;
 
   already_AddRefed<nsPIDOMWindowOuter>
   GetContentInternal(mozilla::ErrorResult& aError,
                      mozilla::dom::CallerType aCallerType);
   void GetContentOuter(JSContext* aCx,
                        JS::MutableHandle<JSObject*> aRetval,
                        mozilla::dom::CallerType aCallerType,
                        mozilla::ErrorResult& aError);
-  void GetContent(JSContext* aCx,
-                  JS::MutableHandle<JSObject*> aRetval,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
   already_AddRefed<nsPIDOMWindowOuter> GetContent()
   {
     MOZ_ASSERT(IsOuterWindow());
     mozilla::IgnoredErrorResult ignored;
     nsCOMPtr<nsPIDOMWindowOuter> win =
       GetContentInternal(ignored, mozilla::dom::CallerType::System);
     return win.forget();
   }
 
-  already_AddRefed<mozilla::dom::Promise>
-  CreateImageBitmap(JSContext* aCx,
-                    const mozilla::dom::ImageBitmapSource& aImage,
-                    mozilla::ErrorResult& aRv);
-
-  already_AddRefed<mozilla::dom::Promise>
-  CreateImageBitmap(JSContext* aCx,
-                    const mozilla::dom::ImageBitmapSource& aImage,
-                    int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh,
-                    mozilla::ErrorResult& aRv);
-
-  already_AddRefed<mozilla::dom::Promise>
-  CreateImageBitmap(JSContext* aCx,
-                    const mozilla::dom::ImageBitmapSource& aImage,
-                    int32_t aOffset, int32_t aLength,
-                    mozilla::dom::ImageBitmapFormat aFormat,
-                    const mozilla::dom::Sequence<mozilla::dom::ChannelPixelLayout>& aLayout,
-                    mozilla::ErrorResult& aRv);
-
-
   // ChromeWindow bits.  Do NOT call these unless your window is in
   // fact chrome.
-  uint16_t WindowState();
-  bool IsFullyOccluded();
   nsIBrowserDOMWindow* GetBrowserDOMWindowOuter();
-  nsIBrowserDOMWindow* GetBrowserDOMWindow(mozilla::ErrorResult& aError);
   void SetBrowserDOMWindowOuter(nsIBrowserDOMWindow* aBrowserWindow);
-  void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserWindow,
-                           mozilla::ErrorResult& aError);
-  void GetAttention(mozilla::ErrorResult& aError);
-  void GetAttentionWithCycleCount(int32_t aCycleCount,
-                                  mozilla::ErrorResult& aError);
   void SetCursorOuter(const nsAString& aCursor, mozilla::ErrorResult& aError);
-  void SetCursor(const nsAString& aCursor, mozilla::ErrorResult& aError);
-  void Maximize();
-  void Minimize();
-  void Restore();
-  void NotifyDefaultButtonLoaded(mozilla::dom::Element& aDefaultButton,
-                                 mozilla::ErrorResult& aError);
-  nsIMessageBroadcaster* GetMessageManager(mozilla::ErrorResult& aError);
-  nsIMessageBroadcaster* GetGroupMessageManager(const nsAString& aGroup,
-                                                mozilla::ErrorResult& aError);
-  void BeginWindowMove(mozilla::dom::Event& aMouseDownEvent,
-                       mozilla::dom::Element* aPanel,
-                       mozilla::ErrorResult& aError);
 
   void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
                                nsIPrincipal& aSubjectPrincipal,
                                mozilla::ErrorResult& aError);
   void GetDialogArguments(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval,
                           nsIPrincipal& aSubjectPrincipal,
                           mozilla::ErrorResult& aError);
   void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue,
@@ -1201,26 +814,17 @@ public:
                       mozilla::ErrorResult& aError);
   void SetReturnValueOuter(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
                            nsIPrincipal& aSubjectPrincipal,
                            mozilla::ErrorResult& aError);
   void SetReturnValue(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
                       nsIPrincipal& aSubjectPrincipal,
                       mozilla::ErrorResult& aError);
 
-  void GetInterface(JSContext* aCx, nsIJSID* aIID,
-                    JS::MutableHandle<JS::Value> aRetval,
-                    mozilla::ErrorResult& aError);
-
   already_AddRefed<nsWindowRoot> GetWindowRootOuter();
-  already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
-
-  mozilla::dom::Performance* GetPerformance();
-
-  void UpdateTopInnerWindow();
 
   virtual bool IsInSyncOperation() override
   {
     return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation();
   }
 
 protected:
   // Web IDL helpers
@@ -1236,90 +840,51 @@ protected:
   // supposed to be readonly replaceable.
   typedef int32_t
     (nsGlobalWindowOuter::*WindowCoordGetter)(mozilla::dom::CallerType aCallerType,
                                               mozilla::ErrorResult&);
   typedef void
     (nsGlobalWindowOuter::*WindowCoordSetter)(int32_t,
                                               mozilla::dom::CallerType aCallerType,
                                               mozilla::ErrorResult&);
-  void GetReplaceableWindowCoord(JSContext* aCx, WindowCoordGetter aGetter,
-                                 JS::MutableHandle<JS::Value> aRetval,
-                                 mozilla::dom::CallerType aCallerType,
-                                 mozilla::ErrorResult& aError);
-  void SetReplaceableWindowCoord(JSContext* aCx, WindowCoordSetter aSetter,
-                                 JS::Handle<JS::Value> aValue,
-                                 const char* aPropName,
-                                 mozilla::dom::CallerType aCallerType,
-                                 mozilla::ErrorResult& aError);
   // And the implementations of WindowCoordGetter/WindowCoordSetter.
 public:
   int32_t GetInnerWidthOuter(mozilla::ErrorResult& aError);
 protected:
-  int32_t GetInnerWidth(mozilla::dom::CallerType aCallerType,
-                        mozilla::ErrorResult& aError);
   nsresult GetInnerWidth(int32_t* aWidth) override;
   void SetInnerWidthOuter(int32_t aInnerWidth,
                           mozilla::dom::CallerType aCallerType,
                           mozilla::ErrorResult& aError);
-  void SetInnerWidth(int32_t aInnerWidth,
-                     mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
 public:
   int32_t GetInnerHeightOuter(mozilla::ErrorResult& aError);
 protected:
-  int32_t GetInnerHeight(mozilla::dom::CallerType aCallerType,
-                         mozilla::ErrorResult& aError);
   nsresult GetInnerHeight(int32_t* aHeight) override;
   void SetInnerHeightOuter(int32_t aInnerHeight,
                            mozilla::dom::CallerType aCallerType,
                            mozilla::ErrorResult& aError);
-  void SetInnerHeight(int32_t aInnerHeight,
-                      mozilla::dom::CallerType aCallerType,
-                      mozilla::ErrorResult& aError);
   int32_t GetScreenXOuter(mozilla::dom::CallerType aCallerType,
                           mozilla::ErrorResult& aError);
-  int32_t GetScreenX(mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
   void SetScreenXOuter(int32_t aScreenX,
                        mozilla::dom::CallerType aCallerType,
                        mozilla::ErrorResult& aError);
-  void SetScreenX(int32_t aScreenX,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
   int32_t GetScreenYOuter(mozilla::dom::CallerType aCallerType,
                           mozilla::ErrorResult& aError);
-  int32_t GetScreenY(mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
   void SetScreenYOuter(int32_t aScreenY,
                        mozilla::dom::CallerType aCallerType,
                        mozilla::ErrorResult& aError);
-  void SetScreenY(int32_t aScreenY,
-                  mozilla::dom::CallerType aCallerType,
-                  mozilla::ErrorResult& aError);
   int32_t GetOuterWidthOuter(mozilla::dom::CallerType aCallerType,
                              mozilla::ErrorResult& aError);
-  int32_t GetOuterWidth(mozilla::dom::CallerType aCallerType,
-                        mozilla::ErrorResult& aError);
   void SetOuterWidthOuter(int32_t aOuterWidth,
                           mozilla::dom::CallerType aCallerType,
                           mozilla::ErrorResult& aError);
-  void SetOuterWidth(int32_t aOuterWidth,
-                     mozilla::dom::CallerType aCallerType,
-                     mozilla::ErrorResult& aError);
   int32_t GetOuterHeightOuter(mozilla::dom::CallerType aCallerType,
                               mozilla::ErrorResult& aError);
-  int32_t GetOuterHeight(mozilla::dom::CallerType aCallerType,
-                         mozilla::ErrorResult& aError);
   void SetOuterHeightOuter(int32_t aOuterHeight,
                            mozilla::dom::CallerType aCallerType,
                            mozilla::ErrorResult& aError);
-  void SetOuterHeight(int32_t aOuterHeight,
-                      mozilla::dom::CallerType aCallerType,
-                      mozilla::ErrorResult& aError);
 
   // Array of idle observers that are notified of idle events.
   nsTObserverArray<IdleObserverHolder> mIdleObservers;
 
   // Idle timer used for function callbacks to notify idle observers.
   nsCOMPtr<nsITimer> mIdleTimer;
 
   // Idle fuzz time added to idle timer callbacks.
@@ -1349,26 +914,18 @@ protected:
   void DropOuterWindowDocs();
   void CleanUp();
   void ClearControllers();
   // Outer windows only.
   void FinalClose();
 
   inline void MaybeClearInnerWindow(nsGlobalWindowInner* aExpectedInner);
 
-  void FreeInnerObjects();
   nsGlobalWindowInner *CallerInnerWindow();
 
-  // Only to be called on an inner window.
-  // aDocument must not be null.
-  void InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument);
-
-  // Inner windows only.
-  nsresult DefineArgumentsProperty(nsIArray *aArguments);
-
   // Get the parent, returns null if this is a toplevel window
   nsPIDOMWindowOuter* GetParentInternal();
 
 public:
   // popup tracking
   bool IsPopupSpamWindow();
 
   // Outer windows only.
@@ -1443,70 +1000,39 @@ private:
                         bool aDoJSFixups,
                         bool aNavigate,
                         nsIArray *argv,
                         nsISupports *aExtraArgument,
                         nsIDocShellLoadInfo* aLoadInfo,
                         bool aForceNoOpener,
                         nsPIDOMWindowOuter **aReturn);
 
-  template<typename Method>
-  void CallOnChildren(Method aMethod);
-
-  void FreezeInternal();
-  void ThawInternal();
-
 public:
-  // Timeout Functions
-  // |interval| is in milliseconds.
-  int32_t SetTimeoutOrInterval(JSContext* aCx,
-                               mozilla::dom::Function& aFunction,
-                               int32_t aTimeout,
-                               const mozilla::dom::Sequence<JS::Value>& aArguments,
-                               bool aIsInterval, mozilla::ErrorResult& aError);
-  int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler,
-                               int32_t aTimeout, bool aIsInterval,
-                               mozilla::ErrorResult& aError);
-
-  // Return true if |aTimeout| was cleared while its handler ran.
-  bool RunTimeoutHandler(mozilla::dom::Timeout* aTimeout, nsIScriptContext* aScx);
-
   // Helper Functions
   already_AddRefed<nsIDocShellTreeOwner> GetTreeOwner();
   already_AddRefed<nsIBaseWindow> GetTreeOwnerWindow();
   already_AddRefed<nsIWebBrowserChrome> GetWebBrowserChrome();
   nsresult SecurityCheckURL(const char *aURL);
   bool IsPrivateBrowsing();
 
   bool PopupWhitelisted();
   PopupControlState RevisePopupAbuseLevel(PopupControlState);
   void     FireAbuseEvents(const nsAString &aPopupURL,
                            const nsAString &aPopupWindowName,
                            const nsAString &aPopupWindowFeatures);
-  void FireOfflineStatusEventIfChanged();
 
   bool GetIsPrerendered();
 
 private:
   void ReportLargeAllocStatus();
 
 public:
-  // Inner windows only.
-  nsresult ScheduleNextIdleObserverCallback();
-  uint32_t GetFuzzTimeMS();
-  nsresult ScheduleActiveTimerCallback();
-  uint32_t FindInsertionIndex(IdleObserverHolder* aIdleObserver);
   virtual nsresult RegisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
-  nsresult FindIndexOfElementToRemove(nsIIdleObserver* aIdleObserver,
-                                      int32_t* aRemoveElementIndex);
   virtual nsresult UnregisterIdleObserver(nsIIdleObserver* aIdleObserverPtr) override;
 
-  // Inner windows only.
-  nsresult FireHashchange(const nsAString &aOldURL, const nsAString &aNewURL);
-
   void FlushPendingNotifications(mozilla::FlushType aType);
 
   // Outer windows only.
   void EnsureReflowFlushAndPaint();
   void CheckSecurityWidthAndHeight(int32_t* width, int32_t* height,
                                    mozilla::dom::CallerType aCallerType);
   void CheckSecurityLeftAndTop(int32_t* left, int32_t* top,
                                mozilla::dom::CallerType aCallerType);
@@ -1536,19 +1062,16 @@ public:
   nsresult GetInnerSize(mozilla::CSSIntSize& aSize);
   nsIntSize GetOuterSize(mozilla::dom::CallerType aCallerType,
                          mozilla::ErrorResult& aError);
   void SetOuterSize(int32_t aLengthCSSPixels, bool aIsWidth,
                     mozilla::dom::CallerType aCallerType,
                     mozilla::ErrorResult& aError);
   nsRect GetInnerScreenRect();
 
-  void ScrollTo(const mozilla::CSSIntPoint& aScroll,
-                const mozilla::dom::ScrollOptions& aOptions);
-
   bool IsFrame();
 
   // Outer windows only.
   // If aLookForCallerOnJSStack is true, this method will look at the JS stack
   // to determine who the caller is.  If it's false, it'll use |this| as the
   // caller.
   bool WindowExists(const nsAString& aName, bool aForceNoOpener,
                     bool aLookForCallerOnJSStack);
@@ -1572,99 +1095,61 @@ public:
 
   virtual uint32_t GetFocusMethod() override;
 
   virtual bool ShouldShowFocusRing() override;
 
   virtual void SetKeyboardIndicators(UIStateChangeType aShowAccelerators,
                                      UIStateChangeType aShowFocusRings) override;
 
-  // Inner windows only.
-  void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent);
-
 public:
   virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() override;
 
 protected:
-  static void NotifyDOMWindowDestroyed(nsGlobalWindowInner* aWindow);
   void NotifyWindowIDDestroyed(const char* aTopic);
 
-  static void NotifyDOMWindowFrozen(nsGlobalWindowInner* aWindow);
-  static void NotifyDOMWindowThawed(nsGlobalWindowInner* aWindow);
-
   void ClearStatus();
 
   virtual void UpdateParentTarget() override;
 
   void InitializeShowFocusRings();
 
-  // Clear the document-dependent slots on our JS wrapper.  Inner windows only.
-  void ClearDocumentDependentSlots(JSContext* aCx);
-
-  // Inner windows only.
-  already_AddRefed<mozilla::dom::StorageEvent>
-  CloneStorageEvent(const nsAString& aType,
-                    const RefPtr<mozilla::dom::StorageEvent>& aEvent,
-                    mozilla::ErrorResult& aRv);
-
 public:
   // Outer windows only.
   nsDOMWindowList* GetWindowList();
 protected:
   // Helper for getComputedStyle and getDefaultComputedStyle
   already_AddRefed<nsICSSDeclaration>
     GetComputedStyleHelperOuter(mozilla::dom::Element& aElt,
                                 const nsAString& aPseudoElt,
                                 bool aDefaultStylesOnly);
-  already_AddRefed<nsICSSDeclaration>
-    GetComputedStyleHelper(mozilla::dom::Element& aElt,
-                           const nsAString& aPseudoElt,
-                           bool aDefaultStylesOnly,
-                           mozilla::ErrorResult& aError);
-  nsresult GetComputedStyleHelper(nsIDOMElement* aElt,
-                                  const nsAString& aPseudoElt,
-                                  bool aDefaultStylesOnly,
-                                  nsIDOMCSSStyleDeclaration** aReturn);
 
   // Outer windows only.
   void PreloadLocalStorage();
 
   // Returns CSS pixels based on primary screen.  Outer windows only.
   mozilla::CSSIntPoint GetScreenXY(mozilla::dom::CallerType aCallerType,
                                    mozilla::ErrorResult& aError);
 
-  nsGlobalWindowInner* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);
-
   void PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessage,
                            const nsAString& aTargetOrigin,
                            JS::Handle<JS::Value> aTransfer,
                            nsIPrincipal& aSubjectPrincipal,
                            mozilla::ErrorResult& aError);
-  void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
-                      const nsAString& aTargetOrigin,
-                      JS::Handle<JS::Value> aTransfer,
-                      nsIPrincipal& aSubjectPrincipal,
-                      mozilla::ErrorResult& aError);
 
   // Ask the user if further dialogs should be blocked, if dialogs are currently
   // being abused. This is used in the cases where we have no modifiable UI to
   // show, in that case we show a separate dialog to ask this question.
   bool ConfirmDialogIfNeeded();
 
   // Helper called after moving/resizing, to update docShell's presContext
   // if we have caused a resolution change by moving across monitors.
   void CheckForDPIChange();
 
 private:
-  // Fire the JS engine's onNewGlobalObject hook.  Only used on inner windows.
-  void FireOnNewGlobalObject();
-
-  void DisconnectEventTargetObjects();
-
-
   enum class SecureContextFlags {
     eDefault,
     eIgnoreOpener
   };
   // Called only on outer windows to compute the value that will be returned by
   // IsSecureContext() for the inner window that corresponds to aDocument.
   bool ComputeIsSecureContext(nsIDocument* aDocument,
                               SecureContextFlags aFlags =
@@ -1672,17 +1157,16 @@ private:
 
   // nsPIDOMWindow<T> should be able to see these helper methods.
   friend class nsPIDOMWindow<mozIDOMWindowProxy>;
   friend class nsPIDOMWindow<mozIDOMWindow>;
   friend class nsPIDOMWindow<nsISupports>;
   friend class nsPIDOMWindowInner;
   friend class nsPIDOMWindowOuter;
 
-  mozilla::dom::TabGroup* TabGroupInner();
   mozilla::dom::TabGroup* TabGroupOuter();
 
   bool IsBackgroundInternal() const;
 
   void SetIsBackgroundInternal(bool aIsBackground);
 
   // NOTE: Chrome Only
   void DisconnectAndClearGroupMessageManagers()
@@ -1703,27 +1187,21 @@ public:
                             already_AddRefed<nsIRunnable>&& aRunnable) override;
 
   virtual nsISerialEventTarget*
   EventTargetFor(mozilla::TaskCategory aCategory) const override;
 
   virtual mozilla::AbstractThread*
   AbstractMainThreadFor(mozilla::TaskCategory aCategory) override;
 
-  void DisableIdleCallbackRequests();
   uint32_t LastIdleRequestHandle() const { return mIdleRequestCallbackCounter - 1; }
   nsresult RunIdleRequest(mozilla::dom::IdleRequest* aRequest,
                           DOMHighResTimeStamp aDeadline, bool aDidTimeout);
-  nsresult ExecuteIdleRequest(TimeStamp aDeadline);
-  void ScheduleIdleRequestDispatch();
-  void SuspendIdleRequests();
-  void ResumeIdleRequests();
 
   typedef mozilla::LinkedList<mozilla::dom::IdleRequest> IdleRequests;
-  void InsertIdleCallback(mozilla::dom::IdleRequest* aRequest);
 
   void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
 
 protected:
   // These members are only used on outer window objects. Make sure
   // you never set any of these on an inner object!
   bool                          mFullScreen : 1;
   bool                          mFullscreenMode : 1;
@@ -1980,28 +1458,23 @@ inline nsISupports*
 ToCanonicalSupports(nsGlobalWindowOuter *p)
 {
     return static_cast<nsIDOMEventTarget*>(p);
 }
 
 inline nsIGlobalObject*
 nsGlobalWindowOuter::GetOwnerGlobal() const
 {
-  if (IsOuterWindow()) {
-    return GetCurrentInnerWindowInternal();
-  }
-
-  return const_cast<nsGlobalWindowOuter*>(this);
+  return GetCurrentInnerWindowInternal();
 }
 
 inline nsGlobalWindowOuter*
 nsGlobalWindowOuter::GetTopInternal()
 {
-  nsGlobalWindowOuter* outer = IsOuterWindow() ? AssertOuter() : GetOuterWindowInternal();
-  nsCOMPtr<nsPIDOMWindowOuter> top = outer ? outer->GetTop() : nullptr;
+  nsCOMPtr<nsPIDOMWindowOuter> top = GetTop();
   if (top) {
     return nsGlobalWindowOuter::Cast(top);
   }
   return nullptr;
 }
 
 inline nsGlobalWindowOuter*
 nsGlobalWindowOuter::GetScriptableTopInternal()
@@ -2045,21 +1518,17 @@ nsGlobalWindowOuter::IsTopLevelWindow()
   MOZ_ASSERT(IsOuterWindow());
   nsPIDOMWindowOuter* parentWindow = GetScriptableTop();
   return parentWindow == this->AsOuter();
 }
 
 inline bool
 nsGlobalWindowOuter::IsPopupSpamWindow()
 {
-  if (IsInnerWindow() && !mOuterWindow) {
-    return false;
-  }
-
-  return GetOuterWindowInternal()->mIsPopupSpam;
+  return mIsPopupSpam;
 }
 
 inline bool
 nsGlobalWindowOuter::IsFrame()
 {
   return GetParentInternal() != nullptr;
 }