LibWeb: Implement the "check if unloading is canceled" AO

This method is responsible for firing `beforeunload` events.
This commit is contained in:
Tim Ledbetter 2024-10-02 23:56:26 +01:00 committed by Andreas Kling
commit 1fa948f114
Notes: github-actions[bot] 2024-10-05 07:18:28 +00:00
7 changed files with 231 additions and 8 deletions

View 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>