Backed out 2 changesets (bug 1651519) for wpt failures in webdriver/tests/switch_to_frame/switch.py. CLOSED TREE

Backed out changeset 52317abc5c68 (bug 1651519)
Backed out changeset 45448dca59a4 (bug 1651519)
This commit is contained in:
Dorel Luca 2020-07-21 21:55:57 +03:00
parent ebc4f4e1ab
commit d91c6dc40b
65 changed files with 152 additions and 99 deletions

View File

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

View File

@ -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.docShell.outerWindowID;
return this.contentWindow.top.windowUtils.outerWindowID;
}
/**

View File

@ -504,7 +504,7 @@ function getTabStateForContentWindow(aContentWindow, aForRemove = false) {
}
function getInnerWindowIDForWindow(aContentWindow) {
return aContentWindow.windowGlobalChild.innerWindowId;
return aContentWindow.windowUtils.currentInnerWindowID;
}
function getMessageManagerForWindow(aContentWindow) {

View File

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

View File

@ -5199,7 +5199,7 @@
this._uniquePanelIDCounter = 0;
}
let outerID = window.docShell.outerWindowID;
let outerID = window.windowUtils.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

View File

@ -102,7 +102,7 @@ async function promiseBrowserContentUnloaded(browser) {
browser,
MSG_WINDOW_DESTROYED,
MSG_WINDOW_DESTROYED => {
let innerWindowId = this.content.windowGlobalChild.innerWindowId;
let innerWindowId = this.content.windowUtils.currentInnerWindowID;
let observer = subject => {
if (
innerWindowId === subject.QueryInterface(Ci.nsISupportsPRUint64).data

View File

@ -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.docShell.outerWindowID;
let windowId = window.windowUtils.outerWindowID;
let WINDOW_ID_CURRENT = -2;
await sendMessage(extension1, "isOpen", { arg: { windowId }, result: true });
await sendMessage(extension2, "isOpen", { arg: { windowId }, result: false });

View File

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

View File

@ -135,7 +135,7 @@ class ReportSiteIssueHelperChild extends JSWindowActorChild {
}
_getLoggedMessages(includePrivate = false) {
const windowId = this.contentWindow.windowGlobalChild.innerWindowId;
const windowId = this.contentWindow.windowUtils.currentInnerWindowID;
return this._getConsoleMessages(windowId).concat(
this._getScriptErrors(windowId, includePrivate)
);

View File

@ -71,7 +71,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=995943
var gGoCount = 0;
function go() {
debug("Invoking go for window with id: " + window.windowGlobalChild.innerWindowId);
debug("Invoking go for window with id: " + window.windowUtils.currentInnerWindowID);
is(++gGoCount, 1, "Should only call go once!");
checkLoadFileURI('http://example.com', false).then(
pushPrefs.bind(null, [['capability.policy.policynames', ' somepolicy '],

View File

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

View File

@ -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 { docShell } = tab1.linkedBrowser.contentWindow;
filter.outerWindowID = docShell.outerWindowID;
const windowUtils = tab1.linkedBrowser.contentWindow.windowUtils;
filter.outerWindowID = windowUtils.outerWindowID;
}
front = await getTabTarget(client, filter);
is(

View File

@ -222,10 +222,13 @@ 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 {
// <xul:browser> or <iframe mozbrowser> tabs in parent process
packet.outerWindowID =
browser.browsingContext.currentWindowGlobal.outerWindowId;
// <iframe mozbrowser> tabs in parent process
const windowUtils = browser.contentWindow.windowUtils;
packet.outerWindowID = windowUtils.outerWindowID;
}
} else {
// Throw if a filter object have been passed but without

View File

@ -80,7 +80,7 @@ function logAccessDeniedWarning(window, callerInfo, extensionPolicy) {
const msg = `The extension "${name}" is not allowed to access ${reportedURI.spec}`;
const innerWindowId = window.windowGlobalChild.innerWindowId;
const innerWindowId = window.windowUtils.currentInnerWindowID;
const errorFlag = 0;

View File

@ -46,7 +46,7 @@ const EventSourceActor = ActorClassWithSpec(eventSourceSpec, {
startListening: function() {
this.stopListening();
this.innerWindowID = this.targetActor.window.windowGlobalChild.innerWindowId;
this.innerWindowID = this.targetActor.window.windowUtils.currentInnerWindowID;
eventSourceEventService.addListener(this.innerWindowID, this);
},

View File

@ -50,7 +50,7 @@ const WebSocketActor = ActorClassWithSpec(webSocketSpec, {
startListening: function() {
this.stopListening();
this.innerWindowID = this.targetActor.window.windowGlobalChild.innerWindowId;
this.innerWindowID = this.targetActor.window.windowUtils.currentInnerWindowID;
webSocketEventService.addListener(this.innerWindowID, this);
},

View File

@ -3519,7 +3519,7 @@ const StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, {
getWindowFromInnerWindowID(innerID) {
innerID = innerID.QueryInterface(Ci.nsISupportsPRUint64).data;
for (const win of this.childWindowPool.values()) {
const id = win.windowGlobalChild.innerWindowId;
const id = win.windowUtils.currentInnerWindowID;
if (id == innerID) {
return win;
}

View File

@ -83,7 +83,7 @@ loader.lazyRequireGetter(
);
function getWindowID(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
}
function getDocShellChromeEventHandler(docShell) {
@ -123,7 +123,7 @@ exports.getChildDocShells = getChildDocShells;
*/
function getInnerId(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
}
const browsingContextTargetPrototype = {
@ -430,8 +430,8 @@ const browsingContextTargetPrototype = {
},
get outerWindowID() {
if (this.docShell) {
return this.docShell.outerWindowID;
if (this.window) {
return this.window.windowUtils.outerWindowID;
}
return null;
},
@ -893,7 +893,7 @@ const browsingContextTargetPrototype = {
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebProgress);
const window = webProgress.DOMWindow;
const id = docShell.outerWindowID;
const id = window.windowUtils.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.docShell.outerWindowID;
parentID = window.parent.windowUtils.outerWindowID;
}
return {
@ -952,7 +952,7 @@ const browsingContextTargetPrototype = {
}
webProgress = webProgress.QueryInterface(Ci.nsIWebProgress);
const id = webProgress.DOMWindow.docShell.outerWindowID;
const id = webProgress.DOMWindow.windowUtils.outerWindowID;
this.emit("frameUpdate", {
frames: [
{

View File

@ -88,10 +88,10 @@ var WebConsoleUtils = {
* Inner ID for the given window, null if we can't access it.
*/
getInnerWindowId: function(window) {
// Might throw with SecurityError: Permission denied to access property
// "windowGlobalChild" on cross-origin object.
// Might throw with SecurityError: Permission denied to access property "windowUtils"
// on cross-origin object.
try {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
} catch (e) {
return null;
}
@ -546,7 +546,7 @@ WebConsoleCommands._registerOriginal("cd", function(owner, window) {
0,
1,
"content javascript",
owner.window.windowGlobalChild.innerWindowId
owner.window.windowUtils.currentInnerWindowID
);
const Services = require("Services");
Services.console.logMessage(scriptError);

View File

@ -72,5 +72,5 @@ ContentObserver.prototype = {
// Utility functions.
ContentObserver.GetInnerWindowID = function(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
};

View File

@ -201,7 +201,7 @@ function logInPage(text, flags, window) {
0,
flags,
"screenshot",
window.windowGlobalChild.innerWindowId
window.windowUtils.currentInnerWindowID
);
Services.console.logMessage(scriptError);
}

View File

@ -22,7 +22,7 @@ function doConsoleCalls(aState)
{
const { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
const console = new ConsoleAPI({
innerID: window.windowGlobalChild.innerWindowId
innerID: window.windowUtils.currentInnerWindowID
});
const longString = (new Array(DevToolsServer.LONG_STRING_LENGTH + 2)).join("a");

View File

@ -123,7 +123,7 @@ add_task(async function test() {
let { testFns } = this.content.wrappedJSObject;
this.content.onbeforeunload = testFns[testIdx];
this.content.location = url;
return this.content.windowGlobalChild.innerWindowId;
return this.content.windowUtils.currentInnerWindowID;
}
);
@ -142,7 +142,7 @@ add_task(async function test() {
"Page should have navigated to the correct URL"
);
Assert.notEqual(
this.content.windowGlobalChild.innerWindowId,
this.content.windowUtils.currentInnerWindowID,
winID,
"Page should have a new inner window"
);
@ -157,7 +157,7 @@ add_task(async function test() {
"Page should have the same URL"
);
Assert.equal(
this.content.windowGlobalChild.innerWindowId,
this.content.windowUtils.currentInnerWindowID,
winID,
"Page should have the same inner window"
);

View File

@ -157,7 +157,8 @@ DOMRequestIpcHelper.prototype = {
this._window = aWindow;
if (this._window) {
// We don't use this.innerWindowID, but other classes rely on it.
this.innerWindowID = this._window.windowGlobalChild.innerWindowId;
let util = this._window.windowUtils;
this.innerWindowID = util.currentInnerWindowID;
}
this._destroyed = false;

View File

@ -2137,6 +2137,29 @@ 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::GetCurrentInnerWindowID(uint64_t* aWindowID) {
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);
NS_ENSURE_TRUE(window, NS_ERROR_NOT_AVAILABLE);
nsGlobalWindowInner* inner =
nsGlobalWindowOuter::Cast(window)->GetCurrentInnerWindowInternal();
if (!inner) {
return NS_ERROR_NOT_AVAILABLE;
}
*aWindowID = inner->WindowID();
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::SuspendTimeouts() {
nsCOMPtr<nsPIDOMWindowOuter> window = do_QueryReferent(mWindow);

View File

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

View File

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

View File

@ -14,7 +14,7 @@ var service = SpecialPowers.Cc["@mozilla.org/eventsourceevent/service;1"]
.getService(SpecialPowers.Ci.nsIEventSourceEventService);
ok(!!service, "We have the nsIEventSourceEventService");
var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId;
var innerId = SpecialPowers.getDOMWindowUtils(window).currentInnerWindowID;
ok(innerId, "We have a valid innerWindowID: " + innerId);
var channelId = null;
@ -66,4 +66,4 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>
</html>

View File

@ -14,7 +14,7 @@ var service = SpecialPowers.Cc["@mozilla.org/eventsourceevent/service;1"]
.getService(SpecialPowers.Ci.nsIEventSourceEventService);
ok(!!service, "We have the nsIEventSourceEventService");
var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId;
var innerId = SpecialPowers.getDOMWindowUtils(window).currentInnerWindowID;
ok(innerId, "We have a valid innerWindowID: " + innerId);
var channelId;
@ -69,4 +69,4 @@ function checkCallsCount() {
</script>
</pre>
</body>
</html>
</html>

View File

@ -14,7 +14,7 @@ var service = SpecialPowers.Cc["@mozilla.org/eventsourceevent/service;1"]
.getService(SpecialPowers.Ci.nsIEventSourceEventService);
ok(!!service, "We have the nsIEventSourceEventService");
var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId;
var innerId = SpecialPowers.getDOMWindowUtils(window).currentInnerWindowID;
ok(innerId, "We have a valid innerWindowID: " + innerId);
var listener = {
@ -64,4 +64,4 @@ function doTest(status) {
</script>
</pre>
</body>
</html>
</html>

View File

@ -14,7 +14,7 @@ var service = SpecialPowers.Cc["@mozilla.org/eventsourceevent/service;1"]
.getService(SpecialPowers.Ci.nsIEventSourceEventService);
ok(!!service, "We have the nsIEventSourceEventService");
var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId;
var innerId = SpecialPowers.getDOMWindowUtils(window).currentInnerWindowID;
ok(innerId, "We have a valid innerWindowID: " + innerId);
var channelId = null;
@ -58,4 +58,4 @@ SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>
</html>

View File

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

View File

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

View File

@ -1293,6 +1293,17 @@ 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;
/**
* Get the id of the current inner window of this window. If there
* is no current inner window, throws NS_ERROR_NOT_AVAILABLE.
*/
readonly attribute unsigned long long currentInnerWindowID;
/**
* Put the window into a state where scripts are frozen and events
* suppressed, for use when the window has launched a modal prompt.

View File

@ -257,7 +257,7 @@ IdpSandbox.prototype = {
// can't rethrow anything else because that could leak information about the
// internal workings of the IdP across origins.
_logError(e) {
let winID = this.window.windowGlobalChild.innerWindowId;
let winID = this.window.windowUtils.currentInnerWindowID;
let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance(
Ci.nsIScriptError
);

View File

@ -253,7 +253,7 @@ setupPrototype(RTCIceCandidate, {
class RTCSessionDescription {
init(win) {
this._win = win;
this._winID = this._win.windowGlobalChild.innerWindowId;
this._winID = this._win.windowUtils.currentInnerWindowID;
}
__init({ type, sdp }) {
@ -389,7 +389,7 @@ class RTCPeerConnection {
}
__init(rtcConfig) {
this._winID = this._win.windowGlobalChild.innerWindowId;
this._winID = this._win.windowUtils.currentInnerWindowID;
// TODO: Update this code once we support pc.setConfiguration, to track
// setting from content independently from pref (Bug 1181768).
if (
@ -1021,7 +1021,7 @@ class RTCPeerConnection {
} else {
this._havePermission = new Promise((resolve, reject) => {
this._settlePermission = { allow: resolve, deny: reject };
let outerId = this._win.docShell.outerWindowID;
let outerId = this._win.windowUtils.outerWindowID;
let chrome = new CreateOfferRequest(
outerId,
@ -2020,7 +2020,7 @@ setupPrototype(PeerConnectionObserver, {
class RTCPeerConnectionStatic {
init(win) {
this._winID = win.windowGlobalChild.innerWindowId;
this._winID = win.windowUtils.currentInnerWindowID;
}
registerPeerConnectionLifecycleCallback(cb) {

View File

@ -216,8 +216,8 @@ function injectControlledFrame(target = document.body) {
: Promise.reject(new Error("Frame removed from document"));
},
innerWindowId() {
return SpecialPowers.wrap(iframe).browsingContext.currentWindowContext
.innerWindowId;
var utils = SpecialPowers.getDOMWindowUtils(iframe.contentWindow);
return utils.currentInnerWindowID;
},
};

View File

@ -40,7 +40,7 @@ add_task(async function() {
if (aTopic == "console-storage-cache-event") {
apiCallCount++;
if (apiCallCount == 4) {
let windowId = content.windowGlobalChild.innerWindowId;
let windowId = content.window.windowUtils.currentInnerWindowID;
Services.obs.removeObserver(this, "console-storage-cache-event");
ok(

View File

@ -17,7 +17,7 @@ function test() {
);
function getInnerWindowId(aWindow) {
return aWindow.windowGlobalChild.innerWindowId;
return aWindow.windowUtils.currentInnerWindowID;
}
function whenNewWindowLoaded(aOptions, aCallback) {

View File

@ -2,7 +2,7 @@
<script>
dump("Content running top level script " + window.location.href + "\n");
var winID = SpecialPowers.wrap(this).windowGlobalChild.innerWindowId;
var winID = SpecialPowers.getDOMWindowUtils(this).currentInnerWindowID;
var observer = {
observe(subject, topic) {

View File

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

View File

@ -26,7 +26,7 @@ var tests = [
{ payload: (function() { var buffer = ""; for (var i = 0; i < 120; ++i) buffer += i; return buffer; }()) },
]
var innerId = window.top.windowGlobalChild.innerWindowId;
var innerId = window.top.windowUtils.currentInnerWindowID;
ok(innerId, "We have a valid innerWindowID: " + innerId);
var service = Cc["@mozilla.org/websocketevent/service;1"]

View File

@ -38,7 +38,7 @@ function hasExpectedProperties(message, exception) {
is(message.sourceName, location.href, "has correct sourceName/filename");
ok(message.lineNumber > 0, "has lineNumber");
is(message.innerWindowID, window.windowGlobalChild.innerWindowId,
is(message.innerWindowID, window.windowUtils.currentInnerWindowID,
"correct innerWindowID");
}

View File

@ -43,7 +43,7 @@ async function go() {
return;
}
let winID = w.docShell.outerWindowID;
let winID = w.windowUtils.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.

View File

@ -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.wrap(win).docShell.outerWindowID;
let winID = SpecialPowers.getDOMWindowUtils(win).outerWindowID;
win.eval("obj = {}");
win.obj.foo = {bar: "baz"};

View File

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

View File

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

View File

@ -1439,11 +1439,12 @@ NS_IMETHODIMP HttpBaseChannel::GetTopLevelContentWindowId(uint64_t* aWindowId) {
if (loadContext) {
nsCOMPtr<mozIDOMWindowProxy> topWindow;
loadContext->GetTopWindow(getter_AddRefs(topWindow));
nsCOMPtr<nsIDOMWindowUtils> windowUtils;
if (topWindow) {
if (nsPIDOMWindowInner* inner =
nsPIDOMWindowOuter::From(topWindow)->GetCurrentInnerWindow()) {
mContentWindowId = inner->WindowID();
}
windowUtils = nsGlobalWindowOuter::Cast(topWindow)->WindowUtils();
}
if (windowUtils) {
windowUtils->GetCurrentInnerWindowID(&mContentWindowId);
}
}
}

View File

@ -241,7 +241,7 @@ class Page extends ContentProcessDomain {
const window = defaultContext.window;
const executionContextId = Runtime._onContextCreated("context-created", {
windowId: window.windowGlobalChild.innerWindowId,
windowId: window.windowUtils.currentInnerWindowID,
window,
isDefault: false,
contextName: worldName,

View File

@ -89,7 +89,7 @@ class Runtime extends ContentProcessDomain {
// after we replied to `enable` request.
executeSoon(() => {
this._onContextCreated("context-created", {
windowId: this.content.windowGlobalChild.innerWindowId,
windowId: this.content.windowUtils.currentInnerWindowID,
window: this.content,
isDefault: true,
});
@ -325,7 +325,8 @@ class Runtime extends ContentProcessDomain {
_getDefaultContextForWindow(innerWindowId) {
if (!innerWindowId) {
innerWindowId = this.content.windowGlobalChild.innerWindowId;
const { windowUtils } = this.content;
innerWindowId = windowUtils.currentInnerWindowID;
}
const curContexts = this.innerWindowIdToContexts.get(innerWindowId);
if (curContexts) {

View File

@ -48,7 +48,7 @@ class ExecutionContext {
// Here, we assume that debuggee is a window object and we will propably have
// to adapt that once we cover workers or contexts that aren't a document.
this.window = debuggee;
this.windowId = debuggee.windowGlobalChild.innerWindowId;
this.windowId = debuggee.windowUtils.currentInnerWindowID;
this.id = id;
this.frameId = debuggee.docShell.browsingContext.id.toString();
this.isDefault = isDefault;

View File

@ -74,8 +74,8 @@ class ContextObserver {
handleEvent({ type, target, persisted }) {
const window = target.defaultView;
const frameId = window.browsingContext.id;
const id = window.windowGlobalChild.innerWindowId;
const frameId = window.docShell.browsingContext.id;
const id = window.windowUtils.currentInnerWindowID;
switch (type) {
case "DOMWindowCreated":

View File

@ -231,7 +231,7 @@ class SpecialPowersChild extends JSWindowActorChild {
let window = this.contentWindow;
// We should not invoke the getter.
if (!("SpecialPowers" in window.wrappedJSObject)) {
this._windowID = window.windowGlobalChild.innerWindowId;
this._windowID = window.windowUtils.currentInnerWindowID;
defineSpecialPowers(this);
if (this.IsInNestedFrame) {

View File

@ -132,9 +132,7 @@ function wrapPrivileged(obj, win) {
let { windowID, proxies, handler } = perWindowInfo.get(win) || {};
// |windowUtils| is undefined if |win| is a non-window object
// such as a sandbox.
let currentID = win.windowGlobalChild
? win.windowGlobalChild.innerWindowId
: 0;
let currentID = win.windowUtils ? win.windowUtils.currentInnerWindowID : 0;
// Values are dead objects if the inner window is changed.
if (windowID !== currentID) {
windowID = currentID;

View File

@ -109,7 +109,7 @@ class DefaultMap extends Map {
}
function getInnerWindowID(window) {
return window.windowGlobalChild?.innerWindowId;
return window.windowUtils.currentInnerWindowID;
}
/**

View File

@ -14,6 +14,14 @@ 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;
@ -87,7 +95,7 @@ var CreatedNavigationTargetListener = {
const sourceFrameId = WebNavigationFrames.getFrameId(
sourceDocShell.browsingContext
);
const createdOuterWindowId = sourceDocShell?.outerWindowID;
const createdOuterWindowId = getDocShellOuterWindowId(sourceDocShell);
let url;
if (props.hasKey("url")) {

View File

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

View File

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

View File

@ -48,7 +48,7 @@ add_task(async function test_contentscript_devtools_sandbox_metadata() {
let win = window.open("file_sample.html");
let innerWindowID = SpecialPowers.wrap(win).windowGlobalChild.innerWindowId;
let innerWindowID = SpecialPowers.getDOMWindowUtils(win).currentInnerWindowID;
await extension.awaitFinish("contentScript.executed");

View File

@ -191,8 +191,7 @@ add_task(async function test_ExtensionPageContextChild_in_child_frame() {
let frame = this.content.document.querySelector(
"iframe[src*='iframe.html']"
);
let innerWindowID =
frame.browsingContext.currentWindowContext.innerWindowId;
let innerWindowID = frame.contentWindow.windowUtils.currentInnerWindowID;
let context = ExtensionPageChild.extensionContexts.get(innerWindowID);
Assert.ok(context, "Got extension page context for child frame");
@ -238,7 +237,7 @@ add_task(async function test_ExtensionPageContextChild_in_toplevel() {
"resource://gre/modules/ExtensionPageChild.jsm"
);
let innerWindowID = this.content.windowGlobalChild.innerWindowId;
let innerWindowID = this.content.windowUtils.currentInnerWindowID;
let context = ExtensionPageChild.extensionContexts.get(innerWindowID);
Assert.ok(context, "Got extension page context for top-level document");

View File

@ -51,7 +51,7 @@ this.InsecurePasswordUtils = {
* Inner ID for the given window.
*/
_getInnerWindowId(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
},
_sendWebConsoleMessage(messageTag, domDoc) {

View File

@ -69,7 +69,7 @@ var AboutReader = function(actor, articlePromise) {
this._docRef = Cu.getWeakReference(doc);
this._winRef = Cu.getWeakReference(win);
this._innerWindowId = win.windowGlobalChild.innerWindowId;
this._innerWindowId = win.windowUtils.currentInnerWindowID;
this._article = null;
this._languagePromise = new Promise(resolve => {

View File

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

View File

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

View File

@ -37,7 +37,8 @@ function CallbackObject(id, callback, mediator) {
}
function RemoteMediator(window) {
this._windowID = window.windowGlobalChild.innerWindowId;
let utils = window.windowUtils;
this._windowID = utils.currentInnerWindowID;
this.mm = window.docShell.messageManager;
this.mm.addWeakMessageListener(MSG_INSTALL_CALLBACK, this);