Bug 1294456 - Stop Marionette from being confused about which tab it currently cares about in each window. r=automatedtester

MozReview-Commit-ID: CW0bWILbIuC

--HG--
extra : rebase_source : ca7a20f7a187dc57857297b59a1a6152cb7f5ad8
This commit is contained in:
Mike Conley 2016-08-25 15:06:56 -04:00
parent f4c8161378
commit b5e760d22d

View File

@ -46,6 +46,12 @@ browser.Context = class {
this.setBrowser(win);
// A reference to the tab corresponding to the current window handle, if any.
// Specifically, this.tab refers to the last tab that Marionette switched
// to in this browser window. Note that this may not equal the currently
// selected tab. For example, if Marionette switches to tab A, and then
// clicks on a button that opens a new tab B in the same browser window,
// this.tab will still point to tab A, despite tab B being the currently
// selected tab.
this.tab = null;
this.pendingCommands = [];
@ -214,7 +220,9 @@ browser.Context = class {
hasRemotenessChange() {
// None of these checks are relevant on b2g or if we don't have a tab yet,
// and may not apply on Fennec.
if (this.driver.appName != "Firefox" || this.tab === null) {
if (this.driver.appName != "Firefox" ||
this.tab === null ||
this.browserForTab === null) {
return false;
}
@ -222,9 +230,7 @@ browser.Context = class {
return true;
}
// this.tab can potentially get stale and cause problems, see bug 1227252
let currentTab = this.browser.selectedTab;
let currentIsRemote = this.browser.getBrowserForTab(currentTab).isRemoteBrowser;
let currentIsRemote = this.browserForTab.isRemoteBrowser;
this._hasRemotenessChange = this._browserWasRemote !== currentIsRemote;
this._browserWasRemote = currentIsRemote;
return this._hasRemotenessChange;