diff --git a/browser/actors/WebRTCChild.jsm b/browser/actors/WebRTCChild.jsm index dcbabc0cfac5..f2a022acdcb6 100644 --- a/browser/actors/WebRTCChild.jsm +++ b/browser/actors/WebRTCChild.jsm @@ -491,5 +491,5 @@ function getTabStateForContentWindow(aContentWindow, aForRemove = false) { } function getInnerWindowIDForWindow(aContentWindow) { - return aContentWindow.windowUtils.currentInnerWindowID; + return aContentWindow.windowGlobalChild.innerWindowId; } diff --git a/browser/components/extensions/test/browser/browser_ext_getViews.js b/browser/components/extensions/test/browser/browser_ext_getViews.js index be8c1dce5fae..a8c5183d7564 100644 --- a/browser/components/extensions/test/browser/browser_ext_getViews.js +++ b/browser/components/extensions/test/browser/browser_ext_getViews.js @@ -97,7 +97,7 @@ async function promiseBrowserContentUnloaded(browser) { browser, MSG_WINDOW_DESTROYED, MSG_WINDOW_DESTROYED => { - let innerWindowId = this.content.windowUtils.currentInnerWindowID; + let innerWindowId = this.content.windowGlobalChild.innerWindowId; let observer = subject => { if ( innerWindowId === subject.QueryInterface(Ci.nsISupportsPRUint64).data diff --git a/browser/extensions/report-site-issue/experimentalAPIs/actors/tabExtrasActor.jsm b/browser/extensions/report-site-issue/experimentalAPIs/actors/tabExtrasActor.jsm index b79b60ea830a..869856dbeab9 100644 --- a/browser/extensions/report-site-issue/experimentalAPIs/actors/tabExtrasActor.jsm +++ b/browser/extensions/report-site-issue/experimentalAPIs/actors/tabExtrasActor.jsm @@ -135,7 +135,7 @@ class ReportSiteIssueHelperChild extends JSWindowActorChild { } _getLoggedMessages(includePrivate = false) { - const windowId = this.contentWindow.windowUtils.currentInnerWindowID; + const windowId = this.contentWindow.windowGlobalChild.innerWindowId; return this._getConsoleMessages(windowId).concat( this._getScriptErrors(windowId, includePrivate) ); diff --git a/caps/tests/mochitest/test_bug995943.xhtml b/caps/tests/mochitest/test_bug995943.xhtml index 5a228155fd91..adb7701e4a9f 100644 --- a/caps/tests/mochitest/test_bug995943.xhtml +++ b/caps/tests/mochitest/test_bug995943.xhtml @@ -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.windowUtils.currentInnerWindowID); + debug("Invoking go for window with id: " + window.windowGlobalChild.innerWindowId); is(++gGoCount, 1, "Should only call go once!"); checkLoadFileURI('http://example.com', false).then( pushPrefs.bind(null, [['capability.policy.policynames', ' somepolicy '], diff --git a/devtools/server/actors/addon/webextension-inspected-window.js b/devtools/server/actors/addon/webextension-inspected-window.js index 06a8eed1d47d..e091ab7f22c9 100644 --- a/devtools/server/actors/addon/webextension-inspected-window.js +++ b/devtools/server/actors/addon/webextension-inspected-window.js @@ -80,7 +80,7 @@ function logAccessDeniedWarning(window, callerInfo, extensionPolicy) { const msg = `The extension "${name}" is not allowed to access ${reportedURIorPrincipal.spec}`; - const innerWindowId = window.windowUtils.currentInnerWindowID; + const innerWindowId = window.windowGlobalChild.innerWindowId; const errorFlag = 0; diff --git a/devtools/server/actors/network-monitor/eventsource-actor.js b/devtools/server/actors/network-monitor/eventsource-actor.js index 35ce82e7cac5..3ac12c304dc5 100644 --- a/devtools/server/actors/network-monitor/eventsource-actor.js +++ b/devtools/server/actors/network-monitor/eventsource-actor.js @@ -46,7 +46,7 @@ const EventSourceActor = ActorClassWithSpec(eventSourceSpec, { startListening: function() { this.stopListening(); - this.innerWindowID = this.targetActor.window.windowUtils.currentInnerWindowID; + this.innerWindowID = this.targetActor.window.windowGlobalChild.innerWindowId; eventSourceEventService.addListener(this.innerWindowID, this); }, diff --git a/devtools/server/actors/network-monitor/websocket-actor.js b/devtools/server/actors/network-monitor/websocket-actor.js index 00b3e67df065..c4a0af0685e1 100644 --- a/devtools/server/actors/network-monitor/websocket-actor.js +++ b/devtools/server/actors/network-monitor/websocket-actor.js @@ -50,7 +50,7 @@ const WebSocketActor = ActorClassWithSpec(webSocketSpec, { startListening: function() { this.stopListening(); - this.innerWindowID = this.targetActor.window.windowUtils.currentInnerWindowID; + this.innerWindowID = this.targetActor.window.windowGlobalChild.innerWindowId; webSocketEventService.addListener(this.innerWindowID, this); }, diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js index 61150d66f175..874b34ad2bd8 100644 --- a/devtools/server/actors/storage.js +++ b/devtools/server/actors/storage.js @@ -3542,7 +3542,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.windowUtils.currentInnerWindowID; + const id = win.windowGlobalChild.innerWindowId; if (id == innerID) { return win; } diff --git a/devtools/server/actors/targets/browsing-context.js b/devtools/server/actors/targets/browsing-context.js index 3229b01faaff..3d57b76b638c 100644 --- a/devtools/server/actors/targets/browsing-context.js +++ b/devtools/server/actors/targets/browsing-context.js @@ -72,7 +72,7 @@ loader.lazyRequireGetter( ); function getWindowID(window) { - return window.windowUtils.currentInnerWindowID; + return window.windowGlobalChild.innerWindowId; } function getDocShellChromeEventHandler(docShell) { @@ -112,7 +112,7 @@ exports.getChildDocShells = getChildDocShells; */ function getInnerId(window) { - return window.windowUtils.currentInnerWindowID; + return window.windowGlobalChild.innerWindowId; } const browsingContextTargetPrototype = { diff --git a/devtools/server/actors/webconsole/utils.js b/devtools/server/actors/webconsole/utils.js index 25b2a428bea8..a35e7cf2a250 100644 --- a/devtools/server/actors/webconsole/utils.js +++ b/devtools/server/actors/webconsole/utils.js @@ -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 "windowUtils" - // on cross-origin object. + // Might throw with SecurityError: Permission denied to access property + // "windowGlobalChild" on cross-origin object. try { - return window.windowUtils.currentInnerWindowID; + return window.windowGlobalChild.innerWindowId; } catch (e) { return null; } @@ -546,7 +546,7 @@ WebConsoleCommands._registerOriginal("cd", function(owner, window) { 0, 1, "content javascript", - owner.window.windowUtils.currentInnerWindowID + owner.window.windowGlobalChild.innerWindowId ); const Services = require("Services"); Services.console.logMessage(scriptError); diff --git a/devtools/shared/content-observer.js b/devtools/shared/content-observer.js index 30578e805d87..805037427b9e 100644 --- a/devtools/shared/content-observer.js +++ b/devtools/shared/content-observer.js @@ -72,5 +72,5 @@ ContentObserver.prototype = { // Utility functions. ContentObserver.GetInnerWindowID = function(window) { - return window.windowUtils.currentInnerWindowID; + return window.windowGlobalChild.innerWindowId; }; diff --git a/devtools/shared/screenshot/capture.js b/devtools/shared/screenshot/capture.js index 6173d3465d06..eb8fc47224f6 100644 --- a/devtools/shared/screenshot/capture.js +++ b/devtools/shared/screenshot/capture.js @@ -201,7 +201,7 @@ function logInPage(text, flags, window) { 0, flags, "screenshot", - window.windowUtils.currentInnerWindowID + window.windowGlobalChild.innerWindowId ); Services.console.logMessage(scriptError); } diff --git a/devtools/shared/webconsole/test/chrome/test_consoleapi_innerID.html b/devtools/shared/webconsole/test/chrome/test_consoleapi_innerID.html index 0b3d70371103..19b92e1d0d3d 100644 --- a/devtools/shared/webconsole/test/chrome/test_consoleapi_innerID.html +++ b/devtools/shared/webconsole/test/chrome/test_consoleapi_innerID.html @@ -22,7 +22,7 @@ function doConsoleCalls(aState) { const { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm"); const console = new ConsoleAPI({ - innerID: window.windowUtils.currentInnerWindowID + innerID: window.windowGlobalChild.innerWindowId }); const longString = (new Array(DevToolsServer.LONG_STRING_LENGTH + 2)).join("a"); diff --git a/docshell/test/browser/browser_onbeforeunload_navigation.js b/docshell/test/browser/browser_onbeforeunload_navigation.js index 48101c63f71b..c3e48e8714eb 100644 --- a/docshell/test/browser/browser_onbeforeunload_navigation.js +++ b/docshell/test/browser/browser_onbeforeunload_navigation.js @@ -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.windowUtils.currentInnerWindowID; + return this.content.windowGlobalChild.innerWindowId; } ); @@ -142,7 +142,7 @@ add_task(async function test() { "Page should have navigated to the correct URL" ); Assert.notEqual( - this.content.windowUtils.currentInnerWindowID, + this.content.windowGlobalChild.innerWindowId, 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.windowUtils.currentInnerWindowID, + this.content.windowGlobalChild.innerWindowId, winID, "Page should have the same inner window" ); diff --git a/dom/base/DOMRequestHelper.jsm b/dom/base/DOMRequestHelper.jsm index d32840441f05..2b2aca05b464 100644 --- a/dom/base/DOMRequestHelper.jsm +++ b/dom/base/DOMRequestHelper.jsm @@ -157,8 +157,7 @@ DOMRequestIpcHelper.prototype = { this._window = aWindow; if (this._window) { // We don't use this.innerWindowID, but other classes rely on it. - let util = this._window.windowUtils; - this.innerWindowID = util.currentInnerWindowID; + this.innerWindowID = this._window.windowGlobalChild.innerWindowId; } this._destroyed = false; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 19e888a23fe4..96ecc484331a 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2154,20 +2154,6 @@ nsDOMWindowUtils::GetOuterWindowID(uint64_t* aWindowID) { return NS_OK; } -NS_IMETHODIMP -nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t* aWindowID) { - nsCOMPtr 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 window = do_QueryReferent(mWindow); diff --git a/dom/base/test/test_eventsourceservice_basic.html b/dom/base/test/test_eventsourceservice_basic.html index 5009c48a7414..da08fb0cd94b 100644 --- a/dom/base/test/test_eventsourceservice_basic.html +++ b/dom/base/test/test_eventsourceservice_basic.html @@ -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.getDOMWindowUtils(window).currentInnerWindowID; +var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId; ok(innerId, "We have a valid innerWindowID: " + innerId); var channelId = null; @@ -66,4 +66,4 @@ SimpleTest.waitForExplicitFinish(); - \ No newline at end of file + diff --git a/dom/base/test/test_eventsourceservice_reconnect_error.html b/dom/base/test/test_eventsourceservice_reconnect_error.html index cf44ead9e7a5..cb124693c9f0 100644 --- a/dom/base/test/test_eventsourceservice_reconnect_error.html +++ b/dom/base/test/test_eventsourceservice_reconnect_error.html @@ -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.getDOMWindowUtils(window).currentInnerWindowID; +var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId; ok(innerId, "We have a valid innerWindowID: " + innerId); var channelId; @@ -69,4 +69,4 @@ function checkCallsCount() { - \ No newline at end of file + diff --git a/dom/base/test/test_eventsourceservice_status_error.html b/dom/base/test/test_eventsourceservice_status_error.html index 637af8eb8351..55be8e0dc79a 100644 --- a/dom/base/test/test_eventsourceservice_status_error.html +++ b/dom/base/test/test_eventsourceservice_status_error.html @@ -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.getDOMWindowUtils(window).currentInnerWindowID; +var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId; ok(innerId, "We have a valid innerWindowID: " + innerId); var listener = { @@ -64,4 +64,4 @@ function doTest(status) { - \ No newline at end of file + diff --git a/dom/base/test/test_eventsourceservice_worker.html b/dom/base/test/test_eventsourceservice_worker.html index d71d29ce0798..99c89f4e5085 100644 --- a/dom/base/test/test_eventsourceservice_worker.html +++ b/dom/base/test/test_eventsourceservice_worker.html @@ -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.getDOMWindowUtils(window).currentInnerWindowID; +var innerId = SpecialPowers.wrap(window).windowGlobalChild.innerWindowId; ok(innerId, "We have a valid innerWindowID: " + innerId); var channelId = null; @@ -58,4 +58,4 @@ SimpleTest.waitForExplicitFinish(); - \ No newline at end of file + diff --git a/dom/browser-element/BrowserElementChildPreload.js b/dom/browser-element/BrowserElementChildPreload.js index bc6cc1d9bb57..8cf7bb1b5ba0 100644 --- a/dom/browser-element/BrowserElementChildPreload.js +++ b/dom/browser-element/BrowserElementChildPreload.js @@ -134,9 +134,8 @@ BrowserElementChild.prototype = { }, _tryGetInnerWindowID(win) { - let utils = win.windowUtils; try { - return utils.currentInnerWindowID; + return win.windowGlobalChild.innerWindowId; } catch (e) { return null; } diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 4fb2908efc3b..b17a4ce1fbdf 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -1303,12 +1303,6 @@ interface nsIDOMWindowUtils : nsISupports { */ 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. diff --git a/dom/media/IdpSandbox.jsm b/dom/media/IdpSandbox.jsm index a4733f91cd35..b407a14ee025 100644 --- a/dom/media/IdpSandbox.jsm +++ b/dom/media/IdpSandbox.jsm @@ -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.windowUtils.currentInnerWindowID; + let winID = this.window.windowGlobalChild.innerWindowId; let scriptError = Cc["@mozilla.org/scripterror;1"].createInstance( Ci.nsIScriptError ); diff --git a/dom/media/PeerConnection.jsm b/dom/media/PeerConnection.jsm index ff36fdbeec8e..5d02f70e27a9 100644 --- a/dom/media/PeerConnection.jsm +++ b/dom/media/PeerConnection.jsm @@ -253,7 +253,7 @@ setupPrototype(RTCIceCandidate, { class RTCSessionDescription { init(win) { this._win = win; - this._winID = this._win.windowUtils.currentInnerWindowID; + this._winID = this._win.windowGlobalChild.innerWindowId; } __init({ type, sdp }) { @@ -389,7 +389,7 @@ class RTCPeerConnection { } __init(rtcConfig) { - this._winID = this._win.windowUtils.currentInnerWindowID; + this._winID = this._win.windowGlobalChild.innerWindowId; // TODO: Update this code once we support pc.setConfiguration, to track // setting from content independently from pref (Bug 1181768). if ( @@ -2020,7 +2020,7 @@ setupPrototype(PeerConnectionObserver, { class RTCPeerConnectionStatic { init(win) { - this._winID = win.windowUtils.currentInnerWindowID; + this._winID = win.windowGlobalChild.innerWindowId; } registerPeerConnectionLifecycleCallback(cb) { diff --git a/dom/push/test/test_utils.js b/dom/push/test/test_utils.js index 73d49cc0d642..b704f17138aa 100644 --- a/dom/push/test/test_utils.js +++ b/dom/push/test/test_utils.js @@ -216,8 +216,8 @@ function injectControlledFrame(target = document.body) { : Promise.reject(new Error("Frame removed from document")); }, innerWindowId() { - var utils = SpecialPowers.getDOMWindowUtils(iframe.contentWindow); - return utils.currentInnerWindowID; + return SpecialPowers.wrap(iframe).browsingContext.currentWindowContext + .innerWindowId; }, }; diff --git a/dom/tests/browser/browser_ConsoleStorageAPITests.js b/dom/tests/browser/browser_ConsoleStorageAPITests.js index 39b12d13ba12..4322d61c480c 100644 --- a/dom/tests/browser/browser_ConsoleStorageAPITests.js +++ b/dom/tests/browser/browser_ConsoleStorageAPITests.js @@ -40,7 +40,7 @@ add_task(async function() { if (aTopic == "console-storage-cache-event") { apiCallCount++; if (apiCallCount == 4) { - let windowId = content.window.windowUtils.currentInnerWindowID; + let windowId = content.windowGlobalChild.innerWindowId; Services.obs.removeObserver(this, "console-storage-cache-event"); ok( diff --git a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js index 0ce1d4ad7587..1c61a7fbcc36 100644 --- a/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js +++ b/dom/tests/browser/browser_ConsoleStoragePBTest_perwindowpb.js @@ -17,7 +17,7 @@ function test() { ); function getInnerWindowId(aWindow) { - return aWindow.windowUtils.currentInnerWindowID; + return aWindow.windowGlobalChild.innerWindowId; } function whenNewWindowLoaded(aOptions, aCallback) { diff --git a/dom/tests/browser/file_postMessage_parent.html b/dom/tests/browser/file_postMessage_parent.html index 910ad9183c38..f9aa63a8c7c1 100644 --- a/dom/tests/browser/file_postMessage_parent.html +++ b/dom/tests/browser/file_postMessage_parent.html @@ -2,7 +2,7 @@