diff --git a/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-transitionWhile.html b/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-intercept.html similarity index 88% rename from testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-transitionWhile.html rename to testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-intercept.html index e5855cf63e815..af0fe104f944f 100644 --- a/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-intercept.html @@ -13,9 +13,9 @@ assert_equals(e.navigationType, "push"); assert_equals(i.contentWindow.navigation.currentEntry.index, 1); }); - i.contentWindow.navigation.onnavigate = e => e.transitionWhile(Promise.resolve()); + i.contentWindow.navigation.onnavigate = e => e.intercept(); let result = i.contentWindow.navigation.navigate("/common/blank.html?1"); assert_true(oncurrententrychange_called); await result.committed; -}, "currententrychange fires for navigation.navigate() intercepted by transitionWhile()"); +}, "currententrychange fires for navigation.navigate() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-replace-transitionWhile.html b/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-replace-intercept.html similarity index 88% rename from testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-replace-transitionWhile.html rename to testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-replace-intercept.html index 9e1401233b21a..33209202d8ce0 100644 --- a/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-replace-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-navigate-replace-intercept.html @@ -15,9 +15,9 @@ assert_equals(e.navigationType, "replace"); assert_equals(i.contentWindow.navigation.currentEntry.index, 0); }); - i.contentWindow.navigation.onnavigate = e => e.transitionWhile(Promise.resolve()); + i.contentWindow.navigation.onnavigate = e => e.intercept(); let result = i.contentWindow.navigation.navigate("/common/blank.html?1", { history: "replace" }); assert_true(oncurrententrychange_called); await result.committed; -}, "currententrychange fires for navigation.navigate() with replace intercepted by transitionWhile()"); +}, "currententrychange fires for navigation.navigate() with replace intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-reload-transitionWhile.html b/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-reload-intercept.html similarity index 87% rename from testing/web-platform/tests/navigation-api/currententrychange-event/navigation-reload-transitionWhile.html rename to testing/web-platform/tests/navigation-api/currententrychange-event/navigation-reload-intercept.html index c732de941f7ed..275e23363c9bf 100644 --- a/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-reload-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-reload-intercept.html @@ -13,9 +13,9 @@ assert_equals(e.navigationType, "reload"); assert_equals(i.contentWindow.navigation.currentEntry.index, 0); }); - i.contentWindow.navigation.onnavigate = e => e.transitionWhile(Promise.resolve()); + i.contentWindow.navigation.onnavigate = e => e.intercept(); let result = i.contentWindow.navigation.reload(); assert_true(oncurrententrychange_called); await result.committed; -}, "currententrychange fires for navigation.reload() intercepted by transitionWhile()"); +}, "currententrychange fires for navigation.reload() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/focus-reset/autofocus.html b/testing/web-platform/tests/navigation-api/focus-reset/autofocus.html index 4418dfa76cde7..60444473673bb 100644 --- a/testing/web-platform/tests/navigation-api/focus-reset/autofocus.html +++ b/testing/web-platform/tests/navigation-api/focus-reset/autofocus.html @@ -23,7 +23,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); @@ -44,7 +44,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); @@ -65,7 +65,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); @@ -88,7 +88,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); @@ -111,7 +111,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); @@ -134,7 +134,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); @@ -156,7 +156,7 @@ assert_equals(document.activeElement, decoy, "focus() worked"); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); const { committed, finished } = navigation.navigate("#1"); diff --git a/testing/web-platform/tests/navigation-api/focus-reset/basic.html b/testing/web-platform/tests/navigation-api/focus-reset/basic.html index 1ffaa022ee4ba..f5a30972b0e54 100644 --- a/testing/web-platform/tests/navigation-api/focus-reset/basic.html +++ b/testing/web-platform/tests/navigation-api/focus-reset/basic.html @@ -12,7 +12,7 @@ navigation.addEventListener("navigate", e => { assert_throws_js(TypeError, () => { - e.transitionWhile(Promise.resolve(), { focusReset: "invalid" }); + e.intercept({ focusReset: "invalid" }); }); throwAssertionHappened = true; }, { once: true }); @@ -27,40 +27,37 @@ testFocusWasReset(t => { navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); }, "Resets the focus when no focusReset option is provided"); testFocusWasReset(t => { navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); }, { once: true }); }, "Resets the focus when focusReset is explicitly set to undefined"); testFocusWasReset(t => { navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(r => t.step_timeout(r, 5))); + e.intercept({ handler: () => new Promise(r => t.step_timeout(r, 5)) }); }, { once: true }); }, "Resets the focus when no focusReset option is provided (nontrivial fulfilled promise)"); testFocusWasReset(t => { navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject()); + e.intercept({ handler: () => Promise.reject() }); }, { once: true }); }, "Resets the focus when no focusReset option is provided (rejected promise)"); testFocusWasReset(t => { navigation.addEventListener("navigate", e => { - e.transitionWhile( - Promise.resolve(), - { focusReset: "after-transition" } - ); + e.intercept({ focusReset: "after-transition" }); }, { once: true }); }, "Resets the focus when focusReset is explicitly set to 'after-transition'"); testFocusWasNotReset(t => { navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve(), { focusReset: "manual" }); + e.intercept({ focusReset: "manual" }); }); }, "Does not reset the focus when focusReset is set to 'manual'"); diff --git a/testing/web-platform/tests/navigation-api/focus-reset/change-focus-again-in-blur-during-transitionWhile.html b/testing/web-platform/tests/navigation-api/focus-reset/change-focus-again-in-blur-during-intercept.html similarity index 83% rename from testing/web-platform/tests/navigation-api/focus-reset/change-focus-again-in-blur-during-transitionWhile.html rename to testing/web-platform/tests/navigation-api/focus-reset/change-focus-again-in-blur-during-intercept.html index 2275ac8e96c37..a7339c97883f6 100644 --- a/testing/web-platform/tests/navigation-api/focus-reset/change-focus-again-in-blur-during-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/focus-reset/change-focus-again-in-blur-during-intercept.html @@ -4,10 +4,10 @@ diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html index d162d8ddb883b..676672a230f15 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html @@ -24,7 +24,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html index 928d202045e34..41c3ca71eef1d 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html @@ -12,7 +12,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html index b7d284088081e..a467ecf9d73d8 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html @@ -24,7 +24,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_true(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html index 32bc4cd291ac6..b9fa97f6d526a 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html @@ -22,7 +22,7 @@ window.onmessage = t.step_func_done(e => { assert_equals(e.data.navigationType, "push", "navigationType"); assert_true(e.data.cancelable, "cancelable"); - assert_true(e.data.canTransition, "canTransition"); + assert_true(e.data.canIntercept, "canIntercept"); assert_false(e.data.userInitiated, "userInitiated"); assert_true(e.data.hashChange, "hashChange"); assert_equals(e.data.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html index fc815abb39eb1..566bea3dc7e9b 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html @@ -10,7 +10,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_true(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html index 24824b12177d9..77a5873c0838f 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html @@ -17,7 +17,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html index 1ac3eef874770..41ac1b037506f 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html @@ -9,7 +9,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html index 96032c14ac60a..1eda74e982831 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html @@ -17,7 +17,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_true(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html index 8a58be7a2b412..5679236a7ddca 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html @@ -15,7 +15,7 @@ window.onmessage = t.step_func_done(e => { assert_equals(e.data.navigationType, "push", "navigationType"); assert_true(e.data.cancelable, "cancelable"); - assert_true(e.data.canTransition, "canTransition"); + assert_true(e.data.canIntercept, "canIntercept"); assert_false(e.data.userInitiated, "userInitiated"); assert_true(e.data.hashChange, "hashChange"); assert_equals(e.data.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html index 3901b9ddbccc4..a7e4181c3a19f 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html @@ -9,7 +9,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_true(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html index d386e487a333c..ea9ea479c3473 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html @@ -18,7 +18,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html index a899dd86a3a77..478483e238d72 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html @@ -9,7 +9,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html index b44303c18b8b8..324adb32a4592 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html @@ -18,7 +18,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_true(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html index 65f062fcd578b..23dceb0420484 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html @@ -16,7 +16,7 @@ window.onmessage = t.step_func_done(e => { assert_equals(e.data.navigationType, "push", "navigationType"); assert_true(e.data.cancelable, "cancelable"); - assert_true(e.data.canTransition, "canTransition"); + assert_true(e.data.canIntercept, "canIntercept"); assert_false(e.data.userInitiated, "userInitiated"); assert_true(e.data.hashChange, "hashChange"); assert_equals(e.data.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html index 3f3c38d85062d..9ca853180343f 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html @@ -9,7 +9,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push", "navigationType"); assert_true(e.cancelable, "cancelable"); - assert_true(e.canTransition, "canTransition"); + assert_true(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_true(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html index 96e8a0c1e6543..3393a2ecaa9e6 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html @@ -1,9 +1,10 @@ + diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-and-navigate.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-and-navigate.html similarity index 81% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-and-navigate.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-and-navigate.html index f226371d79b35..dfbb67b6b6b1c 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-and-navigate.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-and-navigate.html @@ -8,7 +8,7 @@ await new Promise(r => window.onload = () => t.step_timeout(r, 0)); await navigation.navigate("#1").finished; - navigation.onnavigate = e => e.transitionWhile(Promise.resolve()); + navigation.onnavigate = e => e.intercept(); navigation.oncurrententrychange = e => { if (e.navigationType == "traverse") { assert_equals(location.hash, ""); @@ -23,5 +23,5 @@ await promise_rejects_dom(t, "AbortError", back_result.finished); assert_equals(navigation.currentEntry.index, 1); assert_equals(navigation.entries().length, 2); -}, "Using transitionWhile() then navigate() in the ensuing currententrychange should abort the finished promise (but not the committed promise)"); +}, "Using intercept() then navigate() in the ensuing currententrychange should abort the finished promise (but not the committed promise)"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-canceled-event.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-canceled-event.html similarity index 72% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-canceled-event.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-canceled-event.html index f1fe3ece38bf2..d4b9633c1a37c 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-canceled-event.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-canceled-event.html @@ -7,11 +7,11 @@ let assertionHappened = false; navigation.onnavigate = t.step_func_done(e => { e.preventDefault(); - assert_throws_dom("InvalidStateError", () => e.transitionWhile(Promise.resolve())); + assert_throws_dom("InvalidStateError", () => e.intercept()); assertionHappened = true; }); location.href = "#1"; assert_true(assertionHappened); -}, "event.transitionWhile() throws if used on a canceled event"); +}, "event.intercept() throws if used on a canceled event"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-cross-document-same-origin.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-cross-document-same-origin.html similarity index 73% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-cross-document-same-origin.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-cross-document-same-origin.html index 9e55958c53378..0d610cce4f507 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-cross-document-same-origin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-cross-document-same-origin.html @@ -7,13 +7,15 @@ let target_url = location.href + "?1"; navigation.onnavigate = t.step_func_done(e => { assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); - e.transitionWhile(Promise.resolve().then( - t.step_func_done(() => assert_equals(location.href, target_url)))); + e.intercept({ handler: async () => { + await Promise.resolve(); + t.step_func_done(() => assert_equals(location.href, target_url)); + }}); }); window.onload = t.step_func(() => location.href = target_url); -}, "event.transitionWhile() intercepts a same-origin cross-document navigation"); +}, "event.intercept() intercepts a same-origin cross-document navigation"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-cross-origin.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-cross-origin.html similarity index 70% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-cross-origin.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-cross-origin.html index e53371a96a2ce..b367df546c6a7 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-cross-origin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-cross-origin.html @@ -6,13 +6,13 @@ async_test(t => { navigation.onnavigate = t.step_func_done(e => { assert_true(e.cancelable); - assert_false(e.canTransition); + assert_false(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); - assert_throws_dom("SecurityError", () => e.transitionWhile(Promise.resolve())); + assert_throws_dom("SecurityError", () => e.intercept()); e.preventDefault(); }); window.onload = t.step_func(() => location.href = get_host_info().HTTPS_REMOTE_ORIGIN); -}, "event.transitionWhile() should throw if called for a cross origin navigation"); +}, "event.intercept() should throw if called for a cross origin navigation"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/intercept-detach-multiple.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-detach-multiple.html new file mode 100644 index 0000000000000..5b6a62328491a --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-detach-multiple.html @@ -0,0 +1,18 @@ + + + + + diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-detach.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-detach.html similarity index 80% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-detach.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-detach.html index 25159850803d8..b5ce45aa29c38 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-detach.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-detach.html @@ -8,10 +8,10 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { let iframe_constructor = i.contentWindow.DOMException; i.remove(); - assert_throws_dom("InvalidStateError", iframe_constructor, () => e.transitionWhile(Promise.resolve())); + assert_throws_dom("InvalidStateError", iframe_constructor, () => e.intercept()); }); i.contentWindow.location.href = "#1"; }); -}, "event.transitionWhile() throws if used on an event from a detached iframe"); +}, "event.intercept() throws if used on an event from a detached iframe"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-null-or-undefined.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-null-or-undefined.html new file mode 100644 index 0000000000000..7f5bd6b19f834 --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-null-or-undefined.html @@ -0,0 +1,21 @@ + + + + diff --git a/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-returns-non-promise.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-returns-non-promise.html new file mode 100644 index 0000000000000..96116e929533f --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-returns-non-promise.html @@ -0,0 +1,18 @@ + + + + diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-reject.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-throws.html similarity index 82% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-reject.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-throws.html index 28864b38a5186..769f675999747 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-reject.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-handler-throws.html @@ -17,10 +17,10 @@ assert_greater_than(e.lineno, 0); }); navigation.onnavigate = e => { - e.transitionWhile(new Promise((resolve, reject) => t.step_timeout(() => reject(err), 0))); + e.intercept({ handler() { throw err; }}); }; location.href = "#1"; assert_equals(location.hash, "#1"); -}, "event.transitionWhile() should abort if the given promise rejects"); +}, "event.intercept() should abort if the handler throws"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-history-pushState.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-history-pushState.html similarity index 78% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-history-pushState.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-history-pushState.html index a08e4ea282376..aad08b742ef4a 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-history-pushState.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-history-pushState.html @@ -5,19 +5,19 @@ async_test(t => { let start_length = history.length; navigation.onnavigate = t.step_func(e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(() => { - resolve(); + e.intercept({ handler: async () => { + await new Promise(r => t.step_timeout(r, 0)); t.step_timeout(t.step_func_done(() => { assert_equals(location.hash, "#1"); assert_equals(history.state, "update"); assert_equals(history.length, start_length + 1); }, 0)); - }, 0))); + }}); }); history.pushState("update", "", "#1"); assert_equals(location.hash, "#1"); assert_equals(history.state, "update"); assert_equals(history.length, start_length + 1); -}, "event.transitionWhile() should proceed if the given promise resolves"); +}, "event.intercept() should proceed if the given promise resolves"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-history-replaceState.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-history-replaceState.html similarity index 78% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-history-replaceState.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-history-replaceState.html index e575876de245b..16edec8596e44 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-history-replaceState.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-history-replaceState.html @@ -5,19 +5,19 @@ async_test(t => { let start_length = history.length; navigation.onnavigate = t.step_func(e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(() => { - resolve(); + e.intercept({ handler: async () => { + await new Promise(r => t.step_timeout(r, 0)); t.step_timeout(t.step_func_done(() => { assert_equals(location.hash, "#1"); assert_equals(history.state, "update"); assert_equals(history.length, start_length); }, 0)); - }, 0))); + }}); }); history.replaceState("update", "", "#1"); assert_equals(location.hash, "#1"); assert_equals(history.state, "update"); assert_equals(history.length, start_length); -}, "event.transitionWhile() should proceed if the given promise resolves"); +}, "event.intercept() should proceed if the given promise resolves"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-multiple-times-reject.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-multiple-times-reject.html similarity index 75% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-multiple-times-reject.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-multiple-times-reject.html index 0532d755fd343..0b0f1f0b8e838 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-multiple-times-reject.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-multiple-times-reject.html @@ -20,9 +20,12 @@ assert_greater_than(e.lineno, 0); }); navigation.onnavigate = t.step_func(e => { - e.transitionWhile(Promise.resolve()); - e.transitionWhile(new Promise((resolve, reject) => t.step_timeout(() => reject(err), 1))); - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 1))); + e.intercept(); + e.intercept({ handler: async () => { + await new Promise(r => t.step_timeout(r, 1)); + return Promise.reject(err); + }}); + e.intercept({ handler: () => new Promise(resolve => t.step_timeout(resolve, 1)) }); }); await navigation.navigate("#1").finished.catch(t.step_func(e => { @@ -31,5 +34,5 @@ })); assert_true(onnavigateerror_called); assert_true(caught_rejection); -}, "event.transitionWhile() is called multiple times and one of the promises rejects"); +}, "event.intercept() is called multiple times and one of the promises rejects"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-multiple-times.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-multiple-times.html similarity index 69% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-multiple-times.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-multiple-times.html index d5661a54eba39..6deaeeb507de7 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-multiple-times.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-multiple-times.html @@ -7,24 +7,24 @@ let p2_resolved = false; let p3_resolved = false; navigation.onnavigate = t.step_func(e => { - let p1 = Promise.resolve().then(t.step_func(() => { + e.intercept({ handler: async () => { + await Promise.resolve(); assert_false(p2_resolved); assert_false(p3_resolved); p1_resolved = true; - })); - let p2 = new Promise(resolve => t.step_timeout(resolve, 1)).then(t.step_func(() => { + }}); + e.intercept({ handler: async () => { + await new Promise(resolve => t.step_timeout(resolve, 1)); assert_true(p1_resolved); assert_false(p3_resolved); p2_resolved = true; - })); - let p3 = new Promise(resolve => t.step_timeout(resolve, 1)).then(t.step_func(() => { + }}); + e.intercept({ handler: async () => { + await new Promise(resolve => t.step_timeout(resolve, 1)); assert_true(p1_resolved); assert_true(p2_resolved); p3_resolved = true; - })); - e.transitionWhile(p1); - e.transitionWhile(p2); - e.transitionWhile(p3); + }}); }); let promise = navigation.navigate("#1").finished; @@ -37,5 +37,5 @@ assert_true(p1_resolved); assert_true(p2_resolved); assert_true(p3_resolved); -}, "navigation.navigate() returns a finished promise that awaits all promises if event.transitionWhile() is called multiple times"); +}, "navigation.navigate() returns a finished promise that awaits all promises if event.intercept() is called multiple times"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-navigation-back.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-navigation-back.html similarity index 80% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-navigation-back.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-navigation-back.html index 3a4629005be58..8babf2bcdcc5b 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-navigation-back.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-navigation-back.html @@ -8,12 +8,12 @@ window.onload = () => t.step_timeout(() => { navigation.navigate("#foo").committed.then(() => { assert_true(navigation.canGoBack); - navigation.onnavigate = t.step_func(e => e.transitionWhile(Promise.resolve())); + navigation.onnavigate = t.step_func(e => e.intercept()); navigation.back().committed.then(t.step_func_done(() => { assert_equals(navigation.entries().length, 2); assert_equals(navigation.currentEntry, navigation.entries()[0]); })); }); }, 0); -}, "event.transitionWhile() can intercept navigation.back()"); +}, "event.intercept() can intercept navigation.back()"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-on-synthetic-event.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-on-synthetic-event.html similarity index 74% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-on-synthetic-event.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-on-synthetic-event.html index 3acf41745811a..3a4b54de5e9c9 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-on-synthetic-event.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-on-synthetic-event.html @@ -10,8 +10,8 @@ signal: (new AbortController()).signal }); - assert_throws_dom("SecurityError", () => event.transitionWhile(Promise.resolve())); + assert_throws_dom("SecurityError", () => event.intercept()); }); history.pushState(1, null, "#1"); -}, "event.transitionWhile() throws if invoked on a synthetic event"); +}, "event.intercept() throws if invoked on a synthetic event"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-popstate.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-popstate.html similarity index 82% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-popstate.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-popstate.html index a889e40e22b5a..f5f9d82be7f7e 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-popstate.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-popstate.html @@ -14,7 +14,7 @@ onpopstate_fired = true; last_state = e.state; } - navigation.onnavigate = t.step_func(e => e.transitionWhile(Promise.resolve())); + navigation.onnavigate = t.step_func(e => e.intercept()); await navigation.navigate("#").finished; assert_true(navigation.canGoBack); @@ -22,5 +22,5 @@ await navigation.back().finished; assert_true(onpopstate_fired); assert_not_equals(last_state, null); -}, "event.transitionWhile() should provide popstate with a valid state object"); +}, "event.intercept() should provide popstate with a valid state object"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/intercept-reject.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-reject.html new file mode 100644 index 0000000000000..4c5ec0163d1ab --- /dev/null +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-reject.html @@ -0,0 +1,29 @@ + + + + diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-resolve.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-resolve.html similarity index 77% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-resolve.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-resolve.html index b49c66399daee..b60d89b5dfee2 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-resolve.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-resolve.html @@ -11,10 +11,10 @@ }); navigation.onnavigateerror = t.step_func_done(assert_unreached); navigation.onnavigate = e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 0))); + e.intercept({ handler: () => new Promise(resolve => t.step_timeout(resolve, 0)) }); }; location.href = "#1"; assert_equals(location.hash, "#1"); -}, "event.transitionWhile() should proceed if the given promise resolves"); +}, "event.intercept() should proceed if the given promise resolves"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-same-document-history-back.html b/testing/web-platform/tests/navigation-api/navigate-event/intercept-same-document-history-back.html similarity index 91% rename from testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-same-document-history-back.html rename to testing/web-platform/tests/navigation-api/navigate-event/intercept-same-document-history-back.html index 4c404386fe216..6faabe1964651 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/transitionWhile-same-document-history-back.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/intercept-same-document-history-back.html @@ -10,7 +10,7 @@ let onnavigatesuccess_calls = 0; navigation.onnavigate = e => { onnavigate_calls++; - e.transitionWhile(Promise.resolve()); + e.intercept(); } navigation.onnavigatesuccess = t.step_func(e => { onnavigatesuccess_calls++; @@ -36,5 +36,5 @@ history.back(); })); }, 0); -}, "event.transitionWhile() can intercept same-document history.back()"); +}, "event.intercept() can intercept same-document history.back()"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-cross-origin.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-cross-origin.html index 38b7d584b8856..d8f2e383124be 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-cross-origin.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-cross-origin.html @@ -7,7 +7,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_false(e.canTransition); + assert_false(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.formData, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html index c42f389ba67be..90a612b758869 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html @@ -11,7 +11,7 @@ navigation.onnavigate = t.step_func(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_true(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, ""); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download.html index 5615e34738445..c5ca306b7908d 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-download.html @@ -14,7 +14,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, download_attr); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-fragment.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-fragment.html index 591ed73dbf164..b7706b7debea3 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-fragment.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-fragment.html @@ -7,7 +7,7 @@ navigation.onnavigate = t.step_func(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html index 822f2f33ba4df..b8e925a4dbacd 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html @@ -7,7 +7,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.formData, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-userInitiated.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-userInitiated.html index 832a3f843e22f..b746bbe3f028c 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-userInitiated.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-userInitiated.html @@ -10,7 +10,7 @@ navigation.onnavigate = t.step_func(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_true(e.userInitiated); assert_true(e.hashChange); assert_equals(e.formData, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-with-target.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-with-target.html index a0de04d5ea442..c2053a37b09a4 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-with-target.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-anchor-with-target.html @@ -12,7 +12,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.formData, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-get.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-get.html index d3cafa1b3fa34..69a49eb08a677 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-get.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-get.html @@ -9,7 +9,7 @@ assert_equals(e.navigationType, "replace"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-userInitiated.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-userInitiated.html index d6fc712c26a09..454f0773962f3 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-userInitiated.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-userInitiated.html @@ -14,7 +14,7 @@ assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_true(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-with-target.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-with-target.html index 12cafe5eb0815..b23ab3a70ccb2 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-with-target.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form-with-target.html @@ -11,7 +11,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form.html index bc120420ca3c1..b537a9b58f090 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-form.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-form.html @@ -9,7 +9,7 @@ assert_equals(e.navigationType, "replace"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-fragment.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-fragment.html index ddabfaeef5afc..976754f28a885 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-fragment.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-fragment.html @@ -13,7 +13,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "traverse"); assert_false(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-pushState.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-pushState.html index 074aa71568159..4d870fb2ae6d0 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-pushState.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-after-pushState.html @@ -13,7 +13,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "traverse"); assert_false(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-cross-document.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-cross-document.html index 967cf5db0cdb4..cd7be6e9ad37e 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-cross-document.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-back-cross-document.html @@ -12,7 +12,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "traverse"); assert_false(e.cancelable); - assert_false(e.canTransition); + assert_false(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-go-0.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-go-0.html index f7453e4805f8c..96d98cf44c826 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-go-0.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-go-0.html @@ -8,7 +8,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "reload"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-pushState.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-pushState.html index 0651c529daa3e..2f8c81c7090cb 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-pushState.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-pushState.html @@ -7,7 +7,7 @@ navigation.onnavigate = t.step_func(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-replaceState.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-replaceState.html index d0fe5d949ba17..d8417fbfd308a 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-replaceState.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-history-replaceState.html @@ -7,7 +7,7 @@ navigation.onnavigate = t.step_func(e => { assert_equals(e.navigationType, "replace"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-iframe-location.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-iframe-location.html index cbf16c896a856..059b995011836 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-iframe-location.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-iframe-location.html @@ -11,7 +11,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-location.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-location.html index 998da50994cae..c5aa0be97a47b 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-location.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-location.html @@ -7,7 +7,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "replace"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-meta-refresh.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-meta-refresh.html index 9077fec5fa053..1f8ed306851fd 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-meta-refresh.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-meta-refresh.html @@ -10,7 +10,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "reload"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-cross-document.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-cross-document.html index 4847ac8f1be90..214644066e1d1 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-cross-document.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-cross-document.html @@ -12,7 +12,7 @@ i.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "traverse"); assert_false(e.cancelable); - assert_false(e.canTransition); + assert_false(e.canIntercept); assert_false(e.userInitiated); assert_false(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-same-document.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-same-document.html index 626ea33136adb..8753e6b1c86ba 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-same-document.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-back-same-document.html @@ -12,7 +12,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "traverse"); assert_false(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-navigate.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-navigate.html index adc71a324379a..76f98c7236106 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-navigate.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-navigation-navigate.html @@ -6,7 +6,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "replace"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-to-srcdoc.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-to-srcdoc.html index 996fecfceaf67..26ad135b6ad0b 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-to-srcdoc.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-to-srcdoc.html @@ -11,7 +11,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable, "cancelable"); - assert_false(e.canTransition, "canTransition"); + assert_false(e.canIntercept, "canIntercept"); assert_false(e.userInitiated, "userInitiated"); assert_false(e.hashChange, "hashChange"); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open-self.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open-self.html index cdfc57c4a022f..274c8bc4d5762 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open-self.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open-self.html @@ -6,7 +6,7 @@ navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open.html b/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open.html index aef333abc4d19..afc998271f6e9 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/navigate-window-open.html @@ -11,7 +11,7 @@ iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => { assert_equals(e.navigationType, "push"); assert_true(e.cancelable); - assert_true(e.canTransition); + assert_true(e.canIntercept); assert_false(e.userInitiated); assert_true(e.hashChange); assert_equals(e.downloadRequest, null); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-intercept.html similarity index 82% rename from testing/web-platform/tests/navigation-api/navigate-event/signal-abort-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigate-event/signal-abort-intercept.html index ce195cf677229..1e92d8e445f6c 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-intercept.html @@ -8,11 +8,11 @@ navigation.onnavigate = t.step_func(e => { abort_signal = e.signal; abort_signal.onabort = () => onabort_called = true; - e.transitionWhile(Promise.resolve()); + e.intercept(); }); await navigation.navigate("?1").finished; assert_false(abort_signal.aborted); assert_false(onabort_called); -}, "event.transitionWhile() does not signal event.signal"); +}, "event.intercept() does not signal event.signal"); diff --git a/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-window-stop-after-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-window-stop-after-intercept.html similarity index 88% rename from testing/web-platform/tests/navigation-api/navigate-event/signal-abort-window-stop-after-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigate-event/signal-abort-window-stop-after-intercept.html index bc44a07b20e83..51ba7753a8a9f 100644 --- a/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-window-stop-after-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigate-event/signal-abort-window-stop-after-intercept.html @@ -19,7 +19,7 @@ navigation.onnavigate = t.step_func(e => { abort_signal = e.signal; abort_signal.onabort = () => onabort_called = true; - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 0))); + e.intercept({ handler: () => new Promise(resolve => t.step_timeout(resolve, 0)) }); }); let result = navigation.navigate("?1"); window.stop(); @@ -36,5 +36,5 @@ t.step_timeout(t.step_func_done(() => {}), 5); }); }); -}, "window.stop() cancels the navigate event's transitionWhile() and signals event.signal"); +}, "window.stop() cancels the navigate event's intercept() and signals event.signal"); diff --git a/testing/web-platform/tests/navigation-api/navigation-history-entry/key-id-location-reload-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigation-history-entry/key-id-location-reload-intercept.html similarity index 91% rename from testing/web-platform/tests/navigation-api/navigation-history-entry/key-id-location-reload-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigation-history-entry/key-id-location-reload-intercept.html index e5924d243160c..62ce0974399e8 100644 --- a/testing/web-platform/tests/navigation-api/navigation-history-entry/key-id-location-reload-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigation-history-entry/key-id-location-reload-intercept.html @@ -10,7 +10,7 @@ const original = i.contentWindow.navigation.currentEntry; const { key, id } = original; - i.contentWindow.navigation.addEventListener("navigate", e => e.transitionWhile(Promise.resolve())); + i.contentWindow.navigation.addEventListener("navigate", e => e.intercept()); i.onload = t.unreached_func("the iframe must not reload"); @@ -19,5 +19,5 @@ assert_equals(i.contentWindow.navigation.currentEntry, original); assert_equals(i.contentWindow.navigation.currentEntry.key, key); assert_equals(i.contentWindow.navigation.currentEntry.id, id); -}, "NavigationHistoryEntry's key and id after location.reload() intercepted by transitionWhile()"); +}, "NavigationHistoryEntry's key and id after location.reload() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/navigate-transitionWhile-history-state.html b/testing/web-platform/tests/navigation-api/navigation-methods/navigate-intercept-history-state.html similarity index 70% rename from testing/web-platform/tests/navigation-api/navigation-methods/navigate-transitionWhile-history-state.html rename to testing/web-platform/tests/navigation-api/navigation-methods/navigate-intercept-history-state.html index c5e1036bff4fc..7faf6ffb5a294 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/navigate-transitionWhile-history-state.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/navigate-intercept-history-state.html @@ -6,9 +6,9 @@ history.replaceState("state1", "", "#1"); assert_equals(history.state, "state1"); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve("r")); + navigation.onnavigate = e => e.intercept({ handler: () => Promise.resolve("r") }); await navigation.navigate("#2").committed; assert_equals(location.hash, "#2"); assert_equals(history.state, null); -}, "history.story should be nulled by navigate() handled by transitionWhile()"); +}, "history.story should be nulled by navigate() handled by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/navigate-state-repeated-await.html b/testing/web-platform/tests/navigation-api/navigation-methods/navigate-state-repeated-await.html index a003992d66a3b..539b3dc1da9de 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/navigate-state-repeated-await.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/navigate-state-repeated-await.html @@ -3,7 +3,7 @@ diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-intercept.html similarity index 83% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-intercept.html index c1161f895a54d..2654045c2b008 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/back-intercept.html @@ -16,10 +16,10 @@ assert_equals((new URL(entry0.url)).hash, ""); assert_equals((new URL(entry1.url)).hash, "#1"); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve({ abc: "def" })); + navigation.onnavigate = e => e.intercept({ handler: () => Promise.resolve({ abc: "def" }) }); const result = navigation.back(); await assertBothFulfill(t, result, entry0); assert_equals(navigation.currentEntry, entry0); -}, "back() and transitionWhile() with a fulfilled promise"); +}, "back() and intercept() with a fulfilled promise"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-transitionWhile-rejected.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-intercept-rejected.html similarity index 88% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-transitionWhile-rejected.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-intercept-rejected.html index 7ff0c70f0b9ae..9e86dcca19760 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-transitionWhile-rejected.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-intercept-rejected.html @@ -20,10 +20,10 @@ const err = new Error("boo!"); const promise = Promise.reject(err); promise.catch(() => {}); // prevent unhandled rejection testharness.js errors - navigation.onnavigate = e => e.transitionWhile(promise); + navigation.onnavigate = e => e.intercept({ handler: () => promise }); const result = navigation.forward(); await assertCommittedFulfillsFinishedRejectsExactly(t, result, entry1, err); assert_equals(navigation.currentEntry, entry1); -}, "forward() promise rejection with rejected transitionWhile()"); +}, "forward() promise rejection with rejected intercept()"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-intercept.html similarity index 86% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-intercept.html index 2b8175b619d61..ce4ab3217070a 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/forward-intercept.html @@ -19,10 +19,10 @@ await navigation.back().committed; const promise = Promise.resolve({ abc: "def" }); - navigation.onnavigate = e => e.transitionWhile(promise); + navigation.onnavigate = e => e.intercept({ handler: () => promise }); const result = navigation.forward(); await assertBothFulfill(t, result, entry1); assert_equals(navigation.currentEntry, entry1); -}, "forward() and transitionWhile() with a fulfilled promise"); +}, "forward() and intercept() with a fulfilled promise"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile-interrupted.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-interrupted.html similarity index 84% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile-interrupted.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-interrupted.html index fa818b484d327..36403c892c6c9 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile-interrupted.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-interrupted.html @@ -9,7 +9,7 @@ // into a replace navigation. await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); - navigation.addEventListener("navigate", e => e.transitionWhile(Promise.resolve())); + navigation.addEventListener("navigate", e => e.intercept()); const result1 = navigation.navigate("#1"); const result2 = navigation.navigate("#2"); @@ -19,5 +19,5 @@ await assertCommittedFulfillsFinishedRejectsDOM(t, result1, navigation.entries()[1], "AbortError"); await assertBothFulfill(t, result2, navigation.currentEntry); -}, "interrupted navigate() promises with transitionWhile()"); +}, "interrupted navigate() promises with intercept()"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile-rejected.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-rejected.html similarity index 79% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile-rejected.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-rejected.html index c1d4c4980251c..79c8bd803e346 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile-rejected.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-rejected.html @@ -8,10 +8,10 @@ const err = new Error("boo!"); const promise = Promise.reject(err); promise.catch(() => {}); // prevent unhandled rejection testharness.js errors - navigation.onnavigate = e => e.transitionWhile(promise); + navigation.onnavigate = e => e.intercept({ handler: () => promise }); const result = navigation.navigate("#1"); await assertCommittedFulfillsFinishedRejectsExactly(t, result, navigation.currentEntry, err); -}, "navigate() and transitionWhile() with a rejected promise"); +}, "navigate() and intercept() with a rejected promise"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept.html similarity index 71% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept.html index 2fe78e53e99f1..a9946c71ff3a8 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept.html @@ -5,11 +5,11 @@ diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-transitionWhile-rejected.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-intercept-rejected.html similarity index 79% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-transitionWhile-rejected.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-intercept-rejected.html index e6ec928a73685..93cd75c2b9986 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-transitionWhile-rejected.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-intercept-rejected.html @@ -8,10 +8,10 @@ const err = new Error("boo!"); const promise = Promise.reject(err); promise.catch(() => {}); // prevent unhandled rejection testharness.js errors - navigation.onnavigate = e => e.transitionWhile(promise); + navigation.onnavigate = e => e.intercept({ handler: () => promise }); const result = navigation.reload(); await assertCommittedFulfillsFinishedRejectsExactly(t, result, navigation.currentEntry, err); -}, "reload() and transitionWhile() with a rejected promise"); +}, "reload() and intercept() with a rejected promise"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-intercept.html similarity index 67% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-intercept.html index 19cea8afc2806..92f1636a6e85b 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload-intercept.html @@ -5,10 +5,10 @@ diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload.html index 028d5855701ad..388f0d94b5030 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/reload.html @@ -12,5 +12,5 @@ assertNeverSettles(t, result, i.contentWindow); await new Promise(resolve => i.onload = () => t.step_timeout(resolve, 0)); -}, "reload() promises never settle (without transitionWhile())"); +}, "reload() promises never settle (without intercept())"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile-rejected.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-intercept-rejected.html similarity index 88% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile-rejected.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-intercept-rejected.html index 613531023fa4b..f934eae5d4c1a 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile-rejected.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-intercept-rejected.html @@ -21,10 +21,10 @@ const err = new Error("boo!"); const promise = Promise.reject(err); promise.catch(() => {}); // prevent unhandled rejection testharness.js errors - navigation.onnavigate = e => e.transitionWhile(promise); + navigation.onnavigate = e => e.intercept({ handler: () => promise }); const result = navigation.traverseTo(key0); await assertCommittedFulfillsFinishedRejectsExactly(t, result, entry0, err); assert_equals(navigation.currentEntry, entry0); -}, "traverseTo() promise rejection with rejected transitionWhile()"); +}, "traverseTo() promise rejection with rejected intercept()"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile.html b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-intercept.html similarity index 83% rename from testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile.html rename to testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-intercept.html index 430fbe8be7921..a4cb4e711d8c9 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/return-value/traverseTo-intercept.html @@ -18,10 +18,10 @@ assert_equals((new URL(entry0.url)).hash, ""); assert_equals((new URL(entry1.url)).hash, "#1"); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve({ abc: "def" })); + navigation.onnavigate = e => e.intercept({ handler: () => Promise.resolve({ abc: "def" }) }); const result = navigation.traverseTo(key0); await assertBothFulfill(t, result, entry0); assert_equals(navigation.currentEntry, entry0); -}, "traverseTo() and transitionWhile() with a fulfilled promise"); +}, "traverseTo() and intercept() with a fulfilled promise"); diff --git a/testing/web-platform/tests/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html b/testing/web-platform/tests/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html index 25dd134649627..a0a2918887861 100644 --- a/testing/web-platform/tests/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html +++ b/testing/web-platform/tests/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html @@ -20,7 +20,7 @@ let result; i.contentWindow.navigation.onnavigate = t.step_func(e => { - e.transitionWhile(new Promise(resolve => () => t.step_timeout(resolve, 2))); + e.intercept({ handler: () => new Promise(resolve => t.step_timeout(resolve, 2)) }); t.step_timeout(() => i.remove(), 1); }); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/README.md b/testing/web-platform/tests/navigation-api/ordering-and-transition/README.md index 653dd2198c3a2..628b22ec48b7d 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/README.md +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/README.md @@ -15,10 +15,10 @@ Note: existing for `currententrychange` causes code to run, and thus microtasks to run, at a very specific point in the navigation-commit lifecycle. We want to test that it doesn't impact the ordering. -* Similarly we test that `transitionWhile(Promise.resolve())` does not change - the ordering compared to no `transitionWhile()` call, for same-document +* Similarly we test that `intercept()` does not change + the ordering compared to no `intercept()` call, for same-document navigations, by trying to ensure most variants have appropriate - `transitionWhile()` counterparts with similar orderings. + `intercept()` counterparts with similar orderings. TODOs: diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-transitionWhile-reject.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-intercept-reject.html similarity index 87% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-transitionWhile-reject.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-intercept-reject.html index 20202777a9f03..4869cedd2528e 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-transitionWhile-reject.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-intercept-reject.html @@ -23,7 +23,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler() { + recorder.record("handler run"); + return Promise.reject(expectedError); + }}); }); let a = document.createElement("a"); @@ -40,11 +43,12 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["promise microtask", "#1", { from, navigationType: "push" }], ["navigateerror", "#1", { from, navigationType: "push" }], ["transition.finished rejected", "#1", null], ]); recorder.assertErrorsAre(expectedError); -}, "event and promise ordering for intercepted by passing a rejected promise to transitionWhile()"); +}, "event and promise ordering for intercepted by passing a rejected promise to intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-intercept.html similarity index 87% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-intercept.html index 822c0a230d506..23326c827b7a2 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download-intercept.html @@ -22,7 +22,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); }); let a = document.createElement("a"); @@ -39,9 +39,10 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["promise microtask", "#1", { from, navigationType: "push" }], ["navigatesuccess", "#1", { from, navigationType: "push" }], ["transition.finished fulfilled", "#1", null], ]); -}, "event and promise ordering for intercepted by transitionWhile()"); +}, "event and promise ordering for intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download.html index 0490069c7aa47..c6af13c3e0618 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/anchor-download.html @@ -20,5 +20,5 @@ i.contentWindow.navigation.onnavigateerror = t.unreached_func("navigateerror must not fire"); await new Promise(resolve => t.step_timeout(resolve, 20)); assert_true(navigate_called); -}, " fires navigate, but not navigatesuccess or navigateerror when not intercepted by transitionWhile()"); +}, " fires navigate, but not navigatesuccess or navigateerror when not intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-transitionWhile-reject.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-intercept-reject.html similarity index 87% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-transitionWhile-reject.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-intercept-reject.html index 05d86b4910213..c0d4f55027137 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-transitionWhile-reject.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-intercept-reject.html @@ -24,7 +24,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler() { + recorder.record("handler run"); + return Promise.reject(expectedError); + }}); }); const result = navigation.back(); @@ -39,6 +42,7 @@ ["promise microtask", "#1", null], ["navigate", "#1", null], ["currententrychange", "", { from, navigationType: "traverse" }], + ["handler run", "", { from, navigationType: "traverse" }], ["committed fulfilled", "", { from, navigationType: "traverse" }], ["navigateerror", "", { from, navigationType: "traverse" }], ["finished rejected", "", null], @@ -46,5 +50,5 @@ ]); recorder.assertErrorsAre(expectedError); -}, "event and promise ordering for same-document navigation.back() intercepted by passing a rejected promise to transitionWhile()"); +}, "event and promise ordering for same-document navigation.back() intercepted by passing a rejected promise to intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-intercept.html similarity index 90% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-intercept.html index d435aab37b4b1..7bd248bc9c5a7 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/back-same-document-intercept.html @@ -23,7 +23,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); }); const result = navigation.back(); @@ -38,10 +38,11 @@ ["promise microtask", "#1", null], ["navigate", "#1", null], ["currententrychange", "", { from, navigationType: "traverse" }], + ["handler run", "", { from, navigationType: "traverse" }], ["committed fulfilled", "", { from, navigationType: "traverse" }], ["navigatesuccess", "", { from, navigationType: "traverse" }], ["finished fulfilled", "", null], ["transition.finished fulfilled", "", null] ]); -}, "event and promise ordering for same-document navigation.back() intercepted by transitionWhile()"); +}, "event and promise ordering for same-document navigation.back() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/currententrychange-before-popstate-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/currententrychange-before-popstate-intercept.html similarity index 96% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/currententrychange-before-popstate-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/currententrychange-before-popstate-intercept.html index 59f37e97125e6..c51c7c444cb9a 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/currententrychange-before-popstate-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/currententrychange-before-popstate-intercept.html @@ -9,7 +9,7 @@ await navigation.navigate("#foo").committed; assert_equals(navigation.entries().length, 2); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve()); + navigation.onnavigate = e => e.intercept(); let oncurrententrychange_back_called = false; let onpopstate_back_called = false; diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/intercept-async.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/intercept-async.html new file mode 100644 index 0000000000000..f2ca0969506bb --- /dev/null +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/intercept-async.html @@ -0,0 +1,55 @@ + + + + + + + diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-double-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-double-intercept.html similarity index 86% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-double-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-double-intercept.html index 5ec22b119fa67..36ae5ce4ab52b 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-double-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-double-intercept.html @@ -22,7 +22,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(r => t.step_timeout(r, 1))); + e.intercept({ handler() { + recorder.record("handler run"); + return new Promise(r => t.step_timeout(r, 1)); + }}); if (location.hash === "#1") { fromHash1 = navigation.currentEntry; @@ -40,11 +43,13 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from: fromStart, navigationType: "push" }], + ["handler run", "#1", { from: fromStart, navigationType: "push" }], ["AbortSignal abort", "#1", { from: fromStart, navigationType: "push" }], ["navigateerror", "#1", { from: fromStart, navigationType: "push" }], ["navigate", "#1", null], ["currententrychange", "#2", { from: fromHash1, navigationType: "push" }], + ["handler run", "#2", { from: fromHash1, navigationType: "push" }], ["transition.finished rejected", "#2", { from: fromHash1, navigationType: "push" }], ["promise microtask", "#2", { from: fromHash1, navigationType: "push" }], ["navigatesuccess", "#2", { from: fromHash1, navigationType: "push" }], @@ -52,5 +57,5 @@ ]); recorder.assertErrorsAreAbortErrors(); -}, "event and promise ordering when location.href is set repeatedly and handled by transitionWhile()"); +}, "event and promise ordering when location.href is set repeatedly and handled by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile-reentrant.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept-reentrant.html similarity index 85% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile-reentrant.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept-reentrant.html index 4dedb58d5b042..3fabf52bfbab2 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile-reentrant.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept-reentrant.html @@ -23,7 +23,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 2))); + e.intercept({ handler() { + recorder.record("handler run"); + return new Promise(resolve => t.step_timeout(resolve, 2)); + }}); if (firstNavigate) { firstNavigate = false; @@ -46,11 +49,12 @@ ["navigate", "", null], ["currententrychange", "#2", { from, navigationType: "push" }], + ["handler run", "#2", { from, navigationType: "push" }], ["promise microtask", "#2", { from, navigationType: "push" }], ["navigatesuccess", "#2", { from, navigationType: "push" }], ["transition.finished fulfilled", "#2", null] ]); recorder.assertErrorsAreAbortErrors(); -}, "event and promise ordering for the location.href setter intercepted by transitionWhile() where we set location.href again inside the navigate handler"); +}, "event and promise ordering for the location.href setter intercepted by intercept() where we set location.href again inside the navigate handler"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile-reject.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept-reject.html similarity index 86% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile-reject.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept-reject.html index dbef3928e30c9..b4aeb726b3b59 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile-reject.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept-reject.html @@ -23,7 +23,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler() { + recorder.record("handler run"); + return Promise.reject(expectedError); + }}); }); location.href = "/common/blank.html#1"; @@ -36,11 +39,12 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["promise microtask", "#1", { from, navigationType: "push" }], ["navigateerror", "#1", { from, navigationType: "push" }], ["transition.finished rejected", "#1", null], ]); recorder.assertErrorsAre(expectedError); -}, "event and promise ordering for location.href setter intercepted by passing a rejected promise to transitionWhile()"); +}, "event and promise ordering for location.href setter intercepted by passing a rejected promise to intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept.html similarity index 90% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept.html index 0e1d22df7254f..bb861d37ae54a 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/location-href-intercept.html @@ -22,7 +22,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); }); location.href = "/common/blank.html#1"; @@ -35,9 +35,10 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["promise microtask", "#1", { from, navigationType: "push" }], ["navigatesuccess", "#1", { from, navigationType: "push" }], ["transition.finished fulfilled", "#1", null], ]); -}, "event and promise ordering for location.href setter intercepted by transitionWhile()"); +}, "event and promise ordering for location.href setter intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-double-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-double-intercept.html similarity index 88% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-double-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-double-intercept.html index 556d1737a6e37..6ce67b9af644a 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-double-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-double-intercept.html @@ -22,7 +22,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(r => t.step_timeout(r, 1))); + e.intercept({ handler() { + recorder.record("handler run"); + return new Promise(r => t.step_timeout(r, 1)); + }}); if (location.hash === "#1") { fromHash1 = navigation.currentEntry; @@ -43,11 +46,13 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from: fromStart, navigationType: "push" }], + ["handler run", "#1", { from: fromStart, navigationType: "push" }], ["AbortSignal abort", "#1", { from: fromStart, navigationType: "push" }], ["navigateerror", "#1", { from: fromStart, navigationType: "push" }], ["navigate", "#1", null], ["currententrychange", "#2", { from: fromHash1, navigationType: "push" }], + ["handler run", "#2", { from: fromHash1, navigationType: "push" }], ["committed fulfilled 1", "#2", { from: fromHash1, navigationType: "push" }], ["finished rejected 1", "#2", { from: fromHash1, navigationType: "push" }], ["transition.finished rejected", "#2", { from: fromHash1, navigationType: "push" }], @@ -59,5 +64,5 @@ ]); recorder.assertErrorsAreAbortErrors(); -}, "event and promise ordering when navigate() is called repeatedly and handled by transitionWhile()"); +}, "event and promise ordering when navigate() is called repeatedly and handled by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-in-transition-finished.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-in-transition-finished.html index 8c74ba2f632f7..9251cfe049d30 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-in-transition-finished.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-in-transition-finished.html @@ -32,7 +32,7 @@ })); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); if (location.hash === "#1") { fromHash1 = navigation.currentEntry; @@ -50,6 +50,7 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from: fromStart, navigationType: "push" }], + ["handler run", "#1", { from: fromStart, navigationType: "push" }], ["committed fulfilled 1", "#1", { from: fromStart, navigationType: "push" }], ["promise microtask", "#1", { from: fromStart, navigationType: "push" }], ["navigatesuccess", "#1", { from: fromStart, navigationType: "push" }], @@ -58,6 +59,7 @@ ["navigate", "#1", null], ["currententrychange", "#2", { from: fromHash1, navigationType: "push" }], + ["handler run", "#2", { from: fromHash1, navigationType: "push" }], ["committed fulfilled 2", "#2", { from: fromHash1, navigationType: "push" }], ["navigatesuccess", "#2", { from: fromHash1, navigationType: "push" }], ["finished fulfilled 2", "#2", null], diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-intercept-stop.html similarity index 89% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-intercept-stop.html index 9a8c412b3333e..5d126a8c2ff9b 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-intercept-stop.html @@ -22,7 +22,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); }); const result = navigation.navigate("/common/blank.html#1"); @@ -38,6 +38,7 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["AbortSignal abort", "#1", { from, navigationType: "push" }], ["navigateerror", "#1", { from, navigationType: "push" }], ["committed fulfilled", "#1", null], @@ -47,5 +48,5 @@ ]); recorder.assertErrorsAreAbortErrors(); -}, "event and promise ordering for navigation.navigate() intercepted by transitionWhile() but then stopped using window.stop()"); +}, "event and promise ordering for navigation.navigate() intercepted by intercept() but then stopped using window.stop()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-intercept.html similarity index 90% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-intercept.html index b72bf49eae20f..f76f20bf85efa 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-intercept.html @@ -22,7 +22,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); }); const result = navigation.navigate("#1"); @@ -36,11 +36,12 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["committed fulfilled", "#1", { from, navigationType: "push" }], ["promise microtask", "#1", { from, navigationType: "push" }], ["navigatesuccess", "#1", { from, navigationType: "push" }], ["finished fulfilled", "#1", null], ["transition.finished fulfilled", "#1", null], ]); -}, "event and promise ordering for same-document navigation.navigate() intercepted by transitionWhile()"); +}, "event and promise ordering for same-document navigation.navigate() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reentrant.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-intercept-reentrant.html similarity index 91% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reentrant.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-intercept-reentrant.html index 2ef4c4fe27294..86f4e06731353 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reentrant.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-intercept-reentrant.html @@ -23,7 +23,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 2))); + e.intercept({ handler() { + recorder.record("handler run"); + return new Promise(r => t.step_timeout(r, 2)); + }}); if (firstNavigate) { firstNavigate = false; @@ -48,6 +51,7 @@ ["navigate", "", null], ["currententrychange", "#2", { from, navigationType: "push" }], + ["handler run", "#2", { from, navigationType: "push" }], ["committed fulfilled 2", "#2", { from, navigationType: "push" }], ["committed rejected 1", "#2", { from, navigationType: "push" }], ["finished rejected 1", "#2", { from, navigationType: "push" }], diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reject.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-intercept-reject.html similarity index 86% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reject.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-intercept-reject.html index b3a10b422e944..88c668e0e99e8 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reject.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/navigate-same-document-intercept-reject.html @@ -23,7 +23,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler() { + recorder.record("handler run"); + return Promise.reject(expectedError); + }}); }); const result = navigation.navigate("#1"); @@ -37,6 +40,7 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "#1", { from, navigationType: "push" }], + ["handler run", "#1", { from, navigationType: "push" }], ["committed fulfilled", "#1", { from, navigationType: "push" }], ["promise microtask", "#1", { from, navigationType: "push" }], ["navigateerror", "#1", { from, navigationType: "push" }], @@ -45,5 +49,5 @@ ]); recorder.assertErrorsAre(expectedError); -}, "event and promise ordering for same-document navigation.navigate() intercepted by passing a rejected promise to transitionWhile()"); +}, "event and promise ordering for same-document navigation.navigate() intercepted by passing a rejected promise to intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-transitionWhile-reject.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-intercept-reject.html similarity index 88% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/reload-transitionWhile-reject.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/reload-intercept-reject.html index 6939ee2df8208..334d2108ecdc2 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-transitionWhile-reject.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-intercept-reject.html @@ -23,7 +23,10 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler() { + recorder.record("handler run"); + return Promise.reject(expectedError); + }}); }); const result = navigation.reload(); @@ -37,6 +40,7 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "", { from, navigationType: "reload" }], + ["handler run", "", { from, navigationType: "reload" }], ["committed fulfilled", "", { from, navigationType: "reload" }], ["promise microtask", "", { from, navigationType: "reload" }], ["navigateerror", "", { from, navigationType: "reload" }], @@ -45,5 +49,5 @@ ]); recorder.assertErrorsAre(expectedError); -}, "event and promise ordering for navigation.reload() intercepted by transitionWhile()"); +}, "event and promise ordering for navigation.reload() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-transitionWhile.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-intercept.html similarity index 91% rename from testing/web-platform/tests/navigation-api/ordering-and-transition/reload-transitionWhile.html rename to testing/web-platform/tests/navigation-api/ordering-and-transition/reload-intercept.html index 31cd813f7419b..8d4160a4d959f 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/reload-intercept.html @@ -22,7 +22,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.resolve()); + e.intercept({ handler() { recorder.record("handler run"); } }); }); const result = navigation.reload(); @@ -36,11 +36,12 @@ /* event name, location.hash value, navigation.transition properties */ ["navigate", "", null], ["currententrychange", "", { from, navigationType: "reload" }], + ["handler run", "", { from, navigationType: "reload" }], ["committed fulfilled", "", { from, navigationType: "reload" }], ["promise microtask", "", { from, navigationType: "reload" }], ["navigatesuccess", "", { from, navigationType: "reload" }], ["finished fulfilled", "", null], ["transition.finished fulfilled", "", null], ]); -}, "event and promise ordering for navigation.reload() intercepted by transitionWhile()"); +}, "event and promise ordering for navigation.reload() intercepted by intercept()"); diff --git a/testing/web-platform/tests/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html b/testing/web-platform/tests/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html index 859e07df13970..fa38b822166ee 100644 --- a/testing/web-platform/tests/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html +++ b/testing/web-platform/tests/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html @@ -5,7 +5,7 @@ diff --git a/testing/web-platform/tests/navigation-api/per-entry-events/dispose-same-document-replace-with-transitionWhile.html b/testing/web-platform/tests/navigation-api/per-entry-events/dispose-same-document-replace-with-intercept.html similarity index 91% rename from testing/web-platform/tests/navigation-api/per-entry-events/dispose-same-document-replace-with-transitionWhile.html rename to testing/web-platform/tests/navigation-api/per-entry-events/dispose-same-document-replace-with-intercept.html index bcb0f02d75d34..4e492e30aedeb 100644 --- a/testing/web-platform/tests/navigation-api/per-entry-events/dispose-same-document-replace-with-transitionWhile.html +++ b/testing/web-platform/tests/navigation-api/per-entry-events/dispose-same-document-replace-with-intercept.html @@ -28,9 +28,9 @@ assert_equals(location.search, "?replacement"); }); - navigation.addEventListener("navigate", e => e.transitionWhile(Promise.resolve())); + navigation.addEventListener("navigate", e => e.intercept()); navigation.navigate("?replacement", { history: "replace" }); assert_true(disposeCalled); -}, "dispose events when doing a same-document replace using navigation.navigate() and transitionWhile()"); +}, "dispose events when doing a same-document replace using navigation.navigate() and intercept()"); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-basic.html b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-basic.html index 647b12ba7d011..8270f8e2ad33d 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-basic.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-basic.html @@ -12,7 +12,7 @@ assert_equals(window.scrollY, 0); await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve(), { scrollRestoration: "after-transition" }); + navigation.onnavigate = e => e.intercept({ scrollRestoration: "after-transition" }); await navigation.back().finished; assert_equals(window.scrollY, 0); }, "scrollRestoration: after-transition should scroll when back completes"); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html index 5e60ca33721c2..2e762379a5314 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html @@ -15,15 +15,16 @@ await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - let transitionWhile_resolve; + let intercept_resolve; navigation.onnavigate = e => { - e.transitionWhile(new Promise(r => transitionWhile_resolve = r), { scrollRestoration: "after-transition" }); + e.intercept({ handler: () => new Promise(r => intercept_resolve = r), + scrollRestoration: "after-transition" }); }; let back_promises = navigation.back(); await back_promises.committed; history.scrollRestoration = "auto"; - transitionWhile_resolve(); + intercept_resolve(); await back_promises.finished; assert_equals(window.scrollY, 0); }, "scrollRestoration: after-transition should ignore history.scrollRestoration even if it changes in the middle of the navigation"); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-intercept-handler-modifies.html b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-intercept-handler-modifies.html new file mode 100644 index 0000000000000..a11c04c3250cc --- /dev/null +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-intercept-handler-modifies.html @@ -0,0 +1,33 @@ + + + + +
+ + diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-reject.html b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-reject.html index 7a75b8abd037f..b1cfcede3ee71 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-reject.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-reject.html @@ -12,10 +12,12 @@ assert_equals(window.scrollY, 0); await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - navigation.onnavigate = e => e.transitionWhile(Promise.reject(), { scrollRestoration: "after-transition" }); + navigation.onnavigate = + e => e.intercept({ handler: () => Promise.reject(), + scrollRestoration: "after-transition" }); await promise_rejects_exactly(t, undefined, navigation.back().finished); assert_not_equals(window.scrollY, 0); -}, "scrollRestoration: after-transition should not scroll when the transitionWhile promise rejects"); +}, "scrollRestoration: after-transition should not scroll when the intercept() handler rejects"); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-timing.html b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-timing.html index 35a9071459f7c..3bb892054aab6 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-timing.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-timing.html @@ -13,12 +13,6 @@ await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - let transitionWhile_resolve; - navigation.onnavigate = t.step_func(e => { - e.transitionWhile(new Promise(r => transitionWhile_resolve = r)); - assert_not_equals(window.scrollY, 0); - }), { scrollRestoration: "after-transition" }; - window.onpopstate = t.step_func(() => assert_not_equals(window.scrollY, 0)); window.onhashchange = t.step_func(() => assert_not_equals(window.scrollY, 0)); @@ -30,10 +24,21 @@ }); let back_promises = navigation.back(); - - await back_promises.committed; - transitionWhile_resolve(); - assert_not_equals(window.scrollY, 0); + navigation.onnavigate = t.step_func(e => { + e.intercept({ scrollRestoration: "after-transition", + handler: async () => { + // The ordering here should be: + // * intercept() is called + // * back_promises.committed is resolved + // * this handler runs. + // If this handler incorrectly blocks back_promises.committed, + // this test will hang. + await back_promises.committed; + assert_not_equals(window.scrollY, 0); + } + }); + assert_not_equals(window.scrollY, 0); + }); await back_promises.finished; assert_equals(window.scrollY, 0); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html index 6c7a8385606ee..90dfebd68bf85 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html @@ -15,7 +15,7 @@ await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve(), { scrollRestoration: "after-transition" }); + navigation.onnavigate = e => e.intercept({ scrollRestoration: "after-transition" }); await navigation.back().finished; assert_equals(window.scrollY, 0); }, "scrollRestoration: after-transition should ignore history.scrollRestoration"); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-basic.html b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-basic.html index 84732fb532bd2..5421cd66ae6ff 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-basic.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-basic.html @@ -12,7 +12,7 @@ assert_equals(window.scrollY, 0); await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - navigation.onnavigate = e => e.transitionWhile(Promise.resolve(), { scrollRestoration: "manual" }); + navigation.onnavigate = e => e.intercept({ scrollRestoration: "manual" }); await navigation.back().finished; assert_not_equals(window.scrollY, 0); }, "scrollRestoration: manual should prevent auto scroll on back."); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html index f0676ea1b3787..c35a77e57d45a 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html @@ -13,7 +13,7 @@ await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); navigation.onnavigate = e => { - e.transitionWhile(Promise.resolve(), { scrollRestoration: "manual" }); + e.intercept({ scrollRestoration: "manual" }); e.restoreScroll(); assert_equals(window.scrollY, 0); } diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html index a3d01a52a34f8..4ebc08eb71495 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html @@ -13,18 +13,19 @@ await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); - let transitionWhile_resolve; + let intercept_resolve; let navigate_event; navigation.onnavigate = e => { navigate_event = e; - e.transitionWhile(new Promise(r => transitionWhile_resolve = r), { scrollRestoration: "manual" }); + e.intercept({ handler: () => new Promise(r => intercept_resolve = r), + scrollRestoration: "manual" }); }; let back_promises = navigation.back(); await back_promises.committed; assert_not_equals(window.scrollY, 0); navigate_event.restoreScroll(); assert_equals(window.scrollY, 0); - transitionWhile_resolve(); + intercept_resolve(); await back_promises.finished; assert_equals(window.scrollY, 0); }, "scrollRestoration: restoreScroll() should work after a navigate event dispatch"); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html index 6cf0fe16061e7..6a98638ffdd54 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html @@ -16,7 +16,7 @@ let navigate_event; navigation.onnavigate = e => { navigate_event = e; - e.transitionWhile(Promise.resolve(), { scrollRestoration: "manual" }); + e.intercept({ scrollRestoration: "manual" }); }; await navigation.back().finished; assert_not_equals(window.scrollY, 0); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html index 9ca5bfa064345..f29f533fe07ce 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html @@ -13,7 +13,7 @@ await navigation.navigate("#frag").finished; assert_not_equals(window.scrollY, 0); navigation.onnavigate = t.step_func(e => { - e.transitionWhile(Promise.resolve(), { scrollRestoration: "manual" }); + e.intercept({ scrollRestoration: "manual" }); e.restoreScroll(); assert_equals(window.scrollY, 0); assert_throws_dom("InvalidStateError", () => e.restoreScroll()); diff --git a/testing/web-platform/tests/navigation-api/scroll-restoration/restoreScroll-exceptions.html b/testing/web-platform/tests/navigation-api/scroll-restoration/restoreScroll-exceptions.html index 2f2b459d93bd9..0b9ff28d751a8 100644 --- a/testing/web-platform/tests/navigation-api/scroll-restoration/restoreScroll-exceptions.html +++ b/testing/web-platform/tests/navigation-api/scroll-restoration/restoreScroll-exceptions.html @@ -12,27 +12,27 @@ // Throw for non-traverse navigation.addEventListener("navigate", t.step_func(e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); assert_throws_dom("InvalidStateError", () => e.restoreScroll()); }), { once : true }); await navigation.navigate("#frag").finished; - // Throw for non-transitionWhile() traverse + // Throw for non-intercept() traverse navigation.addEventListener("navigate", t.step_func(e => { assert_throws_dom("InvalidStateError", () => e.restoreScroll()); }), { once : true }); await navigation.back().finished; - // Throw for transitionWhile() traverse with no explicit scrollRestoration behavior. + // Throw for intercept() traverse with no explicit scrollRestoration behavior. navigation.addEventListener("navigate", t.step_func(e => { - e.transitionWhile(Promise.resolve()); + e.intercept(); assert_throws_dom("InvalidStateError", () => e.restoreScroll()); }), { once : true }); await navigation.forward().finished; - // Throw for transitionWhile() traverse with scrollRestoration "after-transition". + // Throw for intercept() traverse with scrollRestoration "after-transition". navigation.addEventListener("navigate", t.step_func(e => { - e.transitionWhile(Promise.resolve(), { scrollRestoration: "after-transition" }); + e.intercept({ scrollRestoration: "after-transition" }); assert_throws_dom("InvalidStateError", () => e.restoreScroll()); }), { once : true }); await navigation.back().finished;