Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug
authorBrendan Dahl <bdahl@mozilla.com>
Tue, 05 Nov 2019 17:56:28 +0000
changeset 500633 0e3e0d51aaf6eee8f95fde1dd93849ce732f96e1
parent 500632 67f2b416b27017704978b551e172fe10e415bf0d
child 500634 4db47986ccce962f09c79d443788a2bb3757f55e
push id36768
push usershindli@mozilla.com
push dateTue, 05 Nov 2019 22:07:34 +0000
treeherdermozilla-central@e96c1ca93d25 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1470510
milestone72.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 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug nsXULWindow is no longer XUL specific and is somewhat confusing name. Differential Revision: https://phabricator.services.mozilla.com/D51486
accessible/generic/RootAccessible.cpp
browser/base/content/browser.js
browser/components/BrowserGlue.jsm
browser/components/downloads/DownloadsTaskbar.jsm
browser/components/extensions/parent/ext-browser.js
browser/components/extensions/test/browser/browser_ext_windows_create.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_context_and_chromeFlags.js
browser/components/search/SearchTelemetry.jsm
browser/components/sessionstore/SessionStore.jsm
browser/components/tests/startupRecorder.js
devtools/server/actors/webbrowser.js
docshell/base/nsDocShell.cpp
docshell/base/nsDocShellTreeOwner.cpp
docshell/test/navigation/browser_test-content-chromeflags.js
dom/base/Document.cpp
dom/base/Document.h
dom/base/nsCCUncollectableMarker.cpp
dom/base/nsFocusManager.cpp
dom/base/nsFrameLoader.cpp
dom/base/nsGlobalWindowInner.cpp
dom/base/nsGlobalWindowOuter.cpp
dom/base/nsGlobalWindowOuter.h
dom/ipc/BrowserParent.cpp
dom/ipc/ContentParent.cpp
dom/plugins/base/nsPluginHost.cpp
dom/xul/XULPersist.cpp
testing/talos/talos/tests/devtools/addon/api.js
testing/talos/talos/tests/twinopen/api.js
toolkit/components/browser/nsWebBrowser.cpp
toolkit/components/extensions/ExtensionParent.jsm
toolkit/components/extensions/parent/ext-tabs-base.js
toolkit/components/printingui/nsPrintProgress.cpp
toolkit/components/prompts/test/chromeScript.js
toolkit/components/sessionstore/SessionStoreListener.cpp
toolkit/components/startup/nsAppStartup.cpp
toolkit/components/windowwatcher/nsWindowWatcher.cpp
toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js
toolkit/components/windowwatcher/test/browser_new_remote_window_flags.js
toolkit/components/windowwatcher/test/test_alwaysOnTop_windows.html
toolkit/components/windowwatcher/test/test_modal_windows.html
toolkit/components/xulstore/new/XULStore.jsm
toolkit/components/xulstore/old/XULStore.jsm
toolkit/content/tests/chrome/findbar_window.xul
toolkit/content/widgets/findbar.js
toolkit/xre/nsINativeAppSupport.idl
toolkit/xre/nsNativeAppSupportCocoa.mm
widget/android/nsWindow.cpp
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaUtils.mm
widget/cocoa/nsCocoaWindow.mm
widget/nsBaseWidget.cpp
widget/nsIWidgetListener.cpp
widget/nsIWidgetListener.h
widget/tests/TestAppShellSteadyState.cpp
widget/windows/WidgetTraceEvent.cpp
widget/windows/WindowsUIUtils.cpp
xpfe/appshell/AppWindow.cpp
xpfe/appshell/AppWindow.h
xpfe/appshell/moz.build
xpfe/appshell/nsAppShellService.cpp
xpfe/appshell/nsAppShellService.h
xpfe/appshell/nsAppShellWindowEnumerator.cpp
xpfe/appshell/nsAppShellWindowEnumerator.h
xpfe/appshell/nsChromeTreeOwner.cpp
xpfe/appshell/nsChromeTreeOwner.h
xpfe/appshell/nsContentTreeOwner.cpp
xpfe/appshell/nsContentTreeOwner.h
xpfe/appshell/nsIAppShellService.idl
xpfe/appshell/nsIAppWindow.idl
xpfe/appshell/nsIWindowMediator.idl
xpfe/appshell/nsIWindowMediatorListener.idl
xpfe/appshell/nsIXULWindow.idl
xpfe/appshell/nsWindowMediator.cpp
xpfe/appshell/nsWindowMediator.h
xpfe/appshell/nsXULWindow.cpp
xpfe/appshell/nsXULWindow.h
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -40,17 +40,17 @@
 #include "nsIServiceManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsReadableUtils.h"
 #include "nsFocusManager.h"
 #include "nsGlobalWindow.h"
 
 #ifdef MOZ_XUL
-#  include "nsIXULWindow.h"
+#  include "nsIAppWindow.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 using namespace mozilla::dom;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
@@ -92,28 +92,28 @@ role RootAccessible::NativeRole() const 
   return DocAccessibleWrap::NativeRole();
 }
 
 // RootAccessible protected member
 #ifdef MOZ_XUL
 uint32_t RootAccessible::GetChromeFlags() const {
   // Return the flag set for the top level window as defined
   // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
-  // Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
+  // Not simple: nsIAppWindow is not just a QI from nsIDOMWindow
   nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
   NS_ENSURE_TRUE(docShell, 0);
   nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
   docShell->GetTreeOwner(getter_AddRefs(treeOwner));
   NS_ENSURE_TRUE(treeOwner, 0);
-  nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwner));
-  if (!xulWin) {
+  nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(treeOwner));
+  if (!appWin) {
     return 0;
   }
   uint32_t chromeFlags;
-  xulWin->GetChromeFlags(&chromeFlags);
+  appWin->GetChromeFlags(&chromeFlags);
   return chromeFlags;
 }
 #endif
 
 uint64_t RootAccessible::NativeState() const {
   uint64_t state = DocAccessibleWrap::NativeState();
   if (state & states::DEFUNCT) return state;
 
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1754,17 +1754,17 @@ var gBrowserInit = {
     // text color.
     ToolbarIconColor.init();
   },
 
   onDOMContentLoaded() {
     // This needs setting up before we create the first remote browser.
     window.docShell.treeOwner
       .QueryInterface(Ci.nsIInterfaceRequestor)
-      .getInterface(Ci.nsIXULWindow).XULBrowserWindow = window.XULBrowserWindow;
+      .getInterface(Ci.nsIAppWindow).XULBrowserWindow = window.XULBrowserWindow;
     window.browserDOMWindow = new nsBrowserAccess();
 
     gBrowser = window._gBrowser;
     delete window._gBrowser;
     gBrowser.init();
 
     BrowserWindowTracker.track(window);
 
@@ -2529,17 +2529,17 @@ var gBrowserInit = {
       AutoShowBookmarksToolbar.uninit();
     }
 
     // Final window teardown, do this last.
     gBrowser.destroy();
     window.XULBrowserWindow = null;
     window.docShell.treeOwner
       .QueryInterface(Ci.nsIInterfaceRequestor)
-      .getInterface(Ci.nsIXULWindow).XULBrowserWindow = null;
+      .getInterface(Ci.nsIAppWindow).XULBrowserWindow = null;
     window.browserDOMWindow = null;
   },
 };
 
 gBrowserInit.idleTasksFinishedPromise = new Promise(resolve => {
   gBrowserInit.idleTaskPromiseResolve = resolve;
 });
 
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -444,21 +444,21 @@ let LEGACY_ACTORS = {
   // The sizemode="maximized" attribute needs to be set before first paint.
   let sizemode = getValue("sizemode");
   if (sizemode == "maximized") {
     docElt.setAttribute("sizemode", sizemode);
 
     // Set the size to use when the user leaves the maximized mode.
     // The persisted size is the outer size, but the height/width
     // attributes set the inner size.
-    let xulWin = win.docShell.treeOwner
+    let appWin = win.docShell.treeOwner
       .QueryInterface(Ci.nsIInterfaceRequestor)
-      .getInterface(Ci.nsIXULWindow);
-    height -= xulWin.outerToInnerHeightDifferenceInCSSPixels;
-    width -= xulWin.outerToInnerWidthDifferenceInCSSPixels;
+      .getInterface(Ci.nsIAppWindow);
+    height -= appWin.outerToInnerHeightDifferenceInCSSPixels;
+    width -= appWin.outerToInnerWidthDifferenceInCSSPixels;
     docElt.setAttribute("height", height);
     docElt.setAttribute("width", width);
   } else {
     // Setting the size of the window in the features string instead of here
     // causes the window to grow by the size of the titlebar.
     win.resizeTo(width, height);
   }
 
--- a/browser/components/downloads/DownloadsTaskbar.jsm
+++ b/browser/components/downloads/DownloadsTaskbar.jsm
@@ -126,17 +126,17 @@ var DownloadsTaskbar = {
 
   /**
    * On Windows, attaches the taskbar indicator to the specified browser window.
    */
   _attachIndicator(aWindow) {
     // Activate the indicator on the specified window.
     let docShell = aWindow.docShell.treeOwner
       .QueryInterface(Ci.nsIInterfaceRequestor)
-      .getInterface(Ci.nsIXULWindow).docShell;
+      .getInterface(Ci.nsIAppWindow).docShell;
     this._taskbarProgress = gWinTaskbar.getTaskbarProgress(docShell);
 
     // If the DownloadSummary object has already been created, we should update
     // the state of the new indicator, otherwise it will be updated as soon as
     // the DownloadSummary view is registered.
     if (this._summary) {
       this.onSummaryChanged();
     }
--- a/browser/components/extensions/parent/ext-browser.js
+++ b/browser/components/extensions/parent/ext-browser.js
@@ -1004,17 +1004,17 @@ class Window extends WindowBase {
     return this.window.outerHeight;
   }
 
   get incognito() {
     return PrivateBrowsingUtils.isWindowPrivate(this.window);
   }
 
   get alwaysOnTop() {
-    return this.xulWindow.zLevel >= Ci.nsIXULWindow.raisedZ;
+    return this.appWindow.zLevel >= Ci.nsIAppWindow.raisedZ;
   }
 
   get isLastFocused() {
     return this.window === windowTracker.topWindow;
   }
 
   static getState(window) {
     const STATES = {
--- a/browser/components/extensions/test/browser/browser_ext_windows_create.js
+++ b/browser/components/extensions/test/browser/browser_ext_windows_create.js
@@ -167,17 +167,17 @@ add_task(async function testWindowCreate
           .join(" "),
         expected.hiddenChrome.sort().join(" "),
         "Got expected hidden chrome"
       );
     }
     if (expected.chromeFlags) {
       let { chromeFlags } = latestWindow.docShell.treeOwner
         .QueryInterface(Ci.nsIInterfaceRequestor)
-        .getInterface(Ci.nsIXULWindow);
+        .getInterface(Ci.nsIAppWindow);
       for (let flag of expected.chromeFlags) {
         ok(
           chromeFlags & Ci.nsIWebBrowserChrome[flag],
           `Expected window to have the ${flag} flag`
         );
       }
     }
 
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_context_and_chromeFlags.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_context_and_chromeFlags.js
@@ -1,26 +1,26 @@
 "use strict";
 
 /**
  * Given some window in the parent process, ensure that
- * the nsIXULWindow has the CHROME_PRIVATE_WINDOW chromeFlag,
+ * the nsIAppWindow has the CHROME_PRIVATE_WINDOW chromeFlag,
  * and that the usePrivateBrowsing property is set to true on
  * both the window's nsILoadContext, as well as on the initial
  * browser's content docShell nsILoadContext.
  *
  * @param win (nsIDOMWindow)
  *        An nsIDOMWindow in the parent process.
  * @return Promise
  */
 function assertWindowIsPrivate(win) {
   let winDocShell = win.docShell;
   let chromeFlags = winDocShell.treeOwner
     .QueryInterface(Ci.nsIInterfaceRequestor)
-    .getInterface(Ci.nsIXULWindow).chromeFlags;
+    .getInterface(Ci.nsIAppWindow).chromeFlags;
 
   if (!win.gBrowser.selectedBrowser.hasContentOpener) {
     Assert.ok(
       chromeFlags & Ci.nsIWebBrowserChrome.CHROME_PRIVATE_WINDOW,
       "Should have the private window chrome flag"
     );
   }
 
--- a/browser/components/search/SearchTelemetry.jsm
+++ b/browser/components/search/SearchTelemetry.jsm
@@ -239,20 +239,20 @@ class TelemetryHandler {
   }
 
   // nsIWindowMediatorListener
 
   /**
    * This is called when a new window is opened, and handles registration of
    * that window if it is a browser window.
    *
-   * @param {nsIXULWindow} xulWin The xul window that was opened.
+   * @param {nsIAppWindow} appWin The xul window that was opened.
    */
-  onOpenWindow(xulWin) {
-    let win = xulWin.docShell.domWindow;
+  onOpenWindow(appWin) {
+    let win = appWin.docShell.domWindow;
     win.addEventListener(
       "load",
       () => {
         if (
           win.document.documentElement.getAttribute("windowtype") !=
           "navigator:browser"
         ) {
           return;
@@ -263,20 +263,20 @@ class TelemetryHandler {
       { once: true }
     );
   }
 
   /**
    * Listener that is called when a window is closed, and handles deregistration of
    * that window if it is a browser window.
    *
-   * @param {nsIXULWindow} xulWin The xul window that was closed.
+   * @param {nsIAppWindow} appWin The xul window that was closed.
    */
-  onCloseWindow(xulWin) {
-    let win = xulWin.docShell.domWindow;
+  onCloseWindow(appWin) {
+    let win = appWin.docShell.domWindow;
 
     if (
       win.document.documentElement.getAttribute("windowtype") !=
       "navigator:browser"
     ) {
       return;
     }
 
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -5254,17 +5254,17 @@ var SessionStoreInternal = {
         hasFirstArgument = false;
       }
     }
 
     return !hasFirstArgument;
   },
 
   /**
-   * on popup windows, the XULWindow's attributes seem not to be set correctly
+   * on popup windows, the AppWindow's attributes seem not to be set correctly
    * we use thus JSDOMWindow attributes for sizemode and normal window attributes
    * (and hope for reasonable values when maximized/minimized - since then
    * outerWidth/outerHeight aren't the dimensions of the restored window)
    * @param aWindow
    *        Window reference
    * @param aAttribute
    *        String sizemode | width | height | other window attribute
    * @returns string
@@ -5293,23 +5293,23 @@ var SessionStoreInternal = {
       let docElem = aWindow.document.documentElement;
       let attr = parseInt(docElem.getAttribute(aAttribute), 10);
       if (attr) {
         if (aAttribute != "width" && aAttribute != "height") {
           return attr;
         }
         // Width and height attribute report the inner size, but we want
         // to store the outer size, so add the difference.
-        let xulWin = aWindow.docShell.treeOwner
+        let appWin = aWindow.docShell.treeOwner
           .QueryInterface(Ci.nsIInterfaceRequestor)
-          .getInterface(Ci.nsIXULWindow);
+          .getInterface(Ci.nsIAppWindow);
         let diff =
           aAttribute == "width"
-            ? xulWin.outerToInnerWidthDifferenceInCSSPixels
-            : xulWin.outerToInnerHeightDifferenceInCSSPixels;
+            ? appWin.outerToInnerWidthDifferenceInCSSPixels
+            : appWin.outerToInnerHeightDifferenceInCSSPixels;
         return attr + diff;
       }
     }
 
     switch (aAttribute) {
       case "width":
         return aWindow.outerWidth;
       case "height":
--- a/browser/components/tests/startupRecorder.js
+++ b/browser/components/tests/startupRecorder.js
@@ -118,18 +118,18 @@ startupRecorder.prototype = {
       }
       return;
     }
 
     // We only care about the first paint notification for browser windows, and
     // not other types (for example, the gfx sanity test window)
     if (topic == firstPaintNotification) {
       // In the case we're handling xul-window-visible, we'll have been handed
-      // an nsIXULWindow instead of an nsIDOMWindow.
-      if (subject instanceof Ci.nsIXULWindow) {
+      // an nsIAppWindow instead of an nsIDOMWindow.
+      if (subject instanceof Ci.nsIAppWindow) {
         subject = subject
           .QueryInterface(Ci.nsIInterfaceRequestor)
           .getInterface(Ci.nsIDOMWindow);
       }
 
       if (
         subject.document.documentElement.getAttribute("windowtype") !=
         "navigator:browser"
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -284,22 +284,22 @@ BrowserTabList.prototype._getChildren = 
     // Filter tabs that are closing. listTabs calls made right after TabClose
     // events still list tabs in process of being closed.
     const tab = gBrowser.getTabForBrowser(browser);
     return !tab.closing;
   });
 };
 
 BrowserTabList.prototype.getList = function(browserActorOptions) {
-  const topXULWindow = Services.wm.getMostRecentWindow(
+  const topAppWindow = Services.wm.getMostRecentWindow(
     DebuggerServer.chromeWindowType
   );
   let selectedBrowser = null;
-  if (topXULWindow) {
-    selectedBrowser = this._getSelectedBrowser(topXULWindow);
+  if (topAppWindow) {
+    selectedBrowser = this._getSelectedBrowser(topAppWindow);
   }
 
   // As a sanity check, make sure all the actors presently in our map get
   // picked up when we iterate over all windows' tabs.
   const initialMapSize = this._actorByBrowser.size;
   this._foundCount = 0;
 
   // To avoid mysterious behavior if tabs are closed or opened mid-iteration,
@@ -411,21 +411,21 @@ BrowserTabList.prototype.getTab = functi
       }
     }
     return Promise.reject({
       error: "noTab",
       message: "Unable to find tab with tabId '" + tabId + "'",
     });
   }
 
-  const topXULWindow = Services.wm.getMostRecentWindow(
+  const topAppWindow = Services.wm.getMostRecentWindow(
     DebuggerServer.chromeWindowType
   );
-  if (topXULWindow) {
-    const selectedBrowser = this._getSelectedBrowser(topXULWindow);
+  if (topAppWindow) {
+    const selectedBrowser = this._getSelectedBrowser(topAppWindow);
     return this._getActorForBrowser(selectedBrowser, browserActorOptions);
   }
   return Promise.reject({
     error: "noTab",
     message: "Unable to find any selected browser",
   });
 };
 
@@ -776,17 +776,17 @@ BrowserTabList.prototype.onOpenWindow = 
 
   window.addEventListener("load", handleLoad);
 },
 "BrowserTabList.prototype.onOpenWindow");
 
 BrowserTabList.prototype.onCloseWindow = DevToolsUtils.makeInfallible(function(
   window
 ) {
-  if (window instanceof Ci.nsIXULWindow) {
+  if (window instanceof Ci.nsIAppWindow) {
     window = window.docShell.domWindow;
   }
 
   if (appShellDOMWindowType(window) !== DebuggerServer.chromeWindowType) {
     return;
   }
 
   /*
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4979,17 +4979,17 @@ nsDocShell::GetParentNativeWindow(native
 
 NS_IMETHODIMP
 nsDocShell::SetParentNativeWindow(nativeWindow aParentNativeWindow) {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetNativeHandle(nsAString& aNativeHandle) {
-  // the nativeHandle should be accessed from nsIXULWindow
+  // the nativeHandle should be accessed from nsIAppWindow
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetVisibility(bool* aVisibility) {
   NS_ENSURE_ARG_POINTER(aVisibility);
 
   *aVisibility = false;
--- a/docshell/base/nsDocShellTreeOwner.cpp
+++ b/docshell/base/nsDocShellTreeOwner.cpp
@@ -355,17 +355,17 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocS
   }
 
   if (aShellItem == mWebBrowser->mDocShell) {
     nsCOMPtr<nsIBrowserChild> browserChild =
         do_QueryInterface(webBrowserChrome);
     if (browserChild) {
       // The XUL window to resize is in the parent process, but there we
       // won't be able to get aShellItem to do the hack in
-      // nsXULWindow::SizeShellTo, so let's send the width and height of
+      // AppWindow::SizeShellTo, so let's send the width and height of
       // aShellItem too.
       nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem));
       NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);
 
       int32_t width = 0;
       int32_t height = 0;
       shellAsWin->GetSize(&width, &height);
       return browserChild->RemoteSizeShellTo(aCX, aCY, width, height);
@@ -583,17 +583,17 @@ nsDocShellTreeOwner::GetParentNativeWind
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow) {
   return NS_ERROR_NULL_POINTER;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
-  // the nativeHandle should be accessed from nsIXULWindow
+  // the nativeHandle should be accessed from nsIAppWindow
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsDocShellTreeOwner::GetVisibility(bool* aVisibility) {
   nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin = GetOwnerWin();
   if (ownerWin) {
     return ownerWin->GetVisibility(aVisibility);
--- a/docshell/test/navigation/browser_test-content-chromeflags.js
+++ b/docshell/test/navigation/browser_test-content-chromeflags.js
@@ -28,17 +28,17 @@ add_task(async function() {
     },
     async function(browser) {
       let openedPromise = BrowserTestUtils.waitForNewWindow();
       BrowserTestUtils.synthesizeMouse("a", 0, 0, {}, browser);
       let win = await openedPromise;
 
       let chromeFlags = win.docShell.treeOwner
         .QueryInterface(Ci.nsIInterfaceRequestor)
-        .getInterface(Ci.nsIXULWindow).chromeFlags;
+        .getInterface(Ci.nsIAppWindow).chromeFlags;
 
       let expected = CHROME_ALL;
 
       // In the multi-process tab case, the new window will have the
       // CHROME_REMOTE_WINDOW flag set.
       if (gMultiProcessBrowser) {
         expected |= CHROME_REMOTE_WINDOW;
       }
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -307,17 +307,17 @@
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/dom/SVGDocument.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/TabGroup.h"
 #ifdef MOZ_XUL
 #  include "mozilla/dom/XULBroadcastManager.h"
 #  include "mozilla/dom/XULPersist.h"
-#  include "nsIXULWindow.h"
+#  include "nsIAppWindow.h"
 #  include "nsIChromeRegistry.h"
 #  include "nsXULPrototypeDocument.h"
 #  include "nsXULCommandDispatcher.h"
 #  include "nsXULPopupManager.h"
 #  include "nsIDocShellTreeOwner.h"
 #endif
 
 #include "mozilla/DocLoadingTimelineMarker.h"
@@ -8376,17 +8376,17 @@ already_AddRefed<MediaQueryList> Documen
 }
 
 void Document::SetMayStartLayout(bool aMayStartLayout) {
   mMayStartLayout = aMayStartLayout;
   if (MayStartLayout()) {
     // Before starting layout, check whether we're a toplevel chrome
     // window.  If we are, setup some state so that we don't have to restyle
     // the whole tree after StartLayout.
-    if (nsCOMPtr<nsIXULWindow> win = GetXULWindowIfToplevelChrome()) {
+    if (nsCOMPtr<nsIAppWindow> win = GetAppWindowIfToplevelChrome()) {
       // We're the chrome document!
       win->BeforeStartLayout();
     }
     ReadyState state = GetReadyStateEnum();
     if (state >= READYSTATE_INTERACTIVE) {
       // DOMContentLoaded has fired already.
       MaybeResolveReadyForIdle();
     }
@@ -14270,33 +14270,33 @@ nsINode* Document::CreateNSResolver(nsIN
 already_AddRefed<XPathResult> Document::Evaluate(
     JSContext* aCx, const nsAString& aExpression, nsINode& aContextNode,
     XPathNSResolver* aResolver, uint16_t aType, JS::Handle<JSObject*> aResult,
     ErrorResult& rv) {
   return XPathEvaluator()->Evaluate(aCx, aExpression, aContextNode, aResolver,
                                     aType, aResult, rv);
 }
 
-already_AddRefed<nsIXULWindow> Document::GetXULWindowIfToplevelChrome() const {
+already_AddRefed<nsIAppWindow> Document::GetAppWindowIfToplevelChrome() const {
   nsCOMPtr<nsIDocShellTreeItem> item = GetDocShell();
   if (!item) {
     return nullptr;
   }
   nsCOMPtr<nsIDocShellTreeOwner> owner;
   item->GetTreeOwner(getter_AddRefs(owner));
-  nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(owner);
-  if (!xulWin) {
-    return nullptr;
-  }
-  nsCOMPtr<nsIDocShell> xulWinShell;
-  xulWin->GetDocShell(getter_AddRefs(xulWinShell));
-  if (!SameCOMIdentity(xulWinShell, item)) {
-    return nullptr;
-  }
-  return xulWin.forget();
+  nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(owner);
+  if (!appWin) {
+    return nullptr;
+  }
+  nsCOMPtr<nsIDocShell> appWinShell;
+  appWin->GetDocShell(getter_AddRefs(appWinShell));
+  if (!SameCOMIdentity(appWinShell, item)) {
+    return nullptr;
+  }
+  return appWin.forget();
 }
 
 Document* Document::GetTopLevelContentDocument() {
   Document* parent;
 
   if (!mLoadedAsData) {
     parent = this;
   } else {
--- a/dom/base/Document.h
+++ b/dom/base/Document.h
@@ -128,17 +128,17 @@ class nsViewManager;
 class nsPresContext;
 class nsRange;
 class nsSimpleContentList;
 class nsTextNode;
 class nsWindowSizes;
 class nsDOMCaretPosition;
 class nsViewportInfo;
 class nsIGlobalObject;
-class nsIXULWindow;
+class nsIAppWindow;
 class nsXULPrototypeDocument;
 class nsXULPrototypeElement;
 class PermissionDelegateHandler;
 struct nsFont;
 
 namespace mozilla {
 class AbstractThread;
 class CSSStyleSheet;
@@ -3531,19 +3531,19 @@ class Document : public nsINode,
     eAdopted,
     eAttributeChanged,
     eGetCustomInterface
   };
 
   Document* GetTopLevelContentDocument();
   const Document* GetTopLevelContentDocument() const;
 
-  // Returns the associated XUL window if this is a top-level chrome document,
+  // Returns the associated app window if this is a top-level chrome document,
   // null otherwise.
-  already_AddRefed<nsIXULWindow> GetXULWindowIfToplevelChrome() const;
+  already_AddRefed<nsIAppWindow> GetAppWindowIfToplevelChrome() const;
 
   already_AddRefed<Element> CreateElement(
       const nsAString& aTagName, const ElementCreationOptionsOrString& aOptions,
       ErrorResult& rv);
   already_AddRefed<Element> CreateElementNS(
       const nsAString& aNamespaceURI, const nsAString& aQualifiedName,
       const ElementCreationOptionsOrString& aOptions, ErrorResult& rv);
   already_AddRefed<Element> CreateXULElement(
--- a/dom/base/nsCCUncollectableMarker.cpp
+++ b/dom/base/nsCCUncollectableMarker.cpp
@@ -13,17 +13,17 @@
 #include "InProcessBrowserChildMessageManager.h"
 #include "nsIWindowMediator.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebNavigation.h"
 #include "nsISHistory.h"
 #include "nsISHEntry.h"
 #include "nsIWindowWatcher.h"
 #include "mozilla/Services.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 #include "nsContentUtils.h"
 #include "nsGlobalWindow.h"
 #include "nsJSEnvironment.h"
 #include "nsFrameLoader.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/CycleCollectedJSRuntime.h"
@@ -346,17 +346,17 @@ nsresult nsCCUncollectableMarker::Observ
   }
 
   nsCOMPtr<nsIAppShellService> appShell =
       do_GetService(NS_APPSHELLSERVICE_CONTRACTID);
   if (appShell) {
     bool hasHiddenWindow = false;
     appShell->GetHasHiddenWindow(&hasHiddenWindow);
     if (hasHiddenWindow) {
-      nsCOMPtr<nsIXULWindow> hw;
+      nsCOMPtr<nsIAppWindow> hw;
       appShell->GetHiddenWindow(getter_AddRefs(hw));
       nsCOMPtr<nsIDocShell> shell;
       hw->GetDocShell(getter_AddRefs(shell));
       MarkDocShell(shell, cleanupJS);
     }
   }
 
 #ifdef MOZ_XUL
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -19,17 +19,17 @@
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIFormControl.h"
 #include "nsLayoutUtils.h"
 #include "nsFrameTraversal.h"
 #include "nsIWebNavigation.h"
 #include "nsCaret.h"
 #include "nsIBaseWindow.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsViewManager.h"
 #include "nsFrameSelection.h"
 #include "mozilla/dom/Document.h"
 #include "mozilla/dom/Selection.h"
 #include "nsXULPopupManager.h"
 #include "nsMenuPopupFrame.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIPrincipal.h"
@@ -695,20 +695,20 @@ nsFocusManager::WindowRaised(mozIDOMWind
   // retrieve the last focused element within the window that was raised
   nsCOMPtr<nsPIDOMWindowOuter> currentWindow;
   RefPtr<Element> currentFocus = GetFocusedDescendant(
       window, eIncludeAllDescendants, getter_AddRefs(currentWindow));
 
   NS_ASSERTION(currentWindow, "window raised with no window current");
   if (!currentWindow) return NS_OK;
 
-  // If there is no nsIXULWindow, then this is an embedded or child process
+  // If there is no nsIAppWindow, then this is an embedded or child process
   // window. Pass false for aWindowRaised so that commands get updated.
-  nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(baseWindow));
-  Focus(currentWindow, currentFocus, 0, true, false, xulWin != nullptr, true);
+  nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(baseWindow));
+  Focus(currentWindow, currentFocus, 0, true, false, appWin != nullptr, true);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsFocusManager::WindowLowered(mozIDOMWindowProxy* aWindow) {
   NS_ENSURE_TRUE(aWindow, NS_ERROR_INVALID_ARG);
   nsCOMPtr<nsPIDOMWindowOuter> window = nsPIDOMWindowOuter::From(aWindow);
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -34,17 +34,17 @@
 #include "nsIScrollable.h"
 #include "nsFrameLoader.h"
 #include "nsFrameLoaderOwner.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsSubDocumentFrame.h"
 #include "nsError.h"
 #include "nsISHistory.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIMozBrowserFrame.h"
 #include "nsISHistory.h"
 #include "nsIScriptError.h"
 #include "nsGlobalWindow.h"
 #include "nsHTMLDocument.h"
 #include "nsPIWindowRoot.h"
 #include "nsLayoutUtils.h"
 #include "nsMappedAttributes.h"
@@ -2593,17 +2593,17 @@ bool nsFrameLoader::TryRemoteBrowserInte
   }
 
   uint32_t chromeFlags = 0;
   nsCOMPtr<nsIDocShellTreeOwner> parentOwner;
   if (NS_FAILED(parentDocShell->GetTreeOwner(getter_AddRefs(parentOwner))) ||
       !parentOwner) {
     return false;
   }
-  nsCOMPtr<nsIXULWindow> window(do_GetInterface(parentOwner));
+  nsCOMPtr<nsIAppWindow> window(do_GetInterface(parentOwner));
   if (window && NS_FAILED(window->GetChromeFlags(&chromeFlags))) {
     return false;
   }
 
   AUTO_PROFILER_LABEL("nsFrameLoader::TryRemoteBrowser:Create", OTHER);
 
   MutableTabContext context;
   nsresult rv = GetNewTabContext(&context);
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -155,17 +155,16 @@
 #include "nsQueryObject.h"
 #include "nsContentUtils.h"
 #include "nsCSSProps.h"
 #include "nsIURIFixup.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "nsIObserverService.h"
 #include "nsFocusManager.h"
-#include "nsIXULWindow.h"
 #include "nsITimedChannel.h"
 #include "nsServiceManagerUtils.h"
 #ifdef MOZ_XUL
 #  include "nsIDOMXULControlElement.h"
 #  include "nsMenuPopupFrame.h"
 #endif
 #include "mozilla/dom/CustomEvent.h"
 #include "nsIJARChannel.h"
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -149,17 +149,17 @@
 #include "nsContentUtils.h"
 #include "nsCSSProps.h"
 #include "nsIURIFixup.h"
 #include "nsIURIMutator.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventStateManager.h"
 #include "nsIObserverService.h"
 #include "nsFocusManager.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsITimedChannel.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/dom/CustomEvent.h"
 #include "nsIJARChannel.h"
 #include "nsIScreenManager.h"
 #include "nsIEffectiveTLDService.h"
 #include "nsIClassifiedChannel.h"
 
@@ -1541,17 +1541,17 @@ void nsGlobalWindowOuter::SetInitialPrin
     nsIContentSecurityPolicy* aCSP) {
   // First, grab the subject principal.
   nsCOMPtr<nsIPrincipal> newWindowPrincipal =
       nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller();
 
   // We should never create windows with an expanded principal.
   // If we have a system principal, make sure we're not using it for a content
   // docshell.
-  // NOTE: Please keep this logic in sync with nsXULWindow::Initialize().
+  // NOTE: Please keep this logic in sync with AppWindow::Initialize().
   if (nsContentUtils::IsExpandedPrincipal(newWindowPrincipal) ||
       (nsContentUtils::IsSystemPrincipal(newWindowPrincipal) &&
        GetDocShell()->ItemType() != nsIDocShellTreeItem::typeChrome)) {
     newWindowPrincipal = nullptr;
   }
 
   // If there's an existing document, bail if it either:
   if (mDoc) {
@@ -4399,19 +4399,19 @@ nsresult nsGlobalWindowOuter::SetFullscr
       FinishDOMFullscreenChange(mDoc, false);
       return NS_OK;
     }
   }
 
   // Prevent chrome documents which are still loading from resizing
   // the window after we set fullscreen mode.
   nsCOMPtr<nsIBaseWindow> treeOwnerAsWin = GetTreeOwnerWindow();
-  nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwnerAsWin));
-  if (aFullscreen && xulWin) {
-    xulWin->SetIntrinsicallySized(false);
+  nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(treeOwnerAsWin));
+  if (aFullscreen && appWin) {
+    appWin->SetIntrinsicallySized(false);
   }
 
   // Set this before so if widget sends an event indicating its
   // gone full screen, the state trap above works.
   mFullscreen = aFullscreen;
 
   // Sometimes we don't want the top-level widget to actually go fullscreen:
   // - in the B2G desktop client, we don't want the emulated screen dimensions
@@ -6790,20 +6790,20 @@ void nsGlobalWindowOuter::ActivateOrDeac
     // When a window with an open sheet gains or loses focus, only the sheet
     // window receives the NS_ACTIVATE/NS_DEACTIVATE event.  However the
     // styling of the containing top level window also needs to change.  We
     // get around this by calling nsPIDOMWindow::SetActive() on both windows.
 
     // Get the top level widget's nsGlobalWindowOuter
     nsCOMPtr<nsPIDOMWindowOuter> topLevelWindow;
 
-    // widgetListener should be a nsXULWindow
+    // widgetListener should be an AppWindow
     nsIWidgetListener* listener = topLevelWidget->GetWidgetListener();
     if (listener) {
-      nsCOMPtr<nsIXULWindow> window = listener->GetXULWindow();
+      nsCOMPtr<nsIAppWindow> window = listener->GetAppWindow();
       nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window));
       topLevelWindow = do_GetInterface(req);
     }
 
     if (topLevelWindow) {
       topLevelWindow->SetActive(aActivate);
     }
   }
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -51,16 +51,17 @@
 #include "mozilla/dom/EventTarget.h"
 #include "mozilla/dom/WindowBinding.h"
 #include "Units.h"
 #include "nsComponentManagerUtils.h"
 #include "nsSize.h"
 #include "nsCheapSets.h"
 #include "mozilla/dom/ImageBitmapSource.h"
 #include "mozilla/UniquePtr.h"
+#include "mozilla/dom/BrowsingContext.h"
 
 class nsDocShell;
 class nsIArray;
 class nsIBaseWindow;
 class nsIContent;
 class nsICSSDeclaration;
 class nsIDocShellTreeOwner;
 class nsIDOMWindowUtils;
@@ -84,17 +85,16 @@ struct nsRect;
 class nsWindowSizes;
 
 namespace mozilla {
 class AbstractThread;
 class DOMEventTargetHelper;
 class ThrottledEventQueue;
 namespace dom {
 class BarProp;
-class BrowsingContext;
 struct ChannelPixelLayout;
 class Console;
 class Crypto;
 class CustomElementRegistry;
 class DocGroup;
 class External;
 class Function;
 class Gamepad;
--- a/dom/ipc/BrowserParent.cpp
+++ b/dom/ipc/BrowserParent.cpp
@@ -67,17 +67,17 @@
 #include "nsILoadInfo.h"
 #include "nsIPromptFactory.h"
 #include "nsITransportSecurityInfo.h"
 #include "nsIURI.h"
 #include "nsIWindowWatcher.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIWebProtocolHandlerRegistrar.h"
 #include "nsIXULBrowserWindow.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsViewManager.h"
 #include "nsVariant.h"
 #include "nsIWidget.h"
 #include "nsNetUtil.h"
 #ifndef XP_WIN
 #  include "nsJARProtocolHandler.h"
 #endif
 #include "nsPIDOMWindow.h"
@@ -405,17 +405,17 @@ nsIXULBrowserWindow* BrowserParent::GetX
   }
 
   nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
   docShell->GetTreeOwner(getter_AddRefs(treeOwner));
   if (!treeOwner) {
     return nullptr;
   }
 
-  nsCOMPtr<nsIXULWindow> window = do_GetInterface(treeOwner);
+  nsCOMPtr<nsIAppWindow> window = do_GetInterface(treeOwner);
   if (!window) {
     return nullptr;
   }
 
   nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
   window->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
   return xulBrowserWindow;
 }
@@ -793,19 +793,19 @@ mozilla::ipc::IPCResult BrowserParent::R
   if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_CX) {
     width = mDimensions.width;
   }
 
   if (aFlags & nsIEmbeddingSiteWindow::DIM_FLAGS_IGNORE_CY) {
     height = mDimensions.height;
   }
 
-  nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwner));
-  NS_ENSURE_TRUE(xulWin, IPC_OK());
-  xulWin->SizeShellToWithLimit(width, height, aShellItemWidth,
+  nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(treeOwner));
+  NS_ENSURE_TRUE(appWin, IPC_OK());
+  appWin->SizeShellToWithLimit(width, height, aShellItemWidth,
                                aShellItemHeight);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult BrowserParent::RecvDropLinks(
     nsTArray<nsString>&& aLinks) {
   nsCOMPtr<nsIBrowser> browser =
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -173,17 +173,17 @@
 #include "nsISound.h"
 #include "mozilla/mozSpellChecker.h"
 #include "nsIStringBundle.h"
 #include "nsISupportsPrimitives.h"
 #include "nsITimer.h"
 #include "nsIURIFixup.h"
 #include "nsIURL.h"
 #include "nsIDocShellTreeOwner.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIWindowWatcher.h"
 #include "nsPIWindowWatcher.h"
 #include "nsThread.h"
 #include "nsWindowWatcher.h"
 #include "nsIXULRuntime.h"
 #include "mozilla/dom/ParentProcessMessageManager.h"
 #include "mozilla/dom/ProcessMessageManager.h"
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -2687,17 +2687,17 @@ nsPluginHost::GetName(nsACString& aName)
 #ifdef XP_WIN
 // Re-enable any top level browser windows that were disabled by modal dialogs
 // displayed by the crashed plugin.
 static void CheckForDisabledWindows() {
   nsCOMPtr<nsIWindowMediator> wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!wm) return;
 
   nsCOMPtr<nsISimpleEnumerator> windowList;
-  wm->GetXULWindowEnumerator(nullptr, getter_AddRefs(windowList));
+  wm->GetAppWindowEnumerator(nullptr, getter_AddRefs(windowList));
   if (!windowList) return;
 
   bool haveWindows;
   do {
     windowList->HasMoreElements(&haveWindows);
     if (!haveWindows) return;
 
     nsCOMPtr<nsISupports> supportsWindow;
--- a/dom/xul/XULPersist.cpp
+++ b/dom/xul/XULPersist.cpp
@@ -8,34 +8,34 @@
 
 #ifdef MOZ_NEW_XULSTORE
 #  include "mozilla/XULStore.h"
 #else
 #  include "nsIXULStore.h"
 #  include "nsIStringEnumerator.h"
 #endif
 
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 
 namespace mozilla {
 namespace dom {
 
 static bool IsRootElement(Element* aElement) {
   return aElement->OwnerDoc()->GetRootElement() == aElement;
 }
 
 static bool ShouldPersistAttribute(Element* aElement, nsAtom* aAttribute) {
   if (IsRootElement(aElement)) {
     // This is not an element of the top document, its owner is
-    // not an nsXULWindow. Persist it.
+    // not an AppWindow. Persist it.
     if (aElement->OwnerDoc()->GetInProcessParentDocument()) {
       return true;
     }
     // The following attributes of xul:window should be handled in
-    // nsXULWindow::SavePersistentAttributes instead of here.
+    // AppWindow::SavePersistentAttributes instead of here.
     if (aAttribute == nsGkAtoms::screenX || aAttribute == nsGkAtoms::screenY ||
         aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height ||
         aAttribute == nsGkAtoms::sizemode) {
       return false;
     }
   }
   return true;
 }
@@ -61,17 +61,17 @@ void XULPersist::AttributeChanged(dom::E
                                   nsAtom* aAttribute, int32_t aModType,
                                   const nsAttrValue* aOldValue) {
   NS_ASSERTION(aElement->OwnerDoc() == mDocument, "unexpected doc");
 
   // See if there is anything we need to persist in the localstore.
   //
   // XXX Namespace handling broken :-(
   nsAutoString persist;
-  // Persistence of attributes of xul:window is handled in nsXULWindow.
+  // Persistence of attributes of xul:window is handled in AppWindow.
   if (aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::persist, persist) &&
       ShouldPersistAttribute(aElement, aAttribute) && !persist.IsEmpty() &&
       // XXXldb This should check that it's a token, not just a substring.
       persist.Find(nsDependentAtomString(aAttribute)) >= 0) {
     // Might not need this, but be safe for now.
     nsCOMPtr<nsIDocumentObserver> kungFuDeathGrip(this);
     nsContentUtils::AddScriptRunner(
         NewRunnableMethod<Element*, int32_t, nsAtom*>(
@@ -130,20 +130,20 @@ void XULPersist::Persist(Element* aEleme
     rv = XULStore::RemoveValue(uri, id, attrstr);
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "value removed");
 #else
     mLocalStore->RemoveValue(uri, id, attrstr);
 #endif
     return;
   }
 
-  // Persisting attributes to top level windows is handled by nsXULWindow.
+  // Persisting attributes to top level windows is handled by AppWindow.
   if (IsRootElement(aElement)) {
-    if (nsCOMPtr<nsIXULWindow> win =
-            mDocument->GetXULWindowIfToplevelChrome()) {
+    if (nsCOMPtr<nsIAppWindow> win =
+            mDocument->GetAppWindowIfToplevelChrome()) {
       return;
     }
   }
 
 #ifdef MOZ_NEW_XULSTORE
   rv = XULStore::SetValue(uri, id, attrstr, valuestr);
 #else
   mLocalStore->SetValue(uri, id, attrstr, valuestr);
@@ -295,20 +295,20 @@ nsresult XULPersist::ApplyPersistentAttr
     uint32_t cnt = aElements.Length();
     for (int32_t i = int32_t(cnt) - 1; i >= 0; --i) {
       Element* element = aElements.SafeElementAt(i);
       if (!element) {
         continue;
       }
 
       // Applying persistent attributes to top level windows is handled
-      // by nsXULWindow.
+      // by AppWindow.
       if (IsRootElement(element)) {
-        if (nsCOMPtr<nsIXULWindow> win =
-                mDocument->GetXULWindowIfToplevelChrome()) {
+        if (nsCOMPtr<nsIAppWindow> win =
+                mDocument->GetAppWindowIfToplevelChrome()) {
           continue;
         }
       }
 
       Unused << element->SetAttr(kNameSpaceID_None, attr, value, true);
     }
   }
 
--- a/testing/talos/talos/tests/devtools/addon/api.js
+++ b/testing/talos/talos/tests/devtools/addon/api.js
@@ -8,17 +8,17 @@ ChromeUtils.defineModuleGetter(
 
 /* globals ExtensionAPI */
 this.damp = class extends ExtensionAPI {
   getAPI(context) {
     return {
       damp: {
         startTest() {
           let { rootURI } = context.extension;
-          let window = context.xulWindow;
+          let window = context.appWindow;
           if (!("Damp" in window)) {
             let script = rootURI.resolve("content/damp.js");
             Services.scriptloader.loadSubScript(script, window);
           }
 
           let damp = new window.Damp();
           return damp.startTest(rootURI);
         },
--- a/testing/talos/talos/tests/twinopen/api.js
+++ b/testing/talos/talos/tests/twinopen/api.js
@@ -50,17 +50,17 @@ function waitForBrowserPaint() {
   });
 }
 
 async function startTest(context) {
   await TalosParentProfiler.resume("twinopen", true);
   Cu.forceGC();
   Cu.forceCC();
   Cu.forceShrinkingGC();
-  let win = context.xulWindow;
+  let win = context.appWindow;
   await openDelay(win);
   let mozAfterPaint = waitForBrowserPaint();
 
   // We have to compare time measurements across two windows so we must use
   // the absolute time.
   let start = win.performance.timing.fetchStart + win.performance.now();
   let newWin = win.OpenBrowserWindow();
   let end = await mozAfterPaint;
--- a/toolkit/components/browser/nsWebBrowser.cpp
+++ b/toolkit/components/browser/nsWebBrowser.cpp
@@ -1074,17 +1074,17 @@ nsWebBrowser::SetParentNativeWindow(nati
 
   mParentNativeWindow = aParentNativeWindow;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWebBrowser::GetNativeHandle(nsAString& aNativeHandle) {
-  // the nativeHandle should be accessed from nsIXULWindow
+  // the nativeHandle should be accessed from nsIAppWindow
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsWebBrowser::GetVisibility(bool* aVisibility) {
   NS_ENSURE_ARG_POINTER(aVisibility);
 
   if (mDocShell) {
--- a/toolkit/components/extensions/ExtensionParent.jsm
+++ b/toolkit/components/extensions/ExtensionParent.jsm
@@ -803,24 +803,24 @@ class ExtensionPageContextParent extends
     this.viewType = params.viewType;
 
     this.extension.views.add(this);
 
     extension.emit("extension-proxy-context-load", this);
   }
 
   // The window that contains this context. This may change due to moving tabs.
-  get xulWindow() {
+  get appWindow() {
     let win = this.xulBrowser.ownerGlobal;
     return win.docShell.rootTreeItem.domWindow;
   }
 
   get currentWindow() {
     if (this.viewType !== "background") {
-      return this.xulWindow;
+      return this.appWindow;
     }
   }
 
   get windowId() {
     let { currentWindow } = this;
     let { windowTracker } = apiManager.global;
 
     if (currentWindow && windowTracker) {
--- a/toolkit/components/extensions/parent/ext-tabs-base.js
+++ b/toolkit/components/extensions/parent/ext-tabs-base.js
@@ -838,24 +838,24 @@ class WindowBase {
       throw new ExtensionError("extension cannot access window");
     }
     this.extension = extension;
     this.window = window;
     this.id = id;
   }
 
   /**
-   * @property {nsIXULWindow} xulWindow
-   *        The nsIXULWindow object for this browser window.
+   * @property {nsIAppWindow} appWindow
+   *        The nsIAppWindow object for this browser window.
    *        @readonly
    */
-  get xulWindow() {
+  get appWindow() {
     return this.window.docShell.treeOwner
       .QueryInterface(Ci.nsIInterfaceRequestor)
-      .getInterface(Ci.nsIXULWindow);
+      .getInterface(Ci.nsIAppWindow);
   }
 
   /**
    * Returns true if this window is the current window for the given extension
    * context, false otherwise.
    *
    * @param {BaseContext} context
    *        The extension context for which to perform the check.
@@ -871,17 +871,17 @@ class WindowBase {
 
   /**
    * @property {string} type
    *        The type of the window, as defined by the WebExtension API. May be
    *        either "normal" or "popup".
    *        @readonly
    */
   get type() {
-    let { chromeFlags } = this.xulWindow;
+    let { chromeFlags } = this.appWindow;
 
     if (chromeFlags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) {
       return "popup";
     }
 
     return "normal";
   }
 
--- a/toolkit/components/printingui/nsPrintProgress.cpp
+++ b/toolkit/components/printingui/nsPrintProgress.cpp
@@ -6,17 +6,17 @@
 #include "nsPrintProgress.h"
 
 #include "mozilla/dom/BrowsingContext.h"
 #include "nsArray.h"
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIComponentManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsXULAppAPI.h"
 
 NS_IMPL_ADDREF(nsPrintProgress)
 NS_IMPL_RELEASE(nsPrintProgress)
@@ -70,18 +70,18 @@ NS_IMETHODIMP nsPrintProgress::OpenProgr
         nsPIDOMWindowOuter::From(parent);
     NS_ENSURE_STATE(pParentWindow);
     nsCOMPtr<nsIDocShell> docShell = pParentWindow->GetDocShell();
     NS_ENSURE_STATE(docShell);
 
     nsCOMPtr<nsIDocShellTreeOwner> owner;
     docShell->GetTreeOwner(getter_AddRefs(owner));
 
-    nsCOMPtr<nsIXULWindow> ownerXULWindow = do_GetInterface(owner);
-    nsCOMPtr<mozIDOMWindowProxy> ownerWindow = do_GetInterface(ownerXULWindow);
+    nsCOMPtr<nsIAppWindow> ownerAppWindow = do_GetInterface(owner);
+    nsCOMPtr<mozIDOMWindowProxy> ownerWindow = do_GetInterface(ownerAppWindow);
     NS_ENSURE_STATE(ownerWindow);
 
     nsCOMPtr<nsPIDOMWindowOuter> piOwnerWindow =
         nsPIDOMWindowOuter::From(ownerWindow);
 
     // Open the dialog.
     RefPtr<mozilla::dom::BrowsingContext> newBC;
 
--- a/toolkit/components/prompts/test/chromeScript.js
+++ b/toolkit/components/prompts/test/chromeScript.js
@@ -133,17 +133,17 @@ function getPromptState(ui) {
 
   let treeOwner =
     ui.prompt && ui.prompt.docShell && ui.prompt.docShell.treeOwner;
   if (treeOwner && treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)) {
     // Check that the dialog is modal, chrome and dependent;
     // We can't just check window.opener because that'll be
     // a content window, which therefore isn't exposed (it'll lie and
     // be null).
-    let flags = treeOwner.getInterface(Ci.nsIXULWindow).chromeFlags;
+    let flags = treeOwner.getInterface(Ci.nsIAppWindow).chromeFlags;
     state.chrome = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_CHROME) != 0;
     state.dialog = (flags & Ci.nsIWebBrowserChrome.CHROME_OPENAS_DIALOG) != 0;
     state.chromeDependent =
       (flags & Ci.nsIWebBrowserChrome.CHROME_DEPENDENT) != 0;
     let wbc = treeOwner.getInterface(Ci.nsIWebBrowserChrome);
     state.isWindowModal = wbc.isWindowModal();
   }
 
--- a/toolkit/components/sessionstore/SessionStoreListener.cpp
+++ b/toolkit/components/sessionstore/SessionStoreListener.cpp
@@ -12,17 +12,17 @@
 #include "nsGenericHTMLElement.h"
 #include "nsIBrowser.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsImportModule.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsITimer.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIWebProgress.h"
 #include "nsPresContext.h"
 #include "nsPrintfCString.h"
 #include "SessionStoreFunctions.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
@@ -661,17 +661,17 @@ bool TabListener::UpdateSessionStore(uin
   }
 
   uint32_t chromeFlags = 0;
   nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
   mDocShell->GetTreeOwner(getter_AddRefs(treeOwner));
   if (!treeOwner) {
     return false;
   }
-  nsCOMPtr<nsIXULWindow> window(do_GetInterface(treeOwner));
+  nsCOMPtr<nsIAppWindow> window(do_GetInterface(treeOwner));
   if (!window) {
     return false;
   }
   if (window && NS_FAILED(window->GetChromeFlags(&chromeFlags))) {
     return false;
   }
 
   UpdateSessionStoreData data;
--- a/toolkit/components/startup/nsAppStartup.cpp
+++ b/toolkit/components/startup/nsAppStartup.cpp
@@ -16,17 +16,17 @@
 #include "nsIPromptService.h"
 #include "nsIStringBundle.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIToolkitProfile.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsIWindowMediator.h"
 #include "nsIWindowWatcher.h"
 #include "nsIXULRuntime.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsNativeCharsetUtils.h"
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ResultExtensions.h"
 #include "mozilla/Unused.h"
 #include "GeckoProfiler.h"
@@ -313,17 +313,17 @@ nsAppStartup::Quit(uint32_t aMode) {
     else if (mConsiderQuitStopper == suspiciousCount) {
       // ... or there is only a hiddenWindow left, and it's useless:
 
       // Failure shouldn't be fatal, but will abort quit attempt:
       if (!appShell) return NS_OK;
 
       bool usefulHiddenWindow;
       appShell->GetApplicationProvidedHiddenWindow(&usefulHiddenWindow);
-      nsCOMPtr<nsIXULWindow> hiddenWindow;
+      nsCOMPtr<nsIAppWindow> hiddenWindow;
       appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
       // If the remaining windows are useful, we won't quit:
       if (!hiddenWindow || usefulHiddenWindow) {
         return NS_OK;
       }
 
       ferocity = eAttemptQuit;
     }
@@ -592,26 +592,26 @@ nsAppStartup::CreateChromeWindow(nsIWebB
 
   // Fission windows must also be marked as remote
   if ((aChromeFlags & nsIWebBrowserChrome::CHROME_FISSION_WINDOW) &&
       !(aChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW)) {
     NS_WARNING("Cannot create non-remote fission window!");
     return NS_ERROR_FAILURE;
   }
 
-  nsCOMPtr<nsIXULWindow> newWindow;
+  nsCOMPtr<nsIAppWindow> newWindow;
 
   if (aParent) {
-    nsCOMPtr<nsIXULWindow> xulParent(do_GetInterface(aParent));
-    NS_ASSERTION(xulParent,
-                 "window created using non-XUL parent. that's unexpected, but "
+    nsCOMPtr<nsIAppWindow> appParent(do_GetInterface(aParent));
+    NS_ASSERTION(appParent,
+                 "window created using non-app parent. that's unexpected, but "
                  "may work.");
 
-    if (xulParent)
-      xulParent->CreateNewWindow(aChromeFlags, aOpeningTab, aOpener,
+    if (appParent)
+      appParent->CreateNewWindow(aChromeFlags, aOpeningTab, aOpener,
                                  aNextRemoteTabId, getter_AddRefs(newWindow));
     // And if it fails, don't try again without a parent. It could fail
     // intentionally (bug 115969).
   } else {  // try using basic methods:
     MOZ_RELEASE_ASSERT(aNextRemoteTabId == 0,
                        "Unexpected aNextRemoteTabId, we shouldn't ever have a "
                        "next actor ID without a parent");
 
--- a/toolkit/components/windowwatcher/nsWindowWatcher.cpp
+++ b/toolkit/components/windowwatcher/nsWindowWatcher.cpp
@@ -66,17 +66,17 @@
 #include "mozilla/StaticPrefs_fission.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Storage.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/BrowserParent.h"
 #include "mozilla/dom/BrowserHost.h"
 #include "mozilla/dom/DocGroup.h"
 #include "mozilla/dom/TabGroup.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIXULBrowserWindow.h"
 #include "nsGlobalWindow.h"
 #include "ReferrerInfo.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 /****************************************************************
@@ -906,27 +906,27 @@ nsresult nsWindowWatcher::OpenWindowInte
       rv = CreateChromeWindow(features, parentChrome, chromeFlags, nullptr,
                               openerWindow, 0, getter_AddRefs(newChrome));
 
       if (parentTopInnerWindow) {
         parentTopInnerWindow->Resume();
       }
 
       if (newChrome) {
-        nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(newChrome);
-        if (xulWin) {
+        nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(newChrome);
+        if (appWin) {
           nsCOMPtr<nsIXULBrowserWindow> xulBrowserWin;
-          xulWin->GetXULBrowserWindow(getter_AddRefs(xulBrowserWin));
+          appWin->GetXULBrowserWindow(getter_AddRefs(xulBrowserWin));
           if (xulBrowserWin) {
             nsPIDOMWindowOuter* openerWindow =
                 aForceNoOpener ? nullptr : parentWindow.get();
             xulBrowserWin->ForceInitialBrowserNonRemote(openerWindow);
           }
         }
-        /* It might be a chrome nsXULWindow, in which case it won't have
+        /* It might be a chrome AppWindow, in which case it won't have
             an nsIDOMWindow (primary content shell). But in that case, it'll
             be able to hand over an nsIDocShellTreeItem directly. */
         nsCOMPtr<nsPIDOMWindowOuter> newWindow(do_GetInterface(newChrome));
         nsCOMPtr<nsIDocShellTreeItem> newDocShellItem;
         if (newWindow) {
           GetWindowTreeItem(newWindow, getter_AddRefs(newDocShellItem));
         }
         if (!newDocShellItem) {
@@ -2367,19 +2367,19 @@ void nsWindowWatcher::SizeOpenedWindow(n
       if (!sizeChromeHeight) {
         height += chromeHeight;
       }
       treeOwnerAsWin->SetSize(width * scale, height * scale, false);
     }
   }
 
   if (aIsCallerChrome) {
-    nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(treeOwnerAsWin);
-    if (xulWin && aSizeSpec.mLockAspectRatio) {
-      xulWin->LockAspectRatio(true);
+    nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(treeOwnerAsWin);
+    if (appWin && aSizeSpec.mLockAspectRatio) {
+      appWin->LockAspectRatio(true);
     }
   }
 
   treeOwnerAsWin->SetVisibility(true);
 }
 
 void nsWindowWatcher::GetWindowTreeItem(mozIDOMWindowProxy* aWindow,
                                         nsIDocShellTreeItem** aResult) {
--- a/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js
+++ b/toolkit/components/windowwatcher/test/browser_new_content_window_chromeflags.js
@@ -147,17 +147,17 @@ registerCleanupFunction(() => {
  *
  * @param win (nsIDOMWindow)
  *        Some window in the parent process.
  * @returns int
  */
 function getParentChromeFlags(win) {
   return win.docShell.treeOwner
     .QueryInterface(Ci.nsIInterfaceRequestor)
-    .getInterface(Ci.nsIXULWindow).chromeFlags;
+    .getInterface(Ci.nsIAppWindow).chromeFlags;
 }
 
 /**
  * Given some nsIDOMWindow for a window running in the parent process,
  * asynchronously return the nsIWebBrowserChrome chrome flags for the
  * associated content window.
  *
  * @param win (nsIDOMWindow)
--- a/toolkit/components/windowwatcher/test/browser_new_remote_window_flags.js
+++ b/toolkit/components/windowwatcher/test/browser_new_remote_window_flags.js
@@ -15,17 +15,17 @@ add_task(async function setup() {
   });
 });
 
 function assertFlags(win) {
   let docShell = win.docShell;
   let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
   let chromeFlags = docShell.treeOwner
     .QueryInterface(Ci.nsIInterfaceRequestor)
-    .getInterface(Ci.nsIXULWindow).chromeFlags;
+    .getInterface(Ci.nsIAppWindow).chromeFlags;
   Assert.ok(
     loadContext.useRemoteTabs,
     "Should be using remote tabs on the load context"
   );
   Assert.ok(
     chromeFlags & Ci.nsIWebBrowserChrome.CHROME_REMOTE_WINDOW,
     "Should have the remoteness chrome flag on the window"
   );
--- a/toolkit/components/windowwatcher/test/test_alwaysOnTop_windows.html
+++ b/toolkit/components/windowwatcher/test/test_alwaysOnTop_windows.html
@@ -15,17 +15,17 @@ Tests the alwaysOnTop window feature for
   const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
   const {ctypes} = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
   const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
   function assertAlwaysOnTop(win, expected) {
     let docShell = win.docShell;
     let chromeFlags = docShell.treeOwner
                               .QueryInterface(Ci.nsIInterfaceRequestor)
-                              .getInterface(Ci.nsIXULWindow)
+                              .getInterface(Ci.nsIAppWindow)
                               .chromeFlags;
     let hasFlag = !!(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_ALWAYS_ON_TOP);
     is(hasFlag, expected, "Window should have CHROME_ALWAYS_ON_TOP flag.");
 
     const hWND = Number(win.docShell.treeOwner.nsIBaseWindow.nativeHandle);
     const WS_EX_TOPMOST = 0x00000008;
     const GWL_EXSTYLE = -20;
 
--- a/toolkit/components/windowwatcher/test/test_modal_windows.html
+++ b/toolkit/components/windowwatcher/test/test_modal_windows.html
@@ -15,17 +15,17 @@ that is opened reports itself as being m
 
   ChromeUtils.import("resource://gre/modules/Services.jsm");
   const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
 
   add_task(async function() {
     BrowserTestUtils.domWindowOpened().then((win) => {
       let treeOwner = win.docShell.treeOwner;
       let chromeFlags = treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
-                                 .getInterface(Ci.nsIXULWindow)
+                                 .getInterface(Ci.nsIAppWindow)
                                  .chromeFlags;
       ok(chromeFlags & Ci.nsIWebBrowserChrome.CHROME_MODAL,
          "Should have the modal chrome flag");
 
       let wbc = treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIWebBrowserChrome);
       ok(wbc.isWindowModal(), "Should report as modal");
 
--- a/toolkit/components/xulstore/new/XULStore.jsm
+++ b/toolkit/components/xulstore/new/XULStore.jsm
@@ -51,17 +51,17 @@ const XULStore = {
     if (!node.id) {
       throw new Error("Node without ID passed into persist()");
     }
 
     const uri = node.ownerDocument.documentURI;
     const value = node.getAttribute(attr);
 
     if (node.localName == "window") {
-      log("Persisting attributes to windows is handled by nsXULWindow.");
+      log("Persisting attributes to windows is handled by AppWindow.");
       return;
     }
 
     // See Bug 1476680 - we could drop the `hasValue` check so that
     // any time there's an empty attribute it gets removed from the
     // store. Since this is copying behavior from document.persist,
     // callers would need to be updated with that change.
     if (!value && xulStore.hasValue(uri, node.id, attr)) {
--- a/toolkit/components/xulstore/old/XULStore.jsm
+++ b/toolkit/components/xulstore/old/XULStore.jsm
@@ -137,17 +137,17 @@ XULStore.prototype = {
     if (!node.id) {
       throw new Error("Node without ID passed into persist()");
     }
 
     const uri = node.ownerDocument.documentURI;
     const value = node.getAttribute(attr);
 
     if (node.localName == "window") {
-      this.log("Persisting attributes to windows is handled by nsXULWindow.");
+      this.log("Persisting attributes to windows is handled by AppWindow.");
       return;
     }
 
     // See Bug 1476680 - we could drop the `hasValue` check so that
     // any time there's an empty attribute it gets removed from the
     // store. Since this is copying behavior from document.persist,
     // callers would need to be updated with that change.
     if (!value && this.hasValue(uri, node.id, attr)) {
--- a/toolkit/content/tests/chrome/findbar_window.xul
+++ b/toolkit/content/tests/chrome/findbar_window.xul
@@ -61,17 +61,17 @@
     }
     SimpleTest.requestLongerTimeout(2);
 
     function onLoad() {
       (async function() {
         window.docShell
               .treeOwner
               .QueryInterface(Ci.nsIInterfaceRequestor)
-              .getInterface(Ci.nsIXULWindow)
+              .getInterface(Ci.nsIAppWindow)
               .XULBrowserWindow = gXULBrowserWindow;
 
         gFindBar = document.getElementById("FindToolbar");
         for (let browserId of ["content", "content-remote"]) {
           await startTestWithBrowser(browserId);
         }
       })().then(() => {
         window.close();
--- a/toolkit/content/widgets/findbar.js
+++ b/toolkit/content/widgets/findbar.js
@@ -741,17 +741,17 @@
       target.dispatchEvent(event);
     }
 
     _updateStatusUIBar(foundURL) {
       if (!this._xulBrowserWindow) {
         try {
           this._xulBrowserWindow = window.docShell.treeOwner
             .QueryInterface(Ci.nsIInterfaceRequestor)
-            .getInterface(Ci.nsIXULWindow).XULBrowserWindow;
+            .getInterface(Ci.nsIAppWindow).XULBrowserWindow;
         } catch (ex) {}
         if (!this._xulBrowserWindow) {
           return false;
         }
       }
 
       // Call this has the same effect like hovering over link,
       // the browser shows the URL as a tooltip.
--- a/toolkit/xre/nsINativeAppSupport.idl
+++ b/toolkit/xre/nsINativeAppSupport.idl
@@ -39,18 +39,16 @@
  *                      application acting as a remote server.
  *  quit - Informs the native app support that the application is stopping. The
  *         app support should disable any functionality enabled by start.
  *
  *  onLastWindowClosing -  Called when the last window is closed. Used as a
  *                         "soft" shutdown, passwords are flushed.
  */
 
-interface nsIXULWindow;
-
 [scriptable, uuid(5fdf8480-1f98-11d4-8077-00600811a9c3)]
 interface nsINativeAppSupport : nsISupports {
     // Startup/shutdown.
     boolean start();
     void    enable();
 
     void onLastWindowClosing();
     void ReOpen();
--- a/toolkit/xre/nsNativeAppSupportCocoa.mm
+++ b/toolkit/xre/nsNativeAppSupportCocoa.mm
@@ -275,17 +275,17 @@ nsNativeAppSupportCocoa::ReOpen() {
   bool haveOpenWindows = false;
   bool done = false;
 
   nsCOMPtr<nsIWindowMediator> wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!wm) {
     return NS_ERROR_FAILURE;
   } else {
     nsCOMPtr<nsISimpleEnumerator> windowList;
-    wm->GetXULWindowEnumerator(nullptr, getter_AddRefs(windowList));
+    wm->GetAppWindowEnumerator(nullptr, getter_AddRefs(windowList));
     bool more;
     windowList->HasMoreElements(&more);
     while (more) {
       nsCOMPtr<nsISupports> nextWindow = nullptr;
       windowList->GetNext(getter_AddRefs(nextWindow));
       nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(nextWindow));
       if (!baseWindow) {
         windowList->HasMoreElements(&more);
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -45,17 +45,17 @@ using mozilla::dom::ContentParent;
 
 #include "nsIBaseWindow.h"
 #include "nsIBrowserDOMWindow.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIWidgetListener.h"
 #include "nsIWindowWatcher.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 
 #include "nsAppShell.h"
 #include "nsFocusManager.h"
 #include "nsIdleService.h"
 #include "nsLayoutUtils.h"
 #include "nsViewManager.h"
 
 #include "WidgetUtils.h"
@@ -1310,21 +1310,21 @@ void nsWindow::GeckoViewSupport::Open(
   window->mAndroidView = androidView;
 
   // Attach other session support objects.
   window->mGeckoViewSupport->Transfer(sessionWindow, aQueue, aCompositor,
                                       aDispatcher, aSessionAccessibility,
                                       aInitData);
 
   if (window->mWidgetListener) {
-    nsCOMPtr<nsIXULWindow> xulWindow(window->mWidgetListener->GetXULWindow());
-    if (xulWindow) {
-      // Our window is not intrinsically sized, so tell nsXULWindow to
+    nsCOMPtr<nsIAppWindow> appWindow(window->mWidgetListener->GetAppWindow());
+    if (appWindow) {
+      // Our window is not intrinsically sized, so tell AppWindow to
       // not set a size for us.
-      xulWindow->SetIntrinsicallySized(false);
+      appWindow->SetIntrinsicallySized(false);
     }
   }
 }
 
 void nsWindow::GeckoViewSupport::Close() {
   if (window.mAndroidView) {
     window.mAndroidView->mEventDispatcher->Detach();
   }
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -518,17 +518,17 @@ class nsChildView final : public nsBaseW
   void ResetParent();
 
   static bool DoHasPendingInputEvent();
   static uint32_t GetCurrentInputEventCount();
   static void UpdateCurrentInputEventCount();
 
   NSView<mozView>* GetEditorView();
 
-  nsCocoaWindow* GetXULWindowWidget() const;
+  nsCocoaWindow* GetAppWindowWidget() const;
 
   virtual void ReparentNativeWidget(nsIWidget* aNewParent) override;
 
   mozilla::widget::TextInputHandler* GetTextInputHandler() { return mTextInputHandler; }
 
   NSColor* VibrancyFillColorForThemeGeometryType(nsITheme::ThemeGeometryType aThemeGeometryType);
   NSColor* VibrancyFontSmoothingBackgroundColorForThemeGeometryType(
       nsITheme::ThemeGeometryType aThemeGeometryType);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -487,17 +487,17 @@ void nsChildView::TearDownView() {
                             withObject:nil
                          waitUntilDone:false];
   }
   mView = nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-nsCocoaWindow* nsChildView::GetXULWindowWidget() const {
+nsCocoaWindow* nsChildView::GetAppWindowWidget() const {
   id windowDelegate = [[mView window] delegate];
   if (windowDelegate && [windowDelegate isKindOfClass:[WindowDelegate class]]) {
     return [(WindowDelegate*)windowDelegate geckoWidget];
   }
   return nullptr;
 }
 
 void nsChildView::Destroy() {
@@ -589,49 +589,49 @@ void* nsChildView::GetNativeData(uint32_
   NS_OBJC_END_TRY_ABORT_BLOCK_NSNULL;
 }
 
 #pragma mark -
 
 nsTransparencyMode nsChildView::GetTransparencyMode() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
-  nsCocoaWindow* windowWidget = GetXULWindowWidget();
+  nsCocoaWindow* windowWidget = GetAppWindowWidget();
   return windowWidget ? windowWidget->GetTransparencyMode() : eTransparencyOpaque;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(eTransparencyOpaque);
 }
 
 // This is called by nsContainerFrame on the root widget for all window types
 // except popup windows (when nsCocoaWindow::SetTransparencyMode is used instead).
 void nsChildView::SetTransparencyMode(nsTransparencyMode aMode) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
-  nsCocoaWindow* windowWidget = GetXULWindowWidget();
+  nsCocoaWindow* windowWidget = GetAppWindowWidget();
   if (windowWidget) {
     windowWidget->SetTransparencyMode(aMode);
   }
 
   UpdateInternalOpaqueRegion();
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 void nsChildView::SuppressAnimation(bool aSuppress) {
-  GetXULWindowWidget()->SuppressAnimation(aSuppress);
+  GetAppWindowWidget()->SuppressAnimation(aSuppress);
 }
 
 bool nsChildView::IsVisible() const {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   if (!mVisible) {
     return mVisible;
   }
 
-  if (!GetXULWindowWidget()->IsVisible()) {
+  if (!GetAppWindowWidget()->IsVisible()) {
     return false;
   }
 
   // mVisible does not accurately reflect the state of a hidden tabbed view
   // so verify that the view has a window as well
   // then check native widget hierarchy visibility
   return ([mView window] != nil) && !NSIsEmptyRect([mView visibleRect]);
 
@@ -828,17 +828,17 @@ void nsChildView::BackingScaleFactorChan
   mBackingScaleFactor = newScale;
   NSRect frame = [mView frame];
   mBounds = nsCocoaUtils::CocoaRectToGeckoRectDevPix(frame, newScale);
 
   if (StaticPrefs::gfx_core_animation_enabled_AtStartup()) {
     mNativeLayerRoot->SetBackingScale(mBackingScaleFactor);
   }
 
-  if (mWidgetListener && !mWidgetListener->GetXULWindow()) {
+  if (mWidgetListener && !mWidgetListener->GetAppWindow()) {
     if (PresShell* presShell = mWidgetListener->GetPresShell()) {
       presShell->BackingScaleFactorChanged();
     }
   }
 }
 
 int32_t nsChildView::RoundsWidgetCoordinatesTo() {
   if (BackingScaleFactor() == 2.0) {
@@ -1162,17 +1162,17 @@ static NSMenuItem* NativeMenuItemWithLoc
     }
   }
 
   return nil;
 }
 
 bool nsChildView::SendEventToNativeMenuSystem(NSEvent* aEvent) {
   bool handled = false;
-  nsCocoaWindow* widget = GetXULWindowWidget();
+  nsCocoaWindow* widget = GetAppWindowWidget();
   if (widget) {
     nsMenuBarX* mb = widget->GetMenuBar();
     if (mb) {
       // Check if main menu wants to handle the event.
       handled = mb->PerformKeyEquivalent(aEvent);
     }
   }
 
@@ -1227,17 +1227,17 @@ nsresult nsChildView::ActivateNativeMenu
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 // Used for testing native menu system structure and event handling.
 nsresult nsChildView::ForceUpdateNativeMenuAt(const nsAString& indexString) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
-  nsCocoaWindow* widget = GetXULWindowWidget();
+  nsCocoaWindow* widget = GetAppWindowWidget();
   if (widget) {
     nsMenuBarX* mb = widget->GetMenuBar();
     if (mb) {
       if (indexString.IsEmpty())
         mb->ForceNativeMenuReload();
       else
         mb->ForceUpdateNativeMenuAt(indexString);
     }
@@ -1907,17 +1907,17 @@ void nsChildView::PrepareWindowEffects()
   {
     MutexAutoLock lock(mEffectsLock);
     mHasRoundedBottomCorners = [mView hasRoundedBottomCorners];
     CGFloat cornerRadius = [mView cornerRadius];
     mDevPixelCornerRadius = cornerRadius * BackingScaleFactor();
     mIsCoveringTitlebar = [mView isCoveringTitlebar];
     NSInteger styleMask = [[mView window] styleMask];
     bool wasFullscreen = mIsFullscreen;
-    nsCocoaWindow* windowWidget = GetXULWindowWidget();
+    nsCocoaWindow* windowWidget = GetAppWindowWidget();
     mIsFullscreen =
         (styleMask & NSFullScreenWindowMask) || (windowWidget && windowWidget->InFullScreenMode());
 
     canBeOpaque = mIsFullscreen && wasFullscreen;
     if (canBeOpaque && VibrancyManager::SystemSupportsVibrancy()) {
       canBeOpaque = !EnsureVibrancyManager().HasVibrantRegions();
     }
     if (mIsCoveringTitlebar && !StaticPrefs::gfx_core_animation_enabled_AtStartup()) {
@@ -3433,30 +3433,30 @@ NSEvent* gLastDragMouseDownEvent = nil; 
 
 - (BOOL)isCoveringTitlebar {
   return [[self window] isKindOfClass:[BaseWindow class]] &&
          [(BaseWindow*)[self window] mainChildView] == self &&
          [(BaseWindow*)[self window] drawsContentsIntoWindowFrame];
 }
 
 - (void)viewWillStartLiveResize {
-  nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetXULWindowWidget() : nullptr;
+  nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetAppWindowWidget() : nullptr;
   if (windowWidget) {
     windowWidget->NotifyLiveResizeStarted();
   }
 }
 
 - (void)viewDidEndLiveResize {
   // mGeckoChild may legitimately be null here. It should also have been null
   // in viewWillStartLiveResize, so there's no problem. However if we run into
   // cases where the windowWidget was non-null in viewWillStartLiveResize but
   // is null here, that might be problematic because we might get stuck with
   // a content process that has the displayport suppressed. If that scenario
   // arises (I'm not sure that it does) we will need to handle it gracefully.
-  nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetXULWindowWidget() : nullptr;
+  nsCocoaWindow* windowWidget = mGeckoChild ? mGeckoChild->GetAppWindowWidget() : nullptr;
   if (windowWidget) {
     windowWidget->NotifyLiveResizeStopped();
   }
 }
 
 - (NSColor*)vibrancyFillColorForThemeGeometryType:(nsITheme::ThemeGeometryType)aThemeGeometryType {
   if (!mGeckoChild) {
     return [NSColor whiteColor];
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -17,17 +17,17 @@
 #include "nsMenuBarX.h"
 #include "nsCocoaFeatures.h"
 #include "nsCocoaWindow.h"
 #include "nsCOMPtr.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIAppShellService.h"
 #include "nsIOSPermissionRequest.h"
 #include "nsIRunnable.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIBaseWindow.h"
 #include "nsIServiceManager.h"
 #include "nsMenuUtilsX.h"
 #include "nsToolkit.h"
 #include "nsCRT.h"
 #include "SVGImageContext.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/dom/Promise.h"
@@ -269,27 +269,27 @@ void nsCocoaUtils::HideOSChromeOnScreen(
 #define NS_APPSHELLSERVICE_CONTRACTID "@mozilla.org/appshell/appShellService;1"
 nsIWidget* nsCocoaUtils::GetHiddenWindowWidget() {
   nsCOMPtr<nsIAppShellService> appShell(do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
   if (!appShell) {
     NS_WARNING("Couldn't get AppShellService in order to get hidden window ref");
     return nullptr;
   }
 
-  nsCOMPtr<nsIXULWindow> hiddenWindow;
+  nsCOMPtr<nsIAppWindow> hiddenWindow;
   appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
   if (!hiddenWindow) {
     // Don't warn, this happens during shutdown, bug 358607.
     return nullptr;
   }
 
   nsCOMPtr<nsIBaseWindow> baseHiddenWindow;
   baseHiddenWindow = do_GetInterface(hiddenWindow);
   if (!baseHiddenWindow) {
-    NS_WARNING("Couldn't get nsIBaseWindow from hidden window (nsIXULWindow)");
+    NS_WARNING("Couldn't get nsIBaseWindow from hidden window (nsIAppWindow)");
     return nullptr;
   }
 
   nsCOMPtr<nsIWidget> hiddenWindowWidget;
   if (NS_FAILED(baseHiddenWindow->GetMainWidget(getter_AddRefs(hiddenWindowWidget)))) {
     NS_WARNING("Couldn't get nsIWidget from hidden window (nsIBaseWindow)");
     return nullptr;
   }
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -14,17 +14,17 @@
 #include "nsWidgetsCID.h"
 #include "nsIRollupListener.h"
 #include "nsChildView.h"
 #include "nsWindowMap.h"
 #include "nsAppShell.h"
 #include "nsIAppShellService.h"
 #include "nsIBaseWindow.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsToolkit.h"
 #include "nsTouchBarNativeAPIDefines.h"
 #include "nsPIDOMWindow.h"
 #include "nsThreadUtils.h"
 #include "nsMenuBarX.h"
 #include "nsMenuUtilsX.h"
 #include "nsStyleConsts.h"
 #include "nsNativeThemeColors.h"
@@ -660,17 +660,17 @@ void nsCocoaWindow::SetModal(bool aState
   mModal = aState;
   nsCocoaWindow* ancestor = static_cast<nsCocoaWindow*>(mAncestorLink);
   if (aState) {
     ++gXULModalLevel;
     // When a non-sheet window gets "set modal", make the window(s) that it
     // appears over behave as they should.  We can't rely on native methods to
     // do this, for the following reason:  The OS runs modal non-sheet windows
     // in an event loop (using [NSApplication runModalForWindow:] or similar
-    // methods) that's incompatible with the modal event loop in nsXULWindow::
+    // methods) that's incompatible with the modal event loop in AppWindow::
     // ShowModal() (each of these event loops is "exclusive", and can't run at
     // the same time as other (similar) event loops).
     if (mWindowType != eWindowType_sheet) {
       while (ancestor) {
         if (ancestor->mNumModalDescendents++ == 0) {
           NSWindow* aWindow = ancestor->GetCocoaWindow();
           if (ancestor->mWindowType != eWindowType_invisible) {
             [[aWindow standardWindowButton:NSWindowCloseButton] setEnabled:NO];
@@ -1650,17 +1650,17 @@ void nsCocoaWindow::BackingScaleFactorCh
     if (mSizeConstraints.mMaxSize.height < NS_MAXSIZE) {
       mSizeConstraints.mMaxSize.height =
           std::min(NS_MAXSIZE, NSToIntRound(mSizeConstraints.mMaxSize.height * scaleFactor));
     }
   }
 
   mBackingScaleFactor = newScale;
 
-  if (!mWidgetListener || mWidgetListener->GetXULWindow()) {
+  if (!mWidgetListener || mWidgetListener->GetAppWindow()) {
     return;
   }
 
   if (PresShell* presShell = mWidgetListener->GetPresShell()) {
     presShell->BackingScaleFactorChanged();
   }
   mWidgetListener->UIResolutionChanged();
 }
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -29,17 +29,17 @@
 #include "nsIContent.h"
 #include "mozilla/dom/Document.h"
 #include "nsIServiceManager.h"
 #include "mozilla/Preferences.h"
 #include "BasicLayers.h"
 #include "ClientLayerManager.h"
 #include "mozilla/layers/Compositor.h"
 #include "nsIXULRuntime.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIBaseWindow.h"
 #include "nsXULPopupManager.h"
 #include "nsIWidgetListener.h"
 #include "nsIGfxInfo.h"
 #include "npapi.h"
 #include "X11UndefineNone.h"
 #include "base/thread.h"
 #include "prdtoa.h"
@@ -1637,20 +1637,20 @@ nsIRollupListener* nsBaseWidget::GetActi
   if (gRollupListener) return gRollupListener;
 
   return nsXULPopupManager::GetInstance();
 }
 
 void nsBaseWidget::NotifyWindowDestroyed() {
   if (!mWidgetListener) return;
 
-  nsCOMPtr<nsIXULWindow> window = mWidgetListener->GetXULWindow();
-  nsCOMPtr<nsIBaseWindow> xulWindow(do_QueryInterface(window));
-  if (xulWindow) {
-    xulWindow->Destroy();
+  nsCOMPtr<nsIAppWindow> window = mWidgetListener->GetAppWindow();
+  nsCOMPtr<nsIBaseWindow> appWindow(do_QueryInterface(window));
+  if (appWindow) {
+    appWindow->Destroy();
   }
 }
 
 void nsBaseWidget::NotifyWindowMoved(int32_t aX, int32_t aY) {
   if (mWidgetListener) {
     mWidgetListener->WindowMoved(this, aX, aY);
   }
 
@@ -2023,21 +2023,21 @@ void nsBaseWidget::NotifyLiveResizeStart
   NotifyLiveResizeStopped();
   MOZ_ASSERT(mLiveResizeListeners.IsEmpty());
 
   // If we can get the active remote tab for the current widget, suppress
   // the displayport on it during the live resize.
   if (!mWidgetListener) {
     return;
   }
-  nsCOMPtr<nsIXULWindow> xulWindow = mWidgetListener->GetXULWindow();
-  if (!xulWindow) {
+  nsCOMPtr<nsIAppWindow> appWindow = mWidgetListener->GetAppWindow();
+  if (!appWindow) {
     return;
   }
-  mLiveResizeListeners = xulWindow->GetLiveResizeListeners();
+  mLiveResizeListeners = appWindow->GetLiveResizeListeners();
   for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
     mLiveResizeListeners[i]->LiveResizeStarted();
   }
 }
 
 void nsBaseWidget::NotifyLiveResizeStopped() {
   if (!mLiveResizeListeners.IsEmpty()) {
     for (uint32_t i = 0; i < mLiveResizeListeners.Length(); i++) {
--- a/widget/nsIWidgetListener.cpp
+++ b/widget/nsIWidgetListener.cpp
@@ -3,24 +3,24 @@
  * 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/. */
 
 #include "nsIWidgetListener.h"
 
 #include "nsRegion.h"
 #include "nsView.h"
 #include "nsIWidget.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 
 #include "mozilla/BasicEvents.h"
 #include "mozilla/PresShell.h"
 
 using namespace mozilla;
 
-nsIXULWindow* nsIWidgetListener::GetXULWindow() { return nullptr; }
+nsIAppWindow* nsIWidgetListener::GetAppWindow() { return nullptr; }
 
 nsView* nsIWidgetListener::GetView() { return nullptr; }
 
 PresShell* nsIWidgetListener::GetPresShell() { return nullptr; }
 
 bool nsIWidgetListener::WindowMoved(nsIWidget* aWidget, int32_t aX,
                                     int32_t aY) {
   return false;
--- a/widget/nsIWidgetListener.h
+++ b/widget/nsIWidgetListener.h
@@ -11,17 +11,17 @@
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/TimeStamp.h"
 
 #include "nsRegionFwd.h"
 #include "Units.h"
 
 class nsView;
 class nsIWidget;
-class nsIXULWindow;
+class nsIAppWindow;
 
 namespace mozilla {
 class PresShell;
 }  // namespace mozilla
 
 /**
  * sizemode is an adjunct to widget size
  */
@@ -40,21 +40,21 @@ enum nsWindowZ {
   nsWindowZTop = 0,  // on top
   nsWindowZBottom,   // on bottom
   nsWindowZRelative  // just below some specified widget
 };
 
 class nsIWidgetListener {
  public:
   /**
-   * If this listener is for an nsIXULWindow, return it. If this is null, then
+   * If this listener is for an nsIAppWindow, return it. If this is null, then
    * this is likely a listener for a view, which can be determined using
    * GetView. If both methods return null, this will be an nsWebBrowser.
    */
-  virtual nsIXULWindow* GetXULWindow();
+  virtual nsIAppWindow* GetAppWindow();
 
   /**
    * If this listener is for an nsView, return it.
    */
   virtual nsView* GetView();
 
   /**
    * Return the presshell for this widget listener.
--- a/widget/tests/TestAppShellSteadyState.cpp
+++ b/widget/tests/TestAppShellSteadyState.cpp
@@ -11,17 +11,17 @@
 #include "mozilla/dom/Document.h"
 #include "nsIDOMEventListener.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMWindowUtils.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIRunnable.h"
 #include "nsIURI.h"
 #include "nsIWebBrowserChrome.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 
 #include "nsAppShellCID.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/EventTarget.h"
@@ -356,24 +356,24 @@ bool Test4Internal(nsIAppShell* aAppShel
   nsCOMPtr<nsIURI> uri;
   if (NS_FAILED(NS_NewURI(getter_AddRefs(uri), "about:", nullptr))) {
     fail("Failed to create new uri");
     return false;
   }
 
   uint32_t flags = nsIWebBrowserChrome::CHROME_DEFAULT;
 
-  nsCOMPtr<nsIXULWindow> xulWindow;
+  nsCOMPtr<nsIAppWindow> appWindow;
   if (NS_FAILED(appService->CreateTopLevelWindow(
-          nullptr, uri, flags, 100, 100, nullptr, getter_AddRefs(xulWindow)))) {
+          nullptr, uri, flags, 100, 100, nullptr, getter_AddRefs(appWindow)))) {
     fail("Failed to create new window");
     return false;
   }
 
-  nsCOMPtr<nsIDOMWindow> window = do_GetInterface(xulWindow);
+  nsCOMPtr<nsIDOMWindow> window = do_GetInterface(appWindow);
   if (!window) {
     fail("Can't get dom window!");
     return false;
   }
 
   RefPTr<dom::EventTarget> target = do_QueryInterface(window);
   if (!target) {
     fail("Can't QI to EventTarget!");
--- a/widget/windows/WidgetTraceEvent.cpp
+++ b/widget/windows/WidgetTraceEvent.cpp
@@ -15,17 +15,17 @@
 #include "nsAppShellCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCOMPtr.h"
 #include "nsIAppShellService.h"
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsISupportsImpl.h"
 #include "nsIWidget.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsWindowDefs.h"
 
 namespace {
 
 // Used for signaling the background thread from the main thread.
 HANDLE sEventHandle = nullptr;
@@ -37,17 +37,17 @@ class HWNDGetter : public mozilla::Runna
   HWNDGetter() : Runnable("HWNDGetter"), hidden_window_hwnd(nullptr) {}
 
   HWND hidden_window_hwnd;
 
   NS_IMETHOD Run() override {
     // Jump through some hoops to locate the hidden window.
     nsCOMPtr<nsIAppShellService> appShell(
         do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
-    nsCOMPtr<nsIXULWindow> hiddenWindow;
+    nsCOMPtr<nsIAppWindow> hiddenWindow;
 
     nsresult rv = appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     nsCOMPtr<nsIDocShell> docShell;
     rv = hiddenWindow->GetDocShell(getter_AddRefs(docShell));
--- a/widget/windows/WindowsUIUtils.cpp
+++ b/widget/windows/WindowsUIUtils.cpp
@@ -11,17 +11,16 @@
 
 #include "WindowsUIUtils.h"
 
 #include "nsIObserverService.h"
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
-#include "nsIXULWindow.h"
 #include "mozilla/Services.h"
 #include "mozilla/WidgetUtils.h"
 #include "mozilla/WindowsVersion.h"
 #include "nsString.h"
 #include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 #include "nsPIDOMWindow.h"
 
rename from xpfe/appshell/nsXULWindow.cpp
rename to xpfe/appshell/AppWindow.cpp
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/AppWindow.cpp
@@ -2,17 +2,17 @@
 /* vim:set ts=2 sw=2 sts=2 ci et: */
 /* 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/. */
 
 #include "mozilla/MathAlgorithms.h"
 
 // Local includes
-#include "nsXULWindow.h"
+#include "AppWindow.h"
 #include <algorithm>
 
 // Helper classes
 #include "nsPrintfCString.h"
 #include "nsString.h"
 #include "nsWidgetsCID.h"
 #include "nsThreadUtils.h"
 #include "nsNetCID.h"
@@ -69,24 +69,16 @@
 #  include "mozilla/XULStore.h"
 #endif
 
 #ifdef XP_MACOSX
 #  include "nsINativeMenuService.h"
 #  define USE_NATIVE_MENUS
 #endif
 
-using namespace mozilla;
-using dom::AutoNoJSAPI;
-using dom::BrowserHost;
-using dom::BrowsingContext;
-using dom::Document;
-using dom::EventTarget;
-using dom::LoadURIOptions;
-
 #define SIZEMODE_NORMAL NS_LITERAL_STRING("normal")
 #define SIZEMODE_MAXIMIZED NS_LITERAL_STRING("maximized")
 #define SIZEMODE_MINIMIZED NS_LITERAL_STRING("minimized")
 #define SIZEMODE_FULLSCREEN NS_LITERAL_STRING("fullscreen")
 
 #define WINDOWTYPE_ATTRIBUTE NS_LITERAL_STRING("windowtype")
 
 #define PERSIST_ATTRIBUTE NS_LITERAL_STRING("persist")
@@ -96,20 +88,29 @@ using dom::LoadURIOptions;
 #define HEIGHT_ATTRIBUTE NS_LITERAL_STRING("height")
 #define MODE_ATTRIBUTE NS_LITERAL_STRING("sizemode")
 #define TILED_ATTRIBUTE NS_LITERAL_STRING("gtktiledwindow")
 #define ZLEVEL_ATTRIBUTE NS_LITERAL_STRING("zlevel")
 
 #define SIZE_PERSISTENCE_TIMEOUT 500  // msec
 
 //*****************************************************************************
-//***    nsXULWindow: Object Management
+//***    AppWindow: Object Management
 //*****************************************************************************
 
-nsXULWindow::nsXULWindow(uint32_t aChromeFlags)
+namespace mozilla {
+
+using dom::AutoNoJSAPI;
+using dom::BrowserHost;
+using dom::BrowsingContext;
+using dom::Document;
+using dom::EventTarget;
+using dom::LoadURIOptions;
+
+AppWindow::AppWindow(uint32_t aChromeFlags)
     : mChromeTreeOwner(nullptr),
       mContentTreeOwner(nullptr),
       mPrimaryContentTreeOwner(nullptr),
       mModalStatus(NS_OK),
       mContinueModalLoop(false),
       mDebuting(false),
       mChromeLoaded(false),
       mSizingShellFromXUL(false),
@@ -123,50 +124,50 @@ nsXULWindow::nsXULWindow(uint32_t aChrom
       mChromeFlagsFrozen(false),
       mIgnoreXULSizeMode(false),
       mDestroying(false),
       mRegistered(false),
       mPersistentAttributesDirty(0),
       mPersistentAttributesMask(0),
       mChromeFlags(aChromeFlags),
       mNextRemoteTabId(0),
-      mSPTimerLock("nsXULWindow.mSPTimerLock"),
+      mSPTimerLock("AppWindow.mSPTimerLock"),
       mWidgetListenerDelegate(this) {}
 
-nsXULWindow::~nsXULWindow() {
+AppWindow::~AppWindow() {
   {
     MutexAutoLock lock(mSPTimerLock);
     if (mSPTimer) mSPTimer->Cancel();
   }
   Destroy();
 }
 
 //*****************************************************************************
-// nsXULWindow::nsISupports
+// AppWindow::nsISupports
 //*****************************************************************************
 
-NS_IMPL_ADDREF(nsXULWindow)
-NS_IMPL_RELEASE(nsXULWindow)
-
-NS_INTERFACE_MAP_BEGIN(nsXULWindow)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXULWindow)
-  NS_INTERFACE_MAP_ENTRY(nsIXULWindow)
+NS_IMPL_ADDREF(AppWindow)
+NS_IMPL_RELEASE(AppWindow)
+
+NS_INTERFACE_MAP_BEGIN(AppWindow)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAppWindow)
+  NS_INTERFACE_MAP_ENTRY(nsIAppWindow)
   NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
-  NS_INTERFACE_MAP_ENTRY_CONCRETE(nsXULWindow)
+  NS_INTERFACE_MAP_ENTRY_CONCRETE(AppWindow)
 NS_INTERFACE_MAP_END
 
-nsresult nsXULWindow::Initialize(nsIXULWindow* aParent, nsIXULWindow* aOpener,
-                                 nsIURI* aUrl, int32_t aInitialWidth,
-                                 int32_t aInitialHeight, bool aIsHiddenWindow,
-                                 nsIRemoteTab* aOpeningTab,
-                                 mozIDOMWindowProxy* aOpenerWindow,
-                                 nsWidgetInitData& widgetInitData) {
+nsresult AppWindow::Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
+                               nsIURI* aUrl, int32_t aInitialWidth,
+                               int32_t aInitialHeight, bool aIsHiddenWindow,
+                               nsIRemoteTab* aOpeningTab,
+                               mozIDOMWindowProxy* aOpenerWindow,
+                               nsWidgetInitData& widgetInitData) {
   nsresult rv;
   nsCOMPtr<nsIWidget> parentWidget;
 
   mIsHiddenWindow = aIsHiddenWindow;
 
   int32_t initialX = 0, initialY = 0;
   nsCOMPtr<nsIBaseWindow> base(do_QueryInterface(aOpener));
   if (base) {
@@ -201,17 +202,17 @@ nsresult nsXULWindow::Initialize(nsIXULW
   }
   if (!mWindow) {
     return NS_ERROR_FAILURE;
   }
 
   /* This next bit is troublesome. We carry two different versions of a pointer
      to our parent window. One is the parent window's widget, which is passed
      to our own widget. The other is a weak reference we keep here to our
-     parent nsXULWindow. The former is useful to the widget, and we can't
+     parent AppWindow. The former is useful to the widget, and we can't
      trust its treatment of the parent reference because they're platform-
      specific. The latter is useful to this class.
        A better implementation would be one in which the parent keeps strong
      references to its children and closes them before it allows itself
      to be closed. This would mimic the behaviour of OSes that support
      top-level child windows in OSes that do not. Later.
   */
   nsCOMPtr<nsIBaseWindow> parentAsWin(do_QueryInterface(aParent));
@@ -320,20 +321,20 @@ nsresult nsXULWindow::Initialize(nsIXULW
     rv = webNav->LoadURI(urlString, loadURIOptions);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return rv;
 }
 
 //*****************************************************************************
-// nsXULWindow::nsIIntefaceRequestor
+// AppWindow::nsIIntefaceRequestor
 //*****************************************************************************
 
-NS_IMETHODIMP nsXULWindow::GetInterface(const nsIID& aIID, void** aSink) {
+NS_IMETHODIMP AppWindow::GetInterface(const nsIID& aIID, void** aSink) {
   nsresult rv;
 
   NS_ENSURE_ARG_POINTER(aSink);
 
   if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
     rv = EnsurePrompter();
     if (NS_FAILED(rv)) return rv;
     return mPrompter->QueryInterface(aIID, aSink);
@@ -362,49 +363,49 @@ NS_IMETHODIMP nsXULWindow::GetInterface(
       NS_SUCCEEDED(EnsureContentTreeOwner()) &&
       NS_SUCCEEDED(mContentTreeOwner->QueryInterface(aIID, aSink)))
     return NS_OK;
 
   return QueryInterface(aIID, aSink);
 }
 
 //*****************************************************************************
-// nsXULWindow::nsIXULWindow
+// AppWindow::nsIAppWindow
 //*****************************************************************************
 
-NS_IMETHODIMP nsXULWindow::GetDocShell(nsIDocShell** aDocShell) {
+NS_IMETHODIMP AppWindow::GetDocShell(nsIDocShell** aDocShell) {
   NS_ENSURE_ARG_POINTER(aDocShell);
 
   *aDocShell = mDocShell;
   NS_IF_ADDREF(*aDocShell);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetZLevel(uint32_t* outLevel) {
+NS_IMETHODIMP AppWindow::GetZLevel(uint32_t* outLevel) {
   nsCOMPtr<nsIWindowMediator> mediator(
       do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (mediator)
     mediator->GetZLevel(this, outLevel);
   else
     *outLevel = normalZ;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetZLevel(uint32_t aLevel) {
+NS_IMETHODIMP AppWindow::SetZLevel(uint32_t aLevel) {
   nsCOMPtr<nsIWindowMediator> mediator(
       do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!mediator) return NS_ERROR_FAILURE;
 
   uint32_t zLevel;
   mediator->GetZLevel(this, &zLevel);
   if (zLevel == aLevel) return NS_OK;
 
   /* refuse to raise a maximized window above the normal browser level,
      for fear it could hide newly opened browser windows */
-  if (aLevel > nsIXULWindow::normalZ && mWindow) {
+  if (aLevel > nsIAppWindow::normalZ && mWindow) {
     nsSizeMode sizeMode = mWindow->SizeMode();
     if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen) {
       return NS_ERROR_FAILURE;
     }
   }
 
   // do it
   mediator->SetZLevel(this, aLevel);
@@ -426,17 +427,17 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(uin
 
         doc->DispatchEvent(*event);
       }
     }
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetChromeFlags(uint32_t* aChromeFlags) {
+NS_IMETHODIMP AppWindow::GetChromeFlags(uint32_t* aChromeFlags) {
   NS_ENSURE_ARG_POINTER(aChromeFlags);
   *aChromeFlags = mChromeFlags;
   /* mChromeFlags is kept up to date, except for scrollbar visibility.
      That can be changed directly by the content DOM window, which
      doesn't know to update the chrome window. So that we must check
      separately. */
 
   // however, it's pointless to ask if the window isn't set up yet
@@ -445,74 +446,74 @@ NS_IMETHODIMP nsXULWindow::GetChromeFlag
   if (GetContentScrollbarVisibility())
     *aChromeFlags |= nsIWebBrowserChrome::CHROME_SCROLLBARS;
   else
     *aChromeFlags &= ~nsIWebBrowserChrome::CHROME_SCROLLBARS;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetChromeFlags(uint32_t aChromeFlags) {
+NS_IMETHODIMP AppWindow::SetChromeFlags(uint32_t aChromeFlags) {
   NS_ASSERTION(!mChromeFlagsFrozen,
                "SetChromeFlags() after AssumeChromeFlagsAreFrozen()!");
 
   mChromeFlags = aChromeFlags;
   if (mChromeLoaded) {
     ApplyChromeFlags();
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::AssumeChromeFlagsAreFrozen() {
+NS_IMETHODIMP AppWindow::AssumeChromeFlagsAreFrozen() {
   mChromeFlagsFrozen = true;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetIntrinsicallySized(bool aIntrinsicallySized) {
+NS_IMETHODIMP AppWindow::SetIntrinsicallySized(bool aIntrinsicallySized) {
   mIntrinsicallySized = aIntrinsicallySized;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetIntrinsicallySized(bool* aIntrinsicallySized) {
+NS_IMETHODIMP AppWindow::GetIntrinsicallySized(bool* aIntrinsicallySized) {
   NS_ENSURE_ARG_POINTER(aIntrinsicallySized);
 
   *aIntrinsicallySized = mIntrinsicallySized;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetPrimaryContentShell(
+NS_IMETHODIMP AppWindow::GetPrimaryContentShell(
     nsIDocShellTreeItem** aDocShellTreeItem) {
   NS_ENSURE_ARG_POINTER(aDocShellTreeItem);
   NS_IF_ADDREF(*aDocShellTreeItem = mPrimaryContentShell);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) {
+AppWindow::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) {
   if (aPrimary) {
     mPrimaryBrowserParent = aTab;
     mPrimaryContentShell = nullptr;
   } else if (mPrimaryBrowserParent == aTab) {
     mPrimaryBrowserParent = nullptr;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::RemoteTabRemoved(nsIRemoteTab* aTab) {
+AppWindow::RemoteTabRemoved(nsIRemoteTab* aTab) {
   if (aTab == mPrimaryBrowserParent) {
     mPrimaryBrowserParent = nullptr;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::GetPrimaryRemoteTab(nsIRemoteTab** aTab) {
+AppWindow::GetPrimaryRemoteTab(nsIRemoteTab** aTab) {
   nsCOMPtr<nsIRemoteTab> tab = mPrimaryBrowserParent;
   tab.forget(aTab);
   return NS_OK;
 }
 
 static LayoutDeviceIntSize GetOuterToInnerSizeDifference(nsIWidget* aWindow) {
   if (!aWindow) {
     return LayoutDeviceIntSize();
@@ -526,53 +527,53 @@ static CSSIntSize GetOuterToInnerSizeDif
   if (!aWindow) {
     return {};
   }
   LayoutDeviceIntSize devPixelSize = GetOuterToInnerSizeDifference(aWindow);
   return RoundedToInt(devPixelSize / aWindow->GetDefaultScale());
 }
 
 NS_IMETHODIMP
-nsXULWindow::GetOuterToInnerHeightDifferenceInCSSPixels(uint32_t* aResult) {
+AppWindow::GetOuterToInnerHeightDifferenceInCSSPixels(uint32_t* aResult) {
   *aResult = GetOuterToInnerSizeDifferenceInCSSPixels(mWindow).height;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::GetOuterToInnerWidthDifferenceInCSSPixels(uint32_t* aResult) {
+AppWindow::GetOuterToInnerWidthDifferenceInCSSPixels(uint32_t* aResult) {
   *aResult = GetOuterToInnerSizeDifferenceInCSSPixels(mWindow).width;
   return NS_OK;
 }
 
 nsTArray<RefPtr<mozilla::LiveResizeListener>>
-nsXULWindow::GetLiveResizeListeners() {
+AppWindow::GetLiveResizeListeners() {
   nsTArray<RefPtr<mozilla::LiveResizeListener>> listeners;
   if (mPrimaryBrowserParent) {
     BrowserHost* host = BrowserHost::GetFrom(mPrimaryBrowserParent.get());
     listeners.AppendElement(host->GetActor());
   }
   return listeners;
 }
 
-NS_IMETHODIMP nsXULWindow::AddChildWindow(nsIXULWindow* aChild) {
+NS_IMETHODIMP AppWindow::AddChildWindow(nsIAppWindow* aChild) {
   // we're not really keeping track of this right now
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::RemoveChildWindow(nsIXULWindow* aChild) {
+NS_IMETHODIMP AppWindow::RemoveChildWindow(nsIAppWindow* aChild) {
   // we're not really keeping track of this right now
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::ShowModal() {
-  AUTO_PROFILER_LABEL("nsXULWindow::ShowModal", OTHER);
+NS_IMETHODIMP AppWindow::ShowModal() {
+  AUTO_PROFILER_LABEL("AppWindow::ShowModal", OTHER);
 
   // Store locally so it doesn't die on us
   nsCOMPtr<nsIWidget> window = mWindow;
-  nsCOMPtr<nsIXULWindow> tempRef = this;
+  nsCOMPtr<nsIAppWindow> tempRef = this;
 
   window->SetModal(true);
   mContinueModalLoop = true;
   EnableParent(false);
 
   {
     AutoNoJSAPI nojsapi;
     SpinEventLoopUntil([&]() { return !mContinueModalLoop; });
@@ -591,41 +592,41 @@ NS_IMETHODIMP nsXULWindow::ShowModal() {
      modal loop is always exited using ExitModalLoop (the other way would be
      to change the protected member variable directly.)
   */
 
   return mModalStatus;
 }
 
 //*****************************************************************************
-// nsXULWindow::nsIBaseWindow
+// AppWindow::nsIBaseWindow
 //*****************************************************************************
 
-NS_IMETHODIMP nsXULWindow::InitWindow(nativeWindow aParentNativeWindow,
-                                      nsIWidget* parentWidget, int32_t x,
-                                      int32_t y, int32_t cx, int32_t cy) {
+NS_IMETHODIMP AppWindow::InitWindow(nativeWindow aParentNativeWindow,
+                                    nsIWidget* parentWidget, int32_t x,
+                                    int32_t y, int32_t cx, int32_t cy) {
   // XXX First Check In
   NS_ASSERTION(false, "Not Yet Implemented");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::Create() {
+NS_IMETHODIMP AppWindow::Create() {
   // XXX First Check In
   NS_ASSERTION(false, "Not Yet Implemented");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::Destroy() {
+NS_IMETHODIMP AppWindow::Destroy() {
   nsresult rv;
   nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mDocShell, &rv));
   if (webProgress) {
     webProgress->RemoveProgressListener(this);
   }
 
-  nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
+  nsCOMPtr<nsIAppWindow> kungFuDeathGrip(this);
   {
     MutexAutoLock lock(mSPTimerLock);
     if (mSPTimer) {
       mSPTimer->Cancel();
       SavePersistentAttributes();
       mSPTimer = nullptr;
     }
   }
@@ -637,30 +638,30 @@ NS_IMETHODIMP nsXULWindow::Destroy() {
 
   mozilla::AutoRestore<bool> guard(mDestroying);
   mDestroying = true;
 
   nsCOMPtr<nsIAppShellService> appShell(
       do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
   NS_ASSERTION(appShell, "Couldn't get appShell... xpcom shutdown?");
   if (appShell)
-    appShell->UnregisterTopLevelWindow(static_cast<nsIXULWindow*>(this));
-
-  nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
+    appShell->UnregisterTopLevelWindow(static_cast<nsIAppWindow*>(this));
+
+  nsCOMPtr<nsIAppWindow> parentWindow(do_QueryReferent(mParentWindow));
   if (parentWindow) parentWindow->RemoveChildWindow(this);
 
   // let's make sure the window doesn't get deleted out from under us
   // while we are trying to close....this can happen if the docshell
-  // we close ends up being the last owning reference to this xulwindow
+  // we close ends up being the last owning reference to this AppWindow
 
   // XXXTAB This shouldn't be an issue anymore because the ownership model
   // only goes in one direction.  When webshell container is fully removed
   // try removing this...
 
-  nsCOMPtr<nsIXULWindow> placeHolder = this;
+  nsCOMPtr<nsIAppWindow> placeHolder = this;
 
   // Remove modality (if any) and hide while destroying. More than
   // a convenience, the hide prevents user interaction with the partially
   // destroyed window. This is especially necessary when the eldest window
   // in a stack of modal windows is destroyed first. It happens.
   ExitModalLoop(NS_OK);
   // XXX: Skip unmapping the window on Linux due to GLX hangs on the compositor
   // thread with NVIDIA driver 310.32. We don't need to worry about user
@@ -680,17 +681,17 @@ NS_IMETHODIMP nsXULWindow::Destroy() {
     if (parentWidget && parentWidget->IsVisible()) {
       bool isParentHiddenWindow = false;
 
       if (appShell) {
         bool hasHiddenWindow = false;
         appShell->GetHasHiddenWindow(&hasHiddenWindow);
         if (hasHiddenWindow) {
           nsCOMPtr<nsIBaseWindow> baseHiddenWindow;
-          nsCOMPtr<nsIXULWindow> hiddenWindow;
+          nsCOMPtr<nsIAppWindow> hiddenWindow;
           appShell->GetHiddenWindow(getter_AddRefs(hiddenWindow));
           if (hiddenWindow) {
             baseHiddenWindow = do_GetInterface(hiddenWindow);
             isParentHiddenWindow = (baseHiddenWindow == parent);
           }
         }
       }
 
@@ -710,25 +711,25 @@ NS_IMETHODIMP nsXULWindow::Destroy() {
     nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(mDocShell));
     shellAsWin->Destroy();
     mDocShell = nullptr;  // this can cause reentrancy of this function
   }
 
   mPrimaryContentShell = nullptr;
 
   if (mContentTreeOwner) {
-    mContentTreeOwner->XULWindow(nullptr);
+    mContentTreeOwner->AppWindow(nullptr);
     NS_RELEASE(mContentTreeOwner);
   }
   if (mPrimaryContentTreeOwner) {
-    mPrimaryContentTreeOwner->XULWindow(nullptr);
+    mPrimaryContentTreeOwner->AppWindow(nullptr);
     NS_RELEASE(mPrimaryContentTreeOwner);
   }
   if (mChromeTreeOwner) {
-    mChromeTreeOwner->XULWindow(nullptr);
+    mChromeTreeOwner->AppWindow(nullptr);
     NS_RELEASE(mChromeTreeOwner);
   }
   if (mWindow) {
     mWindow->SetWidgetListener(nullptr);  // nsWebShellWindow hackery
     mWindow->Destroy();
     mWindow = nullptr;
   }
 
@@ -743,27 +744,27 @@ NS_IMETHODIMP nsXULWindow::Destroy() {
 
     if (obssvc)
       obssvc->NotifyObservers(nullptr, "xul-window-destroyed", nullptr);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetDevicePixelsPerDesktopPixel(double* aScale) {
+NS_IMETHODIMP AppWindow::GetDevicePixelsPerDesktopPixel(double* aScale) {
   *aScale = mWindow ? mWindow->GetDesktopToDeviceScale().scale : 1.0;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetUnscaledDevicePixelsPerCSSPixel(double* aScale) {
+NS_IMETHODIMP AppWindow::GetUnscaledDevicePixelsPerCSSPixel(double* aScale) {
   *aScale = mWindow ? mWindow->GetDefaultScale().scale : 1.0;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetPositionDesktopPix(int32_t aX, int32_t aY) {
+NS_IMETHODIMP AppWindow::SetPositionDesktopPix(int32_t aX, int32_t aY) {
   mWindow->Move(aX, aY);
   if (mSizingShellFromXUL) {
     // If we're invoked for sizing from XUL, we want to neither ignore anything
     // nor persist anything, since it's already the value in XUL.
     return NS_OK;
   }
   if (!mChromeLoaded) {
     // If we're called before the chrome is loaded someone obviously wants this
@@ -773,29 +774,29 @@ NS_IMETHODIMP nsXULWindow::SetPositionDe
   }
   PersistentAttributesDirty(PAD_POSITION);
   SavePersistentAttributes();
   return NS_OK;
 }
 
 // The parameters here are device pixels; do the best we can to convert to
 // desktop px, using the window's current scale factor (if available).
-NS_IMETHODIMP nsXULWindow::SetPosition(int32_t aX, int32_t aY) {
+NS_IMETHODIMP AppWindow::SetPosition(int32_t aX, int32_t aY) {
   // Don't reset the window's size mode here - platforms that don't want to move
   // maximized windows should reset it in their respective Move implementation.
   DesktopToLayoutDeviceScale currScale = mWindow->GetDesktopToDeviceScale();
   DesktopPoint pos = LayoutDeviceIntPoint(aX, aY) / currScale;
   return SetPositionDesktopPix(pos.x, pos.y);
 }
 
-NS_IMETHODIMP nsXULWindow::GetPosition(int32_t* aX, int32_t* aY) {
+NS_IMETHODIMP AppWindow::GetPosition(int32_t* aX, int32_t* aY) {
   return GetPositionAndSize(aX, aY, nullptr, nullptr);
 }
 
-NS_IMETHODIMP nsXULWindow::SetSize(int32_t aCX, int32_t aCY, bool aRepaint) {
+NS_IMETHODIMP AppWindow::SetSize(int32_t aCX, int32_t aCY, bool aRepaint) {
   /* any attempt to set the window's size or position overrides the window's
      zoom state. this is important when these two states are competing while
      the window is being opened. but it should probably just always be so. */
   mWindow->SetSizeMode(nsSizeMode_Normal);
 
   mIntrinsicallySized = false;
 
   DesktopToLayoutDeviceScale scale = mWindow->GetDesktopToDeviceScale();
@@ -815,23 +816,22 @@ NS_IMETHODIMP nsXULWindow::SetSize(int32
     mIgnoreXULSizeMode = true;
     return NS_OK;
   }
   PersistentAttributesDirty(PAD_SIZE);
   SavePersistentAttributes();
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetSize(int32_t* aCX, int32_t* aCY) {
+NS_IMETHODIMP AppWindow::GetSize(int32_t* aCX, int32_t* aCY) {
   return GetPositionAndSize(nullptr, nullptr, aCX, aCY);
 }
 
-NS_IMETHODIMP nsXULWindow::SetPositionAndSize(int32_t aX, int32_t aY,
-                                              int32_t aCX, int32_t aCY,
-                                              uint32_t aFlags) {
+NS_IMETHODIMP AppWindow::SetPositionAndSize(int32_t aX, int32_t aY, int32_t aCX,
+                                            int32_t aCY, uint32_t aFlags) {
   /* any attempt to set the window's size or position overrides the window's
      zoom state. this is important when these two states are competing while
      the window is being opened. but it should probably just always be so. */
   mWindow->SetSizeMode(nsSizeMode_Normal);
 
   mIntrinsicallySized = false;
 
   DesktopToLayoutDeviceScale scale = mWindow->GetDesktopToDeviceScale();
@@ -851,32 +851,32 @@ NS_IMETHODIMP nsXULWindow::SetPositionAn
     mIgnoreXULSizeMode = true;
     return NS_OK;
   }
   PersistentAttributesDirty(PAD_POSITION | PAD_SIZE);
   SavePersistentAttributes();
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetPositionAndSize(int32_t* x, int32_t* y,
-                                              int32_t* cx, int32_t* cy) {
+NS_IMETHODIMP AppWindow::GetPositionAndSize(int32_t* x, int32_t* y, int32_t* cx,
+                                            int32_t* cy) {
   if (!mWindow) return NS_ERROR_FAILURE;
 
   LayoutDeviceIntRect rect = mWindow->GetScreenBounds();
 
   if (x) *x = rect.X();
   if (y) *y = rect.Y();
   if (cx) *cx = rect.Width();
   if (cy) *cy = rect.Height();
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::Center(nsIXULWindow* aRelative, bool aScreen,
-                                  bool aAlert) {
+NS_IMETHODIMP AppWindow::Center(nsIAppWindow* aRelative, bool aScreen,
+                                bool aAlert) {
   int32_t left, top, width, height, ourWidth, ourHeight;
   bool screenCoordinates = false, windowCoordinates = false;
   nsresult result;
 
   if (!mChromeLoaded) {
     // note we lose the parameters. at time of writing, this isn't a problem.
     mCenterAfterLoad = true;
     return NS_OK;
@@ -956,235 +956,235 @@ NS_IMETHODIMP nsXULWindow::Center(nsIXUL
       return Center(aRelative, aScreen, aAlert);
     }
     return NS_OK;
   }
 
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULWindow::Repaint(bool aForce) {
+NS_IMETHODIMP AppWindow::Repaint(bool aForce) {
   // XXX First Check In
   NS_ASSERTION(false, "Not Yet Implemented");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetParentWidget(nsIWidget** aParentWidget) {
+NS_IMETHODIMP AppWindow::GetParentWidget(nsIWidget** aParentWidget) {
   NS_ENSURE_ARG_POINTER(aParentWidget);
   NS_ENSURE_STATE(mWindow);
 
   NS_IF_ADDREF(*aParentWidget = mWindow->GetParent());
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetParentWidget(nsIWidget* aParentWidget) {
+NS_IMETHODIMP AppWindow::SetParentWidget(nsIWidget* aParentWidget) {
   // XXX First Check In
   NS_ASSERTION(false, "Not Yet Implemented");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetParentNativeWindow(
+NS_IMETHODIMP AppWindow::GetParentNativeWindow(
     nativeWindow* aParentNativeWindow) {
   NS_ENSURE_ARG_POINTER(aParentNativeWindow);
 
   nsCOMPtr<nsIWidget> parentWidget;
   NS_ENSURE_SUCCESS(GetParentWidget(getter_AddRefs(parentWidget)),
                     NS_ERROR_FAILURE);
 
   if (parentWidget) {
     *aParentNativeWindow = parentWidget->GetNativeData(NS_NATIVE_WIDGET);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetParentNativeWindow(
+NS_IMETHODIMP AppWindow::SetParentNativeWindow(
     nativeWindow aParentNativeWindow) {
   // XXX First Check In
   NS_ASSERTION(false, "Not Yet Implemented");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetNativeHandle(nsAString& aNativeHandle) {
+NS_IMETHODIMP AppWindow::GetNativeHandle(nsAString& aNativeHandle) {
   nsCOMPtr<nsIWidget> mainWidget;
   NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(mainWidget)),
                     NS_ERROR_FAILURE);
 
   if (mainWidget) {
     nativeWindow nativeWindowPtr = mainWidget->GetNativeData(NS_NATIVE_WINDOW);
     /* the nativeWindow pointer is converted to and exposed as a string. This
        is a more reliable way not to lose information (as opposed to JS
        |Number| for instance) */
     aNativeHandle =
         NS_ConvertASCIItoUTF16(nsPrintfCString("0x%p", nativeWindowPtr));
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetVisibility(bool* aVisibility) {
+NS_IMETHODIMP AppWindow::GetVisibility(bool* aVisibility) {
   NS_ENSURE_ARG_POINTER(aVisibility);
 
   // Always claim to be visible for now. See bug
   // https://bugzilla.mozilla.org/show_bug.cgi?id=306245.
 
   *aVisibility = true;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetVisibility(bool aVisibility) {
+NS_IMETHODIMP AppWindow::SetVisibility(bool aVisibility) {
   if (!mChromeLoaded) {
     mShowAfterLoad = aVisibility;
     return NS_OK;
   }
 
   if (mDebuting) {
     return NS_OK;
   }
   mDebuting = true;  // (Show / Focus is recursive)
 
   // XXXTAB Do we really need to show docshell and the window?  Isn't
   // the window good enough?
   nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(mDocShell));
   shellAsWin->SetVisibility(aVisibility);
   // Store locally so it doesn't die on us. 'Show' can result in the window
-  // being closed with nsXULWindow::Destroy being called. That would set
+  // being closed with AppWindow::Destroy being called. That would set
   // mWindow to null and posibly destroy the nsIWidget while its Show method
   // is on the stack. We need to keep it alive until Show finishes.
   nsCOMPtr<nsIWidget> window = mWindow;
   window->Show(aVisibility);
 
   nsCOMPtr<nsIWindowMediator> windowMediator(
       do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (windowMediator)
-    windowMediator->UpdateWindowTimeStamp(static_cast<nsIXULWindow*>(this));
+    windowMediator->UpdateWindowTimeStamp(static_cast<nsIAppWindow*>(this));
 
   // notify observers so that we can hide the splash screen if possible
   nsCOMPtr<nsIObserverService> obssvc = services::GetObserverService();
   NS_ASSERTION(obssvc, "Couldn't get observer service.");
   if (obssvc) {
-    obssvc->NotifyObservers(static_cast<nsIXULWindow*>(this),
+    obssvc->NotifyObservers(static_cast<nsIAppWindow*>(this),
                             "xul-window-visible", nullptr);
   }
 
   mDebuting = false;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetEnabled(bool* aEnabled) {
+NS_IMETHODIMP AppWindow::GetEnabled(bool* aEnabled) {
   NS_ENSURE_ARG_POINTER(aEnabled);
 
   if (mWindow) {
     *aEnabled = mWindow->IsEnabled();
     return NS_OK;
   }
 
   *aEnabled = true;  // better guess than most
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULWindow::SetEnabled(bool aEnable) {
+NS_IMETHODIMP AppWindow::SetEnabled(bool aEnable) {
   if (mWindow) {
     mWindow->Enable(aEnable);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULWindow::GetMainWidget(nsIWidget** aMainWidget) {
+NS_IMETHODIMP AppWindow::GetMainWidget(nsIWidget** aMainWidget) {
   NS_ENSURE_ARG_POINTER(aMainWidget);
 
   *aMainWidget = mWindow;
   NS_IF_ADDREF(*aMainWidget);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetFocus() {
+NS_IMETHODIMP AppWindow::SetFocus() {
   // XXX First Check In
   NS_ASSERTION(false, "Not Yet Implemented");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetTitle(nsAString& aTitle) {
+NS_IMETHODIMP AppWindow::GetTitle(nsAString& aTitle) {
   aTitle = mTitle;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetTitle(const nsAString& aTitle) {
+NS_IMETHODIMP AppWindow::SetTitle(const nsAString& aTitle) {
   NS_ENSURE_STATE(mWindow);
   mTitle.Assign(aTitle);
   mTitle.StripCRLF();
   NS_ENSURE_SUCCESS(mWindow->SetTitle(mTitle), NS_ERROR_FAILURE);
   return NS_OK;
 }
 
 //*****************************************************************************
-// nsXULWindow: Helpers
+// AppWindow: Helpers
 //*****************************************************************************
 
-NS_IMETHODIMP nsXULWindow::EnsureChromeTreeOwner() {
+NS_IMETHODIMP AppWindow::EnsureChromeTreeOwner() {
   if (mChromeTreeOwner) return NS_OK;
 
   mChromeTreeOwner = new nsChromeTreeOwner();
   NS_ADDREF(mChromeTreeOwner);
-  mChromeTreeOwner->XULWindow(this);
+  mChromeTreeOwner->AppWindow(this);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::EnsureContentTreeOwner() {
+NS_IMETHODIMP AppWindow::EnsureContentTreeOwner() {
   if (mContentTreeOwner) return NS_OK;
 
   mContentTreeOwner = new nsContentTreeOwner(false);
   NS_ADDREF(mContentTreeOwner);
-  mContentTreeOwner->XULWindow(this);
+  mContentTreeOwner->AppWindow(this);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::EnsurePrimaryContentTreeOwner() {
+NS_IMETHODIMP AppWindow::EnsurePrimaryContentTreeOwner() {
   if (mPrimaryContentTreeOwner) return NS_OK;
 
   mPrimaryContentTreeOwner = new nsContentTreeOwner(true);
   NS_ADDREF(mPrimaryContentTreeOwner);
-  mPrimaryContentTreeOwner->XULWindow(this);
+  mPrimaryContentTreeOwner->AppWindow(this);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::EnsurePrompter() {
+NS_IMETHODIMP AppWindow::EnsurePrompter() {
   if (mPrompter) return NS_OK;
 
   nsCOMPtr<mozIDOMWindowProxy> ourWindow;
   nsresult rv = GetWindowDOMWindow(getter_AddRefs(ourWindow));
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIWindowWatcher> wwatch =
         do_GetService(NS_WINDOWWATCHER_CONTRACTID);
     if (wwatch) wwatch->GetNewPrompter(ourWindow, getter_AddRefs(mPrompter));
   }
   return mPrompter ? NS_OK : NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULWindow::EnsureAuthPrompter() {
+NS_IMETHODIMP AppWindow::EnsureAuthPrompter() {
   if (mAuthPrompter) return NS_OK;
 
   nsCOMPtr<mozIDOMWindowProxy> ourWindow;
   nsresult rv = GetWindowDOMWindow(getter_AddRefs(ourWindow));
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIWindowWatcher> wwatch(
         do_GetService(NS_WINDOWWATCHER_CONTRACTID));
     if (wwatch)
       wwatch->GetNewAuthPrompter(ourWindow, getter_AddRefs(mAuthPrompter));
   }
   return mAuthPrompter ? NS_OK : NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULWindow::GetAvailScreenSize(int32_t* aAvailWidth,
-                                              int32_t* aAvailHeight) {
+NS_IMETHODIMP AppWindow::GetAvailScreenSize(int32_t* aAvailWidth,
+                                            int32_t* aAvailHeight) {
   nsCOMPtr<mozIDOMWindowProxy> domWindow;
   GetWindowDOMWindow(getter_AddRefs(domWindow));
   NS_ENSURE_STATE(domWindow);
 
   auto* window = nsGlobalWindowOuter::Cast(domWindow);
 
   RefPtr<nsScreen> screen = window->GetScreen();
   NS_ENSURE_STATE(screen);
@@ -1200,17 +1200,17 @@ NS_IMETHODIMP nsXULWindow::GetAvailScree
     return rv.StealNSResult();
   }
 
   return NS_OK;
 }
 
 // Rounds window size to 1000x1000, or, if there isn't enough available
 // screen space, to a multiple of 200x100.
-NS_IMETHODIMP nsXULWindow::ForceRoundedDimensions() {
+NS_IMETHODIMP AppWindow::ForceRoundedDimensions() {
   if (mIsHiddenWindow) {
     return NS_OK;
   }
 
   int32_t availWidthCSS = 0;
   int32_t availHeightCSS = 0;
   int32_t contentWidthCSS = 0;
   int32_t contentHeightCSS = 0;
@@ -1253,79 +1253,79 @@ NS_IMETHODIMP nsXULWindow::ForceRoundedD
   targetContentWidth = NSToIntRound(targetContentWidth * devicePerCSSPixels);
   targetContentHeight = NSToIntRound(targetContentHeight * devicePerCSSPixels);
 
   SetPrimaryContentSize(targetContentWidth, targetContentHeight);
 
   return NS_OK;
 }
 
-void nsXULWindow::OnChromeLoaded() {
+void AppWindow::OnChromeLoaded() {
   nsresult rv = EnsureContentTreeOwner();
 
   if (NS_SUCCEEDED(rv)) {
     mChromeLoaded = true;
     ApplyChromeFlags();
     SyncAttributesToWidget();
     if (mWindow) {
       SizeShell();
       if (mShowAfterLoad) {
         SetVisibility(true);
       }
       AddTooltipSupport();
     }
     // At this point the window may have been closed already during Show() or
-    // SyncAttributesToWidget(), so nsXULWindow::Destroy may already have been
+    // SyncAttributesToWidget(), so AppWindow::Destroy may already have been
     // called. Take care!
   }
   mPersistentAttributesMask |= PAD_POSITION | PAD_SIZE | PAD_MISC;
 }
 
-bool nsXULWindow::NeedsTooltipListener() {
+bool AppWindow::NeedsTooltipListener() {
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   if (!docShellElement || docShellElement->IsXULElement()) {
     // Tooltips in XUL are handled by each element.
     return false;
   }
   // All other non-XUL document types need a tooltip listener.
   return true;
 }
 
-void nsXULWindow::AddTooltipSupport() {
+void AppWindow::AddTooltipSupport() {
   if (!NeedsTooltipListener()) {
     return;
   }
   nsXULTooltipListener* listener = nsXULTooltipListener::GetInstance();
   if (!listener) {
     return;
   }
 
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   MOZ_ASSERT(docShellElement);
   listener->AddTooltipSupport(docShellElement);
 }
 
-void nsXULWindow::RemoveTooltipSupport() {
+void AppWindow::RemoveTooltipSupport() {
   if (!NeedsTooltipListener()) {
     return;
   }
   nsXULTooltipListener* listener = nsXULTooltipListener::GetInstance();
   if (!listener) {
     return;
   }
 
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   MOZ_ASSERT(docShellElement);
   listener->RemoveTooltipSupport(docShellElement);
 }
 
 // If aSpecWidth and/or aSpecHeight are > 0, we will use these CSS px sizes
 // to fit to the screen when staggering windows; if they're negative,
 // we use the window's current size instead.
-bool nsXULWindow::LoadPositionFromXUL(int32_t aSpecWidth, int32_t aSpecHeight) {
+bool AppWindow::LoadPositionFromXUL(int32_t aSpecWidth, int32_t aSpecHeight) {
   bool gotPosition = false;
 
   // if we're the hidden window, don't try to validate our size/position. We're
   // special.
   if (mIsHiddenWindow) return false;
 
   nsCOMPtr<dom::Element> windowElement = GetWindowDOMElement();
   NS_ENSURE_TRUE(windowElement, false);
@@ -1417,17 +1417,17 @@ static Maybe<int32_t> ReadSize(const Ele
   int32_t min =
       std::max(100, ReadIntAttribute(aElement, aMinAttr).valueOr(100));
   int32_t max = ReadIntAttribute(aElement, aMaxAttr)
                     .valueOr(std::numeric_limits<int32_t>::max());
 
   return Some(std::min(max, std::max(*attr, min)));
 }
 
-bool nsXULWindow::LoadSizeFromXUL(int32_t& aSpecWidth, int32_t& aSpecHeight) {
+bool AppWindow::LoadSizeFromXUL(int32_t& aSpecWidth, int32_t& aSpecHeight) {
   bool gotSize = false;
 
   // if we're the hidden window, don't try to validate our size/position. We're
   // special.
   if (mIsHiddenWindow) {
     return false;
   }
 
@@ -1448,17 +1448,17 @@ bool nsXULWindow::LoadSizeFromXUL(int32_
                              nsGkAtoms::minheight, nsGkAtoms::maxheight)) {
     aSpecHeight = *height;
     gotSize = true;
   }
 
   return gotSize;
 }
 
-void nsXULWindow::SetSpecifiedSize(int32_t aSpecWidth, int32_t aSpecHeight) {
+void AppWindow::SetSpecifiedSize(int32_t aSpecWidth, int32_t aSpecHeight) {
   // constrain to screen size
   int32_t screenWidth;
   int32_t screenHeight;
 
   if (NS_SUCCEEDED(GetAvailScreenSize(&screenWidth, &screenHeight))) {
     if (aSpecWidth > screenWidth) {
       aSpecWidth = screenWidth;
     }
@@ -1482,17 +1482,17 @@ void nsXULWindow::SetSpecifiedSize(int32
     SetSize(aSpecWidth, aSpecHeight, false);
   }
 }
 
 /* Miscellaneous persistent attributes are attributes named in the
    |persist| attribute, other than size and position. Those are special
    because it's important to load those before one of the misc
    attributes (sizemode) and they require extra processing. */
-bool nsXULWindow::UpdateWindowStateFromMiscXULAttributes() {
+bool AppWindow::UpdateWindowStateFromMiscXULAttributes() {
   bool gotState = false;
 
   /* There are no misc attributes of interest to the hidden window.
      It's especially important not to try to validate that window's
      size or position, because some platforms (Mac OS X) need to
      make it visible and offscreen. */
   if (mIsHiddenWindow) return false;
 
@@ -1557,18 +1557,18 @@ bool nsXULWindow::UpdateWindowStateFromM
 
 /* Stagger windows of the same type so they don't appear on top of each other.
    This code does have a scary double loop -- it'll keep passing through
    the entire list of open windows until it finds a non-collision. Doesn't
    seem to be a problem, but it deserves watching.
    The aRequested{X,Y} parameters here are in desktop pixels;
    the aSpec{Width,Height} parameters are CSS pixel dimensions.
 */
-void nsXULWindow::StaggerPosition(int32_t& aRequestedX, int32_t& aRequestedY,
-                                  int32_t aSpecWidth, int32_t aSpecHeight) {
+void AppWindow::StaggerPosition(int32_t& aRequestedX, int32_t& aRequestedY,
+                                int32_t aSpecWidth, int32_t aSpecHeight) {
   // These "constants" will be converted from CSS to desktop pixels
   // for the appropriate screen, assuming we find a screen to use...
   // hence they're not actually declared const here.
   int32_t kOffset = 22;
   uint32_t kSlop = 4;
 
   bool keepTrying;
   int bouncedX = 0,  // bounced off vertical edge of screen
@@ -1576,17 +1576,17 @@ void nsXULWindow::StaggerPosition(int32_
 
   // look for any other windows of this type
   nsCOMPtr<nsIWindowMediator> wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!wm) return;
 
   nsCOMPtr<dom::Element> windowElement = GetWindowDOMElement();
   if (!windowElement) return;
 
-  nsCOMPtr<nsIXULWindow> ourXULWindow(this);
+  nsCOMPtr<nsIAppWindow> ourAppWindow(this);
 
   nsAutoString windowType;
   windowElement->GetAttribute(WINDOWTYPE_ATTRIBUTE, windowType);
 
   int32_t screenTop = 0,  // it's pointless to initialize these ...
       screenRight = 0,    // ... but to prevent oversalubrious and ...
       screenBottom = 0,   // ... underbright compilers from ...
       screenLeft = 0;     // ... issuing warnings.
@@ -1621,32 +1621,32 @@ void nsXULWindow::StaggerPosition(int32_
       }
     }
   }
 
   // One full pass through all windows of this type, repeat until no collisions.
   do {
     keepTrying = false;
     nsCOMPtr<nsISimpleEnumerator> windowList;
-    wm->GetXULWindowEnumerator(windowType.get(), getter_AddRefs(windowList));
+    wm->GetAppWindowEnumerator(windowType.get(), getter_AddRefs(windowList));
 
     if (!windowList) break;
 
     // One full pass through all windows of this type, offset and stop on
     // collision.
     do {
       bool more;
       windowList->HasMoreElements(&more);
       if (!more) break;
 
       nsCOMPtr<nsISupports> supportsWindow;
       windowList->GetNext(getter_AddRefs(supportsWindow));
 
-      nsCOMPtr<nsIXULWindow> listXULWindow(do_QueryInterface(supportsWindow));
-      if (listXULWindow != ourXULWindow) {
+      nsCOMPtr<nsIAppWindow> listAppWindow(do_QueryInterface(supportsWindow));
+      if (listAppWindow != ourAppWindow) {
         int32_t listX, listY;
         nsCOMPtr<nsIBaseWindow> listBaseWindow(
             do_QueryInterface(supportsWindow));
         listBaseWindow->GetPosition(&listX, &listY);
         double scale;
         if (NS_SUCCEEDED(
                 listBaseWindow->GetDevicePixelsPerDesktopPixel(&scale))) {
           listX = NSToIntRound(listX / scale);
@@ -1689,17 +1689,17 @@ void nsXULWindow::StaggerPosition(int32_
           keepTrying = bouncedX < 2 || bouncedY == 0;
           break;
         }
       }
     } while (1);
   } while (keepTrying);
 }
 
-void nsXULWindow::SyncAttributesToWidget() {
+void AppWindow::SyncAttributesToWidget() {
   nsCOMPtr<dom::Element> windowElement = GetWindowDOMElement();
   if (!windowElement) return;
 
   MOZ_DIAGNOSTIC_ASSERT(mWindow, "No widget on SyncAttributesToWidget?");
 
   nsAutoString attr;
 
   // "hidechrome" attribute
@@ -1762,17 +1762,17 @@ void nsXULWindow::SyncAttributesToWidget
   }
 }
 
 enum class ConversionDirection {
   InnerToOuter,
   OuterToInner,
 };
 
-static void ConvertWindowSize(nsIXULWindow* aWin, const nsAtom* aAttr,
+static void ConvertWindowSize(nsIAppWindow* aWin, const nsAtom* aAttr,
                               ConversionDirection aDirection,
                               nsAString& aInOutString) {
   MOZ_ASSERT(aWin);
   MOZ_ASSERT(aAttr == nsGkAtoms::width || aAttr == nsGkAtoms::height);
 
   nsresult rv;
   int32_t size = aInOutString.ToInteger(&rv);
   if (NS_FAILED(rv)) {
@@ -1788,18 +1788,17 @@ static void ConvertWindowSize(nsIXULWind
   }
 
   int32_t multiplier = aDirection == ConversionDirection::InnerToOuter ? 1 : -1;
 
   CopyASCIItoUTF16(nsPrintfCString("%d", size + multiplier * sizeDiff),
                    aInOutString);
 }
 
-nsresult nsXULWindow::GetPersistentValue(const nsAtom* aAttr,
-                                         nsAString& aValue) {
+nsresult AppWindow::GetPersistentValue(const nsAtom* aAttr, nsAString& aValue) {
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   if (!docShellElement) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoString windowElementId;
   docShellElement->GetId(windowElementId);
   // Elements must have an ID to be persisted.
@@ -1839,18 +1838,18 @@ nsresult nsXULWindow::GetPersistentValue
     // Convert attributes from outer size to inner size for top-level
     // windows, see bug 1444525 & co.
     ConvertWindowSize(this, aAttr, ConversionDirection::OuterToInner, aValue);
   }
 
   return NS_OK;
 }
 
-nsresult nsXULWindow::SetPersistentValue(const nsAtom* aAttr,
-                                         const nsAString& aValue) {
+nsresult AppWindow::SetPersistentValue(const nsAtom* aAttr,
+                                       const nsAString& aValue) {
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   if (!docShellElement) {
     return NS_ERROR_FAILURE;
   }
 
   nsAutoString windowElementId;
   docShellElement->GetId(windowElementId);
   // Match the behavior of XULPersist and only persist values if the element
@@ -1892,17 +1891,17 @@ nsresult nsXULWindow::SetPersistentValue
     }
   }
 
   return mLocalStore->SetValue(
       uri, windowElementId, nsDependentAtomString(aAttr), maybeConvertedValue);
 #endif
 }
 
-NS_IMETHODIMP nsXULWindow::SavePersistentAttributes() {
+NS_IMETHODIMP AppWindow::SavePersistentAttributes() {
   // can happen when the persistence timer fires at an inopportune time
   // during window shutdown
   if (!mDocShell) return NS_ERROR_FAILURE;
 
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   if (!docShellElement) return NS_ERROR_FAILURE;
 
   nsAutoString persistString;
@@ -2015,88 +2014,87 @@ NS_IMETHODIMP nsXULWindow::SavePersisten
       }
     }
   }
 
   mPersistentAttributesDirty = 0;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetWindowDOMWindow(mozIDOMWindowProxy** aDOMWindow) {
+NS_IMETHODIMP AppWindow::GetWindowDOMWindow(mozIDOMWindowProxy** aDOMWindow) {
   NS_ENSURE_STATE(mDocShell);
 
   if (!mDOMWindow) mDOMWindow = mDocShell->GetWindow();
   NS_ENSURE_TRUE(mDOMWindow, NS_ERROR_FAILURE);
 
   *aDOMWindow = mDOMWindow;
   NS_ADDREF(*aDOMWindow);
   return NS_OK;
 }
 
-dom::Element* nsXULWindow::GetWindowDOMElement() const {
+dom::Element* AppWindow::GetWindowDOMElement() const {
   NS_ENSURE_TRUE(mDocShell, nullptr);
 
   nsCOMPtr<nsIContentViewer> cv;
   mDocShell->GetContentViewer(getter_AddRefs(cv));
   NS_ENSURE_TRUE(cv, nullptr);
 
   const dom::Document* document = cv->GetDocument();
   NS_ENSURE_TRUE(document, nullptr);
 
   return document->GetRootElement();
 }
 
-nsresult nsXULWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
-                                        bool aPrimary) {
+nsresult AppWindow::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
+                                      bool aPrimary) {
   // Set the default content tree owner
   if (aPrimary) {
     NS_ENSURE_SUCCESS(EnsurePrimaryContentTreeOwner(), NS_ERROR_FAILURE);
     aContentShell->SetTreeOwner(mPrimaryContentTreeOwner);
     mPrimaryContentShell = aContentShell;
     mPrimaryBrowserParent = nullptr;
   } else {
     NS_ENSURE_SUCCESS(EnsureContentTreeOwner(), NS_ERROR_FAILURE);
     aContentShell->SetTreeOwner(mContentTreeOwner);
     if (mPrimaryContentShell == aContentShell) mPrimaryContentShell = nullptr;
   }
 
   return NS_OK;
 }
 
-nsresult nsXULWindow::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
+nsresult AppWindow::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
   if (mPrimaryContentShell == aContentShell) {
     mPrimaryContentShell = nullptr;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
+AppWindow::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
   if (mPrimaryBrowserParent) {
     return GetPrimaryRemoteTabSize(aWidth, aHeight);
   } else if (mPrimaryContentShell) {
     return GetPrimaryContentShellSize(aWidth, aHeight);
   }
   return NS_ERROR_UNEXPECTED;
 }
 
-nsresult nsXULWindow::GetPrimaryRemoteTabSize(int32_t* aWidth,
-                                              int32_t* aHeight) {
+nsresult AppWindow::GetPrimaryRemoteTabSize(int32_t* aWidth, int32_t* aHeight) {
   BrowserHost* host = BrowserHost::GetFrom(mPrimaryBrowserParent.get());
   // Need strong ref, since Client* can run script.
   nsCOMPtr<Element> element = host->GetOwnerElement();
   NS_ENSURE_STATE(element);
 
   *aWidth = element->ClientWidth();
   *aHeight = element->ClientHeight();
   return NS_OK;
 }
 
-nsresult nsXULWindow::GetPrimaryContentShellSize(int32_t* aWidth,
-                                                 int32_t* aHeight) {
+nsresult AppWindow::GetPrimaryContentShellSize(int32_t* aWidth,
+                                               int32_t* aHeight) {
   NS_ENSURE_STATE(mPrimaryContentShell);
 
   nsCOMPtr<nsIBaseWindow> shellWindow(do_QueryInterface(mPrimaryContentShell));
   NS_ENSURE_STATE(shellWindow);
 
   int32_t devicePixelWidth, devicePixelHeight;
   double shellScale = 1.0;
   // We want to return CSS pixels. First, we get device pixels
@@ -2106,50 +2104,50 @@ nsresult nsXULWindow::GetPrimaryContentS
   // pixels by this scaling factor gives us CSS pixels.
   shellWindow->GetUnscaledDevicePixelsPerCSSPixel(&shellScale);
   *aWidth = NSToIntRound(devicePixelWidth / shellScale);
   *aHeight = NSToIntRound(devicePixelHeight / shellScale);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
+AppWindow::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
   if (mPrimaryBrowserParent) {
     return SetPrimaryRemoteTabSize(aWidth, aHeight);
   } else if (mPrimaryContentShell) {
     return SizeShellTo(mPrimaryContentShell, aWidth, aHeight);
   }
   return NS_ERROR_UNEXPECTED;
 }
 
-nsresult nsXULWindow::SetPrimaryRemoteTabSize(int32_t aWidth, int32_t aHeight) {
+nsresult AppWindow::SetPrimaryRemoteTabSize(int32_t aWidth, int32_t aHeight) {
   int32_t shellWidth, shellHeight;
   GetPrimaryRemoteTabSize(&shellWidth, &shellHeight);
 
   double scale = 1.0;
   GetUnscaledDevicePixelsPerCSSPixel(&scale);
 
   SizeShellToWithLimit(aWidth, aHeight, shellWidth * scale,
                        shellHeight * scale);
   return NS_OK;
 }
 
-nsresult nsXULWindow::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
+nsresult AppWindow::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
   nsCOMPtr<nsIBaseWindow> shellAsWin = do_QueryInterface(mDocShell);
   NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);
   return shellAsWin->GetSize(aWidth, aHeight);
 }
 
-nsresult nsXULWindow::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
+nsresult AppWindow::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
   nsCOMPtr<nsIDocShellTreeItem> docShellAsItem = mDocShell;
   return SizeShellTo(docShellAsItem, aWidth, aHeight);
 }
 
-NS_IMETHODIMP nsXULWindow::SizeShellTo(nsIDocShellTreeItem* aShellItem,
-                                       int32_t aCX, int32_t aCY) {
+NS_IMETHODIMP AppWindow::SizeShellTo(nsIDocShellTreeItem* aShellItem,
+                                     int32_t aCX, int32_t aCY) {
   // XXXTAB This is wrong, we should actually reflow based on the passed in
   // shell.  For now we are hacking and doing delta sizing.  This is bad
   // because it assumes all size we add will go to the shell which probably
   // won't happen.
 
   nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(aShellItem));
   NS_ENSURE_TRUE(shellAsWin, NS_ERROR_FAILURE);
 
@@ -2157,70 +2155,70 @@ NS_IMETHODIMP nsXULWindow::SizeShellTo(n
   int32_t height = 0;
   shellAsWin->GetSize(&width, &height);
 
   SizeShellToWithLimit(aCX, aCY, width, height);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::ExitModalLoop(nsresult aStatus) {
+NS_IMETHODIMP AppWindow::ExitModalLoop(nsresult aStatus) {
   if (mContinueModalLoop) EnableParent(true);
   mContinueModalLoop = false;
   mModalStatus = aStatus;
   return NS_OK;
 }
 
 // top-level function to create a new window
-NS_IMETHODIMP nsXULWindow::CreateNewWindow(int32_t aChromeFlags,
-                                           nsIRemoteTab* aOpeningTab,
-                                           mozIDOMWindowProxy* aOpener,
-                                           uint64_t aNextRemoteTabId,
-                                           nsIXULWindow** _retval) {
+NS_IMETHODIMP AppWindow::CreateNewWindow(int32_t aChromeFlags,
+                                         nsIRemoteTab* aOpeningTab,
+                                         mozIDOMWindowProxy* aOpener,
+                                         uint64_t aNextRemoteTabId,
+                                         nsIAppWindow** _retval) {
   NS_ENSURE_ARG_POINTER(_retval);
 
   if (aChromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME) {
     MOZ_RELEASE_ASSERT(
         aNextRemoteTabId == 0,
         "Unexpected next remote tab ID, should never have a non-zero "
         "aNextRemoteTabId when creating a new chrome window");
     return CreateNewChromeWindow(aChromeFlags, aOpeningTab, aOpener, _retval);
   }
   return CreateNewContentWindow(aChromeFlags, aOpeningTab, aOpener,
                                 aNextRemoteTabId, _retval);
 }
 
-NS_IMETHODIMP nsXULWindow::CreateNewChromeWindow(int32_t aChromeFlags,
-                                                 nsIRemoteTab* aOpeningTab,
-                                                 mozIDOMWindowProxy* aOpener,
-                                                 nsIXULWindow** _retval) {
+NS_IMETHODIMP AppWindow::CreateNewChromeWindow(int32_t aChromeFlags,
+                                               nsIRemoteTab* aOpeningTab,
+                                               mozIDOMWindowProxy* aOpener,
+                                               nsIAppWindow** _retval) {
   nsCOMPtr<nsIAppShellService> appShell(
       do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
   NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
 
   // Just do a normal create of a window and return.
-  nsCOMPtr<nsIXULWindow> newWindow;
+  nsCOMPtr<nsIAppWindow> newWindow;
   appShell->CreateTopLevelWindow(
       this, nullptr, aChromeFlags, nsIAppShellService::SIZE_TO_CONTENT,
       nsIAppShellService::SIZE_TO_CONTENT, aOpeningTab, aOpener,
       getter_AddRefs(newWindow));
 
   NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);
 
   *_retval = newWindow;
   NS_ADDREF(*_retval);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::CreateNewContentWindow(int32_t aChromeFlags,
-                                                  nsIRemoteTab* aOpeningTab,
-                                                  mozIDOMWindowProxy* aOpener,
-                                                  uint64_t aNextRemoteTabId,
-                                                  nsIXULWindow** _retval) {
+NS_IMETHODIMP AppWindow::CreateNewContentWindow(int32_t aChromeFlags,
+                                                nsIRemoteTab* aOpeningTab,
+                                                mozIDOMWindowProxy* aOpener,
+                                                uint64_t aNextRemoteTabId,
+                                                nsIAppWindow** _retval) {
   nsCOMPtr<nsIAppShellService> appShell(
       do_GetService(NS_APPSHELLSERVICE_CONTRACTID));
   NS_ENSURE_TRUE(appShell, NS_ERROR_FAILURE);
 
   // We need to create a new top level window and then enter a nested
   // loop. Eventually the new window will be told that it has loaded,
   // at which time we know it is safe to spin out of the nested loop
   // and allow the opening code to proceed.
@@ -2234,121 +2232,121 @@ NS_IMETHODIMP nsXULWindow::CreateNewCont
     service->NewURI(urlStr, nullptr, nullptr, getter_AddRefs(uri));
   }
   NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
 
   // We need to create a chrome window to contain the content window we're about
   // to pass back. The subject principal needs to be system while we're creating
   // it to make things work right, so force a system caller. See bug 799348
   // comment 13 for a description of what happens when we don't.
-  nsCOMPtr<nsIXULWindow> newWindow;
+  nsCOMPtr<nsIAppWindow> newWindow;
   {
     AutoNoJSAPI nojsapi;
     // We actually want this toplevel window which we are creating to have a
     // null opener, as we will be creating the content xul:browser window inside
     // of it, so we pass nullptr as our aOpener.
     appShell->CreateTopLevelWindow(this, uri, aChromeFlags, 615, 480,
                                    aOpeningTab, nullptr,
                                    getter_AddRefs(newWindow));
     NS_ENSURE_TRUE(newWindow, NS_ERROR_FAILURE);
   }
 
   // Specify that we want the window to remain locked until the chrome has
   // loaded.
-  nsXULWindow* xulWin =
-      static_cast<nsXULWindow*>(static_cast<nsIXULWindow*>(newWindow));
+  AppWindow* appWin =
+      static_cast<AppWindow*>(static_cast<nsIAppWindow*>(newWindow));
 
   if (aNextRemoteTabId) {
-    xulWin->mNextRemoteTabId = aNextRemoteTabId;
+    appWin->mNextRemoteTabId = aNextRemoteTabId;
   }
 
   if (aOpener) {
     nsCOMPtr<nsIDocShell> docShell;
-    xulWin->GetDocShell(getter_AddRefs(docShell));
+    appWin->GetDocShell(getter_AddRefs(docShell));
     MOZ_ASSERT(docShell);
     nsCOMPtr<nsPIDOMWindowOuter> window = docShell->GetWindow();
     MOZ_ASSERT(window);
     window->SetOpenerForInitialContentBrowser(
         nsPIDOMWindowOuter::From(aOpener)->GetBrowsingContext());
   }
 
-  xulWin->LockUntilChromeLoad();
+  appWin->LockUntilChromeLoad();
 
   {
     AutoNoJSAPI nojsapi;
-    SpinEventLoopUntil([&]() { return !xulWin->IsLocked(); });
+    SpinEventLoopUntil([&]() { return !appWin->IsLocked(); });
   }
 
-  NS_ENSURE_STATE(xulWin->mPrimaryContentShell ||
-                  xulWin->mPrimaryBrowserParent);
-  MOZ_ASSERT_IF(xulWin->mPrimaryContentShell, aNextRemoteTabId == 0);
+  NS_ENSURE_STATE(appWin->mPrimaryContentShell ||
+                  appWin->mPrimaryBrowserParent);
+  MOZ_ASSERT_IF(appWin->mPrimaryContentShell, aNextRemoteTabId == 0);
 
   *_retval = newWindow;
   NS_ADDREF(*_retval);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::GetHasPrimaryContent(bool* aResult) {
+NS_IMETHODIMP AppWindow::GetHasPrimaryContent(bool* aResult) {
   *aResult = mPrimaryBrowserParent || mPrimaryContentShell;
   return NS_OK;
 }
 
-void nsXULWindow::EnableParent(bool aEnable) {
+void AppWindow::EnableParent(bool aEnable) {
   nsCOMPtr<nsIBaseWindow> parentWindow;
   nsCOMPtr<nsIWidget> parentWidget;
 
   parentWindow = do_QueryReferent(mParentWindow);
   if (parentWindow) parentWindow->GetMainWidget(getter_AddRefs(parentWidget));
   if (parentWidget) parentWidget->Enable(aEnable);
 }
 
 // Constrain the window to its proper z-level
-bool nsXULWindow::ConstrainToZLevel(bool aImmediate, nsWindowZ* aPlacement,
-                                    nsIWidget* aReqBelow,
-                                    nsIWidget** aActualBelow) {
+bool AppWindow::ConstrainToZLevel(bool aImmediate, nsWindowZ* aPlacement,
+                                  nsIWidget* aReqBelow,
+                                  nsIWidget** aActualBelow) {
 #if 0
   /* Do we have a parent window? This means our z-order is already constrained,
      since we're a dependent window. Our window list isn't hierarchical,
      so we can't properly calculate placement for such a window.
      Should we just abort? */
   nsCOMPtr<nsIBaseWindow> parentWindow = do_QueryReferent(mParentWindow);
   if (parentWindow)
     return false;
 #endif
 
   nsCOMPtr<nsIWindowMediator> mediator(
       do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!mediator) return false;
 
   bool altered;
   uint32_t position, newPosition, zLevel;
-  nsIXULWindow* us = this;
+  nsIAppWindow* us = this;
 
   altered = false;
   mediator->GetZLevel(this, &zLevel);
 
   // translate from WidgetGUIEvent to nsIWindowMediator constants
   position = nsIWindowMediator::zLevelTop;
-  if (*aPlacement == nsWindowZBottom || zLevel == nsIXULWindow::lowestZ)
+  if (*aPlacement == nsWindowZBottom || zLevel == nsIAppWindow::lowestZ)
     position = nsIWindowMediator::zLevelBottom;
   else if (*aPlacement == nsWindowZRelative)
     position = nsIWindowMediator::zLevelBelow;
 
   if (NS_SUCCEEDED(mediator->CalculateZPosition(
           us, position, aReqBelow, &newPosition, aActualBelow, &altered))) {
     /* If we were asked to move to the top but constrained to remain
        below one of our other windows, first move all windows in that
        window's layer and above to the top. This allows the user to
        click a window which can't be topmost and still bring mozilla
        to the foreground. */
     if (altered &&
         (position == nsIWindowMediator::zLevelTop ||
          (position == nsIWindowMediator::zLevelBelow && aReqBelow == 0)))
-      PlaceWindowLayersBehind(zLevel + 1, nsIXULWindow::highestZ, 0);
+      PlaceWindowLayersBehind(zLevel + 1, nsIAppWindow::highestZ, 0);
 
     if (*aPlacement != nsWindowZBottom &&
         position == nsIWindowMediator::zLevelBottom)
       altered = true;
     if (altered || aImmediate) {
       if (newPosition == nsIWindowMediator::zLevelTop)
         *aPlacement = nsWindowZTop;
       else if (newPosition == nsIWindowMediator::zLevelBottom)
@@ -2368,46 +2366,45 @@ bool nsXULWindow::ConstrainToZLevel(bool
         }
       }
     }
 
     /* CalculateZPosition can tell us to be below nothing, because it tries
        not to change something it doesn't recognize. A request to verify
        being below an unrecognized window, then, is treated as a request
        to come to the top (below null) */
-    nsCOMPtr<nsIXULWindow> windowAbove;
+    nsCOMPtr<nsIAppWindow> windowAbove;
     if (newPosition == nsIWindowMediator::zLevelBelow && *aActualBelow) {
-      windowAbove = (*aActualBelow)->GetWidgetListener()->GetXULWindow();
+      windowAbove = (*aActualBelow)->GetWidgetListener()->GetAppWindow();
     }
 
     mediator->SetZPosition(us, newPosition, windowAbove);
   }
 
   return altered;
 }
 
 /* Re-z-position all windows in the layers from aLowLevel to aHighLevel,
    inclusive, to be behind aBehind. aBehind of null means on top.
    Note this method actually does nothing to our relative window positions.
    (And therefore there's no need to inform WindowMediator we're moving
    things, because we aren't.) This method is useful for, say, moving
    a range of layers of our own windows relative to windows belonging to
    external applications.
 */
-void nsXULWindow::PlaceWindowLayersBehind(uint32_t aLowLevel,
-                                          uint32_t aHighLevel,
-                                          nsIXULWindow* aBehind) {
+void AppWindow::PlaceWindowLayersBehind(uint32_t aLowLevel, uint32_t aHighLevel,
+                                        nsIAppWindow* aBehind) {
   // step through windows in z-order from top to bottommost window
 
   nsCOMPtr<nsIWindowMediator> mediator(
       do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!mediator) return;
 
   nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
-  mediator->GetZOrderXULWindowEnumerator(0, true,
+  mediator->GetZOrderAppWindowEnumerator(0, true,
                                          getter_AddRefs(windowEnumerator));
   if (!windowEnumerator) return;
 
   // each window will be moved behind previousHighWidget, itself
   // a moving target. initialize it.
   nsCOMPtr<nsIWidget> previousHighWidget;
   if (aBehind) {
     nsCOMPtr<nsIBaseWindow> highBase(do_QueryInterface(aBehind));
@@ -2415,44 +2412,44 @@ void nsXULWindow::PlaceWindowLayersBehin
   }
 
   // get next lower window
   bool more;
   while (NS_SUCCEEDED(windowEnumerator->HasMoreElements(&more)) && more) {
     uint32_t nextZ;  // z-level of nextWindow
     nsCOMPtr<nsISupports> nextWindow;
     windowEnumerator->GetNext(getter_AddRefs(nextWindow));
-    nsCOMPtr<nsIXULWindow> nextXULWindow(do_QueryInterface(nextWindow));
-    nextXULWindow->GetZLevel(&nextZ);
+    nsCOMPtr<nsIAppWindow> nextAppWindow(do_QueryInterface(nextWindow));
+    nextAppWindow->GetZLevel(&nextZ);
     if (nextZ < aLowLevel)
       break;  // we've processed all windows through aLowLevel
 
     // move it just below its next higher window
-    nsCOMPtr<nsIBaseWindow> nextBase(do_QueryInterface(nextXULWindow));
+    nsCOMPtr<nsIBaseWindow> nextBase(do_QueryInterface(nextAppWindow));
     if (nextBase) {
       nsCOMPtr<nsIWidget> nextWidget;
       nextBase->GetMainWidget(getter_AddRefs(nextWidget));
       if (nextZ <= aHighLevel)
         nextWidget->PlaceBehind(eZPlacementBelow, previousHighWidget, false);
       previousHighWidget = nextWidget;
     }
   }
 }
 
-void nsXULWindow::SetContentScrollbarVisibility(bool aVisible) {
+void AppWindow::SetContentScrollbarVisibility(bool aVisible) {
   nsCOMPtr<nsPIDOMWindowOuter> contentWin(
       do_GetInterface(mPrimaryContentShell));
   if (!contentWin) {
     return;
   }
 
   nsContentUtils::SetScrollbarsVisibility(contentWin->GetDocShell(), aVisible);
 }
 
-bool nsXULWindow::GetContentScrollbarVisibility() {
+bool AppWindow::GetContentScrollbarVisibility() {
   // This code already exists in dom/src/base/nsBarProp.cpp, but we
   // can't safely get to that from here as this function is called
   // while the DOM window is being set up, and we need the DOM window
   // to get to that code.
   nsCOMPtr<nsIScrollable> scroller(do_QueryInterface(mPrimaryContentShell));
 
   if (scroller) {
     int32_t prefValue;
@@ -2464,21 +2461,21 @@ bool nsXULWindow::GetContentScrollbarVis
 
     if (prefValue == nsIScrollable::Scrollbar_Never) return false;
   }
 
   return true;
 }
 
 // during spinup, attributes that haven't been loaded yet can't be dirty
-void nsXULWindow::PersistentAttributesDirty(uint32_t aDirtyFlags) {
+void AppWindow::PersistentAttributesDirty(uint32_t aDirtyFlags) {
   mPersistentAttributesDirty |= aDirtyFlags & mPersistentAttributesMask;
 }
 
-void nsXULWindow::ApplyChromeFlags() {
+void AppWindow::ApplyChromeFlags() {
   nsCOMPtr<dom::Element> window = GetWindowDOMElement();
   if (!window) {
     return;
   }
 
   if (mChromeLoaded) {
     // The two calls in this block don't need to happen early because they
     // don't cause a global restyle on the document.  Not only that, but the
@@ -2515,33 +2512,33 @@ void nsXULWindow::ApplyChromeFlags() {
 
   // Note that if we're not actually changing the value this will be a no-op,
   // so no need to compare to the old value.
   IgnoredErrorResult rv;
   window->SetAttribute(NS_LITERAL_STRING("chromehidden"), newvalue, rv);
 }
 
 NS_IMETHODIMP
-nsXULWindow::BeforeStartLayout() {
+AppWindow::BeforeStartLayout() {
   ApplyChromeFlags();
   LoadPersistentWindowState();
   SyncAttributesToWidget();
   if (mWindow) {
     SizeShell();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::LockAspectRatio(bool aShouldLock) {
+AppWindow::LockAspectRatio(bool aShouldLock) {
   mWindow->LockAspectRatio(aShouldLock);
   return NS_OK;
 }
 
-void nsXULWindow::LoadPersistentWindowState() {
+void AppWindow::LoadPersistentWindowState() {
   nsCOMPtr<dom::Element> docShellElement = GetWindowDOMElement();
   if (!docShellElement) {
     return;
   }
 
   // Check if the window wants to persist anything.
   nsAutoString persist;
   docShellElement->GetAttr(kNameSpaceID_None, nsGkAtoms::persist, persist);
@@ -2564,17 +2561,17 @@ void nsXULWindow::LoadPersistentWindowSt
 
   loadValue(nsGkAtoms::screenX);
   loadValue(nsGkAtoms::screenY);
   loadValue(nsGkAtoms::width);
   loadValue(nsGkAtoms::height);
   loadValue(nsGkAtoms::sizemode);
 }
 
-void nsXULWindow::SizeShell() {
+void AppWindow::SizeShell() {
   AutoRestore<bool> sizingShellFromXUL(mSizingShellFromXUL);
   mSizingShellFromXUL = true;
 
   int32_t specWidth = -1, specHeight = -1;
   bool gotSize = false;
 
   nsCOMPtr<dom::Element> windowElement = GetWindowDOMElement();
   nsAutoString windowType;
@@ -2597,17 +2594,17 @@ void nsXULWindow::SizeShell() {
     mIgnoreXULSizeMode = true;
   } else if (!mIgnoreXULSize) {
     gotSize = LoadSizeFromXUL(specWidth, specHeight);
     specWidth += windowDiff.width;
     specHeight += windowDiff.height;
   }
 
   bool positionSet = !mIgnoreXULPosition;
-  nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
+  nsCOMPtr<nsIAppWindow> parentWindow(do_QueryReferent(mParentWindow));
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
   // don't override WM placement on unix for independent, top-level windows
   // (however, we think the benefits of intelligent dependent window placement
   // trump that override.)
   if (!parentWindow) positionSet = false;
 #endif
   if (positionSet) {
     // We have to do this before sizing the window, because sizing depends
@@ -2652,32 +2649,32 @@ void nsXULWindow::SizeShell() {
   UpdateWindowStateFromMiscXULAttributes();
 
   if (mChromeLoaded && mCenterAfterLoad && !positionSet &&
       mWindow->SizeMode() == nsSizeMode_Normal) {
     Center(parentWindow, parentWindow ? false : true, false);
   }
 }
 
-NS_IMETHODIMP nsXULWindow::GetXULBrowserWindow(
+NS_IMETHODIMP AppWindow::GetXULBrowserWindow(
     nsIXULBrowserWindow** aXULBrowserWindow) {
   NS_IF_ADDREF(*aXULBrowserWindow = mXULBrowserWindow);
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULWindow::SetXULBrowserWindow(
+NS_IMETHODIMP AppWindow::SetXULBrowserWindow(
     nsIXULBrowserWindow* aXULBrowserWindow) {
   mXULBrowserWindow = aXULBrowserWindow;
   return NS_OK;
 }
 
-void nsXULWindow::SizeShellToWithLimit(int32_t aDesiredWidth,
-                                       int32_t aDesiredHeight,
-                                       int32_t shellItemWidth,
-                                       int32_t shellItemHeight) {
+void AppWindow::SizeShellToWithLimit(int32_t aDesiredWidth,
+                                     int32_t aDesiredHeight,
+                                     int32_t shellItemWidth,
+                                     int32_t shellItemHeight) {
   int32_t widthDelta = aDesiredWidth - shellItemWidth;
   int32_t heightDelta = aDesiredHeight - shellItemHeight;
 
   if (widthDelta || heightDelta) {
     int32_t winWidth = 0;
     int32_t winHeight = 0;
 
     GetSize(&winWidth, &winHeight);
@@ -2686,39 +2683,39 @@ void nsXULWindow::SizeShellToWithLimit(i
     // function assumes that the outer docshell is adding some constant
     // "border" chrome to the content area.
     winWidth = std::max(winWidth + widthDelta, aDesiredWidth);
     winHeight = std::max(winHeight + heightDelta, aDesiredHeight);
     SetSize(winWidth, winHeight, true);
   }
 }
 
-nsresult nsXULWindow::GetTabCount(uint32_t* aResult) {
+nsresult AppWindow::GetTabCount(uint32_t* aResult) {
   if (mXULBrowserWindow) {
     return mXULBrowserWindow->GetTabCount(aResult);
   }
 
   *aResult = 0;
   return NS_OK;
 }
 
-nsresult nsXULWindow::GetNextRemoteTabId(uint64_t* aNextRemoteTabId) {
+nsresult AppWindow::GetNextRemoteTabId(uint64_t* aNextRemoteTabId) {
   NS_ENSURE_ARG_POINTER(aNextRemoteTabId);
   *aNextRemoteTabId = mNextRemoteTabId;
   return NS_OK;
 }
 
-PresShell* nsXULWindow::GetPresShell() {
+PresShell* AppWindow::GetPresShell() {
   if (!mDocShell) {
     return nullptr;
   }
   return mDocShell->GetPresShell();
 }
 
-bool nsXULWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) {
+bool AppWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) {
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm) {
     nsCOMPtr<nsPIDOMWindowOuter> window =
         mDocShell ? mDocShell->GetWindow() : nullptr;
     pm->AdjustPopupsOnWindowChange(window);
   }
 
   // Notify all tabs that the widget moved.
@@ -2732,31 +2729,31 @@ bool nsXULWindow::WindowMoved(nsIWidget*
   }
 
   // Persist position, but not immediately, in case this OS is firing
   // repeated move events as the user drags the window
   SetPersistenceTimer(PAD_POSITION);
   return false;
 }
 
-bool nsXULWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth,
-                                int32_t aHeight) {
+bool AppWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth,
+                              int32_t aHeight) {
   nsCOMPtr<nsIBaseWindow> shellAsWin(do_QueryInterface(mDocShell));
   if (shellAsWin) {
     shellAsWin->SetPositionAndSize(0, 0, aWidth, aHeight, 0);
   }
   // Persist size, but not immediately, in case this OS is firing
   // repeated size events as the user drags the sizing handle
   if (!IsLocked()) SetPersistenceTimer(PAD_POSITION | PAD_SIZE | PAD_MISC);
   return true;
 }
 
-bool nsXULWindow::RequestWindowClose(nsIWidget* aWidget) {
+bool AppWindow::RequestWindowClose(nsIWidget* aWidget) {
   // Maintain a reference to this as it is about to get destroyed.
-  nsCOMPtr<nsIXULWindow> xulWindow(this);
+  nsCOMPtr<nsIAppWindow> appWindow(this);
 
   nsCOMPtr<nsPIDOMWindowOuter> window(mDocShell ? mDocShell->GetWindow()
                                                 : nullptr);
   nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(window);
 
   RefPtr<PresShell> presShell = mDocShell->GetPresShell();
   if (!presShell) {
     mozilla::DebugOnly<bool> dying;
@@ -2772,25 +2769,25 @@ bool nsXULWindow::RequestWindowClose(nsI
         status == nsEventStatus_eConsumeNoDefault)
       return false;
   }
 
   Destroy();
   return false;
 }
 
-void nsXULWindow::SizeModeChanged(nsSizeMode sizeMode) {
+void AppWindow::SizeModeChanged(nsSizeMode sizeMode) {
   // An alwaysRaised (or higher) window will hide any newly opened normal
   // browser windows, so here we just drop a raised window to the normal
   // zlevel if it's maximized. We make no provision for automatically
   // re-raising it when restored.
   if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen) {
     uint32_t zLevel;
     GetZLevel(&zLevel);
-    if (zLevel > nsIXULWindow::normalZ) SetZLevel(nsIXULWindow::normalZ);
+    if (zLevel > nsIAppWindow::normalZ) SetZLevel(nsIAppWindow::normalZ);
   }
   mWindow->SetSizeMode(sizeMode);
 
   // Persist mode, but not immediately, because in many (all?)
   // cases this will merge with the similar call in NS_SIZE and
   // write the attribute values only once.
   SetPersistenceTimer(PAD_MISC);
   nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
@@ -2824,99 +2821,99 @@ void nsXULWindow::SizeModeChanged(nsSize
 
   // Note the current implementation of SetSizeMode just stores
   // the new state; it doesn't actually resize. So here we store
   // the state and pass the event on to the OS. The day is coming
   // when we'll handle the event here, and the return result will
   // then need to be different.
 }
 
-void nsXULWindow::UIResolutionChanged() {
+void AppWindow::UIResolutionChanged() {
   nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
       mDocShell ? mDocShell->GetWindow() : nullptr;
   if (ourWindow) {
     ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("resolutionchange"));
   }
 }
 
-void nsXULWindow::FullscreenWillChange(bool aInFullscreen) {
+void AppWindow::FullscreenWillChange(bool aInFullscreen) {
   if (mDocShell) {
     if (nsCOMPtr<nsPIDOMWindowOuter> ourWindow = mDocShell->GetWindow()) {
       ourWindow->FullscreenWillChange(aInFullscreen);
     }
   }
 }
 
-void nsXULWindow::FullscreenChanged(bool aInFullscreen) {
+void AppWindow::FullscreenChanged(bool aInFullscreen) {
   if (mDocShell) {
     if (nsCOMPtr<nsPIDOMWindowOuter> ourWindow = mDocShell->GetWindow()) {
       ourWindow->FinishFullscreenChange(aInFullscreen);
     }
   }
 }
 
-void nsXULWindow::OcclusionStateChanged(bool aIsFullyOccluded) {
+void AppWindow::OcclusionStateChanged(bool aIsFullyOccluded) {
   nsCOMPtr<nsPIDOMWindowOuter> ourWindow =
       mDocShell ? mDocShell->GetWindow() : nullptr;
   if (ourWindow) {
     // And always fire a user-defined occlusionstatechange event on the window
     ourWindow->DispatchCustomEvent(NS_LITERAL_STRING("occlusionstatechange"));
   }
 }
 
-void nsXULWindow::OSToolbarButtonPressed() {
+void AppWindow::OSToolbarButtonPressed() {
   // Keep a reference as setting the chrome flags can fire events.
-  nsCOMPtr<nsIXULWindow> xulWindow(this);
+  nsCOMPtr<nsIAppWindow> appWindow(this);
 
   // rjc: don't use "nsIWebBrowserChrome::CHROME_EXTRA"
   //      due to components with multiple sidebar components
   //      (such as Mail/News, Addressbook, etc)... and frankly,
   //      Mac IE, OmniWeb, and other Mac OS X apps all work this way
   uint32_t chromeMask = (nsIWebBrowserChrome::CHROME_TOOLBAR |
                          nsIWebBrowserChrome::CHROME_LOCATIONBAR |
                          nsIWebBrowserChrome::CHROME_PERSONAL_TOOLBAR);
 
-  nsCOMPtr<nsIWebBrowserChrome> wbc(do_GetInterface(xulWindow));
+  nsCOMPtr<nsIWebBrowserChrome> wbc(do_GetInterface(appWindow));
   if (!wbc) return;
 
   uint32_t chromeFlags, newChromeFlags = 0;
   wbc->GetChromeFlags(&chromeFlags);
   newChromeFlags = chromeFlags & chromeMask;
   if (!newChromeFlags)
     chromeFlags |= chromeMask;
   else
     chromeFlags &= (~newChromeFlags);
   wbc->SetChromeFlags(chromeFlags);
 }
 
-bool nsXULWindow::ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
-                                nsIWidget* aRequestBelow,
-                                nsIWidget** aActualBelow) {
+bool AppWindow::ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
+                              nsIWidget* aRequestBelow,
+                              nsIWidget** aActualBelow) {
   if (aActualBelow) *aActualBelow = nullptr;
 
   return ConstrainToZLevel(aImmediate, aPlacement, aRequestBelow, aActualBelow);
 }
 
-void nsXULWindow::WindowActivated() {
-  nsCOMPtr<nsIXULWindow> xulWindow(this);
+void AppWindow::WindowActivated() {
+  nsCOMPtr<nsIAppWindow> appWindow(this);
 
   // focusing the window could cause it to close, so keep a reference to it
   nsCOMPtr<nsPIDOMWindowOuter> window =
       mDocShell ? mDocShell->GetWindow() : nullptr;
   nsFocusManager* fm = nsFocusManager::GetFocusManager();
   if (fm && window) fm->WindowRaised(window);
 
   if (mChromeLoaded) {
     PersistentAttributesDirty(PAD_POSITION | PAD_SIZE | PAD_MISC);
     SavePersistentAttributes();
   }
 }
 
-void nsXULWindow::WindowDeactivated() {
-  nsCOMPtr<nsIXULWindow> xulWindow(this);
+void AppWindow::WindowDeactivated() {
+  nsCOMPtr<nsIAppWindow> appWindow(this);
 
   nsCOMPtr<nsPIDOMWindowOuter> window =
       mDocShell ? mDocShell->GetWindow() : nullptr;
   nsFocusManager* fm = nsFocusManager::GetFocusManager();
   if (fm && window && !fm->IsTestMode()) fm->WindowLowered(window);
 }
 
 #ifdef USE_NATIVE_MENUS
@@ -2946,88 +2943,81 @@ static void LoadNativeMenus(Document* aD
     nsCOMPtr<Element> menubarContent(do_QueryInterface(menubarNode));
     nms->CreateNativeMenuBar(aParentWindow, menubarContent);
   } else {
     nms->CreateNativeMenuBar(aParentWindow, nullptr);
   }
 }
 #endif
 
-namespace mozilla {
-
-class nsXULWindowTimerCallback final : public nsITimerCallback,
-                                       public nsINamed {
+class AppWindowTimerCallback final : public nsITimerCallback, public nsINamed {
  public:
-  explicit nsXULWindowTimerCallback(nsXULWindow* aWindow) : mWindow(aWindow) {}
+  explicit AppWindowTimerCallback(AppWindow* aWindow) : mWindow(aWindow) {}
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_IMETHOD Notify(nsITimer* aTimer) override {
     // Although this object participates in a refcount cycle (this -> mWindow
     // -> mSPTimer -> this), mSPTimer is a one-shot timer and releases this
     // after it fires.  So we don't need to release mWindow here.
 
     mWindow->FirePersistenceTimer();
     return NS_OK;
   }
 
   NS_IMETHOD GetName(nsACString& aName) override {
-    aName.AssignLiteral("nsXULWindowTimerCallback");
+    aName.AssignLiteral("AppWindowTimerCallback");
     return NS_OK;
   }
 
  private:
-  ~nsXULWindowTimerCallback() {}
-
-  RefPtr<nsXULWindow> mWindow;
+  ~AppWindowTimerCallback() {}
+
+  RefPtr<AppWindow> mWindow;
 };
 
-NS_IMPL_ISUPPORTS(nsXULWindowTimerCallback, nsITimerCallback, nsINamed)
-
-}  // namespace mozilla
-
-void nsXULWindow::SetPersistenceTimer(uint32_t aDirtyFlags) {
+NS_IMPL_ISUPPORTS(AppWindowTimerCallback, nsITimerCallback, nsINamed)
+
+void AppWindow::SetPersistenceTimer(uint32_t aDirtyFlags) {
   MutexAutoLock lock(mSPTimerLock);
   if (!mSPTimer) {
     mSPTimer = NS_NewTimer();
     if (!mSPTimer) {
       NS_WARNING("Couldn't create @mozilla.org/timer;1 instance?");
       return;
     }
   }
 
-  RefPtr<nsXULWindowTimerCallback> callback =
-      new nsXULWindowTimerCallback(this);
+  RefPtr<AppWindowTimerCallback> callback = new AppWindowTimerCallback(this);
   mSPTimer->InitWithCallback(callback, SIZE_PERSISTENCE_TIMEOUT,
                              nsITimer::TYPE_ONE_SHOT);
 
   PersistentAttributesDirty(aDirtyFlags);
 }
 
-void nsXULWindow::FirePersistenceTimer() {
+void AppWindow::FirePersistenceTimer() {
   MutexAutoLock lock(mSPTimerLock);
   SavePersistentAttributes();
 }
 
 //----------------------------------------
 // nsIWebProgessListener implementation
 //----------------------------------------
 NS_IMETHODIMP
-nsXULWindow::OnProgressChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
-                              int32_t aCurSelfProgress,
-                              int32_t aMaxSelfProgress,
-                              int32_t aCurTotalProgress,
-                              int32_t aMaxTotalProgress) {
+AppWindow::OnProgressChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
+                            int32_t aCurSelfProgress, int32_t aMaxSelfProgress,
+                            int32_t aCurTotalProgress,
+                            int32_t aMaxTotalProgress) {
   MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
-                           uint32_t aStateFlags, nsresult aStatus) {
+AppWindow::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
+                         uint32_t aStateFlags, nsresult aStatus) {
   // If the notification is not about a document finishing, then just
   // ignore it...
   if (!(aStateFlags & nsIWebProgressListener::STATE_STOP) ||
       !(aStateFlags & nsIWebProgressListener::STATE_IS_NETWORK)) {
     return NS_OK;
   }
 
   if (mChromeLoaded) return NS_OK;
@@ -3058,54 +3048,54 @@ nsXULWindow::OnStateChange(nsIWebProgres
 #endif  // USE_NATIVE_MENUS
 
   OnChromeLoaded();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::OnLocationChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
-                              nsIURI* aURI, uint32_t aFlags) {
+AppWindow::OnLocationChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
+                            nsIURI* aURI, uint32_t aFlags) {
   MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
-                            nsresult aStatus, const char16_t* aMessage) {
+AppWindow::OnStatusChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
+                          nsresult aStatus, const char16_t* aMessage) {
   MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::OnSecurityChange(nsIWebProgress* aWebProgress,
-                              nsIRequest* aRequest, uint32_t aState) {
+AppWindow::OnSecurityChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
+                            uint32_t aState) {
   MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsXULWindow::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
-                                    nsIRequest* aRequest, uint32_t aEvent) {
+AppWindow::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
+                                  nsIRequest* aRequest, uint32_t aEvent) {
   MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
   return NS_OK;
 }
 
 /**
  * ExecuteCloseHandler - Run the close handler, if any.
  * @return true iff we found a close handler to run.
  */
-bool nsXULWindow::ExecuteCloseHandler() {
+bool AppWindow::ExecuteCloseHandler() {
   /* If the event handler closes this window -- a likely scenario --
      things get deleted out of order without this death grip.
      (The problem may be the death grip in nsWindow::windowProc,
      which forces this window's widget to remain alive longer
      than it otherwise would.) */
-  nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
+  nsCOMPtr<nsIAppWindow> kungFuDeathGrip(this);
 
   nsCOMPtr<EventTarget> eventTarget;
   if (mDocShell) {
     eventTarget = do_QueryInterface(mDocShell->GetWindow());
   }
 
   if (eventTarget) {
     nsCOMPtr<nsIContentViewer> contentViewer;
@@ -3122,17 +3112,17 @@ bool nsXULWindow::ExecuteCloseHandler() 
         return true;
       // else fall through and return false
     }
   }
 
   return false;
 }  // ExecuteCloseHandler
 
-void nsXULWindow::ConstrainToOpenerScreen(int32_t* aX, int32_t* aY) {
+void AppWindow::ConstrainToOpenerScreen(int32_t* aX, int32_t* aY) {
   if (mOpenerScreenRect.IsEmpty()) {
     *aX = *aY = 0;
     return;
   }
 
   int32_t left, top, width, height;
   // Constrain initial positions to the same screen as opener
   nsCOMPtr<nsIScreenManager> screenmgr =
@@ -3149,86 +3139,85 @@ void nsXULWindow::ConstrainToOpenerScree
       }
       if (*aY < top || *aY > top + height) {
         *aY = top;
       }
     }
   }
 }
 
-nsIXULWindow* nsXULWindow::WidgetListenerDelegate::GetXULWindow() {
-  return mXULWindow->GetXULWindow();
+nsIAppWindow* AppWindow::WidgetListenerDelegate::GetAppWindow() {
+  return mAppWindow->GetAppWindow();
 }
 
-PresShell* nsXULWindow::WidgetListenerDelegate::GetPresShell() {
-  return mXULWindow->GetPresShell();
+PresShell* AppWindow::WidgetListenerDelegate::GetPresShell() {
+  return mAppWindow->GetPresShell();
 }
 
-bool nsXULWindow::WidgetListenerDelegate::WindowMoved(nsIWidget* aWidget,
-                                                      int32_t aX, int32_t aY) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+bool AppWindow::WidgetListenerDelegate::WindowMoved(nsIWidget* aWidget,
+                                                    int32_t aX, int32_t aY) {
+  RefPtr<AppWindow> holder = mAppWindow;
   return holder->WindowMoved(aWidget, aX, aY);
 }
 
-bool nsXULWindow::WidgetListenerDelegate::WindowResized(nsIWidget* aWidget,
-                                                        int32_t aWidth,
-                                                        int32_t aHeight) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+bool AppWindow::WidgetListenerDelegate::WindowResized(nsIWidget* aWidget,
+                                                      int32_t aWidth,
+                                                      int32_t aHeight) {
+  RefPtr<AppWindow> holder = mAppWindow;
   return holder->WindowResized(aWidget, aWidth, aHeight);
 }
 
-bool nsXULWindow::WidgetListenerDelegate::RequestWindowClose(
-    nsIWidget* aWidget) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+bool AppWindow::WidgetListenerDelegate::RequestWindowClose(nsIWidget* aWidget) {
+  RefPtr<AppWindow> holder = mAppWindow;
   return holder->RequestWindowClose(aWidget);
 }
 
-void nsXULWindow::WidgetListenerDelegate::SizeModeChanged(
-    nsSizeMode aSizeMode) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+void AppWindow::WidgetListenerDelegate::SizeModeChanged(nsSizeMode aSizeMode) {
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->SizeModeChanged(aSizeMode);
 }
 
-void nsXULWindow::WidgetListenerDelegate::UIResolutionChanged() {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+void AppWindow::WidgetListenerDelegate::UIResolutionChanged() {
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->UIResolutionChanged();
 }
 
-void nsXULWindow::WidgetListenerDelegate::FullscreenWillChange(
+void AppWindow::WidgetListenerDelegate::FullscreenWillChange(
     bool aInFullscreen) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->FullscreenWillChange(aInFullscreen);
 }
 
-void nsXULWindow::WidgetListenerDelegate::FullscreenChanged(
-    bool aInFullscreen) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+void AppWindow::WidgetListenerDelegate::FullscreenChanged(bool aInFullscreen) {
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->FullscreenChanged(aInFullscreen);
 }
 
-void nsXULWindow::WidgetListenerDelegate::OcclusionStateChanged(
+void AppWindow::WidgetListenerDelegate::OcclusionStateChanged(
     bool aIsFullyOccluded) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->OcclusionStateChanged(aIsFullyOccluded);
 }
 
-void nsXULWindow::WidgetListenerDelegate::OSToolbarButtonPressed() {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+void AppWindow::WidgetListenerDelegate::OSToolbarButtonPressed() {
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->OSToolbarButtonPressed();
 }
 
-bool nsXULWindow::WidgetListenerDelegate::ZLevelChanged(
+bool AppWindow::WidgetListenerDelegate::ZLevelChanged(
     bool aImmediate, nsWindowZ* aPlacement, nsIWidget* aRequestBelow,
     nsIWidget** aActualBelow) {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+  RefPtr<AppWindow> holder = mAppWindow;
   return holder->ZLevelChanged(aImmediate, aPlacement, aRequestBelow,
                                aActualBelow);
 }
 
-void nsXULWindow::WidgetListenerDelegate::WindowActivated() {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+void AppWindow::WidgetListenerDelegate::WindowActivated() {
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->WindowActivated();
 }
 
-void nsXULWindow::WidgetListenerDelegate::WindowDeactivated() {
-  RefPtr<nsXULWindow> holder = mXULWindow;
+void AppWindow::WidgetListenerDelegate::WindowDeactivated() {
+  RefPtr<AppWindow> holder = mAppWindow;
   holder->WindowDeactivated();
 }
+
+}  // namespace mozilla
rename from xpfe/appshell/nsXULWindow.h
rename to xpfe/appshell/AppWindow.h
--- a/xpfe/appshell/nsXULWindow.h
+++ b/xpfe/appshell/AppWindow.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * 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/. */
 
-#ifndef nsXULWindow_h__
-#define nsXULWindow_h__
+#ifndef mozilla_AppWindow_h__
+#define mozilla_AppWindow_h__
 
 // Local Includes
 #include "nsChromeTreeOwner.h"
 #include "nsContentTreeOwner.h"
 
 // Helper classes
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
@@ -22,17 +22,17 @@
 #include "mozilla/Mutex.h"
 
 // Interfaces needed
 #include "nsIBaseWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
 #include "nsIXULBrowserWindow.h"
 #include "nsIWidgetListener.h"
 #include "nsIRemoteTab.h"
 #include "nsIWebProgressListener.h"
 #include "nsITimer.h"
 
@@ -47,49 +47,51 @@ class Element;
 }  // namespace mozilla
 
 class nsAtom;
 class nsXULTooltipListener;
 struct nsWidgetInitData;
 
 namespace mozilla {
 class PresShell;
-class nsXULWindowTimerCallback;
+class AppWindowTimerCallback;
 }  // namespace mozilla
 
-// nsXULWindow
+// AppWindow
 
-#define NS_XULWINDOW_IMPL_CID                        \
+#define NS_APPWINDOW_IMPL_CID                        \
   { /* 8eaec2f3-ed02-4be2-8e0f-342798477298 */       \
     0x8eaec2f3, 0xed02, 0x4be2, {                    \
       0x8e, 0x0f, 0x34, 0x27, 0x98, 0x47, 0x72, 0x98 \
     }                                                \
   }
 
 class nsContentShellInfo;
 
-class nsXULWindow final : public nsIBaseWindow,
-                          public nsIInterfaceRequestor,
-                          public nsIXULWindow,
-                          public nsSupportsWeakReference,
-                          public nsIWebProgressListener {
-  friend class nsChromeTreeOwner;
-  friend class nsContentTreeOwner;
+namespace mozilla {
+
+class AppWindow final : public nsIBaseWindow,
+                        public nsIInterfaceRequestor,
+                        public nsIAppWindow,
+                        public nsSupportsWeakReference,
+                        public nsIWebProgressListener {
+  friend class ::nsChromeTreeOwner;
+  friend class ::nsContentTreeOwner;
 
  public:
   // The implementation of non-refcounted nsIWidgetListener, which would hold a
-  // strong reference on stack before calling nsXULWindow's
+  // strong reference on stack before calling AppWindow's
   // MOZ_CAN_RUN_SCRIPT methods.
   class WidgetListenerDelegate : public nsIWidgetListener {
    public:
-    explicit WidgetListenerDelegate(nsXULWindow* aXULWindow)
-        : mXULWindow(aXULWindow) {}
+    explicit WidgetListenerDelegate(AppWindow* aAppWindow)
+        : mAppWindow(aAppWindow) {}
 
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
-    virtual nsIXULWindow* GetXULWindow() override;
+    virtual nsIAppWindow* GetAppWindow() override;
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
     virtual mozilla::PresShell* GetPresShell() override;
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
     virtual bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) override;
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
     virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth,
                                int32_t aHeight) override;
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
@@ -111,49 +113,49 @@ class nsXULWindow final : public nsIBase
                                nsIWidget* aRequestBelow,
                                nsIWidget** aActualBelow) override;
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
     virtual void WindowActivated() override;
     MOZ_CAN_RUN_SCRIPT_BOUNDARY
     virtual void WindowDeactivated() override;
 
    private:
-    // The lifetime of WidgetListenerDelegate is bound to nsXULWindow so
+    // The lifetime of WidgetListenerDelegate is bound to AppWindow so
     // we just use a raw pointer here.
-    nsXULWindow* mXULWindow;
+    AppWindow* mAppWindow;
   };
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSIINTERFACEREQUESTOR
-  NS_DECL_NSIXULWINDOW
+  NS_DECL_NSIAPPWINDOW
   NS_DECL_NSIBASEWINDOW
 
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULWINDOW_IMPL_CID)
+  NS_DECLARE_STATIC_IID_ACCESSOR(NS_APPWINDOW_IMPL_CID)
 
   void LockUntilChromeLoad() { mLockedUntilChromeLoad = true; }
   bool IsLocked() const { return mLockedUntilChromeLoad; }
   void IgnoreXULSizeMode(bool aEnable) { mIgnoreXULSizeMode = aEnable; }
   void WasRegistered() { mRegistered = true; }
 
-  // nsXULWindow methods...
-  nsresult Initialize(nsIXULWindow* aParent, nsIXULWindow* aOpener,
+  // AppWindow methods...
+  nsresult Initialize(nsIAppWindow* aParent, nsIAppWindow* aOpener,
                       nsIURI* aUrl, int32_t aInitialWidth,
                       int32_t aInitialHeight, bool aIsHiddenWindow,
                       nsIRemoteTab* aOpeningTab,
                       mozIDOMWindowProxy* aOpenerWIndow,
                       nsWidgetInitData& widgetInitData);
 
   nsresult Toolbar();
 
   // nsIWebProgressListener
   NS_DECL_NSIWEBPROGRESSLISTENER
 
   // nsIWidgetListener methods for WidgetListenerDelegate.
-  nsIXULWindow* GetXULWindow() { return this; }
+  nsIAppWindow* GetAppWindow() { return this; }
   mozilla::PresShell* GetPresShell();
   MOZ_CAN_RUN_SCRIPT
   bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY);
   MOZ_CAN_RUN_SCRIPT
   bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight);
   MOZ_CAN_RUN_SCRIPT bool RequestWindowClose(nsIWidget* aWidget);
   MOZ_CAN_RUN_SCRIPT void SizeModeChanged(nsSizeMode aSizeMode);
   MOZ_CAN_RUN_SCRIPT void UIResolutionChanged();
@@ -162,28 +164,28 @@ class nsXULWindow final : public nsIBase
   MOZ_CAN_RUN_SCRIPT void OcclusionStateChanged(bool aIsFullyOccluded);
   MOZ_CAN_RUN_SCRIPT void OSToolbarButtonPressed();
   MOZ_CAN_RUN_SCRIPT
   bool ZLevelChanged(bool aImmediate, nsWindowZ* aPlacement,
                      nsIWidget* aRequestBelow, nsIWidget** aActualBelow);
   MOZ_CAN_RUN_SCRIPT void WindowActivated();
   MOZ_CAN_RUN_SCRIPT void WindowDeactivated();
 
-  explicit nsXULWindow(uint32_t aChromeFlags);
+  explicit AppWindow(uint32_t aChromeFlags);
 
  protected:
   enum persistentAttributes {
     PAD_MISC = 0x1,
     PAD_POSITION = 0x2,
     PAD_SIZE = 0x4
   };
 
-  virtual ~nsXULWindow();
+  virtual ~AppWindow();
 
-  friend class mozilla::nsXULWindowTimerCallback;
+  friend class mozilla::AppWindowTimerCallback;
 
   bool ExecuteCloseHandler();
   void ConstrainToOpenerScreen(int32_t* aX, int32_t* aY);
 
   void SetPersistenceTimer(uint32_t aDirtyFlags);
   void FirePersistenceTimer();
 
   NS_IMETHOD EnsureChromeTreeOwner();
@@ -222,29 +224,29 @@ class nsXULWindow final : public nsIBase
   nsresult SetRootShellSize(int32_t aWidth, int32_t aHeight);
 
   NS_IMETHOD SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
                          int32_t aCY);
   NS_IMETHOD ExitModalLoop(nsresult aStatus);
   NS_IMETHOD CreateNewChromeWindow(int32_t aChromeFlags,
                                    nsIRemoteTab* aOpeningTab,
                                    mozIDOMWindowProxy* aOpenerWindow,
-                                   nsIXULWindow** _retval);
+                                   nsIAppWindow** _retval);
   NS_IMETHOD CreateNewContentWindow(int32_t aChromeFlags,
                                     nsIRemoteTab* aOpeningTab,
                                     mozIDOMWindowProxy* aOpenerWindow,
                                     uint64_t aNextRemoteTabId,
-                                    nsIXULWindow** _retval);
+                                    nsIAppWindow** _retval);
   NS_IMETHOD GetHasPrimaryContent(bool* aResult);
 
   void EnableParent(bool aEnable);
   bool ConstrainToZLevel(bool aImmediate, nsWindowZ* aPlacement,
                          nsIWidget* aReqBelow, nsIWidget** aActualBelow);
   void PlaceWindowLayersBehind(uint32_t aLowLevel, uint32_t aHighLevel,
-                               nsIXULWindow* aBehind);
+                               nsIAppWindow* aBehind);
   void SetContentScrollbarVisibility(bool aVisible);
   bool GetContentScrollbarVisibility();
   void PersistentAttributesDirty(uint32_t aDirtyFlags);
   nsresult GetTabCount(uint32_t* aResult);
 
   void LoadPersistentWindowState();
   nsresult GetPersistentValue(const nsAtom* aAttr, nsAString& aValue);
   nsresult SetPersistentValue(const nsAtom* aAttr, const nsAString& aValue);
@@ -299,10 +301,13 @@ class nsXULWindow final : public nsIBase
   GetPrimaryRemoteTabSize(int32_t* aWidth, int32_t* aHeight);
   nsresult GetPrimaryContentShellSize(int32_t* aWidth, int32_t* aHeight);
   nsresult SetPrimaryRemoteTabSize(int32_t aWidth, int32_t aHeight);
 #ifndef MOZ_NEW_XULSTORE
   nsCOMPtr<nsIXULStore> mLocalStore;
 #endif
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsXULWindow, NS_XULWINDOW_IMPL_CID)
-#endif /* nsXULWindow_h__ */
+NS_DEFINE_STATIC_IID_ACCESSOR(AppWindow, NS_APPWINDOW_IMPL_CID)
+
+}  // namespace mozilla
+
+#endif /* mozilla_AppWindow_h__ */
--- a/xpfe/appshell/moz.build
+++ b/xpfe/appshell/moz.build
@@ -6,37 +6,37 @@
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "Window Management")
 
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 
 XPIDL_SOURCES += [
     'nsIAppShellService.idl',
+    'nsIAppWindow.idl',
     'nsIWindowlessBrowser.idl',
     'nsIWindowMediator.idl',
     'nsIWindowMediatorListener.idl',
     'nsIXULBrowserWindow.idl',
-    'nsIXULWindow.idl',
 ]
 
 XPIDL_MODULE = 'appshell'
 
 EXPORTS += [
     'LiveResizeListener.h',
     'nsAppShellCID.h',
 ]
 
 UNIFIED_SOURCES += [
+    'AppWindow.cpp',
     'nsAppShellService.cpp',
     'nsAppShellWindowEnumerator.cpp',
     'nsChromeTreeOwner.cpp',
     'nsContentTreeOwner.cpp',
     'nsWindowMediator.cpp',
-    'nsXULWindow.cpp',
 ]
 
 XPCOM_MANIFESTS += [
     'components.conf',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
--- a/xpfe/appshell/nsAppShellService.cpp
+++ b/xpfe/appshell/nsAppShellService.cpp
@@ -12,17 +12,17 @@
 #include "nsIObserver.h"
 #include "nsIXPConnect.h"
 #include "nsIXULRuntime.h"
 
 #include "nsIWindowMediator.h"
 #include "nsIWindowWatcher.h"
 #include "nsPIWindowWatcher.h"
 #include "nsPIDOMWindow.h"
-#include "nsXULWindow.h"
+#include "AppWindow.h"
 
 #include "nsWidgetInitData.h"
 #include "nsWidgetsCID.h"
 #include "nsIWidget.h"
 #include "nsIRequestObserver.h"
 #include "nsIEmbeddingSiteWindow.h"
 
 #include "nsAppDirectoryServiceDefs.h"
@@ -128,17 +128,17 @@ nsAppShellService::CreateHiddenWindow() 
   static const char hiddenWindowURL[] = DEFAULT_HIDDENWINDOW_URL;
   uint32_t chromeMask = nsIWebBrowserChrome::CHROME_ALL;
 #endif
 
   nsCOMPtr<nsIURI> url;
   rv = NS_NewURI(getter_AddRefs(url), hiddenWindowURL);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  RefPtr<nsXULWindow> newWindow;
+  RefPtr<AppWindow> newWindow;
   rv =
       JustCreateTopWindow(nullptr, url, chromeMask, initialWidth, initialHeight,
                           true, nullptr, nullptr, getter_AddRefs(newWindow));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIDocShell> docShell;
   newWindow->GetDocShell(getter_AddRefs(docShell));
   if (docShell) {
@@ -161,35 +161,35 @@ nsAppShellService::DestroyHiddenWindow()
   return NS_OK;
 }
 
 /*
  * Create a new top level window and display the given URL within it...
  */
 NS_IMETHODIMP
 nsAppShellService::CreateTopLevelWindow(
-    nsIXULWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
+    nsIAppWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
     int32_t aInitialWidth, int32_t aInitialHeight, nsIRemoteTab* aOpeningTab,
-    mozIDOMWindowProxy* aOpenerWindow, nsIXULWindow** aResult)
+    mozIDOMWindowProxy* aOpenerWindow, nsIAppWindow** aResult)
 
 {
   nsresult rv;
 
   StartupTimeline::RecordOnce(StartupTimeline::CREATE_TOP_LEVEL_WINDOW);
 
-  RefPtr<nsXULWindow> newWindow;
+  RefPtr<AppWindow> newWindow;
   rv = JustCreateTopWindow(aParent, aUrl, aChromeMask, aInitialWidth,
                            aInitialHeight, false, aOpeningTab, aOpenerWindow,
                            getter_AddRefs(newWindow));
   newWindow.forget(aResult);
 
   if (NS_SUCCEEDED(rv)) {
     // the addref resulting from this is the owning addref for this window
     RegisterTopLevelWindow(*aResult);
-    nsCOMPtr<nsIXULWindow> parent;
+    nsCOMPtr<nsIAppWindow> parent;
     if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) parent = aParent;
     (*aResult)->SetZLevel(CalculateWindowZLevel(parent, aChromeMask));
   }
 
   return rv;
 }
 
 /*
@@ -480,25 +480,25 @@ nsAppShellService::CreateWindowlessBrows
   RefPtr<nsIWindowlessBrowser> result = new WindowlessBrowser(browser, isstub);
   nsCOMPtr<nsIDocShell> docshell = do_GetInterface(result);
   docshell->SetInvisible(true);
 
   result.forget(aResult);
   return NS_OK;
 }
 
-uint32_t nsAppShellService::CalculateWindowZLevel(nsIXULWindow* aParent,
+uint32_t nsAppShellService::CalculateWindowZLevel(nsIAppWindow* aParent,
                                                   uint32_t aChromeMask) {
   uint32_t zLevel;
 
-  zLevel = nsIXULWindow::normalZ;
+  zLevel = nsIAppWindow::normalZ;
   if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_RAISED)
-    zLevel = nsIXULWindow::raisedZ;
+    zLevel = nsIAppWindow::raisedZ;
   else if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_LOWERED)
-    zLevel = nsIXULWindow::loweredZ;
+    zLevel = nsIAppWindow::loweredZ;
 
 #ifdef XP_MACOSX
   /* Platforms on which modal windows are always application-modal, not
      window-modal (that's just the Mac, right?) want modal windows to
      be stacked on top of everyone else.
 
      On Mac OS X, bind modality to parent window instead of app (ala Mac OS 9)
   */
@@ -523,17 +523,17 @@ uint32_t nsAppShellService::CalculateWin
 /*
  * Checks to see if any existing window is currently in fullscreen mode.
  */
 static bool CheckForFullscreenWindow() {
   nsCOMPtr<nsIWindowMediator> wm(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!wm) return false;
 
   nsCOMPtr<nsISimpleEnumerator> windowList;
-  wm->GetXULWindowEnumerator(nullptr, getter_AddRefs(windowList));
+  wm->GetAppWindowEnumerator(nullptr, getter_AddRefs(windowList));
   if (!windowList) return false;
 
   for (;;) {
     bool more = false;
     windowList->HasMoreElements(&more);
     if (!more) return false;
 
     nsCOMPtr<nsISupports> supportsWindow;
@@ -550,27 +550,27 @@ static bool CheckForFullscreenWindow() {
   return false;
 }
 #endif
 
 /*
  * Just do the window-making part of CreateTopLevelWindow
  */
 nsresult nsAppShellService::JustCreateTopWindow(
-    nsIXULWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
+    nsIAppWindow* aParent, nsIURI* aUrl, uint32_t aChromeMask,
     int32_t aInitialWidth, int32_t aInitialHeight, bool aIsHiddenWindow,
     nsIRemoteTab* aOpeningTab, mozIDOMWindowProxy* aOpenerWindow,
-    nsXULWindow** aResult) {
+    AppWindow** aResult) {
   *aResult = nullptr;
   NS_ENSURE_STATE(!mXPCOMWillShutDown);
 
-  nsCOMPtr<nsIXULWindow> parent;
+  nsCOMPtr<nsIAppWindow> parent;
   if (aChromeMask & nsIWebBrowserChrome::CHROME_DEPENDENT) parent = aParent;
 
-  RefPtr<nsXULWindow> window = new nsXULWindow(aChromeMask);
+  RefPtr<AppWindow> window = new AppWindow(aChromeMask);
 
 #ifdef XP_WIN
   // If the parent is currently fullscreen, tell the child to ignore persisted
   // full screen states. This way new browser windows open on top of fullscreen
   // windows normally.
   if (window && CheckForFullscreenWindow()) window->IgnoreXULSizeMode(true);
 #endif
 
@@ -732,17 +732,17 @@ nsresult nsAppShellService::JustCreateTo
   if (parent) parent->AddChildWindow(*aResult);
 
   if (center) rv = (*aResult)->Center(parent, parent ? false : true, false);
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsAppShellService::GetHiddenWindow(nsIXULWindow** aWindow) {
+nsAppShellService::GetHiddenWindow(nsIAppWindow** aWindow) {
   NS_ENSURE_ARG_POINTER(aWindow);
 
   EnsureHiddenWindow();
 
   *aWindow = mHiddenWindow;
   NS_IF_ADDREF(*aWindow);
   return *aWindow ? NS_OK : NS_ERROR_FAILURE;
 }
@@ -779,17 +779,17 @@ nsAppShellService::GetApplicationProvide
   *aAPHW = mApplicationProvidedHiddenWindow;
   return NS_OK;
 }
 
 /*
  * Register a new top level window (created elsewhere)
  */
 NS_IMETHODIMP
-nsAppShellService::RegisterTopLevelWindow(nsIXULWindow* aWindow) {
+nsAppShellService::RegisterTopLevelWindow(nsIAppWindow* aWindow) {
   NS_ENSURE_ARG_POINTER(aWindow);
 
   nsCOMPtr<nsIDocShell> docShell;
   aWindow->GetDocShell(getter_AddRefs(docShell));
   NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsPIDOMWindowOuter> domWindow(docShell->GetWindow());
   NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
@@ -811,25 +811,25 @@ nsAppShellService::RegisterTopLevelWindo
   }
 
   // an ongoing attempt to quit is stopped by a newly opened window
   nsCOMPtr<nsIObserverService> obssvc = services::GetObserverService();
   NS_ASSERTION(obssvc, "Couldn't get observer service.");
 
   if (obssvc) {
     obssvc->NotifyObservers(aWindow, "xul-window-registered", nullptr);
-    nsXULWindow* xulWindow = static_cast<nsXULWindow*>(aWindow);
-    xulWindow->WasRegistered();
+    AppWindow* appWindow = static_cast<AppWindow*>(aWindow);
+    appWindow->WasRegistered();
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAppShellService::UnregisterTopLevelWindow(nsIXULWindow* aWindow) {
+nsAppShellService::UnregisterTopLevelWindow(nsIAppWindow* aWindow) {
   if (mXPCOMShuttingDown) {
     /* return an error code in order to:
        - avoid doing anything with other member variables while we are in
          the destructor
        - notify the caller not to release the AppShellService after
          unregistering the window
          (we don't want to be deleted twice consecutively to
          mHiddenWindow->Destroy() in our destructor)
--- a/xpfe/appshell/nsAppShellService.h
+++ b/xpfe/appshell/nsAppShellService.h
@@ -5,17 +5,17 @@
 
 #ifndef __nsAppShellService_h
 #define __nsAppShellService_h
 
 #include "nsIAppShellService.h"
 #include "nsIObserver.h"
 
 // Interfaces Needed
-#include "nsXULWindow.h"
+#include "AppWindow.h"
 #include "nsStringFwd.h"
 #include "nsAutoPtr.h"
 #include "nsIRemoteTab.h"
 #include "mozilla/Attributes.h"
 
 // {0099907D-123C-4853-A46A-43098B5FB68C}
 #define NS_APPSHELLSERVICE_CID                      \
   {                                                 \
@@ -32,25 +32,25 @@ class nsAppShellService final : public n
 
   nsAppShellService();
 
  protected:
   ~nsAppShellService();
 
   void EnsureHiddenWindow();
 
-  nsresult JustCreateTopWindow(nsIXULWindow* aParent, nsIURI* aUrl,
+  nsresult JustCreateTopWindow(nsIAppWindow* aParent, nsIURI* aUrl,
                                uint32_t aChromeMask, int32_t aInitialWidth,
                                int32_t aInitialHeight, bool aIsHiddenWindow,
                                nsIRemoteTab* aOpeningTab,
                                mozIDOMWindowProxy* aOpenerWindow,
-                               nsXULWindow** aResult);
-  uint32_t CalculateWindowZLevel(nsIXULWindow* aParent, uint32_t aChromeMask);
+                               mozilla::AppWindow** aResult);
+  uint32_t CalculateWindowZLevel(nsIAppWindow* aParent, uint32_t aChromeMask);
 
-  RefPtr<nsXULWindow> mHiddenWindow;
+  RefPtr<mozilla::AppWindow> mHiddenWindow;
   bool mXPCOMWillShutDown;
   bool mXPCOMShuttingDown;
   uint16_t mModalWindowCount;
   bool mApplicationProvidedHiddenWindow;
   uint32_t mScreenId;
 };
 
 #endif
--- a/xpfe/appshell/nsAppShellWindowEnumerator.cpp
+++ b/xpfe/appshell/nsAppShellWindowEnumerator.cpp
@@ -6,71 +6,71 @@
 #include "nsAppShellWindowEnumerator.h"
 
 #include "nsIContentViewer.h"
 #include "nsIDocShell.h"
 #include "mozilla/dom/Document.h"
 #include "nsIFactory.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 #include "mozilla/dom/Element.h"
 
 #include "nsWindowMediator.h"
 
 using mozilla::dom::Document;
 using mozilla::dom::Element;
 
 //
 // static helper functions
 //
 
-static void GetAttribute(nsIXULWindow* inWindow, const nsAString& inAttribute,
+static void GetAttribute(nsIAppWindow* inWindow, const nsAString& inAttribute,
                          nsAString& outValue);
-static void GetWindowType(nsIXULWindow* inWindow, nsString& outType);
+static void GetWindowType(nsIAppWindow* inWindow, nsString& outType);
 
 static Element* GetElementFromDocShell(nsIDocShell* aShell) {
   nsCOMPtr<nsIContentViewer> cv;
   aShell->GetContentViewer(getter_AddRefs(cv));
   if (cv) {
     RefPtr<Document> doc = cv->GetDocument();
     if (doc) {
       return doc->GetDocumentElement();
     }
   }
 
   return nullptr;
 }
 
 // generic "retrieve the value of a XUL attribute" function
-void GetAttribute(nsIXULWindow* inWindow, const nsAString& inAttribute,
+void GetAttribute(nsIAppWindow* inWindow, const nsAString& inAttribute,
                   nsAString& outValue) {
   nsCOMPtr<nsIDocShell> shell;
   if (inWindow && NS_SUCCEEDED(inWindow->GetDocShell(getter_AddRefs(shell)))) {
     RefPtr<Element> webshellElement = GetElementFromDocShell(shell);
     if (webshellElement) {
       webshellElement->GetAttribute(inAttribute, outValue);
     }
   }
 }
 
 // retrieve the window type, stored as the value of a particular
 // attribute in its XUL window tag
-void GetWindowType(nsIXULWindow* aWindow, nsString& outType) {
+void GetWindowType(nsIAppWindow* aWindow, nsString& outType) {
   GetAttribute(aWindow, NS_LITERAL_STRING("windowtype"), outType);
 }
 
 //
 // nsWindowInfo
 //
 
-nsWindowInfo::nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp)
+nsWindowInfo::nsWindowInfo(nsIAppWindow* inWindow, int32_t inTimeStamp)
     : mWindow(inWindow),
       mTimeStamp(inTimeStamp),
-      mZLevel(nsIXULWindow::normalZ) {
+      mZLevel(nsIAppWindow::normalZ) {
   ReferenceSelf(true, true);
 }
 
 nsWindowInfo::~nsWindowInfo() {}
 
 // return true if the window described by this WindowInfo has a type
 // equal to the given type
 bool nsWindowInfo::TypeEquals(const nsAString& aType) {
@@ -182,26 +182,26 @@ NS_IMETHODIMP nsASDOMWindowEnumerator::G
     nsWindowMediator::GetDOMWindow(mCurrentPosition->mWindow, domWindow);
     mCurrentPosition = FindNext();
     if (domWindow) return CallQueryInterface(domWindow, retval);
   }
   return NS_ERROR_FAILURE;
 }
 
 //
-// nsASXULWindowEnumerator
+// nsASAppWindowEnumerator
 //
 
-nsASXULWindowEnumerator::nsASXULWindowEnumerator(const char16_t* aTypeString,
+nsASAppWindowEnumerator::nsASAppWindowEnumerator(const char16_t* aTypeString,
                                                  nsWindowMediator& aMediator)
     : nsAppShellWindowEnumerator(aTypeString, aMediator) {}
 
-nsASXULWindowEnumerator::~nsASXULWindowEnumerator() {}
+nsASAppWindowEnumerator::~nsASAppWindowEnumerator() {}
 
-NS_IMETHODIMP nsASXULWindowEnumerator::GetNext(nsISupports** retval) {
+NS_IMETHODIMP nsASAppWindowEnumerator::GetNext(nsISupports** retval) {
   if (!retval) return NS_ERROR_INVALID_ARG;
 
   *retval = nullptr;
   if (mCurrentPosition) {
     CallQueryInterface(mCurrentPosition->mWindow, retval);
     mCurrentPosition = FindNext();
     return NS_OK;
   }
@@ -220,44 +220,44 @@ nsASDOMWindowEarlyToLateEnumerator::nsAS
 }
 
 nsASDOMWindowEarlyToLateEnumerator::~nsASDOMWindowEarlyToLateEnumerator() {}
 
 nsWindowInfo* nsASDOMWindowEarlyToLateEnumerator::FindNext() {
   nsWindowInfo *info, *listEnd;
   bool allWindows = mType.IsEmpty();
 
-  // see nsXULWindowEarlyToLateEnumerator::FindNext
+  // see AppWindowEarlyToLateEnumerator::FindNext
   if (!mCurrentPosition) return nullptr;
 
   info = mCurrentPosition->mYounger;
   listEnd = mWindowMediator->mOldestWindow;
 
   while (info != listEnd) {
     if (allWindows || info->TypeEquals(mType)) return info;
     info = info->mYounger;
   }
 
   return nullptr;
 }
 
 //
-// nsASXULWindowEarlyToLateEnumerator
+// nsASAppWindowEarlyToLateEnumerator
 //
 
-nsASXULWindowEarlyToLateEnumerator::nsASXULWindowEarlyToLateEnumerator(
+nsASAppWindowEarlyToLateEnumerator::nsASAppWindowEarlyToLateEnumerator(
     const char16_t* aTypeString, nsWindowMediator& aMediator)
-    : nsASXULWindowEnumerator(aTypeString, aMediator) {
+    : nsASAppWindowEnumerator(aTypeString, aMediator) {
   mCurrentPosition = aMediator.mOldestWindow;
   AdjustInitialPosition();
 }
 
-nsASXULWindowEarlyToLateEnumerator::~nsASXULWindowEarlyToLateEnumerator() {}
+nsASAppWindowEarlyToLateEnumerator::~nsASAppWindowEarlyToLateEnumerator() {}
 
-nsWindowInfo* nsASXULWindowEarlyToLateEnumerator::FindNext() {
+nsWindowInfo* nsASAppWindowEarlyToLateEnumerator::FindNext() {
   nsWindowInfo *info, *listEnd;
   bool allWindows = mType.IsEmpty();
 
   /* mCurrentPosition null is assumed to mean that the enumerator has run
      its course and is now basically useless. It could also be interpreted
      to mean that it was created at a time when there were no windows. In
      that case it would probably be more appropriate to check to see whether
      windows have subsequently been added. But it's not guaranteed that we'll
@@ -272,65 +272,65 @@ nsWindowInfo* nsASXULWindowEarlyToLateEn
     if (allWindows || info->TypeEquals(mType)) return info;
     info = info->mYounger;
   }
 
   return nullptr;
 }
 
 //
-// nsASXULWindowFrontToBackEnumerator
+// nsASAppWindowFrontToBackEnumerator
 //
 
-nsASXULWindowFrontToBackEnumerator::nsASXULWindowFrontToBackEnumerator(
+nsASAppWindowFrontToBackEnumerator::nsASAppWindowFrontToBackEnumerator(
     const char16_t* aTypeString, nsWindowMediator& aMediator)
-    : nsASXULWindowEnumerator(aTypeString, aMediator) {
+    : nsASAppWindowEnumerator(aTypeString, aMediator) {
   mCurrentPosition = aMediator.mTopmostWindow;
   AdjustInitialPosition();
 }
 
-nsASXULWindowFrontToBackEnumerator::~nsASXULWindowFrontToBackEnumerator() {}
+nsASAppWindowFrontToBackEnumerator::~nsASAppWindowFrontToBackEnumerator() {}
 
-nsWindowInfo* nsASXULWindowFrontToBackEnumerator::FindNext() {
+nsWindowInfo* nsASAppWindowFrontToBackEnumerator::FindNext() {
   nsWindowInfo *info, *listEnd;
   bool allWindows = mType.IsEmpty();
 
-  // see nsXULWindowEarlyToLateEnumerator::FindNext
+  // see AppWindowEarlyToLateEnumerator::FindNext
   if (!mCurrentPosition) return nullptr;
 
   info = mCurrentPosition->mLower;
   listEnd = mWindowMediator->mTopmostWindow;
 
   while (info != listEnd) {
     if (allWindows || info->TypeEquals(mType)) return info;
     info = info->mLower;
   }
 
   return nullptr;
 }
 
 //
-// nsASXULWindowBackToFrontEnumerator
+// nsASAppWindowBackToFrontEnumerator
 //
 
-nsASXULWindowBackToFrontEnumerator::nsASXULWindowBackToFrontEnumerator(
+nsASAppWindowBackToFrontEnumerator::nsASAppWindowBackToFrontEnumerator(
     const char16_t* aTypeString, nsWindowMediator& aMediator)
-    : nsASXULWindowEnumerator(aTypeString, aMediator) {
+    : nsASAppWindowEnumerator(aTypeString, aMediator) {
   mCurrentPosition =
       aMediator.mTopmostWindow ? aMediator.mTopmostWindow->mHigher : nullptr;
   AdjustInitialPosition();
 }
 
-nsASXULWindowBackToFrontEnumerator::~nsASXULWindowBackToFrontEnumerator() {}
+nsASAppWindowBackToFrontEnumerator::~nsASAppWindowBackToFrontEnumerator() {}
 
-nsWindowInfo* nsASXULWindowBackToFrontEnumerator::FindNext() {
+nsWindowInfo* nsASAppWindowBackToFrontEnumerator::FindNext() {
   nsWindowInfo *info, *listEnd;
   bool allWindows = mType.IsEmpty();
 
-  // see nsXULWindowEarlyToLateEnumerator::FindNext
+  // see AppWindowEarlyToLateEnumerator::FindNext
   if (!mCurrentPosition) return nullptr;
 
   info = mCurrentPosition->mHigher;
   listEnd = mWindowMediator->mTopmostWindow;
   if (listEnd) listEnd = listEnd->mHigher;
 
   while (info != listEnd) {
     if (allWindows || info->TypeEquals(mType)) return info;
--- a/xpfe/appshell/nsAppShellWindowEnumerator.h
+++ b/xpfe/appshell/nsAppShellWindowEnumerator.h
@@ -5,29 +5,29 @@
 
 #ifndef nsAppShellWindowEnumerator_h
 #define nsAppShellWindowEnumerator_h
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
 #include "nsSimpleEnumerator.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 
 class nsWindowMediator;
 
 //
 // nsWindowInfo
 //
 
 struct nsWindowInfo {
-  nsWindowInfo(nsIXULWindow* inWindow, int32_t inTimeStamp);
+  nsWindowInfo(nsIAppWindow* inWindow, int32_t inTimeStamp);
   ~nsWindowInfo();
 
-  nsCOMPtr<nsIXULWindow> mWindow;
+  nsCOMPtr<nsIAppWindow> mWindow;
   int32_t mTimeStamp;
   uint32_t mZLevel;
 
   // each struct is in two, independent, circular, doubly-linked lists
   nsWindowInfo *mYounger,  // next younger in sequence
       *mOlder;
   nsWindowInfo *mLower,  // next lower in z-order
       *mHigher;
@@ -67,24 +67,24 @@ class nsAppShellWindowEnumerator : publi
 class nsASDOMWindowEnumerator : public nsAppShellWindowEnumerator {
  public:
   nsASDOMWindowEnumerator(const char16_t* aTypeString,
                           nsWindowMediator& inMediator);
   virtual ~nsASDOMWindowEnumerator();
   NS_IMETHOD GetNext(nsISupports** retval) override;
 };
 
-class nsASXULWindowEnumerator : public nsAppShellWindowEnumerator {
+class nsASAppWindowEnumerator : public nsAppShellWindowEnumerator {
  public:
-  nsASXULWindowEnumerator(const char16_t* aTypeString,
+  nsASAppWindowEnumerator(const char16_t* aTypeString,
                           nsWindowMediator& inMediator);
-  virtual ~nsASXULWindowEnumerator();
+  virtual ~nsASAppWindowEnumerator();
   NS_IMETHOD GetNext(nsISupports** retval) override;
 
-  const nsID& DefaultInterface() override { return NS_GET_IID(nsIXULWindow); }
+  const nsID& DefaultInterface() override { return NS_GET_IID(nsIAppWindow); }
 };
 
 //
 // concrete enumerators
 //
 
 class nsASDOMWindowEarlyToLateEnumerator : public nsASDOMWindowEnumerator {
  public:
@@ -92,42 +92,42 @@ class nsASDOMWindowEarlyToLateEnumerator
                                      nsWindowMediator& inMediator);
 
   virtual ~nsASDOMWindowEarlyToLateEnumerator();
 
  protected:
   virtual nsWindowInfo* FindNext() override;
 };
 
-class nsASXULWindowEarlyToLateEnumerator : public nsASXULWindowEnumerator {
+class nsASAppWindowEarlyToLateEnumerator : public nsASAppWindowEnumerator {
  public:
-  nsASXULWindowEarlyToLateEnumerator(const char16_t* aTypeString,
+  nsASAppWindowEarlyToLateEnumerator(const char16_t* aTypeString,
                                      nsWindowMediator& inMediator);
 
-  virtual ~nsASXULWindowEarlyToLateEnumerator();
+  virtual ~nsASAppWindowEarlyToLateEnumerator();
 
  protected:
   virtual nsWindowInfo* FindNext() override;
 };
 
-class nsASXULWindowFrontToBackEnumerator : public nsASXULWindowEnumerator {
+class nsASAppWindowFrontToBackEnumerator : public nsASAppWindowEnumerator {
  public:
-  nsASXULWindowFrontToBackEnumerator(const char16_t* aTypeString,
+  nsASAppWindowFrontToBackEnumerator(const char16_t* aTypeString,
                                      nsWindowMediator& inMediator);
 
-  virtual ~nsASXULWindowFrontToBackEnumerator();
+  virtual ~nsASAppWindowFrontToBackEnumerator();
 
  protected:
   virtual nsWindowInfo* FindNext() override;
 };
 
-class nsASXULWindowBackToFrontEnumerator : public nsASXULWindowEnumerator {
+class nsASAppWindowBackToFrontEnumerator : public nsASAppWindowEnumerator {
  public:
-  nsASXULWindowBackToFrontEnumerator(const char16_t* aTypeString,
+  nsASAppWindowBackToFrontEnumerator(const char16_t* aTypeString,
                                      nsWindowMediator& inMediator);
 
-  virtual ~nsASXULWindowBackToFrontEnumerator();
+  virtual ~nsASAppWindowBackToFrontEnumerator();
 
  protected:
   virtual nsWindowInfo* FindNext() override;
 };
 
 #endif
--- a/xpfe/appshell/nsChromeTreeOwner.cpp
+++ b/xpfe/appshell/nsChromeTreeOwner.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * 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/. */
 
 // Local Includes
 #include "nsChromeTreeOwner.h"
-#include "nsXULWindow.h"
+#include "AppWindow.h"
 
 // Helper Classes
 #include "nsString.h"
 #include "nsIEmbeddingSiteWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIDocShellTreeItem.h"
 
 // Interfaces needed to include
@@ -38,17 +38,17 @@ const nsLiteralString kWidth(u"width");
 const nsLiteralString kHeight(u"height");
 const nsLiteralString kSizemode(u"sizemode");
 const nsLiteralString kSpace(u" ");
 
 //*****************************************************************************
 //***    nsChromeTreeOwner: Object Management
 //*****************************************************************************
 
-nsChromeTreeOwner::nsChromeTreeOwner() : mXULWindow(nullptr) {}
+nsChromeTreeOwner::nsChromeTreeOwner() : mAppWindow(nullptr) {}
 
 nsChromeTreeOwner::~nsChromeTreeOwner() {}
 
 //*****************************************************************************
 // nsChromeTreeOwner::nsISupports
 //*****************************************************************************
 
 NS_IMPL_ADDREF(nsChromeTreeOwner)
@@ -66,115 +66,115 @@ NS_INTERFACE_MAP_END
 //*****************************************************************************
 // nsChromeTreeOwner::nsIInterfaceRequestor
 //*****************************************************************************
 
 NS_IMETHODIMP nsChromeTreeOwner::GetInterface(const nsIID& aIID, void** aSink) {
   NS_ENSURE_ARG_POINTER(aSink);
 
   if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->GetInterface(aIID, aSink);
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->GetInterface(aIID, aSink);
   }
   if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->GetInterface(aIID, aSink);
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->GetInterface(aIID, aSink);
   }
   if (aIID.Equals(NS_GET_IID(nsIWebBrowserChrome))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->GetInterface(aIID, aSink);
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->GetInterface(aIID, aSink);
   }
   if (aIID.Equals(NS_GET_IID(nsIEmbeddingSiteWindow))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->GetInterface(aIID, aSink);
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->GetInterface(aIID, aSink);
   }
-  if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->QueryInterface(aIID, aSink);
+  if (aIID.Equals(NS_GET_IID(nsIAppWindow))) {
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->QueryInterface(aIID, aSink);
   }
 
   return QueryInterface(aIID, aSink);
 }
 
 //*****************************************************************************
 // nsChromeTreeOwner::nsIDocShellTreeOwner
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsChromeTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
                                      bool aPrimary) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->ContentShellAdded(aContentShell, aPrimary);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->ContentShellAdded(aContentShell, aPrimary);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->ContentShellRemoved(aContentShell);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->ContentShellRemoved(aContentShell);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetPrimaryContentShell(
     nsIDocShellTreeItem** aShell) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPrimaryContentShell(aShell);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPrimaryContentShell(aShell);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->RemoteTabAdded(aTab, aPrimary);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->RemoteTabAdded(aTab, aPrimary);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::RemoteTabRemoved(nsIRemoteTab* aTab) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->RemoteTabRemoved(aTab);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->RemoteTabRemoved(aTab);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::GetPrimaryRemoteTab(nsIRemoteTab** aTab) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPrimaryRemoteTab(aTab);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPrimaryRemoteTab(aTab);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPrimaryContentSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPrimaryContentSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPrimaryContentSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPrimaryContentSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetRootShellSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetRootShellSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetRootShellSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetRootShellSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
                                              int32_t aCX, int32_t aCY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SizeShellTo(aShellItem, aCX, aCY);
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
                                   bool aPersistSizeMode) {
-  NS_ENSURE_STATE(mXULWindow);
-  nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
+  NS_ENSURE_STATE(mAppWindow);
+  nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement();
   if (!docShellElement) return NS_ERROR_FAILURE;
 
   nsAutoString persistString;
   docShellElement->GetAttribute(kPersist, persistString);
 
   bool saveString = false;
   int32_t index;
 
@@ -199,18 +199,18 @@ nsChromeTreeOwner::SetPersistence(bool a
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
                                   bool* aPersistSizeMode) {
-  NS_ENSURE_STATE(mXULWindow);
-  nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
+  NS_ENSURE_STATE(mAppWindow);
+  nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement();
   if (!docShellElement) return NS_ERROR_FAILURE;
 
   nsAutoString persistString;
   docShellElement->GetAttribute(kPersist, persistString);
 
   // data structure doesn't quite match the question, but it's close enough
   // for what we want (since this method is never actually called...)
   if (aPersistPosition)
@@ -222,28 +222,28 @@ nsChromeTreeOwner::GetPersistence(bool* 
   if (aPersistSizeMode)
     *aPersistSizeMode = persistString.Find(kSizemode) > kNotFound;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::GetTabCount(uint32_t* aResult) {
-  if (mXULWindow) {
-    return mXULWindow->GetTabCount(aResult);
+  if (mAppWindow) {
+    return mAppWindow->GetTabCount(aResult);
   }
 
   *aResult = 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::GetHasPrimaryContent(bool* aResult) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetHasPrimaryContent(aResult);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetHasPrimaryContent(aResult);
 }
 
 //*****************************************************************************
 // nsChromeTreeOwner::nsIBaseWindow
 //*****************************************************************************
 
 NS_IMETHODIMP nsChromeTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
                                             nsIWidget* parentWidget, int32_t x,
@@ -256,146 +256,146 @@ NS_IMETHODIMP nsChromeTreeOwner::InitWin
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::Create() {
   NS_ASSERTION(false, "You can't call this");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::Destroy() {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->Destroy();
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->Destroy();
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(
     double* aScale) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetDevicePixelsPerDesktopPixel(
     double* aScale) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetDevicePixelsPerDesktopPixel(aScale);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetPositionDesktopPix(int32_t x, int32_t y) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPositionDesktopPix(x, y);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPositionDesktopPix(x, y);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetPosition(int32_t x, int32_t y) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPosition(x, y);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPosition(x, y);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetPosition(int32_t* x, int32_t* y) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPosition(x, y);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPosition(x, y);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetSize(int32_t cx, int32_t cy,
                                          bool fRepaint) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetSize(cx, cy, fRepaint);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetSize(cx, cy, fRepaint);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetSize(int32_t* cx, int32_t* cy) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetSize(cx, cy);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetSize(cx, cy);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetPositionAndSize(int32_t x, int32_t y,
                                                     int32_t cx, int32_t cy,
                                                     uint32_t aFlags) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPositionAndSize(x, y, cx, cy, aFlags);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPositionAndSize(x, y, cx, cy, aFlags);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetPositionAndSize(int32_t* x, int32_t* y,
                                                     int32_t* cx, int32_t* cy) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPositionAndSize(x, y, cx, cy);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPositionAndSize(x, y, cx, cy);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::Repaint(bool aForce) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->Repaint(aForce);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->Repaint(aForce);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetParentWidget(nsIWidget** aParentWidget) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetParentWidget(aParentWidget);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetParentWidget(aParentWidget);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
   NS_ASSERTION(false, "You can't call this");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetParentNativeWindow(
     nativeWindow* aParentNativeWindow) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetParentNativeWindow(aParentNativeWindow);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetParentNativeWindow(
     nativeWindow aParentNativeWindow) {
   NS_ASSERTION(false, "You can't call this");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetNativeHandle(aNativeHandle);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetNativeHandle(aNativeHandle);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetVisibility(bool* aVisibility) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetVisibility(aVisibility);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetVisibility(aVisibility);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetVisibility(bool aVisibility) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetVisibility(aVisibility);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetVisibility(aVisibility);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetEnabled(bool* aEnabled) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetEnabled(aEnabled);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetEnabled(aEnabled);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetEnabled(bool aEnable) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetEnabled(aEnable);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetEnabled(aEnable);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetMainWidget(nsIWidget** aMainWidget) {
   NS_ENSURE_ARG_POINTER(aMainWidget);
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
-  *aMainWidget = mXULWindow->mWindow;
+  *aMainWidget = mAppWindow->mWindow;
   NS_IF_ADDREF(*aMainWidget);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetFocus() {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetFocus();
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetFocus();
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::GetTitle(nsAString& aTitle) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetTitle(aTitle);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetTitle(aTitle);
 }
 
 NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const nsAString& aTitle) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetTitle(aTitle);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetTitle(aTitle);
 }
 
 //*****************************************************************************
 // nsChromeTreeOwner::nsIWebProgressListener
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsChromeTreeOwner::OnProgressChange(nsIWebProgress* aWebProgress,
@@ -414,30 +414,30 @@ nsChromeTreeOwner::OnStateChange(nsIWebP
                                  nsresult aStatus) {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
                                     nsIRequest* aRequest, nsIURI* aLocation,
                                     uint32_t aFlags) {
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
   // If loading a new root .xul document, then redo chrome.
   if (aWebProgress) {
     nsCOMPtr<nsIDocShell> docshell;
-    mXULWindow->GetDocShell(getter_AddRefs(docshell));
+    mAppWindow->GetDocShell(getter_AddRefs(docshell));
 
     nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(docshell));
     if (webProgress != aWebProgress) {
       return NS_OK;
     }
   }
 
-  mXULWindow->mChromeLoaded = false;
+  mAppWindow->mChromeLoaded = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsChromeTreeOwner::OnStatusChange(nsIWebProgress* aWebProgress,
                                   nsIRequest* aRequest, nsresult aStatus,
                                   const char16_t* aMessage) {
   return NS_OK;
@@ -459,13 +459,13 @@ nsChromeTreeOwner::OnContentBlockingEven
 //*****************************************************************************
 // nsChromeTreeOwner: Helpers
 //*****************************************************************************
 
 //*****************************************************************************
 // nsChromeTreeOwner: Accessors
 //*****************************************************************************
 
-void nsChromeTreeOwner::XULWindow(nsXULWindow* aXULWindow) {
-  mXULWindow = aXULWindow;
+void nsChromeTreeOwner::AppWindow(mozilla::AppWindow* aAppWindow) {
+  mAppWindow = aAppWindow;
 }
 
-nsXULWindow* nsChromeTreeOwner::XULWindow() { return mXULWindow; }
+mozilla::AppWindow* nsChromeTreeOwner::AppWindow() { return mAppWindow; }
--- a/xpfe/appshell/nsChromeTreeOwner.h
+++ b/xpfe/appshell/nsChromeTreeOwner.h
@@ -13,37 +13,39 @@
 // Interfaces Needed
 #include "nsIBaseWindow.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebProgressListener.h"
 #include "nsWeakReference.h"
 
-class nsXULWindow;
+namespace mozilla {
+class AppWindow;
+}
 
 class nsChromeTreeOwner : public nsIDocShellTreeOwner,
                           public nsIBaseWindow,
                           public nsIInterfaceRequestor,
                           public nsIWebProgressListener,
                           public nsSupportsWeakReference {
-  friend class nsXULWindow;
+  friend class mozilla::AppWindow;
 
  public:
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSIBASEWINDOW
   NS_DECL_NSIDOCSHELLTREEOWNER
   NS_DECL_NSIWEBPROGRESSLISTENER
 
  protected:
   nsChromeTreeOwner();
   virtual ~nsChromeTreeOwner();
 
-  void XULWindow(nsXULWindow* aXULWindow);
-  nsXULWindow* XULWindow();
+  void AppWindow(mozilla::AppWindow* aAppWindow);
+  mozilla::AppWindow* AppWindow();
 
  protected:
-  nsXULWindow* mXULWindow;
+  mozilla::AppWindow* mAppWindow;
 };
 
 #endif /* nsChromeTreeOwner_h__ */
--- a/xpfe/appshell/nsContentTreeOwner.cpp
+++ b/xpfe/appshell/nsContentTreeOwner.cpp
@@ -2,17 +2,17 @@
  * vim: set ts=2 sw=2 et 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/. */
 
 // Local Includes
 #include "nsContentTreeOwner.h"
-#include "nsXULWindow.h"
+#include "AppWindow.h"
 
 // Helper Classes
 #include "nsIServiceManager.h"
 #include "nsAutoPtr.h"
 
 // Interfaces needed to be included
 #include "nsIDOMWindow.h"
 #include "nsIDOMChromeWindow.h"
@@ -73,17 +73,17 @@ class nsSiteWindow : public nsIEmbedding
   nsContentTreeOwner* mAggregator;
 };
 
 //*****************************************************************************
 //***    nsContentTreeOwner: Object Management
 //*****************************************************************************
 
 nsContentTreeOwner::nsContentTreeOwner(bool fPrimary)
-    : mXULWindow(nullptr), mPrimary(fPrimary) {
+    : mAppWindow(nullptr), mPrimary(fPrimary) {
   // note if this fails, QI on nsIEmbeddingSiteWindow(2) will simply fail
   mSiteWindow = new nsSiteWindow(this);
 }
 
 nsContentTreeOwner::~nsContentTreeOwner() { delete mSiteWindow; }
 
 //*****************************************************************************
 // nsContentTreeOwner::nsISupports
@@ -117,127 +117,127 @@ NS_INTERFACE_MAP_END
 //*****************************************************************************
 
 NS_IMETHODIMP nsContentTreeOwner::GetInterface(const nsIID& aIID,
                                                void** aSink) {
   NS_ENSURE_ARG_POINTER(aSink);
   *aSink = 0;
 
   if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->GetInterface(aIID, aSink);
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->GetInterface(aIID, aSink);
   }
   if (aIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->GetInterface(aIID, aSink);
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->GetInterface(aIID, aSink);
   }
   if (aIID.Equals(NS_GET_IID(nsIDocShellTreeItem))) {
-    NS_ENSURE_STATE(mXULWindow);
+    NS_ENSURE_STATE(mAppWindow);
     nsCOMPtr<nsIDocShell> shell;
-    mXULWindow->GetDocShell(getter_AddRefs(shell));
+    mAppWindow->GetDocShell(getter_AddRefs(shell));
     if (shell) return shell->QueryInterface(aIID, aSink);
     return NS_ERROR_FAILURE;
   }
 
   if (aIID.Equals(NS_GET_IID(nsIDOMWindow)) ||
       aIID.Equals(NS_GET_IID(nsPIDOMWindowOuter))) {
-    NS_ENSURE_STATE(mXULWindow);
+    NS_ENSURE_STATE(mAppWindow);
     nsCOMPtr<nsIDocShellTreeItem> shell;
-    mXULWindow->GetPrimaryContentShell(getter_AddRefs(shell));
+    mAppWindow->GetPrimaryContentShell(getter_AddRefs(shell));
     if (shell) {
       nsCOMPtr<nsIInterfaceRequestor> thing(do_QueryInterface(shell));
       if (thing) return thing->GetInterface(aIID, aSink);
     }
     return NS_ERROR_FAILURE;
   }
 
-  if (aIID.Equals(NS_GET_IID(nsIXULWindow))) {
-    NS_ENSURE_STATE(mXULWindow);
-    return mXULWindow->QueryInterface(aIID, aSink);
+  if (aIID.Equals(NS_GET_IID(nsIAppWindow))) {
+    NS_ENSURE_STATE(mAppWindow);
+    return mAppWindow->QueryInterface(aIID, aSink);
   }
 
   return QueryInterface(aIID, aSink);
 }
 
 //*****************************************************************************
 // nsContentTreeOwner::nsIDocShellTreeOwner
 //*****************************************************************************
 
 NS_IMETHODIMP
 nsContentTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
                                       bool aPrimary) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->ContentShellAdded(aContentShell, aPrimary);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->ContentShellAdded(aContentShell, aPrimary);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::ContentShellRemoved(nsIDocShellTreeItem* aContentShell) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->ContentShellRemoved(aContentShell);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->ContentShellRemoved(aContentShell);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPrimaryContentShell(aShell);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPrimaryContentShell(aShell);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::RemoteTabAdded(nsIRemoteTab* aTab, bool aPrimary) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->RemoteTabAdded(aTab, aPrimary);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->RemoteTabAdded(aTab, aPrimary);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::RemoteTabRemoved(nsIRemoteTab* aTab) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->RemoteTabRemoved(aTab);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->RemoteTabRemoved(aTab);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetPrimaryRemoteTab(nsIRemoteTab** aTab) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPrimaryRemoteTab(aTab);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPrimaryRemoteTab(aTab);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetPrimaryContentSize(int32_t* aWidth, int32_t* aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPrimaryContentSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPrimaryContentSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::SetPrimaryContentSize(int32_t aWidth, int32_t aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPrimaryContentSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPrimaryContentSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetRootShellSize(int32_t* aWidth, int32_t* aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetRootShellSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetRootShellSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::SetRootShellSize(int32_t aWidth, int32_t aHeight) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetRootShellSize(aWidth, aHeight);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetRootShellSize(aWidth, aHeight);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
                                               int32_t aCX, int32_t aCY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SizeShellTo(aShellItem, aCX, aCY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SizeShellTo(aShellItem, aCX, aCY);
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::SetPersistence(bool aPersistPosition, bool aPersistSize,
                                    bool aPersistSizeMode) {
-  NS_ENSURE_STATE(mXULWindow);
-  nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
+  NS_ENSURE_STATE(mAppWindow);
+  nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement();
   if (!docShellElement) return NS_ERROR_FAILURE;
 
   nsAutoString persistString;
   docShellElement->GetAttribute(NS_LITERAL_STRING("persist"), persistString);
 
   bool saveString = false;
   int32_t index;
 
@@ -294,18 +294,18 @@ nsContentTreeOwner::SetPersistence(bool 
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetPersistence(bool* aPersistPosition, bool* aPersistSize,
                                    bool* aPersistSizeMode) {
-  NS_ENSURE_STATE(mXULWindow);
-  nsCOMPtr<dom::Element> docShellElement = mXULWindow->GetWindowDOMElement();
+  NS_ENSURE_STATE(mAppWindow);
+  nsCOMPtr<dom::Element> docShellElement = mAppWindow->GetWindowDOMElement();
   if (!docShellElement) return NS_ERROR_FAILURE;
 
   nsAutoString persistString;
   docShellElement->GetAttribute(NS_LITERAL_STRING("persist"), persistString);
 
   // data structure doesn't quite match the question, but it's close enough
   // for what we want (since this method is never actually called...)
   if (aPersistPosition)
@@ -321,58 +321,58 @@ nsContentTreeOwner::GetPersistence(bool*
   if (aPersistSizeMode)
     *aPersistSizeMode = persistString.Find("sizemode") >= 0 ? true : false;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetTabCount(uint32_t* aResult) {
-  if (mXULWindow) {
-    return mXULWindow->GetTabCount(aResult);
+  if (mAppWindow) {
+    return mAppWindow->GetTabCount(aResult);
   }
 
   *aResult = 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsContentTreeOwner::GetHasPrimaryContent(bool* aResult) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetHasPrimaryContent(aResult);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetHasPrimaryContent(aResult);
 }
 
 //*****************************************************************************
 // nsContentTreeOwner::nsIWebBrowserChrome3
 //*****************************************************************************
 
 NS_IMETHODIMP nsContentTreeOwner::OnBeforeLinkTraversal(
     const nsAString& originalTarget, nsIURI* linkURI, nsINode* linkNode,
     bool isAppTab, nsAString& _retval) {
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
   nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
-  mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
+  mAppWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
 
   if (xulBrowserWindow)
     return xulBrowserWindow->OnBeforeLinkTraversal(originalTarget, linkURI,
                                                    linkNode, isAppTab, _retval);
 
   _retval = originalTarget;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsContentTreeOwner::ShouldLoadURI(
     nsIDocShell* aDocShell, nsIURI* aURI, nsIReferrerInfo* aReferrerInfo,
     bool aHasPostData, nsIPrincipal* aTriggeringPrincipal,
     nsIContentSecurityPolicy* aCsp, bool* _retval) {
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
   nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
-  mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
+  mAppWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
 
   if (xulBrowserWindow)
     return xulBrowserWindow->ShouldLoadURI(aDocShell, aURI, aReferrerInfo,
                                            aHasPostData, aTriggeringPrincipal,
                                            aCsp, _retval);
 
   *_retval = true;
   return NS_OK;
@@ -399,20 +399,20 @@ NS_IMETHODIMP nsContentTreeOwner::Reload
 //*****************************************************************************
 
 NS_IMETHODIMP nsContentTreeOwner::SetStatusWithContext(
     uint32_t aStatusType, const nsAString& aStatusText,
     nsISupports* aStatusContext) {
   // We only allow the status to be set from the primary content shell
   if (!mPrimary && aStatusType != STATUS_LINK) return NS_OK;
 
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
   nsCOMPtr<nsIXULBrowserWindow> xulBrowserWindow;
-  mXULWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
+  mAppWindow->GetXULBrowserWindow(getter_AddRefs(xulBrowserWindow));
 
   if (xulBrowserWindow) {
     switch (aStatusType) {
       case STATUS_LINK: {
         nsCOMPtr<dom::Element> element = do_QueryInterface(aStatusContext);
         xulBrowserWindow->SetOverLink(aStatusText, element);
         break;
       }
@@ -431,33 +431,33 @@ NS_IMETHODIMP nsContentTreeOwner::SetSta
   return SetStatusWithContext(
       aStatusType,
       aStatus ? static_cast<const nsString&>(nsDependentString(aStatus))
               : EmptyString(),
       nullptr);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetChromeFlags(uint32_t aChromeFlags) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetChromeFlags(aChromeFlags);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetChromeFlags(aChromeFlags);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetChromeFlags(uint32_t* aChromeFlags) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetChromeFlags(aChromeFlags);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetChromeFlags(aChromeFlags);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::ShowAsModal() {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->ShowModal();
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->ShowModal();
 }
 
 NS_IMETHODIMP nsContentTreeOwner::IsWindowModal(bool* _retval) {
-  NS_ENSURE_STATE(mXULWindow);
-  *_retval = mXULWindow->mContinueModalLoop;
+  NS_ENSURE_STATE(mAppWindow);
+  *_retval = mAppWindow->mContinueModalLoop;
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsContentTreeOwner::nsIBaseWindow
 //*****************************************************************************
 
 NS_IMETHODIMP nsContentTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
@@ -472,144 +472,144 @@ NS_IMETHODIMP nsContentTreeOwner::InitWi
 }
 
 NS_IMETHODIMP nsContentTreeOwner::Create() {
   NS_ASSERTION(false, "You can't call this");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP nsContentTreeOwner::Destroy() {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->Destroy();
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->Destroy();
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetUnscaledDevicePixelsPerCSSPixel(
     double* aScale) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetUnscaledDevicePixelsPerCSSPixel(aScale);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetDevicePixelsPerDesktopPixel(
     double* aScale) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetDevicePixelsPerDesktopPixel(aScale);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetDevicePixelsPerDesktopPixel(aScale);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetPositionDesktopPix(int32_t aX,
                                                         int32_t aY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPositionDesktopPix(aX, aY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPositionDesktopPix(aX, aY);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetPosition(int32_t aX, int32_t aY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPosition(aX, aY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPosition(aX, aY);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetPosition(int32_t* aX, int32_t* aY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPosition(aX, aY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPosition(aX, aY);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetSize(int32_t aCX, int32_t aCY,
                                           bool aRepaint) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetSize(aCX, aCY, aRepaint);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetSize(aCX, aCY, aRepaint);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetSize(int32_t* aCX, int32_t* aCY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetSize(aCX, aCY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetSize(aCX, aCY);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetPositionAndSize(int32_t aX, int32_t aY,
                                                      int32_t aCX, int32_t aCY,
                                                      uint32_t aFlags) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetPositionAndSize(aX, aY, aCX, aCY, aFlags);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetPositionAndSize(aX, aY, aCX, aCY, aFlags);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetPositionAndSize(int32_t* aX, int32_t* aY,
                                                      int32_t* aCX,
                                                      int32_t* aCY) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetPositionAndSize(aX, aY, aCX, aCY);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetPositionAndSize(aX, aY, aCX, aCY);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::Repaint(bool aForce) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->Repaint(aForce);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->Repaint(aForce);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetParentWidget(nsIWidget** aParentWidget) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetParentWidget(aParentWidget);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetParentWidget(aParentWidget);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetParentWidget(nsIWidget* aParentWidget) {
   NS_ASSERTION(false, "You can't call this");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetParentNativeWindow(
     nativeWindow* aParentNativeWindow) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetParentNativeWindow(aParentNativeWindow);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetParentNativeWindow(aParentNativeWindow);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetParentNativeWindow(
     nativeWindow aParentNativeWindow) {
   NS_ASSERTION(false, "You can't call this");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetNativeHandle(nsAString& aNativeHandle) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetNativeHandle(aNativeHandle);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetNativeHandle(aNativeHandle);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetVisibility(bool* aVisibility) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetVisibility(aVisibility);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetVisibility(aVisibility);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetVisibility(bool aVisibility) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetVisibility(aVisibility);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetVisibility(aVisibility);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetEnabled(bool* aEnabled) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->GetEnabled(aEnabled);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->GetEnabled(aEnabled);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetEnabled(bool aEnable) {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetEnabled(aEnable);
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetEnabled(aEnable);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetMainWidget(nsIWidget** aMainWidget) {
   NS_ENSURE_ARG_POINTER(aMainWidget);
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
-  *aMainWidget = mXULWindow->mWindow;
+  *aMainWidget = mAppWindow->mWindow;
   NS_IF_ADDREF(*aMainWidget);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetFocus() {
-  NS_ENSURE_STATE(mXULWindow);
-  return mXULWindow->SetFocus();
+  NS_ENSURE_STATE(mAppWindow);
+  return mAppWindow->SetFocus();
 }
 
 NS_IMETHODIMP nsContentTreeOwner::GetTitle(nsAString& aTitle) {
-  NS_ENSURE_STATE(mXULWindow);
+  NS_ENSURE_STATE(mAppWindow);
 
-  return mXULWindow->GetTitle(aTitle);
+  return mAppWindow->GetTitle(aTitle);
 }
 
 NS_IMETHODIMP nsContentTreeOwner::SetTitle(const nsAString& aTitle) {
   return NS_OK;
 }
 
 //*****************************************************************************
 // nsContentTreeOwner: nsIWindowProvider
@@ -624,17 +624,17 @@ nsContentTreeOwner::ProvideWindow(
   NS_ENSURE_ARG_POINTER(aParent);
 
   auto* parentWin = nsPIDOMWindowOuter::From(aParent);
   dom::BrowsingContext* parent =
       parentWin ? parentWin->GetBrowsingContext() : nullptr;
 
   *aReturn = nullptr;
 
-  if (!mXULWindow) {
+  if (!mAppWindow) {
     // Nothing to do here
     return NS_OK;
   }
 
 #ifdef DEBUG
   nsCOMPtr<nsIWebNavigation> parentNav = do_GetInterface(aParent);
   nsCOMPtr<nsIDocShellTreeOwner> parentOwner = do_GetInterface(parentNav);
   NS_ASSERTION(
@@ -685,21 +685,21 @@ nsContentTreeOwner::ProvideWindow(
 
   if (openLocation != nsIBrowserDOMWindow::OPEN_NEWTAB &&
       openLocation != nsIBrowserDOMWindow::OPEN_CURRENTWINDOW) {
     // Just open a window normally
     return NS_OK;
   }
 
   nsCOMPtr<mozIDOMWindowProxy> domWin;
-  mXULWindow->GetWindowDOMWindow(getter_AddRefs(domWin));
+  mAppWindow->GetWindowDOMWindow(getter_AddRefs(domWin));
   nsCOMPtr<nsIDOMChromeWindow> chromeWin = do_QueryInterface(domWin);
   if (!chromeWin) {
     // Really odd... but whatever
-    NS_WARNING("nsXULWindow's DOMWindow is not a chrome window");
+    NS_WARNING("AppWindow's DOMWindow is not a chrome window");
     return NS_OK;
   }
 
   nsCOMPtr<nsIBrowserDOMWindow> browserDOMWin;
   chromeWin->GetBrowserDOMWindow(getter_AddRefs(browserDOMWin));
   if (!browserDOMWin) {
     return NS_OK;
   }
@@ -751,21 +751,21 @@ class nsContentTitleSettingEvent : publi
   }
 
  private:
   nsCOMPtr<dom::Element> mElement;
   nsString mTitleDefault;
 };
 #endif
 
-void nsContentTreeOwner::XULWindow(nsXULWindow* aXULWindow) {
-  mXULWindow = aXULWindow;
+void nsContentTreeOwner::AppWindow(mozilla::AppWindow* aAppWindow) {
+  mAppWindow = aAppWindow;
 }
 
-nsXULWindow* nsContentTreeOwner::XULWindow() { return mXULWindow; }
+mozilla::AppWindow* nsContentTreeOwner::AppWindow() { return mAppWindow; }
 
 //*****************************************************************************
 //*** nsSiteWindow implementation
 //*****************************************************************************
 
 nsSiteWindow::nsSiteWindow(nsContentTreeOwner* aAggregator) {
   mAggregator = aAggregator;
 }
@@ -799,17 +799,17 @@ NS_IMETHODIMP
 nsSiteWindow::SetFocus(void) {
 #if 0
   /* This implementation focuses the main document and could make sense.
      However this method is actually being used from within
      nsGlobalWindow::Focus (providing a hook for MDI embedding apps)
      and it's better for our purposes to not pick a document and
      focus it, but allow nsGlobalWindow to carry on unhindered.
   */
-  nsXULWindow *window = mAggregator->XULWindow();
+  AppWindow *window = mAggregator->AppWindow();
   if (window) {
     nsCOMPtr<nsIDocShell> docshell;
     window->GetDocShell(getter_AddRefs(docshell));
     if (docShell) {
       nsCOMPtr<nsPIDOMWindowOuter> domWindow(docShell->GetWindow());
       if (domWindow)
         domWindow->Focus();
     }
@@ -820,59 +820,59 @@ nsSiteWindow::SetFocus(void) {
 
 /* this implementation focuses another window. if there isn't another
    window to focus, we do nothing. */
 NS_IMETHODIMP
 nsSiteWindow::Blur(void) {
   NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID);
 
   nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
-  nsCOMPtr<nsIXULWindow> xulWindow;
+  nsCOMPtr<nsIAppWindow> appWindow;
   bool more, foundUs;
-  nsXULWindow* ourWindow = mAggregator->XULWindow();
+  AppWindow* ourWindow = mAggregator->AppWindow();
 
   {
     nsCOMPtr<nsIWindowMediator> windowMediator(
         do_GetService(kWindowMediatorCID));
     if (windowMediator)
-      windowMediator->GetZOrderXULWindowEnumerator(
+      windowMediator->GetZOrderAppWindowEnumerator(
           0, true, getter_AddRefs(windowEnumerator));
   }
 
   if (!windowEnumerator) return NS_ERROR_FAILURE;
 
   // step through the top-level windows
   foundUs = false;
   windowEnumerator->HasMoreElements(&more);
   while (more) {
     nsCOMPtr<nsISupports> nextWindow;
-    nsCOMPtr<nsIXULWindow> nextXULWindow;
+    nsCOMPtr<nsIAppWindow> nextAppWindow;
 
     windowEnumerator->GetNext(getter_AddRefs(nextWindow));
-    nextXULWindow = do_QueryInterface(nextWindow);
+    nextAppWindow = do_QueryInterface(nextWindow);
 
     // got it!(?)
     if (foundUs) {
-      xulWindow = nextXULWindow;
+      appWindow = nextAppWindow;
       break;
     }
 
     // remember the very first one, in case we have to wrap
-    if (!xulWindow) xulWindow = nextXULWindow;
+    if (!appWindow) appWindow = nextAppWindow;
 
     // look for us
-    if (nextXULWindow == ourWindow) foundUs = true;
+    if (nextAppWindow == ourWindow) foundUs = true;
 
     windowEnumerator->HasMoreElements(&more);
   }
 
   // change focus to the window we just found
-  if (xulWindow) {
+  if (appWindow) {
     nsCOMPtr<nsIDocShell> docshell;
-    xulWindow->GetDocShell(getter_AddRefs(docshell));
+    appWindow->GetDocShell(getter_AddRefs(docshell));
     if (!docshell) {
       return NS_OK;
     }
 
     nsCOMPtr<nsPIDOMWindowOuter> domWindow = docshell->GetWindow();
     if (domWindow) domWindow->Focus();
   }
   return NS_OK;
--- a/xpfe/appshell/nsContentTreeOwner.h
+++ b/xpfe/appshell/nsContentTreeOwner.h
@@ -14,25 +14,27 @@
 // Interfaces Needed
 #include "nsIBaseWindow.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIWebBrowserChrome3.h"
 #include "nsIWindowProvider.h"
 
-class nsXULWindow;
+namespace mozilla {
+class AppWindow;
+}
 class nsSiteWindow;
 
 class nsContentTreeOwner final : public nsIDocShellTreeOwner,
                                  public nsIBaseWindow,
                                  public nsIInterfaceRequestor,
                                  public nsIWebBrowserChrome3,
                                  public nsIWindowProvider {
-  friend class nsXULWindow;
+  friend class mozilla::AppWindow;
   friend class nsSiteWindow;
 
  public:
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIBASEWINDOW
   NS_DECL_NSIDOCSHELLTREEOWNER
   NS_DECL_NSIINTERFACEREQUESTOR
@@ -40,18 +42,18 @@ class nsContentTreeOwner final : public 
   NS_DECL_NSIWEBBROWSERCHROME2
   NS_DECL_NSIWEBBROWSERCHROME3
   NS_DECL_NSIWINDOWPROVIDER
 
  protected:
   explicit nsContentTreeOwner(bool fPrimary);
   virtual ~nsContentTreeOwner();
 
-  void XULWindow(nsXULWindow* aXULWindow);
-  nsXULWindow* XULWindow();
+  void AppWindow(mozilla::AppWindow* aAppWindow);
+  mozilla::AppWindow* AppWindow();
 
  protected:
-  nsXULWindow* mXULWindow;
+  mozilla::AppWindow* mAppWindow;
   nsSiteWindow* mSiteWindow;
   bool mPrimary;
 };
 
 #endif /* nsContentTreeOwner_h__ */
--- a/xpfe/appshell/nsIAppShellService.idl
+++ b/xpfe/appshell/nsIAppShellService.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "nsISupports.idl"
 
-interface nsIXULWindow;
+interface nsIAppWindow;
 interface nsIWindowlessBrowser;
 interface nsIURI;
 interface mozIDOMWindowProxy;
 interface nsIAppShell;
 interface nsIRemoteTab;
 
 [ptr] native JSContext(JSContext);
 
@@ -37,17 +37,17 @@ interface nsIAppShellService : nsISuppor
    *                      the window to wrap to its contents.
    * @param aInitialHeight like aInitialWidth, but subtly different.
    * @param aOpeningTab The RemoteTab that requested that this window be opened.
    *                    Can be left null.
    * @param aOpenerWindow The Window Proxy which requested that this window be opened.
    *                      Can be left null.
    */
   const long SIZE_TO_CONTENT = -1;
-  nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent,
+  nsIAppWindow createTopLevelWindow(in nsIAppWindow aParent,
                                     in nsIURI aUrl,
                                     in uint32_t aChromeMask,
                                     in long aInitialWidth,
                                     in long aInitialHeight,
                                     in nsIRemoteTab aOpeningTab,
                                     in mozIDOMWindowProxy aOpenerWindow);
 
   /**
@@ -74,17 +74,17 @@ interface nsIAppShellService : nsISuppor
   void setScreenId(in uint32_t aScreenId);
 
   /**
    * Return the (singleton) application hidden window, automatically created
    * and maintained by this AppShellService.
    * @param aResult the hidden window.  Do not unhide hidden window.
    *                Do not taunt hidden window.
    */
-  readonly attribute nsIXULWindow hiddenWindow;
+  readonly attribute nsIAppWindow hiddenWindow;
 
   /**
    * Return the (singleton) application hidden window, automatically created
    * and maintained by this AppShellService.
    * @param aResult the hidden window.  Do not unhide hidden window.
    *                Do not taunt hidden window.
    */
   readonly attribute mozIDOMWindowProxy hiddenDOMWindow;
@@ -99,25 +99,25 @@ interface nsIAppShellService : nsISuppor
   /**
    * Add a window to the application's registry of windows.  These windows
    * are generally shown in the Windows taskbar, and the application
    * knows it can't quit until it's out of registered windows.
    * @param aWindow the window to register
    * @note When this method is successful, it fires the global notification
    *       "xul-window-registered"
    */
-  void registerTopLevelWindow(in nsIXULWindow aWindow);
+  void registerTopLevelWindow(in nsIAppWindow aWindow);
 
   /**
    * Remove a window from the application's window registry. Note that
    * this method won't automatically attempt to quit the app when
    * the last window is unregistered. For that, see Quit().
    * @param aWindow you see the pattern
    */
-  void unregisterTopLevelWindow(in nsIXULWindow aWindow);
+  void unregisterTopLevelWindow(in nsIAppWindow aWindow);
 
   /**
    * Whether the hidden window has been lazily created.
    */
   readonly attribute boolean hasHiddenWindow;
 
   /**
    * Start/stop tracking lags in the event loop.
rename from xpfe/appshell/nsIXULWindow.idl
rename to xpfe/appshell/nsIAppWindow.idl
--- a/xpfe/appshell/nsIXULWindow.idl
+++ b/xpfe/appshell/nsIAppWindow.idl
@@ -2,17 +2,17 @@
  *
  * 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/. */
 
 #include "nsISupports.idl"
 
 /**
- * The nsIXULWindow
+ * The nsIAppWindow
  *
  * When the window is destroyed, it will fire a "xul-window-destroyed"
  * notification through the global observer service.
  */
 
 %{C++
 #include "LiveResizeListener.h"
 #include "nsTArray.h"
@@ -22,17 +22,17 @@ interface nsIDocShell;
 interface nsIDocShellTreeItem;
 interface nsIXULBrowserWindow;
 interface nsIRemoteTab;
 interface mozIDOMWindowProxy;
 
 native LiveResizeListenerArray(nsTArray<RefPtr<mozilla::LiveResizeListener>>);
 
 [builtinclass, scriptable, uuid(d6d7a014-e28d-4c9d-8727-1cf6d870619b)]
-interface nsIXULWindow : nsISupports
+interface nsIAppWindow : nsISupports
 {
   /**
    * The docshell owning the XUL for this window.
    */
   readonly attribute nsIDocShell docShell;
 
   /**
    * Indicates if this window is instrinsically sized.
@@ -59,46 +59,46 @@ interface nsIXULWindow : nsISupports
   void remoteTabRemoved(in nsIRemoteTab aTab);
 
   [noscript,notxpcom] LiveResizeListenerArray getLiveResizeListeners();
 
   /**
    * Tell this window that it has picked up a child XUL window
    * @param aChild the child window being added
    */
-  void addChildWindow(in nsIXULWindow aChild);
+  void addChildWindow(in nsIAppWindow aChild);
 
   /**
    * Returns the difference between the inner window size (client size) and the
    * outer window size, in CSS pixels.
    */
   [infallible] readonly attribute unsigned long outerToInnerHeightDifferenceInCSSPixels;
   [infallible] readonly attribute unsigned long outerToInnerWidthDifferenceInCSSPixels;
 
   /**
    * Tell this window that it has lost a child XUL window
    * @param aChild the child window being removed
    */
-  void removeChildWindow(in nsIXULWindow aChild);
+  void removeChildWindow(in nsIAppWindow aChild);
 
   /**
    * Move the window to a centered position.
    * @param aRelative If not null, the window relative to which the window is
    *                  moved. See aScreen parameter for details.
    * @param aScreen   PR_TRUE to center the window relative to the screen
    *                  containing aRelative if aRelative is not null. If
    *                  aRelative is null then relative to the screen of the
    *                  opener window if it was initialized by passing it to
    *                  nsWebShellWindow::Initialize. Failing that relative to
    *                  the main screen.
    *                  PR_FALSE to center it relative to aRelative itself.
    * @param aAlert    PR_TRUE to move the window to an alert position,
    *                  generally centered horizontally and 1/3 down from the top.
    */
-  void center(in nsIXULWindow aRelative, in boolean aScreen, in boolean aAlert);
+  void center(in nsIAppWindow aRelative, in boolean aScreen, in boolean aAlert);
 
   /**
    * Shows the window as a modal window. That is, ensures that it is visible
    * and runs a local event loop, exiting only once the window has been closed.
    */
   void showModal();
 
   /**
@@ -128,17 +128,17 @@ interface nsIXULWindow : nsISupports
    * @param aChromeFlags see nsIWebBrowserChrome
    * @param aOpeningTab the RemoteTab that requested this new window be opened.
    *                    Can be left null.
    * @param aOpener The window which is requesting that this new window be opened.
    * @param aNextRemoteTabId The integer ID of the next remote tab actor to use.
    *        0 means there is no next remote tab actor to use.
    * @return the newly minted window
    */
-  nsIXULWindow createNewWindow(in int32_t aChromeFlags,
+  nsIAppWindow createNewWindow(in int32_t aChromeFlags,
                                in nsIRemoteTab aOpeningTab,
                                in mozIDOMWindowProxy aOpener,
                                in unsigned long long aNextRemoteTabId);
 
   attribute nsIXULBrowserWindow XULBrowserWindow;
 
   /**
    * Back-door method to make sure some stuff is done when the document is
--- a/xpfe/appshell/nsIWindowMediator.idl
+++ b/xpfe/appshell/nsIWindowMediator.idl
@@ -12,17 +12,17 @@
   { 0xbf, 0xa0, 0xfa, 0xc5, 0x4f, 0x27, 0xee, 0xc8 } }
 
 #define NS_WINDOWMEDIATOR_CONTRACTID \
   "@mozilla.org/appshell/window-mediator;1"
 %}
 
 interface mozIDOMWindow;
 interface mozIDOMWindowProxy;
-interface nsIXULWindow;
+interface nsIAppWindow;
 interface nsIWidget;
 interface nsIWindowMediatorListener;
 
 [scriptable, uuid(df0da056-357d-427f-bafd-e6cbf19c9381)]
 interface nsIWindowMediator: nsISupports
 {
   /** Return an enumerator which iterates over all windows of type aWindowType
     * from the oldest window to the youngest.
@@ -32,33 +32,33 @@ interface nsIWindowMediator: nsISupports
     *                     If null, all windows will be enumerated.
     * @return an enumerator of nsIDOMWindows.  Note that windows close
     *         asynchronously in many cases, so windows returned from this
     *         enumerator can have .closed set to true.  Caveat enumerator!
     */
   nsISimpleEnumerator getEnumerator(in wstring aWindowType);
 
   /** Identical to getEnumerator except:
-    * @return an enumerator of nsIXULWindows
+    * @return an enumerator of nsIAppWindows
   */
-  nsISimpleEnumerator getXULWindowEnumerator(in wstring aWindowType);
+  nsISimpleEnumerator getAppWindowEnumerator(in wstring aWindowType);
 
   /** Return an enumerator which iterates over all windows of type aWindowType
     * in their z (front-to-back) order. Note this interface makes
     * no requirement that a window couldn't be revisited if windows
     * are re-ordered while z-order enumerators are active.
     * @param  aWindowType the returned enumerator will enumerate only
     *                     windows of this type. ("type" is the
     *                     |windowtype| attribute of the XML <window> element.)
     *                     If null, all windows will be enumerated.
     * @param  aFrontToBack if true, the enumerator enumerates windows in order
     *                      from front to back. back to front if false.
-    * @return an enumerator of nsIXULWindows
+    * @return an enumerator of nsIAppWindows
     */
-  nsISimpleEnumerator getZOrderXULWindowEnumerator(in wstring aWindowType,
+  nsISimpleEnumerator getZOrderAppWindowEnumerator(in wstring aWindowType,
                         in boolean aFrontToBack);
 
   /** This is a shortcut for simply fetching the first window in
     * front to back order.
     * @param  aWindowType return the topmost window of this type.
     *                     ("type" is the |windowtype| attribute of
     *                     the XML <window> element.)
     *                     If null, return the topmost window of any type.
@@ -90,43 +90,43 @@ interface nsIWindowMediator: nsISupports
     * a current inner anymore.
     */
   mozIDOMWindow getCurrentInnerWindowWithId(in unsigned long long aInnerWindowID);
 
   /** Add the window to the list of known windows. Listeners (see
     * addListener) will be notified through their onOpenWindow method.
     * @param aWindow the window to add
     */
-  [noscript] void registerWindow(in nsIXULWindow aWindow);
+  [noscript] void registerWindow(in nsIAppWindow aWindow);
 
   /** Remove the window from the list of known windows. Listeners (see
     * addListener) will be be notified through their onCloseWindow method.
     * @param aWindow the window to remove
     */
-  [noscript] void unregisterWindow(in nsIXULWindow aWindow);
+  [noscript] void unregisterWindow(in nsIAppWindow aWindow);
 
   /** Call this method when a window gains focus. It's a primitive means of
     * determining the most recent window. It's no longer necessary and it
     * really should be removed.
     * @param aWindow the window which has gained focus
     */
-  [noscript] void updateWindowTimeStamp(in nsIXULWindow aWindow);
+  [noscript] void updateWindowTimeStamp(in nsIAppWindow aWindow);
 
   /* z-ordering: */
 
   const unsigned long zLevelTop    = 1;
   const unsigned long zLevelBottom = 2;
   const unsigned long zLevelBelow  = 3; // below some window
 
   /** A window wants to be moved in z-order. Calculate whether and how
     * it should be constrained. Note this method is advisory only:
     * it changes nothing either in WindowMediator's internal state
     * or with the window.
-    * Note it compares the nsIXULWindow to nsIWidgets. A pure interface
-    * would use all nsIXULWindows. But we expect this to be called from
+    * Note it compares the nsIAppWindow to nsIWidgets. A pure interface
+    * would use all nsIAppWindows. But we expect this to be called from
     * callbacks originating in native window code. They are expected to
     * hand us comparison values which are pulled from general storage
     * in the native widget, and may not correspond to an nsIWidget at all.
     * For that reason this interface requires only objects one step
     * removed from the native window (nsIWidgets), and its implementation
     * must be very understanding of what may be completely invalid
     * pointers in those parameters.
     *
@@ -141,49 +141,49 @@ interface nsIWindowMediator: nsISupports
     * @param outPosition constrained position, values like inPosition.
     * @param outBelow if outPosition==zLevelBelow, the window
     *                 below which inWindow should be placed. Otherwise this
     *                 this value will be null.
     * @return PR_TRUE if the position returned is different from
     *         the position given.
     */
 
-  [noscript] boolean calculateZPosition(in nsIXULWindow   inWindow,
+  [noscript] boolean calculateZPosition(in nsIAppWindow   inWindow,
                                         in unsigned long  inPosition,
                                         in nsIWidget      inBelow,
                                         out unsigned long outPosition,
                                         out nsIWidget     outBelow);
 
   /** A window has been positioned behind another. Inform WindowMediator
     * @param inWindow the window in question
     * @param inPosition new position. values:
     *                   zLevelTop: topmost window.
     *                   zLevelBottom: bottom.
     *                   zLevelBelow: below inBelow. (inBelow is ignored
     *                                for other values of inPosition.)
     * @param inBelow the window inWindow is behind, if zLevelBelow
     */
-  [noscript] void setZPosition(in nsIXULWindow inWindow,
+  [noscript] void setZPosition(in nsIAppWindow inWindow,
                                in unsigned long inPosition,
-                               in nsIXULWindow inBelow);
+                               in nsIAppWindow inBelow);
 
-  /** Return the window's Z level (as defined in nsIXULWindow).
+  /** Return the window's Z level (as defined in nsIAppWindow).
     * @param aWindow the window in question
     * @return aWindow's z level
     */
-  [noscript] uint32_t getZLevel(in nsIXULWindow aWindow);
+  [noscript] uint32_t getZLevel(in nsIAppWindow aWindow);
 
-  /** Set the window's Z level (as defined in nsIXULWindow). The implementation
+  /** Set the window's Z level (as defined in nsIAppWindow). The implementation
     * will reposition the window as necessary to match its new Z level.
     * The implementation will assume a window's Z level to be
-    * nsIXULWindow::normalZ until it has been informed of a different level.
+    * nsIAppWindow::normalZ until it has been informed of a different level.
     * @param aWindow the window in question
     * @param aZLevel the window's new Z level
     */
-  [noscript] void setZLevel(in nsIXULWindow aWindow, in uint32_t aZLevel);
+  [noscript] void setZLevel(in nsIAppWindow aWindow, in uint32_t aZLevel);
 
   /** Register a listener for window status changes.
     * keeps strong ref? (to be decided)
     * @param aListener the listener to register
     */
   void addListener(in nsIWindowMediatorListener aListener);
 
   /** Unregister a listener of window status changes.
--- a/xpfe/appshell/nsIWindowMediatorListener.idl
+++ b/xpfe/appshell/nsIWindowMediatorListener.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
 #include "nsISupports.idl"
 
-interface nsIXULWindow;
+interface nsIAppWindow;
 
 [scriptable, uuid(2F276982-0D60-4377-A595-D350BA516395)]
 interface nsIWindowMediatorListener : nsISupports
 {
-    void onOpenWindow(in nsIXULWindow window);
-    void onCloseWindow(in nsIXULWindow window);
+    void onOpenWindow(in nsIAppWindow window);
+    void onCloseWindow(in nsIAppWindow window);
 };
 
--- a/xpfe/appshell/nsWindowMediator.cpp
+++ b/xpfe/appshell/nsWindowMediator.cpp
@@ -16,22 +16,22 @@
 #include "nsAppShellWindowEnumerator.h"
 #include "nsWindowMediator.h"
 #include "nsIWindowMediatorListener.h"
 #include "nsGlobalWindow.h"
 
 #include "nsIDocShell.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIXULWindow.h"
+#include "nsIAppWindow.h"
 
 using namespace mozilla;
 
 nsresult nsWindowMediator::GetDOMWindow(
-    nsIXULWindow* inWindow, nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow) {
+    nsIAppWindow* inWindow, nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow) {
   nsCOMPtr<nsIDocShell> docShell;
 
   outDOMWindow = nullptr;
   inWindow->GetDocShell(getter_AddRefs(docShell));
   NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
 
   outDOMWindow = docShell->GetWindow();
   return outDOMWindow ? NS_OK : NS_ERROR_FAILURE;
@@ -56,17 +56,17 @@ nsresult nsWindowMediator::Init() {
   NS_ENSURE_SUCCESS(rv, rv);
   rv = obsSvc->AddObserver(this, "xpcom-shutdown", true);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mReady = true;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIXULWindow* inWindow) {
+NS_IMETHODIMP nsWindowMediator::RegisterWindow(nsIAppWindow* inWindow) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_STATE(mReady);
 
   if (GetInfoFor(inWindow)) {
     NS_ERROR("multiple window registration");
     return NS_ERROR_FAILURE;
   }
 
@@ -84,50 +84,50 @@ NS_IMETHODIMP nsWindowMediator::Register
     windowInfo->InsertAfter(mOldestWindow->mOlder, nullptr);
   else
     mOldestWindow = windowInfo;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::UnregisterWindow(nsIXULWindow* inWindow) {
+nsWindowMediator::UnregisterWindow(nsIAppWindow* inWindow) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_STATE(mReady);
   nsWindowInfo* info = GetInfoFor(inWindow);
   if (info) return UnregisterWindow(info);
   return NS_ERROR_INVALID_ARG;
 }
 
 nsresult nsWindowMediator::UnregisterWindow(nsWindowInfo* inInfo) {
   // Inform the iterators
   uint32_t index = 0;
   while (index < mEnumeratorList.Length()) {
     mEnumeratorList[index]->WindowRemoved(inInfo);
     index++;
   }
 
-  nsIXULWindow* window = inInfo->mWindow.get();
+  nsIAppWindow* window = inInfo->mWindow.get();
   ListenerArray::ForwardIterator iter(mListeners);
   while (iter.HasMore()) {
     iter.GetNext()->OnCloseWindow(window);
   }
 
   // Remove from the lists and free up
   if (inInfo == mOldestWindow) mOldestWindow = inInfo->mYounger;
   if (inInfo == mTopmostWindow) mTopmostWindow = inInfo->mLower;
   inInfo->Unlink(true, true);
   if (inInfo == mOldestWindow) mOldestWindow = nullptr;
   if (inInfo == mTopmostWindow) mTopmostWindow = nullptr;
   delete inInfo;
 
   return NS_OK;
 }
 
-nsWindowInfo* nsWindowMediator::GetInfoFor(nsIXULWindow* aWindow) {
+nsWindowInfo* nsWindowMediator::GetInfoFor(nsIAppWindow* aWindow) {
   nsWindowInfo *info, *listEnd;
 
   if (!aWindow) return nullptr;
 
   info = mOldestWindow;
   listEnd = nullptr;
   while (info != listEnd) {
     if (info->mWindow.get() == aWindow) return info;
@@ -165,41 +165,41 @@ nsWindowMediator::GetEnumerator(const ch
 
   RefPtr<nsAppShellWindowEnumerator> enumerator =
       new nsASDOMWindowEarlyToLateEnumerator(inType, *this);
   enumerator.forget(outEnumerator);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::GetXULWindowEnumerator(const char16_t* inType,
+nsWindowMediator::GetAppWindowEnumerator(const char16_t* inType,
                                          nsISimpleEnumerator** outEnumerator) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(outEnumerator);
   NS_ENSURE_STATE(mReady);
 
   RefPtr<nsAppShellWindowEnumerator> enumerator =
-      new nsASXULWindowEarlyToLateEnumerator(inType, *this);
+      new nsASAppWindowEarlyToLateEnumerator(inType, *this);
   enumerator.forget(outEnumerator);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::GetZOrderXULWindowEnumerator(const char16_t* aWindowType,
+nsWindowMediator::GetZOrderAppWindowEnumerator(const char16_t* aWindowType,
                                                bool aFrontToBack,
                                                nsISimpleEnumerator** _retval) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(_retval);
   NS_ENSURE_STATE(mReady);
 
   RefPtr<nsAppShellWindowEnumerator> enumerator;
   if (aFrontToBack)
-    enumerator = new nsASXULWindowFrontToBackEnumerator(aWindowType, *this);
+    enumerator = new nsASAppWindowFrontToBackEnumerator(aWindowType, *this);
   else
-    enumerator = new nsASXULWindowBackToFrontEnumerator(aWindowType, *this);
+    enumerator = new nsASAppWindowBackToFrontEnumerator(aWindowType, *this);
 
   enumerator.forget(_retval);
   return NS_OK;
 }
 
 int32_t nsWindowMediator::AddEnumerator(
     nsAppShellWindowEnumerator* inEnumerator) {
   return mEnumeratorList.AppendElement(inEnumerator) != nullptr;
@@ -339,17 +339,17 @@ nsWindowMediator::GetCurrentInnerWindowW
   // outer is already using another inner, so it's same as not found
   if (outer->GetCurrentInnerWindow() != window) return NS_OK;
 
   window.forget(aWindow);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::UpdateWindowTimeStamp(nsIXULWindow* inWindow) {
+nsWindowMediator::UpdateWindowTimeStamp(nsIAppWindow* inWindow) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_STATE(mReady);
   nsWindowInfo* info = GetInfoFor(inWindow);
   if (info) {
     // increment the window's time stamp
     info->mTimeStamp = ++mTimeStamp;
     return NS_OK;
   }
@@ -358,17 +358,17 @@ nsWindowMediator::UpdateWindowTimeStamp(
 
 /* This method's plan is to intervene only when absolutely necessary.
    We will get requests to place our windows behind unknown windows.
    For the most part, we need to leave those alone (turning them into
    explicit requests to be on top breaks Windows.) So generally we
    calculate a change as seldom as possible.
 */
 NS_IMETHODIMP
-nsWindowMediator::CalculateZPosition(nsIXULWindow* inWindow,
+nsWindowMediator::CalculateZPosition(nsIAppWindow* inWindow,
                                      uint32_t inPosition, nsIWidget* inBelow,
                                      uint32_t* outPosition,
                                      nsIWidget** outBelow, bool* outAltered) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_ARG_POINTER(outBelow);
   NS_ENSURE_STATE(mReady);
 
   *outBelow = nullptr;
@@ -376,17 +376,17 @@ nsWindowMediator::CalculateZPosition(nsI
   if (!inWindow || !outPosition || !outAltered) return NS_ERROR_NULL_POINTER;
 
   if (inPosition != nsIWindowMediator::zLevelTop &&
       inPosition != nsIWindowMediator::zLevelBottom &&
       inPosition != nsIWindowMediator::zLevelBelow)
     return NS_ERROR_INVALID_ARG;
 
   nsWindowInfo* info = mTopmostWindow;
-  nsIXULWindow* belowWindow = nullptr;
+  nsIAppWindow* belowWindow = nullptr;
   bool found = false;
   nsresult result = NS_OK;
 
   *outPosition = inPosition;
   *outAltered = false;
 
   if (mSortingZOrder) {  // don't fight SortZOrder()
     *outBelow = inBelow;
@@ -481,18 +481,18 @@ nsWindowMediator::CalculateZPosition(nsI
     else
       result = NS_ERROR_NO_INTERFACE;
   }
 
   return result;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::SetZPosition(nsIXULWindow* inWindow, uint32_t inPosition,
-                               nsIXULWindow* inBelow) {
+nsWindowMediator::SetZPosition(nsIAppWindow* inWindow, uint32_t inPosition,
+                               nsIAppWindow* inBelow) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   nsWindowInfo *inInfo, *belowInfo;
 
   if ((inPosition != nsIWindowMediator::zLevelTop &&
        inPosition != nsIWindowMediator::zLevelBottom &&
        inPosition != nsIWindowMediator::zLevelBelow) ||
       !inWindow) {
     return NS_ERROR_INVALID_ARG;
@@ -534,29 +534,29 @@ nsWindowMediator::SetZPosition(nsIXULWin
     inInfo->InsertAfter(nullptr, belowInfo);
   }
   if (inPosition == nsIWindowMediator::zLevelTop) mTopmostWindow = inInfo;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::GetZLevel(nsIXULWindow* aWindow, uint32_t* _retval) {
+nsWindowMediator::GetZLevel(nsIAppWindow* aWindow, uint32_t* _retval) {
   NS_ENSURE_ARG_POINTER(_retval);
-  *_retval = nsIXULWindow::normalZ;
+  *_retval = nsIAppWindow::normalZ;
   // This can fail during window destruction.
   nsWindowInfo* info = GetInfoFor(aWindow);
   if (info) {
     *_retval = info->mZLevel;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsWindowMediator::SetZLevel(nsIXULWindow* aWindow, uint32_t aZLevel) {
+nsWindowMediator::SetZLevel(nsIAppWindow* aWindow, uint32_t aZLevel) {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
   NS_ENSURE_STATE(mReady);
 
   nsWindowInfo* info = GetInfoFor(aWindow);
   NS_ASSERTION(info, "setting z level of unregistered window");
   if (!info) return NS_ERROR_FAILURE;
 
   if (info->mZLevel != aZLevel) {
--- a/xpfe/appshell/nsWindowMediator.h
+++ b/xpfe/appshell/nsWindowMediator.h
@@ -10,55 +10,55 @@
 #include "nsIWindowMediator.h"
 #include "nsIObserver.h"
 #include "nsTArray.h"
 #include "nsString.h"
 #include "nsWeakReference.h"
 #include "nsTObserverArray.h"
 
 class nsAppShellWindowEnumerator;
-class nsASXULWindowEarlyToLateEnumerator;
+class nsASAppWindowEarlyToLateEnumerator;
 class nsASDOMWindowEarlyToLateEnumerator;
-class nsASXULWindowFrontToBackEnumerator;
-class nsASXULWindowBackToFrontEnumerator;
+class nsASAppWindowFrontToBackEnumerator;
+class nsASAppWindowBackToFrontEnumerator;
 class nsIWindowMediatorListener;
 struct nsWindowInfo;
 
 class nsWindowMediator : public nsIWindowMediator,
                          public nsIObserver,
                          public nsSupportsWeakReference {
   friend class nsAppShellWindowEnumerator;
-  friend class nsASXULWindowEarlyToLateEnumerator;
+  friend class nsASAppWindowEarlyToLateEnumerator;
   friend class nsASDOMWindowEarlyToLateEnumerator;
-  friend class nsASXULWindowFrontToBackEnumerator;
-  friend class nsASXULWindowBackToFrontEnumerator;
+  friend class nsASAppWindowFrontToBackEnumerator;
+  friend class nsASAppWindowBackToFrontEnumerator;
 
  protected:
   virtual ~nsWindowMediator();
 
  public:
   nsWindowMediator();
 
   nsresult Init();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIWINDOWMEDIATOR
   NS_DECL_NSIOBSERVER
 
-  static nsresult GetDOMWindow(nsIXULWindow* inWindow,
+  static nsresult GetDOMWindow(nsIAppWindow* inWindow,
                                nsCOMPtr<nsPIDOMWindowOuter>& outDOMWindow);
 
  private:
   int32_t AddEnumerator(nsAppShellWindowEnumerator* inEnumerator);
   int32_t RemoveEnumerator(nsAppShellWindowEnumerator* inEnumerator);
   nsWindowInfo* MostRecentWindowInfo(const char16_t* inType,
                                      bool aSkipPrivateBrowsingOrClosed = false);
 
   nsresult UnregisterWindow(nsWindowInfo* inInfo);
-  nsWindowInfo* GetInfoFor(nsIXULWindow* aWindow);
+  nsWindowInfo* GetInfoFor(nsIAppWindow* aWindow);
   nsWindowInfo* GetInfoFor(nsIWidget* aWindow);
   void SortZOrderFrontToBack();
   void SortZOrderBackToFront();
 
   nsTArray<nsAppShellWindowEnumerator*> mEnumeratorList;
   nsWindowInfo* mOldestWindow;
   nsWindowInfo* mTopmostWindow;
   int32_t mTimeStamp;