Skip to content

Commit

Permalink
[wptrunner] Cycle testdriver event loop when testharness isn't loaded (
Browse files Browse the repository at this point in the history
…#48582)

Workaround for https://crbug.com/340662810 that seems to work
without an increase in test runtime or regressions
(https://crrev.com/c/5698330/9).
  • Loading branch information
jonathan-j-lee authored Oct 11, 2024
1 parent 5df7a2c commit 280d04e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tools/wptrunner/wptrunner/executors/executorchrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import collections
import os
import re
import time
from typing import Mapping, MutableMapping, Type

Expand Down Expand Up @@ -244,6 +245,18 @@ def setup(self, runner, protocol=None):
}
self.protocol.cdp.execute_cdp_command("Browser.setPermission", params)

def _get_next_message_classic(self, protocol, url, test_window):
try:
return super()._get_next_message_classic(protocol, url, test_window)
except error.JavascriptErrorException as js_error:
# TODO(crbug.com/340662810): Cycle testdriver event loop to work
# around `testharnessreport.js` flakily not loaded.
if re.search(r'window\.__wptrunner_process_next_event is not a function',
js_error.message):
time.sleep(0.05)
return None
raise


@_evaluate_leaks
class ChromeDriverPrintRefTestExecutor(WebDriverPrintRefTestExecutor,
Expand Down

0 comments on commit 280d04e

Please sign in to comment.