mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Wait for the iframe load before completing the beforeunload test
This test caused some flakiness due to the about:blank load it triggers. It causes headless-browser to receive a load event for about:blank. If we have moved onto the next test before that event arrived, that test would ultimately time out, as its own load will have been dropped while the about:blank load is still ongoing. This patch makes us wait for that iframe load event before completing the test. We may want to consider never sending subframe load events to the UI process as well. We really only care about top-level page loads in the receivers of that event.
This commit is contained in:
parent
d0008ae5e0
commit
be9071834e
Notes:
github-actions[bot]
2024-10-07 20:04:42 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/be9071834eb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1669 Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 7 additions and 0 deletions
|
@ -1,2 +1,3 @@
|
|||
Before unload event fired
|
||||
Default prevented: true
|
||||
iframe load: about:blank
|
||||
|
|
|
@ -3,12 +3,18 @@
|
|||
asyncTest(done => {
|
||||
const iframe = document.createElement("iframe");
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
iframe.contentWindow.addEventListener("beforeunload", e => {
|
||||
println("Before unload event fired");
|
||||
e.preventDefault();
|
||||
println(`Default prevented: ${e.defaultPrevented}`);
|
||||
});
|
||||
|
||||
iframe.addEventListener("load", e => {
|
||||
println(`iframe load: ${e.target.src}`);
|
||||
done();
|
||||
});
|
||||
|
||||
iframe.src = "about:blank";
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Reference in a new issue