Bug 1414974 - Part 6: Change WebIDL bindings to refer to nsGlobalWindowInner rather than nsGlobalWindow, r=bz
authorNika Layzell <nika@thelayzells.com>
Mon, 06 Nov 2017 17:52:14 -0500
changeset 441818 cd4b951a1f54bdab2e8c5adfc1bf699e5cc6b10c
parent 441817 32a9df9f2b077cc08972c0fe2cef46c1d1e2a318
child 441819 eadac792a9e36ff1bca0aad5edb790953d9525df
push id8134
push userryanvm@gmail.com
push dateFri, 10 Nov 2017 21:18:48 +0000
treeherdermozilla-beta@6c6c0e855154 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1414974
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414974 - Part 6: Change WebIDL bindings to refer to nsGlobalWindowInner rather than nsGlobalWindow, r=bz MozReview-Commit-ID: KbCpDFoWyTe
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsDocument.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindow.h
dom/base/nsIDocument.h
dom/base/nsJSEnvironment.cpp
dom/bindings/BindingUtils.cpp
dom/bindings/BindingUtils.h
dom/bindings/Bindings.conf
dom/bindings/WebIDLGlobalNameHash.cpp
dom/canvas/CanvasRenderingContext2D.cpp
dom/canvas/CanvasRenderingContext2D.h
dom/events/CompositionEvent.cpp
dom/events/CompositionEvent.h
dom/events/DragEvent.cpp
dom/events/DragEvent.h
dom/events/FocusEvent.cpp
dom/events/FocusEvent.h
dom/events/KeyboardEvent.cpp
dom/events/KeyboardEvent.h
dom/events/MouseEvent.cpp
dom/events/MouseEvent.h
dom/events/MouseScrollEvent.cpp
dom/events/MouseScrollEvent.h
dom/events/ScrollAreaEvent.cpp
dom/events/ScrollAreaEvent.h
dom/events/SimpleGestureEvent.cpp
dom/events/SimpleGestureEvent.h
dom/events/TouchEvent.cpp
dom/events/TouchEvent.h
dom/events/UIEvent.cpp
dom/events/UIEvent.h
dom/events/WheelEvent.cpp
dom/events/WheelEvent.h
dom/events/XULCommandEvent.h
dom/smil/TimeEvent.cpp
dom/smil/TimeEvent.h
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCJSRuntime.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -719,17 +719,17 @@ nsDOMClassInfo::HasInstance(nsIXPConnect
                             bool *_retval)
 {
   NS_WARNING("nsDOMClassInfo::HasInstance Don't call me!");
 
   return NS_ERROR_UNEXPECTED;
 }
 
 static nsresult
-ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
+ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindowInner *aWin, JSContext *cx,
                  JS::Handle<JSObject*> obj, const char16_t *name,
                  const nsDOMClassInfoData *ci_data,
                  const nsGlobalNameStruct *name_struct,
                  nsScriptNameSpaceManager *nameSpaceManager,
                  JSObject *dot_prototype,
                  JS::MutableHandle<JS::PropertyDescriptor> ctorDesc);
 
 NS_IMETHODIMP
@@ -776,17 +776,17 @@ nsDOMClassInfo::PostCreatePrototype(JSCo
 
   // Make prototype delegation work correctly. Consider if a site sets
   // HTMLElement.prototype.foopy = function () { ... } Now, calling
   // document.body.foopy() needs to ensure that looking up foopy on
   // document.body's prototype will find the right function.
   JS::Rooted<JSObject*> global(cx, ::JS_GetGlobalForObject(cx, proto));
 
   // Only do this if the global object is a window.
-  nsGlobalWindow* win;
+  nsGlobalWindowInner* win;
   if (NS_FAILED(UNWRAP_OBJECT(Window, &global, win))) {
     // Not a window.
     return NS_OK;
   }
 
   if (win->IsClosedOrClosing()) {
     return NS_OK;
   }
@@ -798,19 +798,19 @@ nsDOMClassInfo::PostCreatePrototype(JSCo
                                     &contentDefinedProperty)) {
     return NS_ERROR_FAILURE;
   }
 
   nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
   NS_ENSURE_TRUE(nameSpaceManager, NS_OK);
 
   JS::Rooted<JS::PropertyDescriptor> desc(cx);
-  nsresult rv = ResolvePrototype(sXPConnect, win, cx, global, mData->mNameUTF16,
-                                 mData, nullptr, nameSpaceManager, proto,
-                                 &desc);
+  nsresult rv = ResolvePrototype(sXPConnect, win->AssertInner(), cx, global,
+                                 mData->mNameUTF16, mData, nullptr,
+                                 nameSpaceManager, proto, &desc);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!contentDefinedProperty && desc.object() && !desc.value().isUndefined()) {
     desc.attributesRef() |= JSPROP_RESOLVING;
     if (!JS_DefineUCProperty(cx, global, mData->mNameUTF16,
                              NS_strlen(mData->mNameUTF16), desc)) {
       return NS_ERROR_UNEXPECTED;
     }
   }
@@ -1268,17 +1268,17 @@ nsDOMConstructor::ToString(nsAString &aR
   aResult.Append(mClassName);
   aResult.Append(char16_t(']'));
 
   return NS_OK;
 }
 
 
 static nsresult
-GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin,
+GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindowInner *aWin,
             const nsGlobalNameStruct *aNameStruct,
             JS::MutableHandle<JSObject*> aProto)
 {
   NS_ASSERTION(aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor,
                "Wrong type!");
 
   int32_t id = aNameStruct->mDOMClassInfoID;
   MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?");
@@ -1293,17 +1293,17 @@ GetXPCProto(nsIXPConnect *aXPConnect, JS
   NS_ENSURE_SUCCESS(rv, rv);
 
   return JS_WrapObject(cx, aProto) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 // Either ci_data must be non-null or name_struct must be non-null and of type
 // eTypeClassProto.
 static nsresult
-ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
+ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindowInner *aWin, JSContext *cx,
                  JS::Handle<JSObject*> obj, const char16_t *name,
                  const nsDOMClassInfoData *ci_data,
                  const nsGlobalNameStruct *name_struct,
                  nsScriptNameSpaceManager *nameSpaceManager,
                  JSObject* aDot_prototype,
                  JS::MutableHandle<JS::PropertyDescriptor> ctorDesc)
 {
   JS::Rooted<JSObject*> dot_prototype(cx, aDot_prototype);
@@ -1457,17 +1457,17 @@ ResolvePrototype(nsIXPConnect *aXPConnec
     return NS_ERROR_UNEXPECTED;
   }
 
   return NS_OK;
 }
 
 static bool
 OldBindingConstructorEnabled(const nsGlobalNameStruct *aStruct,
-                             nsGlobalWindow *aWin, JSContext *cx)
+                             nsGlobalWindowInner *aWin, JSContext *cx)
 {
   MOZ_ASSERT(aStruct->mType == nsGlobalNameStruct::eTypeProperty ||
              aStruct->mType == nsGlobalNameStruct::eTypeClassConstructor);
 
   // Don't expose chrome only constructors to content windows.
   if (aStruct->mChromeOnly) {
     bool expose;
     if (aStruct->mAllowXBL) {
@@ -1486,17 +1486,17 @@ OldBindingConstructorEnabled(const nsGlo
 
 static nsresult
 LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
                      nsPIDOMWindowInner *win,
                      JS::MutableHandle<JS::PropertyDescriptor> desc);
 
 // static
 bool
-nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin,
+nsWindowSH::NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
                               const nsAString& aName,
                               const nsGlobalNameStruct& aNameStruct)
 {
   // DOMConstructor is special: creating its proto does not actually define it
   // as a property on the global.  So we don't want to expose its name either.
   if (aName.EqualsLiteral("DOMConstructor")) {
     return false;
   }
@@ -1516,17 +1516,17 @@ static const JSClass ControllersShimClas
 };
 static const JSClass XULControllersShimClass = {
     "XULControllers", 0
 };
 #endif
 
 // static
 nsresult
-nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
+nsWindowSH::GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx,
                           JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
                           JS::MutableHandle<JS::PropertyDescriptor> desc)
 {
   if (id == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_COMPONENTS)) {
     return LookupComponentsShim(cx, obj, aWin->AsInner(), desc);
   }
 
 #ifdef USE_CONTROLLERS_SHIM
--- a/dom/base/nsDOMClassInfo.h
+++ b/dom/base/nsDOMClassInfo.h
@@ -16,16 +16,17 @@
 #include "nsIXPConnect.h"
 
 #ifdef XP_WIN
 #undef GetClassName
 #endif
 
 struct nsGlobalNameStruct;
 class nsGlobalWindow;
+class nsGlobalWindowInner;
 
 struct nsDOMClassInfoData;
 
 typedef nsIClassInfo* (*nsDOMClassInfoConstructorFnc)
   (nsDOMClassInfoData* aData);
 
 typedef nsresult (*nsDOMConstructorFunc)(nsISupports** aNewObject);
 
@@ -135,23 +136,23 @@ public:
   virtual void PreserveWrapper(nsISupports *aNative) override;
 };
 
 // A place to hang some static methods that we should really consider
 // moving to be nsGlobalWindow member methods.  See bug 1062418.
 class nsWindowSH
 {
 protected:
-  static nsresult GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
+  static nsresult GlobalResolve(nsGlobalWindowInner *aWin, JSContext *cx,
                                 JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
                                 JS::MutableHandle<JS::PropertyDescriptor> desc);
 
   friend class nsGlobalWindow;
 public:
-  static bool NameStructEnabled(JSContext* aCx, nsGlobalWindow *aWin,
+  static bool NameStructEnabled(JSContext* aCx, nsGlobalWindowInner *aWin,
                                 const nsAString& aName,
                                 const nsGlobalNameStruct& aNameStruct);
 };
 
 
 // Event handler 'this' translator class, this is called by XPConnect
 // when a "function interface" (nsIDOMEventListener) is called, this
 // class extracts 'this' fomr the first argument to the called
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -6373,17 +6373,17 @@ nsIDocument::CreateAttributeNS(const nsA
 
 bool
 nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp)
 {
   JS::CallArgs args = JS::CallArgsFromVp(aArgc, aVp);
 
   JS::Rooted<JSObject*> global(aCx,
     JS_GetGlobalForObject(aCx, &args.callee()));
-  RefPtr<nsGlobalWindow> window;
+  RefPtr<nsGlobalWindowInner> window;
   UNWRAP_OBJECT(Window, global, window);
   MOZ_ASSERT(window, "Should have a non-null window");
 
   nsDocument* document = static_cast<nsDocument*>(window->GetDoc());
 
   // Function name is the type of the custom element.
   JSString* jsFunName =
     JS_GetFunctionId(JS_ValueToFunction(aCx, args.calleev()));
@@ -10881,17 +10881,17 @@ nsDocument::NotifyMediaFeatureValuesChan
     if (content->IsHTMLElement(nsGkAtoms::img)) {
       auto* imageElement = static_cast<HTMLImageElement*>(content.get());
       imageElement->MediaFeatureValuesChanged();
     }
   }
 }
 
 already_AddRefed<Touch>
-nsIDocument::CreateTouch(nsGlobalWindow* aView,
+nsIDocument::CreateTouch(nsGlobalWindowInner* aView,
                          EventTarget* aTarget,
                          int32_t aIdentifier,
                          int32_t aPageX, int32_t aPageY,
                          int32_t aScreenX, int32_t aScreenY,
                          int32_t aClientX, int32_t aClientY,
                          int32_t aRadiusX, int32_t aRadiusY,
                          float aRotationAngle,
                          float aForce)
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2897,17 +2897,17 @@ SelectZoneGroup(nsGlobalWindow* aNewInne
 
 /**
  * Create a new global object that will be used for an inner window.
  * Return the native global and an nsISupports 'holder' that can be used
  * to manage the lifetime of it.
  */
 static nsresult
 CreateNativeGlobalForInner(JSContext* aCx,
-                           nsGlobalWindow* aNewInner,
+                           nsGlobalWindowInner* aNewInner,
                            nsIURI* aURI,
                            nsIPrincipal* aPrincipal,
                            JS::MutableHandle<JSObject*> aGlobal,
                            bool aIsSecureContext)
 {
   MOZ_ASSERT(aCx);
   MOZ_ASSERT(aNewInner);
   MOZ_ASSERT(aNewInner->IsInnerWindow());
@@ -3137,17 +3137,17 @@ nsGlobalWindow::SetNewDocument(nsIDocume
       // and proto, which makes the JS engine look up classes in
       // cx->globalObject, i.e. this outer window].
 
       mInnerWindow = nullptr;
 
       mCreatingInnerWindow = true;
       // Every script context we are initialized with must create a
       // new global.
-      rv = CreateNativeGlobalForInner(cx, newInnerWindow,
+      rv = CreateNativeGlobalForInner(cx, newInnerWindow->AssertInner(),
                                       aDocument->GetDocumentURI(),
                                       aDocument->NodePrincipal(),
                                       &newInnerGlobal,
                                       ComputeIsSecureContext(aDocument));
       NS_ASSERTION(NS_SUCCEEDED(rv) && newInnerGlobal &&
                    newInnerWindow->GetWrapperPreserveColor() == newInnerGlobal,
                    "Failed to get script global");
       newInnerWindow->mIsSecureContextIfOpenerIgnored =
@@ -4201,26 +4201,26 @@ nsPIDOMWindowInner::UnmuteAudioContexts(
 
   for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
     if (!mAudioContexts[i]->IsOffline()) {
       mAudioContexts[i]->Unmute();
     }
   }
 }
 
-nsGlobalWindow*
+nsGlobalWindowInner*
 nsGlobalWindow::Window()
 {
-  return this;
-}
-
-nsGlobalWindow*
+  return AssertInner();
+}
+
+nsGlobalWindowInner*
 nsGlobalWindow::Self()
 {
-  return this;
+  return AssertInner();
 }
 
 Navigator*
 nsGlobalWindow::Navigator()
 {
   MOZ_RELEASE_ASSERT(IsInnerWindow());
 
   if (!mNavigator) {
@@ -5169,17 +5169,17 @@ nsGlobalWindow::DoResolve(JSContext* aCx
   if (!WebIDLGlobalNameHash::DefineIfEnabled(aCx, aObj, aId, aDesc, &found)) {
     return false;
   }
 
   if (found) {
     return true;
   }
 
-  nsresult rv = nsWindowSH::GlobalResolve(this, aCx, aObj, aId, aDesc);
+  nsresult rv = nsWindowSH::GlobalResolve(AssertInner(), aCx, aObj, aId, aDesc);
   if (NS_FAILED(rv)) {
     return Throw(aCx, rv);
   }
 
   return true;
 }
 
 /* static */
@@ -5260,17 +5260,17 @@ nsGlobalWindow::GetOwnPropertyNames(JSCo
         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, this, entry->mKey,
+      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);
@@ -8784,24 +8784,27 @@ bool IsPopupBlocked(nsIDocument* aDoc)
 }
 
 void
 nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
                                       nsIURI* aPopupURI,
                                       const nsAString& aPopupWindowName,
                                       const nsAString& aPopupWindowFeatures)
 {
+  MOZ_ASSERT(IsOuterWindow(), "All callers seem to assume we're an outer window?");
   MOZ_ASSERT(aDoc);
 
   // Fire a "DOMPopupBlocked" event so that the UI can hear about
   // blocked popups.
   PopupBlockedEventInit init;
   init.mBubbles = true;
   init.mCancelable = true;
-  init.mRequestingWindow = this;
+  // XXX: This is a different object, but webidl requires an inner window here
+  // now.
+  init.mRequestingWindow = GetCurrentInnerWindowInternal();
   init.mPopupWindowURI = aPopupURI;
   init.mPopupWindowName = aPopupWindowName;
   init.mPopupWindowFeatures = aPopupWindowFeatures;
 
   RefPtr<PopupBlockedEvent> event =
     PopupBlockedEvent::Constructor(aDoc,
                                    NS_LITERAL_STRING("DOMPopupBlocked"),
                                    init);
@@ -8889,16 +8892,17 @@ nsGlobalWindow::RevisePopupAbuseLevel(Po
 }
 
 /* If a window open is blocked, fire the appropriate DOM events. */
 void
 nsGlobalWindow::FireAbuseEvents(const nsAString &aPopupURL,
                                 const nsAString &aPopupWindowName,
                                 const nsAString &aPopupWindowFeatures)
 {
+  MOZ_ASSERT(IsOuterWindow());
   // fetch the URI of the window requesting the opened window
 
   nsCOMPtr<nsPIDOMWindowOuter> window = GetTop();
   if (!window) {
     return;
   }
 
   nsCOMPtr<nsIDocument> topDoc = window->GetDoc();
@@ -14515,18 +14519,18 @@ nsGlobalWindow::GetSidebar(OwningExterna
 }
 
 void
 nsGlobalWindow::ClearDocumentDependentSlots(JSContext* aCx)
 {
   MOZ_ASSERT(IsInnerWindow());
 
   // If JSAPI OOMs here, there is basically nothing we can do to recover safely.
-  if (!WindowBinding::ClearCachedDocumentValue(aCx, this) ||
-      !WindowBinding::ClearCachedPerformanceValue(aCx, this)) {
+  if (!WindowBinding::ClearCachedDocumentValue(aCx, AssertInner()) ||
+      !WindowBinding::ClearCachedPerformanceValue(aCx, AssertInner())) {
     MOZ_CRASH("Unhandlable OOM while clearing document dependent slots.");
   }
 }
 
 /* static */
 JSObject*
 nsGlobalWindow::CreateNamedPropertiesObject(JSContext *aCx,
                                             JS::Handle<JSObject*> aProto)
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -785,18 +785,18 @@ public:
   nsISupports* GetParentObject()
   {
     return nullptr;
   }
 
   static JSObject*
     CreateNamedPropertiesObject(JSContext *aCx, JS::Handle<JSObject*> aProto);
 
-  nsGlobalWindow* Window();
-  nsGlobalWindow* Self();
+  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);
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -57,16 +57,17 @@ class ElementCreationOptionsOrString;
 class gfxUserFontSet;
 class imgIRequest;
 class nsBindingManager;
 class nsCachableElementsByNameNodeList;
 class nsIDocShell;
 class nsDocShell;
 class nsDOMNavigationTiming;
 class nsFrameLoader;
+class nsGlobalWindowInner;
 class nsHTMLCSSStyleSheet;
 class nsHTMLDocument;
 class nsHTMLStyleSheet;
 class nsAtom;
 class nsIBFCacheEntry;
 class nsIChannel;
 class nsIContent;
 class nsIContentSink;
@@ -3040,17 +3041,17 @@ public:
                      mozilla::ErrorResult& rv);
   nsINode* CreateNSResolver(nsINode& aNodeResolver);
   already_AddRefed<mozilla::dom::XPathResult>
     Evaluate(JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode,
              mozilla::dom::XPathNSResolver* aResolver, uint16_t aType,
              JS::Handle<JSObject*> aResult, mozilla::ErrorResult& rv);
   // Touch event handlers already on nsINode
   already_AddRefed<mozilla::dom::Touch>
-    CreateTouch(nsGlobalWindow* aView, mozilla::dom::EventTarget* aTarget,
+    CreateTouch(nsGlobalWindowInner* aView, mozilla::dom::EventTarget* aTarget,
                 int32_t aIdentifier, int32_t aPageX, int32_t aPageY,
                 int32_t aScreenX, int32_t aScreenY, int32_t aClientX,
                 int32_t aClientY, int32_t aRadiusX, int32_t aRadiusY,
                 float aRotationAngle, float aForce);
   already_AddRefed<mozilla::dom::TouchList> CreateTouchList();
   already_AddRefed<mozilla::dom::TouchList>
     CreateTouchList(mozilla::dom::Touch& aTouch,
                     const mozilla::dom::Sequence<mozilla::OwningNonNull<mozilla::dom::Touch> >& aTouches);
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -515,18 +515,19 @@ DispatchScriptErrorEvent(nsPIDOMWindowIn
 #ifdef DEBUG
 // A couple of useful functions to call when you're debugging.
 nsGlobalWindowInner *
 JSObject2Win(JSObject *obj)
 {
   return xpc::WindowOrNull(obj);
 }
 
+template<typename T>
 void
-PrintWinURI(nsGlobalWindow *win)
+PrintWinURI(T *win)
 {
   if (!win) {
     printf("No window passed in.\n");
     return;
   }
 
   nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
   if (!doc) {
@@ -539,17 +540,30 @@ PrintWinURI(nsGlobalWindow *win)
     printf("Document doesn't have a URI.\n");
     return;
   }
 
   printf("%s\n", uri->GetSpecOrDefault().get());
 }
 
 void
-PrintWinCodebase(nsGlobalWindow *win)
+PrintWinURIInner(nsGlobalWindowInner* aWin)
+{
+  return PrintWinURI(aWin);
+}
+
+void
+PrintWinURIOuter(nsGlobalWindowOuter* aWin)
+{
+  return PrintWinURI(aWin);
+}
+
+template<typename T>
+void
+PrintWinCodebase(T *win)
 {
   if (!win) {
     printf("No window passed in.\n");
     return;
   }
 
   nsIPrincipal *prin = win->GetPrincipal();
   if (!prin) {
@@ -563,16 +577,28 @@ PrintWinCodebase(nsGlobalWindow *win)
     printf("No URI, maybe the system principal.\n");
     return;
   }
 
   printf("%s\n", uri->GetSpecOrDefault().get());
 }
 
 void
+PrintWinCodebaseInner(nsGlobalWindowInner* aWin)
+{
+  return PrintWinCodebase(aWin);
+}
+
+void
+PrintWinCodebaseOuter(nsGlobalWindowOuter* aWin)
+{
+  return PrintWinCodebase(aWin);
+}
+
+void
 DumpString(const nsAString &str)
 {
   printf("%s\n", NS_ConvertUTF16toUTF8(str).get());
 }
 #endif
 
 #define JS_OPTIONS_DOT_STR "javascript.options."
 
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -3146,17 +3146,17 @@ ConvertExceptionToPromise(JSContext* cx,
   }
 
   // Now make sure we rewrap promise back into the compartment we want
   return JS_WrapValue(cx, rval);
 }
 
 /* static */
 void
-CreateGlobalOptions<nsGlobalWindow>::TraceGlobal(JSTracer* aTrc, JSObject* aObj)
+CreateGlobalOptions<nsGlobalWindowInner>::TraceGlobal(JSTracer* aTrc, JSObject* aObj)
 {
   xpc::TraceXPCGlobal(aTrc, aObj);
 }
 
 static bool sRegisteredDOMNames = false;
 
 nsresult
 RegisterDOMNames()
@@ -3176,18 +3176,18 @@ RegisterDOMNames()
 
   sRegisteredDOMNames = true;
 
   return NS_OK;
 }
 
 /* static */
 bool
-CreateGlobalOptions<nsGlobalWindow>::PostCreateGlobal(JSContext* aCx,
-                                                      JS::Handle<JSObject*> aGlobal)
+CreateGlobalOptions<nsGlobalWindowInner>::PostCreateGlobal(JSContext* aCx,
+                                                           JS::Handle<JSObject*> aGlobal)
 {
   nsresult rv = RegisterDOMNames();
   if (NS_FAILED(rv)) {
     return Throw(aCx, rv);
   }
 
   // Invoking the XPCWrappedNativeScope constructor automatically hooks it
   // up to the compartment of aGlobal.
--- a/dom/bindings/BindingUtils.h
+++ b/dom/bindings/BindingUtils.h
@@ -3092,17 +3092,17 @@ struct CreateGlobalOptions
   {
     MOZ_ALWAYS_TRUE(TryPreserveWrapper(aGlobal));
 
     return true;
   }
 };
 
 template <>
-struct CreateGlobalOptions<nsGlobalWindow>
+struct CreateGlobalOptions<nsGlobalWindowInner>
 {
   static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind =
     ProtoAndIfaceCache::WindowLike;
   static void TraceGlobal(JSTracer* aTrc, JSObject* aObj);
   static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
 };
 
 nsresult
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1356,17 +1356,18 @@ DOMInterfaces = {
 'WebrtcGlobalInformation': {
     'nativeType': 'mozilla::dom::WebrtcGlobalInformation',
     'headerFile': 'WebrtcGlobalInformation.h',
     'wrapperCache': False,
     'concrete': False,
 },
 
 'Window': {
-    'nativeType': 'nsGlobalWindow',
+    'nativeType': 'nsGlobalWindowInner',
+    'headerFile': 'nsGlobalWindow.h',
     'binaryNames': {
         'postMessage': 'postMessageMoz',
     },
     'implicitJSContext': [
         'createImageBitmap',
         'requestIdleCallback'
     ],
 },
--- a/dom/bindings/WebIDLGlobalNameHash.cpp
+++ b/dom/bindings/WebIDLGlobalNameHash.cpp
@@ -223,17 +223,17 @@ WebIDLGlobalNameHash::DefineIfEnabled(JS
   }
 
   {
     // It's safe to pass "&global" here, because we've already unwrapped it, but
     // for general sanity better to not have debug code even having the
     // appearance of mutating things that opt code uses.
 #ifdef DEBUG
     JS::Rooted<JSObject*> temp(aCx, global);
-    DebugOnly<nsGlobalWindow*> win;
+    DebugOnly<nsGlobalWindowInner*> win;
     MOZ_ASSERT(NS_SUCCEEDED(UNWRAP_OBJECT(Window, &temp, win)));
 #endif
   }
 
   if (checkEnabledForScope && !checkEnabledForScope(aCx, global)) {
     return true;
   }
 
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -5496,17 +5496,17 @@ CanvasRenderingContext2D::GetGlobalCompo
   else {
     aError.Throw(NS_ERROR_FAILURE);
   }
 
 #undef CANVAS_OP_TO_GFX_OP
 }
 
 void
-CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& aWindow, double aX,
+CanvasRenderingContext2D::DrawWindow(nsGlobalWindowInner& aWindow, double aX,
                                      double aY, double aW, double aH,
                                      const nsAString& aBgColor,
                                      uint32_t aFlags, ErrorResult& aError)
 {
   MOZ_ASSERT(aWindow.IsInnerWindow());
 
   if (int32_t(aW) == 0 || int32_t(aH) == 0) {
     return;
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -403,17 +403,17 @@ public:
 
   void SetImageSmoothingEnabled(bool aImageSmoothingEnabled) override
   {
     if (aImageSmoothingEnabled != CurrentState().imageSmoothingEnabled) {
       CurrentState().imageSmoothingEnabled = aImageSmoothingEnabled;
     }
   }
 
-  void DrawWindow(nsGlobalWindow& aWindow, double aX, double aY,
+  void DrawWindow(nsGlobalWindowInner& aWindow, double aX, double aY,
                   double aW, double aH,
                   const nsAString& aBgColor, uint32_t aFlags,
                   mozilla::ErrorResult& aError);
 
   enum RenderingMode {
     SoftwareBackendMode,
     OpenGLBackendMode,
     DefaultBackendMode
--- a/dom/events/CompositionEvent.cpp
+++ b/dom/events/CompositionEvent.cpp
@@ -76,17 +76,17 @@ CompositionEvent::GetLocale(nsAString& a
 {
   aLocale = mLocale;
 }
 
 void
 CompositionEvent::InitCompositionEvent(const nsAString& aType,
                                        bool aCanBubble,
                                        bool aCancelable,
-                                       nsGlobalWindow* aView,
+                                       nsGlobalWindowInner* aView,
                                        const nsAString& aData,
                                        const nsAString& aLocale)
 {
   NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
 
   UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
   mData = aData;
   mLocale = aLocale;
--- a/dom/events/CompositionEvent.h
+++ b/dom/events/CompositionEvent.h
@@ -37,17 +37,17 @@ public:
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return CompositionEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   void InitCompositionEvent(const nsAString& aType,
                             bool aCanBubble,
                             bool aCancelable,
-                            nsGlobalWindow* aView,
+                            nsGlobalWindowInner* aView,
                             const nsAString& aData,
                             const nsAString& aLocale);
   void GetData(nsAString&) const;
   void GetLocale(nsAString&) const;
   void GetRanges(TextClauseArray& aRanges);
 
 protected:
   ~CompositionEvent() {}
--- a/dom/events/DragEvent.cpp
+++ b/dom/events/DragEvent.cpp
@@ -36,17 +36,17 @@ NS_IMPL_RELEASE_INHERITED(DragEvent, Mou
 NS_INTERFACE_MAP_BEGIN(DragEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMDragEvent)
 NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 void
 DragEvent::InitDragEvent(const nsAString& aType,
                          bool aCanBubble,
                          bool aCancelable,
-                         nsGlobalWindow* aView,
+                         nsGlobalWindowInner* aView,
                          int32_t aDetail,
                          int32_t aScreenX,
                          int32_t aScreenY,
                          int32_t aClientX,
                          int32_t aClientY,
                          bool aCtrlKey,
                          bool aAltKey,
                          bool aShiftKey,
--- a/dom/events/DragEvent.h
+++ b/dom/events/DragEvent.h
@@ -35,17 +35,17 @@ public:
   {
     return DragEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   DataTransfer* GetDataTransfer();
 
   void InitDragEvent(const nsAString& aType,
                      bool aCanBubble, bool aCancelable,
-                     nsGlobalWindow* aView, int32_t aDetail,
+                     nsGlobalWindowInner* aView, int32_t aDetail,
                      int32_t aScreenX, int32_t aScreenY,
                      int32_t aClientX, int32_t aClientY,
                      bool aCtrlKey, bool aAltKey, bool aShiftKey,
                      bool aMetaKey, uint16_t aButton,
                      EventTarget* aRelatedTarget,
                      DataTransfer* aDataTransfer);
 
   static already_AddRefed<DragEvent> Constructor(const GlobalObject& aGlobal,
--- a/dom/events/FocusEvent.cpp
+++ b/dom/events/FocusEvent.cpp
@@ -41,17 +41,17 @@ FocusEvent::GetRelatedTarget()
   return
     EnsureWebAccessibleRelatedTarget(mEvent->AsFocusEvent()->mRelatedTarget);
 }
 
 void
 FocusEvent::InitFocusEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
-                           nsGlobalWindow* aView,
+                           nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            EventTarget* aRelatedTarget)
 {
   MOZ_ASSERT(!mEvent->mFlags.mIsBeingDispatched);
 
   UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
   mEvent->AsFocusEvent()->mRelatedTarget = aRelatedTarget;
 }
--- a/dom/events/FocusEvent.h
+++ b/dom/events/FocusEvent.h
@@ -40,17 +40,17 @@ public:
                                                   const FocusEventInit& aParam,
                                                   ErrorResult& aRv);
 protected:
   ~FocusEvent() {}
 
   void InitFocusEvent(const nsAString& aType,
                       bool aCanBubble,
                       bool aCancelable,
-                      nsGlobalWindow* aView,
+                      nsGlobalWindowInner* aView,
                       int32_t aDetail,
                       EventTarget* aRelatedTarget);
 };
 
 } // namespace dom
 } // namespace mozilla
 
 already_AddRefed<mozilla::dom::FocusEvent>
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -340,17 +340,17 @@ KeyboardEvent::InitKeyEvent(const nsAStr
 
   return NS_OK;
 }
 
 void
 KeyboardEvent::InitKeyboardEvent(const nsAString& aType,
                                  bool aCanBubble,
                                  bool aCancelable,
-                                 nsGlobalWindow* aView,
+                                 nsGlobalWindowInner* aView,
                                  const nsAString& aKey,
                                  uint32_t aLocation,
                                  bool aCtrlKey,
                                  bool aAltKey,
                                  bool aShiftKey,
                                  bool aMetaKey,
                                  ErrorResult& aRv)
 {
--- a/dom/events/KeyboardEvent.h
+++ b/dom/events/KeyboardEvent.h
@@ -58,28 +58,28 @@ public:
   uint32_t KeyCode();
   virtual uint32_t Which() override;
   uint32_t Location();
 
   void GetCode(nsAString& aCode);
   void GetInitDict(KeyboardEventInit& aParam);
 
   void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
-                    nsGlobalWindow* aView, bool aCtrlKey, bool aAltKey,
+                    nsGlobalWindowInner* aView, bool aCtrlKey, bool aAltKey,
                     bool aShiftKey, bool aMetaKey,
                     uint32_t aKeyCode, uint32_t aCharCode)
   {
     auto* view = aView ? aView->AsInner() : nullptr;
     InitKeyEvent(aType, aCanBubble, aCancelable, view, aCtrlKey, aAltKey,
                  aShiftKey, aMetaKey, aKeyCode, aCharCode);
   }
 
   void InitKeyboardEvent(const nsAString& aType,
                          bool aCanBubble, bool aCancelable,
-                         nsGlobalWindow* aView, const nsAString& aKey,
+                         nsGlobalWindowInner* aView, const nsAString& aKey,
                          uint32_t aLocation, bool aCtrlKey, bool aAltKey,
                          bool aShiftKey, bool aMetaKey, ErrorResult& aRv);
 
 protected:
   ~KeyboardEvent() {}
 
   void InitWithKeyboardEventInit(EventTarget* aOwner,
                                  const nsAString& aType,
--- a/dom/events/MouseEvent.cpp
+++ b/dom/events/MouseEvent.cpp
@@ -49,17 +49,17 @@ NS_IMPL_RELEASE_INHERITED(MouseEvent, UI
 NS_INTERFACE_MAP_BEGIN(MouseEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
 NS_INTERFACE_MAP_END_INHERITING(UIEvent)
 
 void
 MouseEvent::InitMouseEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
-                           nsGlobalWindow* aView,
+                           nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            int32_t aScreenX,
                            int32_t aScreenY,
                            int32_t aClientX,
                            int32_t aClientY,
                            bool aCtrlKey,
                            bool aAltKey,
                            bool aShiftKey,
@@ -125,17 +125,17 @@ MouseEvent::InitMouseEvent(const nsAStri
 
   return NS_OK;
 }
 
 void
 MouseEvent::InitMouseEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
-                           nsGlobalWindow* aView,
+                           nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            int32_t aScreenX,
                            int32_t aScreenY,
                            int32_t aClientX,
                            int32_t aClientY,
                            int16_t aButton,
                            EventTarget* aRelatedTarget,
                            const nsAString& aModifiersList)
@@ -194,17 +194,17 @@ MouseEvent::Constructor(const GlobalObje
   e->SetComposed(aParam.mComposed);
   return e.forget();
 }
 
 void
 MouseEvent::InitNSMouseEvent(const nsAString& aType,
                              bool aCanBubble,
                              bool aCancelable,
-                             nsGlobalWindow* aView,
+                             nsGlobalWindowInner* aView,
                              int32_t aDetail,
                              int32_t aScreenX,
                              int32_t aScreenY,
                              int32_t aClientX,
                              int32_t aClientY,
                              bool aCtrlKey,
                              bool aAltKey,
                              bool aShiftKey,
--- a/dom/events/MouseEvent.h
+++ b/dom/events/MouseEvent.h
@@ -53,17 +53,17 @@ public:
   bool ShiftKey();
   bool AltKey();
   bool MetaKey();
   int16_t Button();
   uint16_t Buttons();
   already_AddRefed<EventTarget> GetRelatedTarget();
   void GetRegion(nsAString& aRegion);
   void InitMouseEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
-                      nsGlobalWindow* aView, int32_t aDetail, int32_t aScreenX,
+                      nsGlobalWindowInner* aView, int32_t aDetail, int32_t aScreenX,
                       int32_t aScreenY, int32_t aClientX, int32_t aClientY,
                       bool aCtrlKey, bool aAltKey, bool aShiftKey,
                       bool aMetaKey, uint16_t aButton,
                       EventTarget* aRelatedTarget);
 
   void InitializeExtraMouseEventDictionaryMembers(const MouseEventInit& aParam);
 
   bool GetModifierState(const nsAString& aKeyArg)
@@ -82,31 +82,31 @@ public:
   {
     return GetMovementPoint().y;
   }
   float MozPressure() const;
   bool HitCluster() const;
   uint16_t MozInputSource() const;
   void InitNSMouseEvent(const nsAString& aType,
                         bool aCanBubble, bool aCancelable,
-                        nsGlobalWindow* aView, int32_t aDetail,
+                        nsGlobalWindowInner* aView, int32_t aDetail,
                         int32_t aScreenX, int32_t aScreenY,
                         int32_t aClientX, int32_t aClientY,
                         bool aCtrlKey, bool aAltKey, bool aShiftKey,
                         bool aMetaKey, uint16_t aButton,
                         EventTarget* aRelatedTarget,
                         float aPressure, uint16_t aInputSource);
 
 protected:
   ~MouseEvent() {}
 
   void InitMouseEvent(const nsAString& aType,
                       bool aCanBubble,
                       bool aCancelable,
-                      nsGlobalWindow* aView,
+                      nsGlobalWindowInner* aView,
                       int32_t aDetail,
                       int32_t aScreenX,
                       int32_t aScreenY,
                       int32_t aClientX,
                       int32_t aClientY,
                       int16_t aButton,
                       EventTarget* aRelatedTarget,
                       const nsAString& aModifiersList);
--- a/dom/events/MouseScrollEvent.cpp
+++ b/dom/events/MouseScrollEvent.cpp
@@ -37,17 +37,17 @@ NS_IMPL_RELEASE_INHERITED(MouseScrollEve
 
 NS_INTERFACE_MAP_BEGIN(MouseScrollEvent)
 NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 void
 MouseScrollEvent::InitMouseScrollEvent(const nsAString& aType,
                                        bool aCanBubble,
                                        bool aCancelable,
-                                       nsGlobalWindow* aView,
+                                       nsGlobalWindowInner* aView,
                                        int32_t aDetail,
                                        int32_t aScreenX,
                                        int32_t aScreenY,
                                        int32_t aClientX,
                                        int32_t aClientY,
                                        bool aCtrlKey,
                                        bool aAltKey,
                                        bool aShiftKey,
--- a/dom/events/MouseScrollEvent.h
+++ b/dom/events/MouseScrollEvent.h
@@ -28,17 +28,17 @@ public:
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return MouseScrollEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   int32_t Axis();
 
   void InitMouseScrollEvent(const nsAString& aType, bool aCanBubble,
-                            bool aCancelable, nsGlobalWindow* aView,
+                            bool aCancelable, nsGlobalWindowInner* aView,
                             int32_t aDetail, int32_t aScreenX, int32_t aScreenY,
                             int32_t aClientX, int32_t aClientY,
                             bool aCtrlKey, bool aAltKey, bool aShiftKey,
                             bool aMetaKey, uint16_t aButton,
                             EventTarget* aRelatedTarget,
                             int32_t aAxis);
 
 protected:
--- a/dom/events/ScrollAreaEvent.cpp
+++ b/dom/events/ScrollAreaEvent.cpp
@@ -30,17 +30,17 @@ NS_IMPL_RELEASE_INHERITED(ScrollAreaEven
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScrollAreaEvent)
 NS_INTERFACE_MAP_END_INHERITING(UIEvent)
 
 void
 ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
                                      bool aCanBubble,
                                      bool aCancelable,
-                                     nsGlobalWindow* aView,
+                                     nsGlobalWindowInner* aView,
                                      int32_t aDetail,
                                      float aX,
                                      float aY,
                                      float aWidth,
                                      float aHeight)
 {
   NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
 
--- a/dom/events/ScrollAreaEvent.h
+++ b/dom/events/ScrollAreaEvent.h
@@ -58,17 +58,17 @@ public:
   float Height() const
   {
     return mClientArea->Height();
   }
 
   void InitScrollAreaEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
-                           nsGlobalWindow* aView,
+                           nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            float aX, float aY,
                            float aWidth, float aHeight);
 
 protected:
   ~ScrollAreaEvent() {}
 
   RefPtr<DOMRect> mClientArea;
--- a/dom/events/SimpleGestureEvent.cpp
+++ b/dom/events/SimpleGestureEvent.cpp
@@ -102,17 +102,17 @@ SimpleGestureEvent::GetClickCount(uint32
   *aClickCount = ClickCount();
   return NS_OK;
 }
 
 void
 SimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
                                            bool aCanBubbleArg,
                                            bool aCancelableArg,
-                                           nsGlobalWindow* aViewArg,
+                                           nsGlobalWindowInner* aViewArg,
                                            int32_t aDetailArg,
                                            int32_t aScreenX,
                                            int32_t aScreenY,
                                            int32_t aClientX,
                                            int32_t aClientY,
                                            bool aCtrlKeyArg,
                                            bool aAltKeyArg,
                                            bool aShiftKeyArg,
--- a/dom/events/SimpleGestureEvent.h
+++ b/dom/events/SimpleGestureEvent.h
@@ -40,17 +40,17 @@ public:
   uint32_t AllowedDirections();
   uint32_t Direction();
   double Delta();
   uint32_t ClickCount();
 
   void InitSimpleGestureEvent(const nsAString& aType,
                               bool aCanBubble,
                               bool aCancelable,
-                              nsGlobalWindow* aView,
+                              nsGlobalWindowInner* aView,
                               int32_t aDetail,
                               int32_t aScreenX,
                               int32_t aScreenY,
                               int32_t aClientX,
                               int32_t aClientY,
                               bool aCtrlKey,
                               bool aAltKey,
                               bool aShiftKey,
--- a/dom/events/TouchEvent.cpp
+++ b/dom/events/TouchEvent.cpp
@@ -79,17 +79,17 @@ NS_INTERFACE_MAP_END_INHERITING(UIEvent)
 
 NS_IMPL_ADDREF_INHERITED(TouchEvent, UIEvent)
 NS_IMPL_RELEASE_INHERITED(TouchEvent, UIEvent)
 
 void
 TouchEvent::InitTouchEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
-                           nsGlobalWindow* aView,
+                           nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            bool aCtrlKey,
                            bool aAltKey,
                            bool aShiftKey,
                            bool aMetaKey,
                            TouchList* aTouches,
                            TouchList* aTargetTouches,
                            TouchList* aChangedTouches)
--- a/dom/events/TouchEvent.h
+++ b/dom/events/TouchEvent.h
@@ -102,17 +102,17 @@ public:
   bool AltKey();
   bool MetaKey();
   bool CtrlKey();
   bool ShiftKey();
 
   void InitTouchEvent(const nsAString& aType,
                       bool aCanBubble,
                       bool aCancelable,
-                      nsGlobalWindow* aView,
+                      nsGlobalWindowInner* aView,
                       int32_t aDetail,
                       bool aCtrlKey,
                       bool aAltKey,
                       bool aShiftKey,
                       bool aMetaKey,
                       TouchList* aTouches,
                       TouchList* aTargetTouches,
                       TouchList* aChangedTouches);
--- a/dom/events/UIEvent.cpp
+++ b/dom/events/UIEvent.cpp
@@ -150,17 +150,17 @@ UIEvent::GetDetail(int32_t* aDetail)
   *aDetail = mDetail;
   return NS_OK;
 }
 
 void
 UIEvent::InitUIEvent(const nsAString& typeArg,
                      bool canBubbleArg,
                      bool cancelableArg,
-                     nsGlobalWindow* viewArg,
+                     nsGlobalWindowInner* viewArg,
                      int32_t detailArg)
 {
   auto* view = viewArg ? viewArg->AsInner() : nullptr;
   InitUIEvent(typeArg, canBubbleArg, cancelableArg, view, detailArg);
 }
 
 NS_IMETHODIMP
 UIEvent::InitUIEvent(const nsAString& typeArg,
--- a/dom/events/UIEvent.h
+++ b/dom/events/UIEvent.h
@@ -49,17 +49,17 @@ public:
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return UIEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
   void InitUIEvent(const nsAString& typeArg,
                    bool canBubbleArg,
                    bool cancelableArg,
-                   nsGlobalWindow* viewArg,
+                   nsGlobalWindowInner* viewArg,
                    int32_t detailArg);
 
   nsPIDOMWindowOuter* GetView() const
   {
     return mView;
   }
 
   int32_t Detail() const
--- a/dom/events/WheelEvent.cpp
+++ b/dom/events/WheelEvent.cpp
@@ -41,17 +41,17 @@ NS_IMPL_RELEASE_INHERITED(WheelEvent, Mo
 
 NS_INTERFACE_MAP_BEGIN(WheelEvent)
 NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
 
 void
 WheelEvent::InitWheelEvent(const nsAString& aType,
                            bool aCanBubble,
                            bool aCancelable,
-                           nsGlobalWindow* aView,
+                           nsGlobalWindowInner* aView,
                            int32_t aDetail,
                            int32_t aScreenX,
                            int32_t aScreenY,
                            int32_t aClientX,
                            int32_t aClientY,
                            uint16_t aButton,
                            EventTarget* aRelatedTarget,
                            const nsAString& aModifiersList,
--- a/dom/events/WheelEvent.h
+++ b/dom/events/WheelEvent.h
@@ -42,17 +42,17 @@ public:
   //       if it's dispatched by widget)
   double DeltaX();
   double DeltaY();
   double DeltaZ();
   uint32_t DeltaMode();
 
   void
   InitWheelEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
-                 nsGlobalWindow* aView, int32_t aDetail,
+                 nsGlobalWindowInner* aView, int32_t aDetail,
                  int32_t aScreenX, int32_t aScreenY,
                  int32_t aClientX, int32_t aClientY, uint16_t aButton,
                  EventTarget* aRelatedTarget, const nsAString& aModifiersList,
                  double aDeltaX, double aDeltaY, double aDeltaZ,
                  uint32_t aDeltaMode);
 
 protected:
   ~WheelEvent() {}
--- a/dom/events/XULCommandEvent.h
+++ b/dom/events/XULCommandEvent.h
@@ -46,17 +46,17 @@ public:
   {
     RefPtr<Event> e =
       mSourceEvent ? mSourceEvent->InternalDOMEvent() : nullptr;
     return e.forget();
   }
 
   void InitCommandEvent(const nsAString& aType,
                         bool aCanBubble, bool aCancelable,
-                        nsGlobalWindow* aView,
+                        nsGlobalWindowInner* aView,
                         int32_t aDetail,
                         bool aCtrlKey, bool aAltKey,
                         bool aShiftKey, bool aMetaKey,
                         Event* aSourceEvent,
                         uint16_t aInputSource)
   {
     InitCommandEvent(aType, aCanBubble, aCancelable, aView->AsInner(),
                      aDetail, aCtrlKey, aAltKey, aShiftKey, aMetaKey,
--- a/dom/smil/TimeEvent.cpp
+++ b/dom/smil/TimeEvent.cpp
@@ -48,17 +48,17 @@ NS_INTERFACE_MAP_END_INHERITING(Event)
 NS_IMETHODIMP
 TimeEvent::GetDetail(int32_t* aDetail)
 {
   *aDetail = mDetail;
   return NS_OK;
 }
 
 void
-TimeEvent::InitTimeEvent(const nsAString& aType, nsGlobalWindow* aView,
+TimeEvent::InitTimeEvent(const nsAString& aType, nsGlobalWindowInner* aView,
                          int32_t aDetail)
 {
   NS_ENSURE_TRUE_VOID(!mEvent->mFlags.mIsBeingDispatched);
 
   Event::InitEvent(aType, false /*doesn't bubble*/, false /*can't cancel*/);
   mDetail = aDetail;
   mView = aView ? aView->GetOuterWindow() : nullptr;
 }
--- a/dom/smil/TimeEvent.h
+++ b/dom/smil/TimeEvent.h
@@ -6,17 +6,17 @@
 
 #ifndef mozilla_dom_TimeEvent_h_
 #define mozilla_dom_TimeEvent_h_
 
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/TimeEventBinding.h"
 #include "nsIDOMTimeEvent.h"
 
-class nsGlobalWindow;
+class nsGlobalWindowInner;
 
 namespace mozilla {
 namespace dom {
 
 class TimeEvent final : public Event,
                         public nsIDOMTimeEvent
 {
 public:
@@ -34,17 +34,17 @@ public:
   // Forward to base class
   NS_FORWARD_TO_EVENT
 
   virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
   {
     return TimeEventBinding::Wrap(aCx, this, aGivenProto);
   }
 
-  void InitTimeEvent(const nsAString& aType, nsGlobalWindow* aView,
+  void InitTimeEvent(const nsAString& aType, nsGlobalWindowInner* aView,
                      int32_t aDetail);
 
 
   int32_t Detail() const
   {
     return mDetail;
   }
 
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -2333,17 +2333,17 @@ nsXPCComponents_Utils::Unload(const nsAC
 NS_IMETHODIMP
 nsXPCComponents_Utils::ImportGlobalProperties(HandleValue aPropertyList,
                                               JSContext* cx)
 {
     RootedObject global(cx, CurrentGlobalOrNull(cx));
     MOZ_ASSERT(global);
 
     // Don't allow doing this if the global is a Window
-    nsGlobalWindow* win;
+    nsGlobalWindowInner* win;
     if (NS_SUCCEEDED(UNWRAP_OBJECT(Window, &global, win))) {
         return NS_ERROR_NOT_AVAILABLE;
     }
 
     GlobalProperties options;
     NS_ENSURE_TRUE(aPropertyList.isObject(), NS_ERROR_INVALID_ARG);
 
     RootedObject propertyList(cx, &aPropertyList.toObject());
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -532,19 +532,19 @@ CompilationScope()
 }
 
 nsGlobalWindowInner*
 WindowOrNull(JSObject* aObj)
 {
     MOZ_ASSERT(aObj);
     MOZ_ASSERT(!js::IsWrapper(aObj));
 
-    nsGlobalWindow* win = nullptr;
+    nsGlobalWindowInner* win = nullptr;
     UNWRAP_NON_WRAPPER_OBJECT(Window, aObj, win);
-    return static_cast<nsGlobalWindowInner*>(win);
+    return win;
 }
 
 nsGlobalWindowInner*
 WindowGlobalOrNull(JSObject* aObj)
 {
     MOZ_ASSERT(aObj);
     JSObject* glob = js::GetGlobalForObjectCrossCompartment(aObj);
 
@@ -2233,17 +2233,17 @@ class XPCJSRuntimeStats : public JS::Run
         // Get some global in this zone.
         AutoSafeJSContext cx;
         JSCompartment* comp = js::GetAnyCompartmentInZone(zone);
         Rooted<Realm*> realm(cx, JS::GetRealmForCompartment(comp));
         xpc::ZoneStatsExtras* extras = new xpc::ZoneStatsExtras;
         extras->pathPrefix.AssignLiteral("explicit/js-non-window/zones/");
         RootedObject global(cx, JS::GetRealmGlobalOrNull(realm));
         if (global) {
-            RefPtr<nsGlobalWindow> window;
+            RefPtr<nsGlobalWindowInner> window;
             if (NS_SUCCEEDED(UNWRAP_OBJECT(Window, global, window))) {
                 // The global is a |window| object.  Use the path prefix that
                 // we should have already created for it.
                 if (mTopWindowPaths->Get(window->WindowID(),
                                          &extras->pathPrefix))
                     extras->pathPrefix.AppendLiteral("/js-");
             }
         }
@@ -2273,17 +2273,17 @@ class XPCJSRuntimeStats : public JS::Run
         }
 
         // Get the compartment's global.
         AutoSafeJSContext cx;
         bool needZone = true;
         Rooted<Realm*> realm(cx, JS::GetRealmForCompartment(c));
         RootedObject global(cx, JS::GetRealmGlobalOrNull(realm));
         if (global) {
-            RefPtr<nsGlobalWindow> window;
+            RefPtr<nsGlobalWindowInner> window;
             if (NS_SUCCEEDED(UNWRAP_OBJECT(Window, global, window))) {
                 // The global is a |window| object.  Use the path prefix that
                 // we should have already created for it.
                 if (mWindowPaths->Get(window->WindowID(),
                                       &extras->jsPathPrefix)) {
                     extras->domPathPrefix.Assign(extras->jsPathPrefix);
                     extras->domPathPrefix.AppendLiteral("/dom/");
                     extras->jsPathPrefix.AppendLiteral("/js-");
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -722,17 +722,17 @@ PeerConnectionImpl::Initialize(PeerConne
     return res;
   }
 
   return NS_OK;
 }
 
 void
 PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
-                               nsGlobalWindow& aWindow,
+                               nsGlobalWindowInner& aWindow,
                                const RTCConfiguration& aConfiguration,
                                nsISupports* aThread,
                                ErrorResult &rv)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aThread);
   mThread = do_QueryInterface(aThread);
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h
@@ -50,17 +50,16 @@
 #include "mozilla/PeerIdentity.h"
 
 namespace test {
 #ifdef USE_FAKE_PCOBSERVER
 class AFakePCObserver;
 #endif
 }
 
-class nsGlobalWindow;
 class nsDOMDataChannel;
 
 namespace mozilla {
 class DataChannel;
 class DtlsIdentity;
 class NrIceCtx;
 class NrIceMediaStream;
 class NrIceStunServer;
@@ -326,17 +325,17 @@ public:
   // This is necessary because RTCConfiguration can't be used by unit-tests
   nsresult Initialize(PeerConnectionObserver& aObserver,
                       nsGlobalWindowInner* aWindow,
                       const PeerConnectionConfiguration& aConfiguration,
                       nsISupports* aThread);
 
   // Initialize PeerConnection from an RTCConfiguration object (JS entrypoint)
   void Initialize(PeerConnectionObserver& aObserver,
-                  nsGlobalWindow& aWindow,
+                  nsGlobalWindowInner& aWindow,
                   const RTCConfiguration& aConfiguration,
                   nsISupports* aThread,
                   ErrorResult &rv);
 
   void SetCertificate(mozilla::dom::RTCCertificate& aCertificate);
   const RefPtr<mozilla::dom::RTCCertificate>& Certificate() const;
   // This is a hack to support external linkage.
   RefPtr<DtlsIdentity> Identity() const;