Skip to content

Commit

Permalink
Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and ns…
Browse files Browse the repository at this point in the history
…IAppWindow. r=smaug

nsXULWindow is no longer XUL specific and is somewhat confusing name.

Differential Revision: https://phabricator.services.mozilla.com/D51486

--HG--
rename : xpfe/appshell/nsXULWindow.cpp => xpfe/appshell/AppWindow.cpp
rename : xpfe/appshell/nsXULWindow.h => xpfe/appshell/AppWindow.h
rename : xpfe/appshell/nsIXULWindow.idl => xpfe/appshell/nsIAppWindow.idl
extra : moz-landing-system : lando
  • Loading branch information
Brendan Dahl committed Nov 5, 2019
1 parent ad00c07 commit eafc9e3
Show file tree
Hide file tree
Showing 74 changed files with 844 additions and 850 deletions.
10 changes: 5 additions & 5 deletions accessible/generic/RootAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "nsGlobalWindow.h"

#ifdef MOZ_XUL
# include "nsIXULWindow.h"
# include "nsIAppWindow.h"
#endif

using namespace mozilla;
Expand Down Expand Up @@ -97,18 +97,18 @@ role RootAccessible::NativeRole() const {
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
Expand Down
4 changes: 2 additions & 2 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ var gBrowserInit = {
// 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;
Expand Down Expand Up @@ -2534,7 +2534,7 @@ var gBrowserInit = {
window.XULBrowserWindow = null;
window.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow).XULBrowserWindow = null;
.getInterface(Ci.nsIAppWindow).XULBrowserWindow = null;
window.browserDOMWindow = null;
},
};
Expand Down
8 changes: 4 additions & 4 deletions browser/components/BrowserGlue.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,11 @@ let LEGACY_ACTORS = {
// 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 {
Expand Down
2 changes: 1 addition & 1 deletion browser/components/downloads/DownloadsTaskbar.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ var DownloadsTaskbar = {
// 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
Expand Down
2 changes: 1 addition & 1 deletion browser/components/extensions/parent/ext-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ class Window extends WindowBase {
}

get alwaysOnTop() {
return this.xulWindow.zLevel >= Ci.nsIXULWindow.raisedZ;
return this.appWindow.zLevel >= Ci.nsIAppWindow.raisedZ;
}

get isLastFocused() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ add_task(async function testWindowCreate() {
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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* 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.
Expand All @@ -15,7 +15,7 @@ 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(
Expand Down
12 changes: 6 additions & 6 deletions browser/components/search/SearchTelemetry.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,10 @@ class TelemetryHandler {
* 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",
() => {
Expand All @@ -268,10 +268,10 @@ class TelemetryHandler {
* 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") !=
Expand Down
10 changes: 5 additions & 5 deletions browser/components/sessionstore/SessionStore.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -5259,7 +5259,7 @@ var SessionStoreInternal = {
},

/**
* 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)
Expand Down Expand Up @@ -5298,13 +5298,13 @@ var SessionStoreInternal = {
}
// 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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions browser/components/tests/startupRecorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ startupRecorder.prototype = {
// 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);
Expand Down
14 changes: 7 additions & 7 deletions devtools/server/actors/webbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ BrowserTabList.prototype._getChildren = function(window) {
};

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
Expand Down Expand Up @@ -416,11 +416,11 @@ BrowserTabList.prototype.getTab = function(
});
}

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({
Expand Down Expand Up @@ -781,7 +781,7 @@ BrowserTabList.prototype.onOpenWindow = DevToolsUtils.makeInfallible(function(
BrowserTabList.prototype.onCloseWindow = DevToolsUtils.makeInfallible(function(
window
) {
if (window instanceof Ci.nsIXULWindow) {
if (window instanceof Ci.nsIAppWindow) {
window = window.docShell.domWindow;
}

Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsDocShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4984,7 +4984,7 @@ nsDocShell::SetParentNativeWindow(nativeWindow aParentNativeWindow) {

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;
}

Expand Down
4 changes: 2 additions & 2 deletions docshell/base/nsDocShellTreeOwner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem, int32_t aCX,
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);
Expand Down Expand Up @@ -588,7 +588,7 @@ nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow) {

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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ add_task(async function() {

let chromeFlags = win.docShell.treeOwner
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow).chromeFlags;
.getInterface(Ci.nsIAppWindow).chromeFlags;

let expected = CHROME_ALL;

Expand Down
18 changes: 9 additions & 9 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
#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"
Expand Down Expand Up @@ -8381,7 +8381,7 @@ void Document::SetMayStartLayout(bool aMayStartLayout) {
// 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();
}
Expand Down Expand Up @@ -14275,23 +14275,23 @@ already_AddRefed<XPathResult> Document::Evaluate(
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) {
nsCOMPtr<nsIAppWindow> appWin = do_GetInterface(owner);
if (!appWin) {
return nullptr;
}
nsCOMPtr<nsIDocShell> xulWinShell;
xulWin->GetDocShell(getter_AddRefs(xulWinShell));
if (!SameCOMIdentity(xulWinShell, item)) {
nsCOMPtr<nsIDocShell> appWinShell;
appWin->GetDocShell(getter_AddRefs(appWinShell));
if (!SameCOMIdentity(appWinShell, item)) {
return nullptr;
}
return xulWin.forget();
return appWin.forget();
}

Document* Document::GetTopLevelContentDocument() {
Expand Down
6 changes: 3 additions & 3 deletions dom/base/Document.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class nsWindowSizes;
class nsDOMCaretPosition;
class nsViewportInfo;
class nsIGlobalObject;
class nsIXULWindow;
class nsIAppWindow;
class nsXULPrototypeDocument;
class nsXULPrototypeElement;
class PermissionDelegateHandler;
Expand Down Expand Up @@ -3536,9 +3536,9 @@ class Document : public nsINode,
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,
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsCCUncollectableMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#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"
Expand Down Expand Up @@ -351,7 +351,7 @@ nsresult nsCCUncollectableMarker::Observe(nsISupports* aSubject,
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));
Expand Down
8 changes: 4 additions & 4 deletions dom/base/nsFocusManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#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"
Expand Down Expand Up @@ -700,10 +700,10 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
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;
}
Expand Down
4 changes: 2 additions & 2 deletions dom/base/nsFrameLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "nsSubDocumentFrame.h"
#include "nsError.h"
#include "nsISHistory.h"
#include "nsIXULWindow.h"
#include "nsIAppWindow.h"
#include "nsIMozBrowserFrame.h"
#include "nsISHistory.h"
#include "nsIScriptError.h"
Expand Down Expand Up @@ -2598,7 +2598,7 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
!parentOwner) {
return false;
}
nsCOMPtr<nsIXULWindow> window(do_GetInterface(parentOwner));
nsCOMPtr<nsIAppWindow> window(do_GetInterface(parentOwner));
if (window && NS_FAILED(window->GetChromeFlags(&chromeFlags))) {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion dom/base/nsGlobalWindowInner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@
#include "mozilla/EventStateManager.h"
#include "nsIObserverService.h"
#include "nsFocusManager.h"
#include "nsIXULWindow.h"
#include "nsITimedChannel.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZ_XUL
Expand Down
Loading

0 comments on commit eafc9e3

Please sign in to comment.