Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1651519) for wpt failures in webdriver/t…
Browse files Browse the repository at this point in the history
…ests/switch_to_frame/switch.py. CLOSED TREE

Backed out changeset 52317abc5c68 (bug 1651519)
Backed out changeset 45448dca59a4 (bug 1651519)
  • Loading branch information
dgluca committed Jul 21, 2020
1 parent ebc4f4e commit d91c6dc
Show file tree
Hide file tree
Showing 65 changed files with 152 additions and 99 deletions.
2 changes: 1 addition & 1 deletion browser/actors/ContextMenuChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion browser/actors/LightweightThemeChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion browser/actors/WebRTCChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ function getTabStateForContentWindow(aContentWindow, aForRemove = false) {
}

function getInnerWindowIDForWindow(aContentWindow) {
return aContentWindow.windowGlobalChild.innerWindowId;
return aContentWindow.windowUtils.currentInnerWindowID;
}

function getMessageManagerForWindow(aContentWindow) {
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/content-refreshblocker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/tabbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const lameMultiWindowState = {
};

function getOuterWindowID(aWindow) {
return aWindow.docShell.outerWindowID;
return aWindow.windowUtils.outerWindowID;
}

function test() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
2 changes: 1 addition & 1 deletion caps/tests/mochitest/test_bug995943.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '],
Expand Down
2 changes: 1 addition & 1 deletion devtools/client/framework/test/browser_target_from_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
);
Expand Down
4 changes: 2 additions & 2 deletions devtools/client/framework/test/browser_two_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
9 changes: 6 additions & 3 deletions devtools/client/fronts/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

Expand Down
2 changes: 1 addition & 1 deletion devtools/server/actors/network-monitor/websocket-actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},

Expand Down
2 changes: 1 addition & 1 deletion devtools/server/actors/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions devtools/server/actors/targets/browsing-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ loader.lazyRequireGetter(
);

function getWindowID(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
}

function getDocShellChromeEventHandler(docShell) {
Expand Down Expand Up @@ -123,7 +123,7 @@ exports.getChildDocShells = getChildDocShells;
*/

function getInnerId(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
}

const browsingContextTargetPrototype = {
Expand Down Expand Up @@ -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;
},
Expand Down Expand Up @@ -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.
Expand All @@ -905,7 +905,7 @@ const browsingContextTargetPrototype = {
window.parent != window &&
window != this._originalWindow
) {
parentID = window.parent.docShell.outerWindowID;
parentID = window.parent.windowUtils.outerWindowID;
}

return {
Expand Down Expand Up @@ -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: [
{
Expand Down
8 changes: 4 additions & 4 deletions devtools/server/actors/webconsole/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion devtools/shared/content-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ ContentObserver.prototype = {
// Utility functions.

ContentObserver.GetInnerWindowID = function(window) {
return window.windowGlobalChild.innerWindowId;
return window.windowUtils.currentInnerWindowID;
};
2 changes: 1 addition & 1 deletion devtools/shared/screenshot/capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function logInPage(text, flags, window) {
0,
flags,
"screenshot",
window.windowGlobalChild.innerWindowId
window.windowUtils.currentInnerWindowID
);
Services.console.logMessage(scriptError);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{
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");
Expand Down
6 changes: 3 additions & 3 deletions docshell/test/browser/browser_onbeforeunload_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
);

Expand All @@ -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"
);
Expand All @@ -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"
);
Expand Down
3 changes: 2 additions & 1 deletion dom/base/DOMRequestHelper.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 23 additions & 0 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion dom/base/test/browser_messagemanager_unload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion dom/base/test/chrome/test_chromeOuterWindowID.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ windows.
const TEST_PAGE_2 = "http://example.com/browser";

function getOuterWindowID(win) {
return win.docShell.outerWindowID;
return win.windowUtils.outerWindowID;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions dom/base/test/test_eventsourceservice_basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.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;
Expand Down Expand Up @@ -66,4 +66,4 @@
</script>
</pre>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions dom/base/test/test_eventsourceservice_reconnect_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.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;
Expand Down Expand Up @@ -69,4 +69,4 @@
</script>
</pre>
</body>
</html>
</html>
4 changes: 2 additions & 2 deletions dom/base/test/test_eventsourceservice_status_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.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 = {
Expand Down Expand Up @@ -64,4 +64,4 @@
</script>
</pre>
</body>
</html>
</html>
Loading

0 comments on commit d91c6dc

Please sign in to comment.