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
--- 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: