ladybird/Tests/LibWebView
sideshowbarker 5af7dadd40 Tests: Wait for beforeunload before the script-back cancel assertion
Problem: TestWebDriverSessionHistory flakes on slow (Sanitizer) CI
runners. The subtest checking that cancellation of a script-initiated
cross-site “back” by a beforeunload handler intermittently failed the
assertion “Expected beforeunload to cancel script-initiated cross-site
history.back(), got [url_b, 0]”. scriptBeforeUnloadCount was 0, not 1.

Cause: history.back() appends its traversal to the traversable’s session
history queue and returns immediately. So the beforeunload prompt to
unload runs async. The test read scriptBeforeUnloadCount in a separate
execute_script right after — with no wait. So on a slow runner, the read
beats the dispatch, and sees 0. Every other script-initiated navigation
in the test waits for its target document to load — and the “refresh”
beforeunload check already polls. But the canceled “back” loads no
target document — and this one waited for nothing.

Fix: Poll with wait_for_script_result until the page is still on /b and
window.scriptBeforeUnloadCount has incremented, before asserting the
final state — mirroring the “refresh” beforeunload check.
2026-06-20 23:50:57 +02:00
..
CMakeLists.txt WebContent: Wait for WebDriver history traversal completion 2026-06-14 17:38:44 +02:00
test-webdriver-session-history.py Tests: Wait for beforeunload before the script-back cancel assertion 2026-06-20 23:50:57 +02:00
TestHistoryStore.cpp LibWebView+UI: Remove the clear-everything history store API 2026-06-10 20:27:36 +02:00
TestHSTSStore.cpp LibWeb+LibHTTP: Consult HSTS preload list before dynamic-store IPC 2026-05-29 22:23:33 +02:00
TestSessionHistory.cpp Tests/LibWebView: Cover the UI history model 2026-06-14 17:38:44 +02:00
TestWebViewURL.cpp UI: Shorten web URLs in location fields 2026-05-31 19:20:59 +02:00