Bug 1398111 - [marionette] Update mainFrame and curFrame when switching chrome windows. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 07 Jun 2018 08:51:27 +0200
changeset 805117 d8bb6c1c43661f278e5c9c0e97ec65434827ba56
parent 805066 f7fd9b08c0156be5b5cd99de5ed0ed0b98d93051
child 805118 03d3e88e82e33437e2d60b48360e4911883755bd
push id112566
push userbmo:hskupin@gmail.com
push dateThu, 07 Jun 2018 08:09:37 +0000
bugs1398111
milestone62.0a1
Bug 1398111 - [marionette] Update mainFrame and curFrame when switching chrome windows. When switching between chrome windows Marionette doesn't update its references for the mainFrame (current chrome window) and curFrame (current frame inside the chrome window). Instead it gets only done right now when a new chrome window opens. It means that in most cases Marionette operates on the wrong chrome window and frame. MozReview-Commit-ID: ChwzGguWurx
testing/marionette/driver.js
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1627,20 +1627,22 @@ GeckoDriver.prototype.setWindowHandle = 
     this.startBrowser(winProperties.win, false /* isNewSession */);
 
     if (registerBrowsers && browserListening) {
       await registerBrowsers;
       await browserListening;
     }
 
   } else {
-    // Otherwise switch to the known chrome window, and activate the tab
-    // if it's a content browser.
+    // Otherwise switch to the known chrome window
     this.curBrowser = this.browsers[winProperties.outerId];
-
+    this.mainFrame = this.curBrowser.window;
+    this.curFrame = null;
+
+    // .. and activate the tab if it's a content browser.
     if ("tabIndex" in winProperties) {
       this.curBrowser.switchToTab(
           winProperties.tabIndex, winProperties.win, focus);
     }
   }
 };
 
 GeckoDriver.prototype.getActiveFrame = function() {