Bug 1595885 - Ensure we have a valid window after wpt reftest timeout, r=webdriver-reviewers,maja_zf
authorJames Graham <james@hoppipolla.co.uk>
Thu, 14 Nov 2019 16:45:55 +0000
changeset 501985 cc9330b5decd89fe8bc422957398d61d89041bb1
parent 501984 8cc93a06da6629d94e26e573e56508e1143fa7ac
child 501986 170b730233cce76d5fea91f337eecf38b0bfd1e3
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswebdriver-reviewers, maja_zf
bugs1595885
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1595885 - Ensure we have a valid window after wpt reftest timeout, r=webdriver-reviewers,maja_zf Typically we can close the wpt reftest window at the end of a test and open a new one for the follwing test. But that interacts badly with the harness trying to run marionette commands before the test starts; for example when it tries to set a pref. So we were hitting a situation where tests that TIMEOUT followed by tests that require a pref end up erroring. To avoid this make sure to set the original opener window as the marionette window when we close the reftest window. Differential Revision: https://phabricator.services.mozilla.com/D53014
testing/marionette/reftest.js
--- a/testing/marionette/reftest.js
+++ b/testing/marionette/reftest.js
@@ -182,19 +182,21 @@ max-width: ${width}px; max-height: ${hei
     }
     if (reftestWin.BrowserApp) {
       reftestWin.BrowserApp = browser;
     }
     reftestWin.gBrowser = browser;
     return reftestWin;
   }
 
-  abort() {
-    if (this.reftestWin) {
+  async abort() {
+    if (this.reftestWin && this.reftestWin != this.parentWindow) {
       this.driver.closeChromeWindow();
+      let parentHandle = this.driver.findWindow([this.parentWindow], () => true);
+      await this.driver.setWindowHandle(parentHandle);
     }
     this.reftestWin = null;
   }
 
   /**
    * Run a specific reftest.
    *
    * The assumed semantics are those of web-platform-tests where
@@ -272,17 +274,17 @@ max-width: ${width}px; max-height: ${hei
         };
       }
       return result;
     })();
 
     let result = await Promise.race([testRunner, timeoutPromise]);
     this.parentWindow.clearTimeout(timeoutHandle);
     if (result.status === STATUS.TIMEOUT) {
-      this.abort();
+      await this.abort();
     }
 
     return result;
   }
 
   async runTest(testUrl, references, expected, timeout, width, height) {
     let win = await this.ensureWindow(timeout, width, height);