Bug 1423356 - Remove dead permanentKey tracker from Marionette. r?automatedtester,whimboo
GeckoDriver#_browserIds attempts to track the permanentKey of the
content browser, but it does so wrongly. The current implementation
does not work because browser.Context#register is not called
consequentially when a browser suffers a remoteness change.
In preparation for a larger window tracking refactoring it is useful
to get rid of possibly confusing and misleading code paths
MozReview-Commit-ID: JW3vE6MrYVi
--- a/testing/marionette/browser.js
+++ b/testing/marionette/browser.js
@@ -154,17 +154,16 @@ browser.Context = class {
// We should have one frame.Manager per browser.Context so that we
// can handle modals in each <xul:browser>.
this.frameManager = new frame.Manager(driver);
this.frameRegsPending = 0;
// register all message listeners
this.frameManager.addMessageManagerListeners(driver.mm);
this.getIdForBrowser = driver.getIdForBrowser.bind(driver);
- this.updateIdForBrowser = driver.updateIdForBrowser.bind(driver);
}
/**
* Returns the content browser for the currently selected tab.
* If there is no tab selected, null will be returned.
*/
get contentBrowser() {
if (this.tab) {
@@ -389,17 +388,16 @@ browser.Context = class {
if (this.tabBrowser) {
// If we're setting up a new session on Firefox, we only process the
// registration for this frame if it belongs to the current tab.
if (!this.tab) {
this.switchToTab();
}
if (target === this.contentBrowser) {
- this.updateIdForBrowser(this.contentBrowser, uid);
this._needsFlushPendingCommands = true;
}
}
// used to delete sessions
this.knownFrames.push(uid);
}
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -136,17 +136,16 @@ this.GeckoDriver = function(appId, serve
this.mainFrame = null;
// chrome iframe that currently has focus
this.curFrame = null;
this.mozBrowserClose = null;
this.currentFrameElement = null;
// frame ID of the current remote frame, used for mozbrowserclose events
this.oopFrameId = null;
this.observing = null;
- this._browserIds = new WeakMap();
// The curent context decides if commands should affect chrome- or
// content space.
this.context = Context.Content;
this.sandboxes = new Sandboxes(() => this.getCurrentWindow());
this.legacyactions = new legacyaction.Chain();
@@ -1321,43 +1320,21 @@ GeckoDriver.prototype.refresh = async fu
this.mm.broadcastAsyncMessage(
"Marionette:waitForPageLoaded" + this.curBrowser.curFrameId,
parameters);
});
await refresh;
};
-/**
- * Forces an update for the given browser's id.
- */
-GeckoDriver.prototype.updateIdForBrowser = function(browser, newId) {
- this._browserIds.set(browser.permanentKey, newId);
-};
-
-/**
- * Retrieves a listener id for the given xul browser element. In case
- * the browser is not known, an attempt is made to retrieve the id from
- * a CPOW, and null is returned if this fails.
- */
GeckoDriver.prototype.getIdForBrowser = function(browser) {
if (browser === null) {
return null;
}
- let permKey = browser.permanentKey;
- if (this._browserIds.has(permKey)) {
- return this._browserIds.get(permKey);
- }
-
- let winId = browser.outerWindowID;
- if (winId) {
- this._browserIds.set(permKey, winId);
- return winId;
- }
- return null;
+ return browser.outerWindowID;
},
/**
* Get the current window's handle. On desktop this typically corresponds
* to the currently selected tab.
*
* Return an opaque server-assigned identifier to this window that
* uniquely identifies it within this Marionette instance. This can