Handle document replacement during desktop integration checks
This commit is contained in:
parent
b38dea0597
commit
4f8cec644e
2 changed files with 12 additions and 2 deletions
|
|
@ -84,11 +84,12 @@ with tempfile.TemporaryFile() as display_file, (ROOT / "logs/xvfb.log").open("w"
|
|||
try:
|
||||
# Wait for Marionette initialization before opening the suite.
|
||||
with Client(2857) as client:
|
||||
connected = True
|
||||
spec = importlib.util.spec_from_file_location("probe", ROOT / "tools/probe-desktop.py")
|
||||
probe = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(probe)
|
||||
probe.register(client)
|
||||
for _ in range(200):
|
||||
for _ in range(600):
|
||||
ready = probe.evaluate(client, "system", "return document.body?.getAttribute('ready-state')==='fullyLoaded';")
|
||||
if ready.get("value"):
|
||||
break
|
||||
|
|
|
|||
|
|
@ -102,7 +102,16 @@ bc.currentWindowGlobal.getActor('VulpesProbe').sendQuery('Evaluate', CODE)
|
|||
last = None
|
||||
deadline = time.monotonic() + timeout
|
||||
while time.monotonic() < deadline:
|
||||
last = evaluate(app, code)
|
||||
try:
|
||||
last = evaluate(app, code)
|
||||
except AssertionError as error:
|
||||
# Navigation can replace the document while its read-only probe is pending.
|
||||
detail = error.args[0] if error.args else None
|
||||
if not isinstance(detail, dict) or not detail.get("error", "").startswith(
|
||||
"AbortError: Actor 'VulpesProbe' destroyed before query"
|
||||
):
|
||||
raise
|
||||
last = None
|
||||
if last:
|
||||
return last
|
||||
time.sleep(0.15)
|
||||
|
|
|
|||
Loading…
Reference in a new issue