Bug 1381858 - Ensure we have a valid window handle before trying to wait, r=ato draft
authorJames Graham <james@hoppipolla.co.uk>
Thu, 29 Jun 2017 09:29:44 -0700
changeset 610607 c1ec9d171f934fd00d0a9b23bd3e289d01594198
parent 610606 3a9bbc6bcb364ac5e7e1fbf3491a8b36b98140fd
child 610637 48dd9b3490af2457d3dc80a71f9b9d493b6c975c
push id68954
push userbmo:james@hoppipolla.co.uk
push dateTue, 18 Jul 2017 15:18:49 +0000
reviewersato
bugs1381858
milestone56.0a1
Bug 1381858 - Ensure we have a valid window handle before trying to wait, r=ato If we switched to a window that is now closed (possible in a reftest run, for example), we might end up calling execute_async_script without a valid current window. The runner window is always supposed to be open (and if it isn't then waiting won't make much sense anyway), so switch to that before executing script in wait(). MozReview-Commit-ID: ERoN4sz5SuH
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
@@ -171,16 +171,17 @@ class MarionetteProtocol(Protocol):
         if runner_handle != self.runner_handle:
             self.load_runner(protocol)
 
     def wait(self):
         socket_timeout = self.marionette.client.sock.gettimeout()
         if socket_timeout:
             self.marionette.timeout.script = socket_timeout / 2
 
+        self.marionette.switch_to_window(self.runner_handle)
         while True:
             try:
                 self.marionette.execute_async_script("")
             except errors.ScriptTimeoutException:
                 self.logger.debug("Script timed out")
                 pass
             except (socket.timeout, IOError):
                 self.logger.debug("Socket closed")