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:
|
try:
|
||||||
# Wait for Marionette initialization before opening the suite.
|
# Wait for Marionette initialization before opening the suite.
|
||||||
with Client(2857) as client:
|
with Client(2857) as client:
|
||||||
|
connected = True
|
||||||
spec = importlib.util.spec_from_file_location("probe", ROOT / "tools/probe-desktop.py")
|
spec = importlib.util.spec_from_file_location("probe", ROOT / "tools/probe-desktop.py")
|
||||||
probe = importlib.util.module_from_spec(spec)
|
probe = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(probe)
|
spec.loader.exec_module(probe)
|
||||||
probe.register(client)
|
probe.register(client)
|
||||||
for _ in range(200):
|
for _ in range(600):
|
||||||
ready = probe.evaluate(client, "system", "return document.body?.getAttribute('ready-state')==='fullyLoaded';")
|
ready = probe.evaluate(client, "system", "return document.body?.getAttribute('ready-state')==='fullyLoaded';")
|
||||||
if ready.get("value"):
|
if ready.get("value"):
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,16 @@ bc.currentWindowGlobal.getActor('VulpesProbe').sendQuery('Evaluate', CODE)
|
||||||
last = None
|
last = None
|
||||||
deadline = time.monotonic() + timeout
|
deadline = time.monotonic() + timeout
|
||||||
while time.monotonic() < deadline:
|
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:
|
if last:
|
||||||
return last
|
return last
|
||||||
time.sleep(0.15)
|
time.sleep(0.15)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue