Bug 1595891 - Guard against IndexError in wpt get_test_window(); r=jgraham
authorGeoff Brown <gbrown@mozilla.com>
Thu, 14 Nov 2019 19:21:09 +0000
changeset 502018 a89e03dd6b3c3917d6c784d57e53fc0ef055d581
parent 502017 1e54f02ec937bc439dfd0241d8f9f6d677ebdad9
child 502019 ae5ead19921d90b992876fc1ef06c4ef81adf8ac
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)
reviewersjgraham
bugs1595891
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 1595891 - Guard against IndexError in wpt get_test_window(); r=jgraham Change order of conditions to avoid intermittent IndexError when there are no handles. Differential Revision: https://phabricator.services.mozilla.com/D52735
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
@@ -208,17 +208,17 @@ class MarionetteTestharnessProtocolPart(
                     test_window = win_obj["window-fcc6-11e5-b4f8-330a88ab9d7f"]
                 except Exception:
                     pass
 
             if test_window is None:
                 handles = self.marionette.window_handles
                 if len(handles) == 2:
                     test_window = next(iter(set(handles) - {parent}))
-                elif handles[0] == parent and len(handles) > 2:
+                elif len(handles) > 2 and handles[0] == parent:
                     # Hope the first one here is the test window
                     test_window = handles[1]
 
             if test_window is not None:
                 assert test_window != parent
                 return test_window
 
             time.sleep(0.1)