Bug 1651519: Part 2 - Also remove nsIDOMWindowUtils::outerWindowID. r=nika,geckoview-reviewers,agi

Differential Revision: https://phabricator.services.mozilla.com/D82957
This commit is contained in:
Kris Maglione 2020-07-21 22:19:19 +00:00
Родитель e7d942c77f
Коммит d182c95351
28 изменённых файлов: 37 добавлений и 70 удалений

Просмотреть файл

@ -905,7 +905,7 @@ class ContextMenuChild extends JSWindowActorChild {
);
context.frameOuterWindowID =
context.target.ownerGlobal.windowUtils.outerWindowID;
context.target.ownerGlobal.docShell.outerWindowID;
context.frameBrowsingContextID =
context.target.ownerGlobal.browsingContext.id;

Просмотреть файл

@ -30,7 +30,7 @@ class LightweightThemeChild extends JSWindowActorChild {
}
// We don't have a message manager, so presumable we're running in a sidebar
// in the parent process.
return this.contentWindow.top.windowUtils.outerWindowID;
return this.contentWindow.top.docShell.outerWindowID;
}
/**

Просмотреть файл

@ -144,7 +144,7 @@ var RefreshBlocker = {
*/
onRefreshAttempted(aWebProgress, aURI, aDelay, aSameURI) {
let win = aWebProgress.DOMWindow;
let outerWindowID = win.windowUtils.outerWindowID;
let outerWindowID = win.docShell.outerWindowID;
let data = {
URI: aURI.spec,

Просмотреть файл

@ -5199,7 +5199,7 @@
this._uniquePanelIDCounter = 0;
}
let outerID = window.windowUtils.outerWindowID;
let outerID = window.docShell.outerWindowID;
// We want panel IDs to be globally unique, that's why we include the
// window ID. We switched to a monotonic counter as Date.now() lead

Просмотреть файл

@ -166,7 +166,7 @@ add_task(async function sidebar_isOpen() {
await sendMessage(extension2, "isOpen", { result: false });
info("Test passing a windowId parameter");
let windowId = window.windowUtils.outerWindowID;
let windowId = window.docShell.outerWindowID;
let WINDOW_ID_CURRENT = -2;
await sendMessage(extension1, "isOpen", { arg: { windowId }, result: true });
await sendMessage(extension2, "isOpen", { arg: { windowId }, result: false });

Просмотреть файл

@ -66,7 +66,7 @@ const lameMultiWindowState = {
};
function getOuterWindowID(aWindow) {
return aWindow.windowUtils.outerWindowID;
return aWindow.docShell.outerWindowID;
}
function test() {

Просмотреть файл

@ -38,7 +38,7 @@ add_task(async function() {
}
info("Test browser window");
let windowId = window.windowUtils.outerWindowID;
let windowId = window.docShell.outerWindowID;
target = await targetFromURL(
new URL("http://foo?type=window&id=" + windowId)
);

Просмотреть файл

@ -47,8 +47,8 @@ async function checkGetTab(client, tab1, tab2, targetFront1, targetFront2) {
if (tab1.linkedBrowser.frameLoader.remoteTab) {
filter.tabId = tab1.linkedBrowser.frameLoader.remoteTab.tabId;
} else {
const windowUtils = tab1.linkedBrowser.contentWindow.windowUtils;
filter.outerWindowID = windowUtils.outerWindowID;
const { docShell } = tab1.linkedBrowser.contentWindow;
filter.outerWindowID = docShell.outerWindowID;
}
front = await getTabTarget(client, filter);
is(

Просмотреть файл

@ -222,13 +222,10 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
if (browser.frameLoader.remoteTab) {
// Tabs in child process
packet.tabId = browser.frameLoader.remoteTab.tabId;
} else if (browser.outerWindowID) {
// <xul:browser> tabs in parent process
packet.outerWindowID = browser.outerWindowID;
} else {
// <iframe mozbrowser> tabs in parent process
const windowUtils = browser.contentWindow.windowUtils;
packet.outerWindowID = windowUtils.outerWindowID;
// <xul:browser> or <iframe mozbrowser> tabs in parent process
packet.outerWindowID =
browser.browsingContext.currentWindowGlobal.outerWindowId;
}
} else {
// Throw if a filter object have been passed but without

Просмотреть файл

@ -430,8 +430,8 @@ const browsingContextTargetPrototype = {
},
get outerWindowID() {
if (this.window) {
return this.window.windowUtils.outerWindowID;
if (this.docShell) {
return this.docShell.outerWindowID;
}
return null;
},
@ -893,7 +893,7 @@ const browsingContextTargetPrototype = {
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);
const window = webProgress.DOMWindow;
const id = window.windowUtils.outerWindowID;
const id = docShell.outerWindowID;
let parentID = undefined;
// Ignore the parent of the original document on non-e10s firefox,
// as we get the xul window as parent and don't care about it.
@ -905,7 +905,7 @@ const browsingContextTargetPrototype = {
window.parent != window &&
window != this._originalWindow
) {
parentID = window.parent.windowUtils.outerWindowID;
parentID = window.parent.docShell.outerWindowID;
}
return {
@ -952,7 +952,7 @@ const browsingContextTargetPrototype = {
}
webProgress = webProgress.QueryInterface(Ci.nsIWebProgress);
const id = webProgress.DOMWindow.windowUtils.outerWindowID;
const id = webProgress.DOMWindow.docShell.outerWindowID;
this.emit("frameUpdate", {
frames: [
{

Просмотреть файл

@ -2137,15 +2137,6 @@ nsDOMWindowUtils::SetDesktopModeViewport(bool aDesktopMode) {
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetOuterWindowID(uint64_t* aWindowID) {
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_STATE(window);
*aWindowID = window->WindowID();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SuspendTimeouts() {
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);

Просмотреть файл

@ -15,7 +15,7 @@ function frameScript() {
]);
}
let outerID = content.windowUtils.outerWindowID;
let outerID = content.docShell.outerWindowID;
function onOuterWindowDestroyed(subject, topic, data) {
if (docShell) {
sendAsyncMessage("Test:Fail", "docShell is non-null");

Просмотреть файл

@ -28,7 +28,7 @@ windows.
const TEST_PAGE_2 = "http://example.com/browser";
function getOuterWindowID(win) {
return win.windowUtils.outerWindowID;
return win.docShell.outerWindowID;
}
/**

Просмотреть файл

@ -145,10 +145,8 @@ BrowserElementChild.prototype = {
* Show a modal prompt. Called by BrowserElementPromptService.
*/
showModalPrompt(win, args) {
let utils = win.windowUtils;
args.windowID = {
outer: utils.outerWindowID,
outer: win.docShell.outerWindowID,
inner: this._tryGetInnerWindowID(win),
};
sendAsyncMsg("showmodalprompt", args);
@ -173,7 +171,7 @@ BrowserElementChild.prototype = {
debug("_waitForResult(" + win + ")");
let utils = win.windowUtils;
let outerWindowID = utils.outerWindowID;
let outerWindowID = win.docShell.outerWindowID;
let innerWindowID = this._tryGetInnerWindowID(win);
if (innerWindowID === null) {
// I have no idea what waiting for a result means when there's no inner

Просмотреть файл

@ -687,7 +687,7 @@ var BrowserElementPromptService = {
},
_getOuterWindowID(win) {
return win.windowUtils.outerWindowID;
return win.docShell.outerWindowID;
},
_browserElementChildMap: {},

Просмотреть файл

@ -1293,11 +1293,6 @@ interface nsIDOMWindowUtils : nsISupports {
in AString aPseudoElement,
in AString aPropertyName);
/**
* Get the id of the outer window of this window. This will never throw.
*/
readonly attribute unsigned long long outerWindowID;
/**
* Put the window into a state where scripts are frozen and events
* suppressed, for use when the window has launched a modal prompt.

Просмотреть файл

@ -1021,7 +1021,7 @@ class RTCPeerConnection {
} else {
this._havePermission = new Promise((resolve, reject) => {
this._settlePermission = { allow: resolve, deny: reject };
let outerId = this._win.windowUtils.outerWindowID;
let outerId = this._win.docShell.outerWindowID;
let chrome = new CreateOfferRequest(
outerId,

Просмотреть файл

@ -23,10 +23,8 @@ function getIDs(iframe) {
// Force inner creation
win.document;
return [
SpecialPowers.getDOMWindowUtils(win).outerWindowID,
SpecialPowers.wrap(win).windowGlobalChild.innerWindowId,
];
let wgc = SpecialPowers.wrap(win).windowGlobalChild;
return [wgc.outerWindowId, wgc.innerWindowId];
}
var i1 = document.createElement("iframe");

Просмотреть файл

@ -43,7 +43,7 @@ async function go() {
return;
}
let winID = w.windowUtils.outerWindowID;
let winID = w.docShell.outerWindowID;
// Remove the frame. This will nuke the WindowProxy wrapper from our chrome
// document's global, so evaluating 'this' in it will return a dead wrapper
// once the window is destroyed.

Просмотреть файл

@ -37,7 +37,7 @@ add_task(async function() {
await new Promise(resolve => frame.addEventListener("load", resolve, {once: true}));
let win = frame.contentWindow;
let winID = SpecialPowers.getDOMWindowUtils(win).outerWindowID;
let winID = SpecialPowers.wrap(win).docShell.outerWindowID;
win.eval("obj = {}");
win.obj.foo = {bar: "baz"};

Просмотреть файл

@ -21,9 +21,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
class Tab {
constructor(window) {
this.id = GeckoViewTabBridge.windowIdToTabId(
window.windowUtils.outerWindowID
);
this.id = GeckoViewTabBridge.windowIdToTabId(window.docShell.outerWindowID);
this.browser = window.browser;
this.active = false;
}

Просмотреть файл

@ -518,7 +518,7 @@ class MobileWindowTracker extends EventEmitter {
}
setTabActive(aWindow, aActive) {
const { browser, tab, windowUtils } = aWindow;
const { browser, tab, docShell } = aWindow;
tab.active = aActive;
if (aActive) {
@ -528,7 +528,7 @@ class MobileWindowTracker extends EventEmitter {
this._topNonPBWindow = this._topWindow;
}
this.emit("tab-activated", {
windowId: windowUtils.outerWindowID,
windowId: docShell.outerWindowID,
tabId: tab.id,
isPrivate,
});

Просмотреть файл

@ -385,7 +385,7 @@ const loadListener = {
// In the case when the currently selected frame is closed,
// there will be no further load events. Stop listening immediately.
case "outer-window-destroyed":
if (bc.window.windowUtils.outerWindowID == winId) {
if (bc.currentWindowContext.outerWindowId == winId) {
this.stop();
sendOk(this.commandID);
}

Просмотреть файл

@ -14,14 +14,6 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/WebNavigationFrames.jsm"
);
function getDocShellOuterWindowId(docShell) {
if (!docShell) {
return undefined;
}
return docShell.domWindow.windowUtils.outerWindowID;
}
function loadListener(event) {
let document = event.target;
let window = document.defaultView;
@ -95,7 +87,7 @@ var CreatedNavigationTargetListener = {
const sourceFrameId = WebNavigationFrames.getFrameId(
sourceDocShell.browsingContext
);
const createdOuterWindowId = getDocShellOuterWindowId(sourceDocShell);
const createdOuterWindowId = sourceDocShell?.outerWindowID;
let url;
if (props.hasKey("url")) {

Просмотреть файл

@ -1455,7 +1455,7 @@ class WindowTrackerBase extends EventEmitter {
});
this._windowIds = new DefaultWeakMap(window => {
return window.windowUtils.outerWindowID;
return window.docShell.outerWindowID;
});
}

Просмотреть файл

@ -118,7 +118,7 @@ class Theme {
if (this.windowId) {
this.lwtData.window = windowTracker.getWindow(
this.windowId
).windowUtils.outerWindowID;
).docShell.outerWindowID;
windowOverrides.set(this.windowId, this);
} else {
windowOverrides.clear();
@ -384,9 +384,7 @@ class Theme {
};
if (windowId) {
lwtData.window = windowTracker.getWindow(
windowId
).windowUtils.outerWindowID;
lwtData.window = windowTracker.getWindow(windowId).docShell.outerWindowID;
windowOverrides.delete(windowId);
} else {
windowOverrides.clear();

Просмотреть файл

@ -172,7 +172,7 @@
}
get outerWindowID() {
return this.contentWindow.windowUtils.outerWindowID;
return this.docShell.outerWindowID;
}
makeEditable(editortype, waitForUrlLoad) {

Просмотреть файл

@ -207,7 +207,7 @@ const toolkitVariableMap = [
function LightweightThemeConsumer(aDocument) {
this._doc = aDocument;
this._win = aDocument.defaultView;
this._winId = this._win.windowUtils.outerWindowID;
this._winId = this._win.docShell.outerWindowID;
Services.obs.addObserver(this, "lightweight-theme-styling-update");