Skip to content

Commit

Permalink
Add a new test to web test that uses pagehide instead of unload
Browse files Browse the repository at this point in the history
It is reasonable to leave the one with unload as it is, and add a new one with pagehide, because there are no other tests that check that the pagehide event is fired on window.close()

Bug: 1488371
Change-Id: I83948d7b1d7f7d526dcefc8c584ce811f9ef6297
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5119400
Reviewed-by: Fergal Daly <[email protected]>
Commit-Queue: Kurumi Muto <[email protected]>
Reviewed-by: Mingyu Lei <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1237379}
  • Loading branch information
Kurumi Muto authored and chromium-wpt-export-bot committed Dec 14, 2023
1 parent e076afd commit b8a8a95
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<!doctype html>
<script>
onload = function() {opener.postMessage("loaded", "*")};
onpagehide = function() {
opener.callback();
}
</script>
16 changes: 16 additions & 0 deletions html/browsers/the-window-object/open-close/close_pagehide.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<title>Running pagehide handler in window.close()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var w = window.open("close_pagehide-1.html");
onmessage = t.step_func(function(event) {
if (event.data != "loaded") {
return;
}
w.close();
});
callback = function() {t.done()}
</script>

0 comments on commit b8a8a95

Please sign in to comment.