mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb: Implement the "check if unloading is canceled" AO
This method is responsible for firing `beforeunload` events.
This commit is contained in:
parent
f807b2800e
commit
1fa948f114
Notes:
github-actions[bot]
2024-10-05 07:18:28 +00:00
Author: https://github.com/tcl3
Commit: 1fa948f114
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1614
Reviewed-by: https://github.com/awesomekling
7 changed files with 231 additions and 8 deletions
14
Tests/LibWeb/Text/input/DOM/beforeunload.html
Normal file
14
Tests/LibWeb/Text/input/DOM/beforeunload.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
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}`);
|
||||
done();
|
||||
});
|
||||
iframe.src = "about:blank";
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue