Bug 1403428 - Handle a rare error case more gracefully. r=ato, a=test-only
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 19 Oct 2017 17:16:34 -0700
changeset 435292 3972e3b8eedfa27a95116279bff8392c085ec144
parent 435291 79dba93cef4e19e50ef6bde2fb0e6e4137f2d754
child 435293 c81df7f7b71fb5056b32eba3d9eff4136bc5719a
push id1567
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 12:36:05 +0000
treeherdermozilla-release@e512c14a0406 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1403428
milestone57.0
Bug 1403428 - Handle a rare error case more gracefully. r=ato, a=test-only In certain rare cases, it's possible for a previous test to close a window between the executor getting the window list and trying to close the needed windows. MozReview-Commit-ID: GTzoOxBaPwl
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
@@ -154,18 +154,23 @@ class MarionetteProtocol(Protocol):
             # The runner window probably changed id but we can restore it
             # This isn't supposed to happen, but marionette ids are not yet stable
             # We assume that the first handle returned corresponds to the runner,
             # but it hopefully doesn't matter too much if that assumption is
             # wrong since we reload the runner in that tab anyway.
             runner_handle = handles.pop(0)
 
         for handle in handles:
-            self.marionette.switch_to_window(handle)
-            self.marionette.close()
+            try:
+                self.marionette.switch_to_window(handle)
+                self.marionette.close()
+            except errors.NoSuchWindowException:
+                # We might have raced with the previous test to close this
+                # window, skip it.
+                pass
 
         self.marionette.switch_to_window(runner_handle)
         if runner_handle != self.runner_handle:
             self.load_runner(protocol)
 
     def wait(self):
         socket_timeout = self.marionette.client.sock.gettimeout()
         if socket_timeout: