Skip to content

Truly independent web browser

Tests/LibWebView: Wait for the Compositor before crashing it

sideshowbarker69c69732d8eb
diff --git a/Tests/LibWebView/test-webdriver-crash-report.py b/Tests/LibWebView/test-webdriver-crash-report.py
index 92bfb84c835..664c487b334 100755
--- a/Tests/LibWebView/test-webdriver-crash-report.py
+++ b/Tests/LibWebView/test-webdriver-crash-report.py
@@ -19,6 +19,21 @@ from pathlib import Path
webdriver_helpers = importlib.import_module("test-webdriver-delete-session")
+def wait_for_compositor(port, session):
+ # The Compositor takes a screenshot, so once one succeeds, the Compositor is done starting up and waiting in its
+ # event loop. A signal sent while it's still starting can land in a system library built without frame pointers,
+ # which leaves the report with a single frame. Until then, taking a screenshot fails with "unable to capture screen".
+ deadline = time.monotonic() + webdriver_helpers.EVENT_TIMEOUT_SECONDS
+ while True:
+ status, _, body = webdriver_helpers.request(port, "GET", f"/session/{session}/screenshot")
+ if status == 200:
+ return
+ assert "unable to capture screen" in body, body
+ if time.monotonic() >= deadline:
+ raise AssertionError("The Compositor never took a screenshot")
+ time.sleep(0.05)
+
+
def crash_helper(webdriver_pid, process_name):
rows = subprocess.check_output(["ps", "-axo", "pid=,ppid=,command="], text=True).splitlines()
children = {}
@@ -91,6 +106,8 @@ def run_test(webdriver_binary, process_name):
},
)
assert status == 200 and payload == {"value": None}, body
+ elif process_name == "Compositor":
+ wait_for_compositor(port, session)
crash_helper(webdriver.pid, process_name)
directory = Path(temporary) / "data/Ladybird/CrashReports"
deadline = time.monotonic() + webdriver_helpers.EVENT_TIMEOUT_SECONDS