Bug 1403428 - Handle a rare error case more gracefully. r=ato draft
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 19 Oct 2017 17:16:34 -0700
changeset 686387 3c8247daf14b8409e9309b46c8da4c928589db2f
parent 686335 a97fb1c39d51a7337b46957bde4273bd308b796a
child 737377 b7784426b83bafd2b89191a9365d7821534f7fd7
push id86187
push userbmo:mrbkap@mozilla.com
push dateWed, 25 Oct 2017 21:27:59 +0000
reviewersato
bugs1403428
milestone58.0a1
Bug 1403428 - Handle a rare error case more gracefully. r=ato 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: