diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-bfcache.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-bfcache.html new file mode 100644 index 0000000000000..93a5b18527587 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-bfcache.html @@ -0,0 +1,255 @@ +< +! +doctype +html +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +common +/ +utils +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +common +/ +dispatcher +/ +dispatcher +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +html +/ +browsers +/ +browsing +- +the +- +web +/ +back +- +forward +- +cache +/ +resources +/ +helper +. +sub +. +js +" +> +< +/ +script +> +< +script +> +runBfcacheTest +( +{ +targetOrigin +: +originSameOrigin +funcBeforeBackNavigation +: +( +) += +> +{ +window +. +did_navigate += +false +; +navigation +. +onnavigate += +( +) += +> +window +. +did_navigate += +true +; +} +async +funcAfterAssertion +( +pageA +pageB +) +{ +/ +/ +When +funcAfterAssertion +is +called +we +' +ve +already +navigated +to +pageB +/ +/ +then +gone +back +to +pageA +with +bfcache +. +Now +go +forward +to +pageB +so +we +can +/ +/ +observe +whether +the +navigate +event +fired +. +await +pageA +. +execute_script +( +( +) += +> +history +. +forward +( +) +) +; +await +pageB +. +execute_script +( +waitForPageShow +) +; +assert_true +( +await +pageB +. +execute_script +( +( +) += +> +window +. +did_navigate +) +) +; +} +} +" +navigate +event +should +fire +when +traversing +to +a +bfcache +hit +" +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-204-205-download.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-204-205-download.html index 3c3794db8580b..43e440cd8794a 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-204-205-download.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-204-205-download.html @@ -301,86 +301,39 @@ . index ; -/ -/ -One -might -be -surprised -that -navigate -does -not -fire -. -( -It -does -fire -for -the -/ -/ -corresponding -tests -of -navigation -. -navigate -( -) +let +onnavigate_called += +false +; i . -e -. -this -is -/ -/ -traversal -- -specific -behavior -. -) -See -https -: -/ -/ -github +contentWindow . -com -/ -WICG -/ navigation -- -api -/ -issues -/ -207 -/ -/ -for -some -discussion . +onnavigate += +( +) += +> +onnavigate_called += +true +; i . contentWindow . -navigation -. -onnavigate +onunload = t . unreached_func ( " -onnavigate +onunload should not be @@ -494,6 +447,11 @@ null ) ; +assert_true +( +onnavigate_called +) +; } back ( diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/back-cross-document-event-order.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/back-cross-document-event-order.html new file mode 100644 index 0000000000000..97a84f1cef0e4 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/back-cross-document-event-order.html @@ -0,0 +1,455 @@ +< +! +doctype +html +> +< +script +src += +" +/ +resources +/ +testharness +. +js +" +> +< +/ +script +> +< +script +src += +" +/ +resources +/ +testharnessreport +. +js +" +> +< +/ +script +> +< +iframe +id += +" +i +" +src += +" +resources +/ +notify +- +top +- +early +. +html +" +> +< +/ +iframe +> +< +script +> +async_test +( +t += +> +{ +let +events += +[ +] +; +function +finish +( +) +{ +assert_array_equals +( +events +[ +" +onnavigate +" +" +onunload +" +" +readystateinteractive +" +" +domcontentloaded +" +" +readystatecomplete +" +" +onload +" +" +onpageshow +" +] +) +; +t +. +done +( +) +; +} +; +window +. +onload += +t +. +step_func +( +( +) += +> +{ +i +. +contentWindow +. +navigation +. +navigate +( +" +? +1 +" +) +; +i +. +onload += +t +. +step_func +( +( +) += +> +{ +window +. +childStarted += +( +) += +> +{ +i +. +contentWindow +. +navigation +. +onnavigatesuccess += +( +) += +> +events +. +push +( +" +onnavigatesuccess +" +) +; +i +. +contentWindow +. +navigation +. +onnavigateerror += +( +) += +> +events +. +push +( +" +onnavigateerror +" +) +; +i +. +contentWindow +. +onpageshow += +( +) += +> +events +. +push +( +" +onpageshow +" +) +; +i +. +contentWindow +. +onhashchange += +( +) += +> +events +. +push +( +" +onhashchange +" +) +; +i +. +contentWindow +. +onpopstate += +( +) += +> +events +. +push +( +" +onpopstate +" +) +; +i +. +onload += +t +. +step_func +( +( +) += +> +{ +events +. +push +( +" +onload +" +) +; +t +. +step_timeout +( +finish +0 +) +; +} +) +; +i +. +contentDocument +. +addEventListener +( +" +DOMContentLoaded +" +( +) += +> +events +. +push +( +" +domcontentloaded +" +) +) +; +i +. +contentDocument +. +onreadystatechange += +( +) += +> +events +. +push +( +" +readystate +" ++ +i +. +contentDocument +. +readyState +) +; +} +; +i +. +contentWindow +. +onunload += +( +) += +> +events +. +push +( +" +onunload +" +) +; +i +. +contentWindow +. +navigation +. +onnavigate += +( +) += +> +events +. +push +( +" +onnavigate +" +) +; +i +. +contentWindow +. +navigation +. +back +( +) +. +committed +. +then +( +( +) += +> +events +. +push +( +" +promisefulfilled +" +) +( +) += +> +events +. +push +( +" +promiserejected +" +) +) +; +} +) +} +) +; +} +" +back +( +) +event +ordering +for +cross +- +document +traversal +" +) +; +< +/ +script +> diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-cross-document-event-order.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-cross-document-event-order.html index 0d235b60a6d5f..767ebf030e9c5 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-cross-document-event-order.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-cross-document-event-order.html @@ -90,6 +90,9 @@ onnavigate " " +onunload +" +" readystateinteractive " " @@ -323,6 +326,25 @@ . contentWindow . +onunload += +( +) += +> +events +. +push +( +" +onunload +" +) +; +i +. +contentWindow +. navigation . onnavigate