commit e4bb80f8de530209c161c6acaf51d83cf888571c parent 49d1f2b903be810009d24746c416b91188895283 Author: Rupin Mittal <42721308+RupinMittal@users.noreply.github.com> Date: Wed, 15 Oct 2025 08:59:23 +0000 Bug 1994167 [wpt PR 55293] - [Navigation API] Change opener-postMessage to use onpageshow, a=testonly Automatic update from web-platform-tests [Navigation API] Change opener-postMessage to use onpageshow (#55293) The page may be cached. In that scenario, once it's restored, the onload event won't fire. But the onpageshow event will. To make the test work, we change it to use onpageshow instead of onload. -- wpt-commits: 15ff35eef07f789561d13573e3efadc01406a6f2 wpt-pr: 55293 Diffstat:
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-origin-traversal-does-not-fire-navigate.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-origin-traversal-does-not-fire-navigate.html @@ -6,11 +6,11 @@ <script> promise_test(async t => { // Open a cross-origin window. - let w = window.open(get_host_info().HTTP_REMOTE_ORIGIN + "/navigation-api/navigate-event/resources/opener-postMessage-onload.html"); + let w = window.open(get_host_info().HTTP_REMOTE_ORIGIN + "/navigation-api/navigate-event/resources/opener-postMessage-onpageshow.html"); await new Promise(resolve => window.onmessage = resolve); // Navigate the opened window to this origin. - w.location = get_host_info().ORIGIN + "/navigation-api/navigate-event/resources/opener-postMessage-onload.html"; + w.location = get_host_info().ORIGIN + "/navigation-api/navigate-event/resources/opener-postMessage-onpageshow.html"; await new Promise(resolve => window.onmessage = resolve); assert_equals(w.navigation.entries().length, 1); assert_equals(w.navigation.currentEntry.index, 0); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigation-back-cross-document-preventDefault.html b/testing/web-platform/tests/navigation-api/navigate-event/navigation-back-cross-document-preventDefault.html @@ -8,10 +8,10 @@ promise_test(async t => { // Wait for after the load event so that the navigation doesn't get converted // into a replace navigation. - let w = window.open("resources/opener-postMessage-onload.html"); + let w = window.open("resources/opener-postMessage-onpageshow.html"); await new Promise(resolve => window.onmessage = resolve); // Navigate to a url that will notify us when the navigation is complete. - w.navigation.navigate("opener-postMessage-onload.html?1"); + w.navigation.navigate("opener-postMessage-onpageshow.html?1"); await new Promise(resolve => window.onmessage = resolve); assert_equals(w.navigation.entries().length, 2); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/resources/opener-postMessage-onload.html b/testing/web-platform/tests/navigation-api/navigate-event/resources/opener-postMessage-onload.html @@ -1,6 +0,0 @@ -<!doctype html> -<head> -<script> -window.onload = () => opener.postMessage("onload", "*"); -</script> -</head> diff --git a/testing/web-platform/tests/navigation-api/navigate-event/resources/opener-postMessage-onpageshow.html b/testing/web-platform/tests/navigation-api/navigate-event/resources/opener-postMessage-onpageshow.html @@ -0,0 +1,6 @@ +<!doctype html> +<head> +<script> +window.onpageshow = () => opener.postMessage("onpageshow", "*"); +</script> +</head>