Skip to content

Commit

Permalink
Cycle testdriver loop correctly
Browse files Browse the repository at this point in the history
Otherwise, the executor, which expects a list, will fail to unpack
`None`.
  • Loading branch information
jonathan-j-lee authored and jgraham committed Mar 5, 2024
1 parent 0ee7a5a commit 7b6ef52
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tools/wptrunner/wptrunner/executors/executorwebdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def do_testharness(self, protocol, url, timeout):
# cases where the browser crashes during script execution:
#
# https://github.com/w3c/webdriver/issues/1308
if not isinstance(result, list) or len(result) != 2:
if not isinstance(result, list) or len(result) != 3:
try:
is_alive = self.is_alive()
except error.WebDriverException:
Expand All @@ -623,6 +623,16 @@ def do_testharness(self, protocol, url, timeout):
if not is_alive:
raise Exception("Browser crashed during script execution.")

# A user prompt created after starting execution of the resume
# script will resolve the script with `null` [1, 2]. In that case,
# cycle this event loop and handle the prompt the next time the
# resume script executes.
#
# [1]: Step 5.3 of https://www.w3.org/TR/webdriver/#execute-async-script
# [2]: https://www.w3.org/TR/webdriver/#dfn-execute-a-function-body
if result is None:
continue

done, rv = handler(result)
if done:
break
Expand Down

0 comments on commit 7b6ef52

Please sign in to comment.