diff --git a/navigation-api/currententrychange-event/navigation-navigate-transitionWhile.html b/navigation-api/currententrychange-event/navigation-navigate-intercept.html similarity index 88% rename from navigation-api/currententrychange-event/navigation-navigate-transitionWhile.html rename to navigation-api/currententrychange-event/navigation-navigate-intercept.html index e5855cf63e8151..af0fe104f944f6 100644 --- a/navigation-api/currententrychange-event/navigation-navigate-transitionWhile.html +++ b/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/navigation-api/currententrychange-event/navigation-navigate-replace-transitionWhile.html b/navigation-api/currententrychange-event/navigation-navigate-replace-intercept.html similarity index 88% rename from navigation-api/currententrychange-event/navigation-navigate-replace-transitionWhile.html rename to navigation-api/currententrychange-event/navigation-navigate-replace-intercept.html index 9e1401233b21a5..33209202d8ce01 100644 --- a/navigation-api/currententrychange-event/navigation-navigate-replace-transitionWhile.html +++ b/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/navigation-api/currententrychange-event/navigation-reload-transitionWhile.html b/navigation-api/currententrychange-event/navigation-reload-intercept.html similarity index 87% rename from navigation-api/currententrychange-event/navigation-reload-transitionWhile.html rename to navigation-api/currententrychange-event/navigation-reload-intercept.html index c732de941f7ed8..275e23363c9bf8 100644 --- a/navigation-api/currententrychange-event/navigation-reload-transitionWhile.html +++ b/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/navigation-api/focus-reset/autofocus.html b/navigation-api/focus-reset/autofocus.html index 4418dfa76cde71..60444473673bb8 100644 --- a/navigation-api/focus-reset/autofocus.html +++ b/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/navigation-api/focus-reset/basic.html b/navigation-api/focus-reset/basic.html index 1ffaa022ee4ba5..f5a30972b0e545 100644 --- a/navigation-api/focus-reset/basic.html +++ b/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/navigation-api/focus-reset/change-focus-again-in-blur-during-transitionWhile.html b/navigation-api/focus-reset/change-focus-again-in-blur-during-intercept.html similarity index 83% rename from navigation-api/focus-reset/change-focus-again-in-blur-during-transitionWhile.html rename to navigation-api/focus-reset/change-focus-again-in-blur-during-intercept.html index 2275ac8e96c375..a7339c97883f6a 100644 --- a/navigation-api/focus-reset/change-focus-again-in-blur-during-transitionWhile.html +++ b/navigation-api/focus-reset/change-focus-again-in-blur-during-intercept.html @@ -4,10 +4,10 @@ diff --git a/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html index d162d8ddb883be..676672a230f150 100644 --- a/navigation-api/navigate-event/cross-window/click-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/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/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html b/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html index 928d202045e342..41c3ca71eef1d5 100644 --- a/navigation-api/navigate-event/cross-window/click-crossdocument-sameorigin.html +++ b/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/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html index b7d284088081e8..a467ecf9d73d88 100644 --- a/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin-sameorigindomain.sub.html +++ b/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/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html b/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html index 32bc4cd291ac64..b9fa97f6d526ae 100644 --- a/navigation-api/navigate-event/cross-window/click-samedocument-crossorigin.html +++ b/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/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html b/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html index fc815abb39eb18..566bea3dc7e9b5 100644 --- a/navigation-api/navigate-event/cross-window/click-samedocument-sameorigin.html +++ b/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/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html index 24824b12177d94..77a5873c0838f8 100644 --- a/navigation-api/navigate-event/cross-window/location-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/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/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html b/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html index 1ac3eef874770a..41ac1b037506f1 100644 --- a/navigation-api/navigate-event/cross-window/location-crossdocument-sameorigin.html +++ b/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/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html index 96032c14ac60a9..1eda74e9828310 100644 --- a/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin-sameorigindomain.sub.html +++ b/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/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html b/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html index 8a58be7a2b4120..5679236a7ddca9 100644 --- a/navigation-api/navigate-event/cross-window/location-samedocument-crossorigin.html +++ b/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/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html b/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html index 3901b9ddbccc49..a7e4181c3a19f0 100644 --- a/navigation-api/navigate-event/cross-window/location-samedocument-sameorigin.html +++ b/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/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html index d386e487a333c2..ea9ea479c34733 100644 --- a/navigation-api/navigate-event/cross-window/open-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/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/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html b/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html index a899dd86a3a773..478483e238d727 100644 --- a/navigation-api/navigate-event/cross-window/open-crossdocument-sameorigin.html +++ b/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/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html index b44303c18b8b81..324adb32a45922 100644 --- a/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin-sameorigindomain.sub.html +++ b/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/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html b/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html index 65f062fcd578ba..23dceb04204841 100644 --- a/navigation-api/navigate-event/cross-window/open-samedocument-crossorigin.html +++ b/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/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html b/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html index 3f3c38d85062d6..9ca853180343f6 100644 --- a/navigation-api/navigate-event/cross-window/open-samedocument-sameorigin.html +++ b/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/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html b/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html index 96e8a0c1e65432..3393a2ecaa9e65 100644 --- a/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html +++ b/navigation-api/navigate-event/cross-window/resources/cross-origin-iframe-helper.html @@ -1,9 +1,10 @@ + diff --git a/navigation-api/navigate-event/transitionWhile-and-navigate.html b/navigation-api/navigate-event/intercept-and-navigate.html similarity index 81% rename from navigation-api/navigate-event/transitionWhile-and-navigate.html rename to navigation-api/navigate-event/intercept-and-navigate.html index f226371d79b357..dfbb67b6b6b1c0 100644 --- a/navigation-api/navigate-event/transitionWhile-and-navigate.html +++ b/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/navigation-api/navigate-event/transitionWhile-canceled-event.html b/navigation-api/navigate-event/intercept-canceled-event.html similarity index 72% rename from navigation-api/navigate-event/transitionWhile-canceled-event.html rename to navigation-api/navigate-event/intercept-canceled-event.html index f1fe3ece38bf20..d4b9633c1a37c4 100644 --- a/navigation-api/navigate-event/transitionWhile-canceled-event.html +++ b/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/navigation-api/navigate-event/transitionWhile-cross-document-same-origin.html b/navigation-api/navigate-event/intercept-cross-document-same-origin.html similarity index 73% rename from navigation-api/navigate-event/transitionWhile-cross-document-same-origin.html rename to navigation-api/navigate-event/intercept-cross-document-same-origin.html index 9e55958c533785..0d610cce4f507c 100644 --- a/navigation-api/navigate-event/transitionWhile-cross-document-same-origin.html +++ b/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/navigation-api/navigate-event/transitionWhile-cross-origin.html b/navigation-api/navigate-event/intercept-cross-origin.html similarity index 70% rename from navigation-api/navigate-event/transitionWhile-cross-origin.html rename to navigation-api/navigate-event/intercept-cross-origin.html index e53371a96a2ce5..b367df546c6a72 100644 --- a/navigation-api/navigate-event/transitionWhile-cross-origin.html +++ b/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/navigation-api/navigate-event/intercept-detach-multiple.html b/navigation-api/navigate-event/intercept-detach-multiple.html new file mode 100644 index 00000000000000..5b6a62328491a9 --- /dev/null +++ b/navigation-api/navigate-event/intercept-detach-multiple.html @@ -0,0 +1,18 @@ + + + + + diff --git a/navigation-api/navigate-event/transitionWhile-detach.html b/navigation-api/navigate-event/intercept-detach.html similarity index 80% rename from navigation-api/navigate-event/transitionWhile-detach.html rename to navigation-api/navigate-event/intercept-detach.html index 25159850803d81..b5ce45aa29c38d 100644 --- a/navigation-api/navigate-event/transitionWhile-detach.html +++ b/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/navigation-api/navigate-event/intercept-handler-null-or-undefined.html b/navigation-api/navigate-event/intercept-handler-null-or-undefined.html new file mode 100644 index 00000000000000..7f5bd6b19f8342 --- /dev/null +++ b/navigation-api/navigate-event/intercept-handler-null-or-undefined.html @@ -0,0 +1,21 @@ + + + + diff --git a/navigation-api/navigate-event/intercept-handler-returns-non-promise.html b/navigation-api/navigate-event/intercept-handler-returns-non-promise.html new file mode 100644 index 00000000000000..96116e929533f5 --- /dev/null +++ b/navigation-api/navigate-event/intercept-handler-returns-non-promise.html @@ -0,0 +1,18 @@ + + + + diff --git a/navigation-api/navigate-event/transitionWhile-reject.html b/navigation-api/navigate-event/intercept-handler-throws.html similarity index 82% rename from navigation-api/navigate-event/transitionWhile-reject.html rename to navigation-api/navigate-event/intercept-handler-throws.html index 28864b38a5186a..769f6759997470 100644 --- a/navigation-api/navigate-event/transitionWhile-reject.html +++ b/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/navigation-api/navigate-event/transitionWhile-history-pushState.html b/navigation-api/navigate-event/intercept-history-pushState.html similarity index 78% rename from navigation-api/navigate-event/transitionWhile-history-pushState.html rename to navigation-api/navigate-event/intercept-history-pushState.html index a08e4ea2823764..aad08b742ef4aa 100644 --- a/navigation-api/navigate-event/transitionWhile-history-pushState.html +++ b/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/navigation-api/navigate-event/transitionWhile-history-replaceState.html b/navigation-api/navigate-event/intercept-history-replaceState.html similarity index 78% rename from navigation-api/navigate-event/transitionWhile-history-replaceState.html rename to navigation-api/navigate-event/intercept-history-replaceState.html index e575876de245b3..16edec8596e44a 100644 --- a/navigation-api/navigate-event/transitionWhile-history-replaceState.html +++ b/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/navigation-api/navigate-event/transitionWhile-multiple-times-reject.html b/navigation-api/navigate-event/intercept-multiple-times-reject.html similarity index 75% rename from navigation-api/navigate-event/transitionWhile-multiple-times-reject.html rename to navigation-api/navigate-event/intercept-multiple-times-reject.html index 0532d755fd343f..0b0f1f0b8e838d 100644 --- a/navigation-api/navigate-event/transitionWhile-multiple-times-reject.html +++ b/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/navigation-api/navigate-event/transitionWhile-multiple-times.html b/navigation-api/navigate-event/intercept-multiple-times.html similarity index 69% rename from navigation-api/navigate-event/transitionWhile-multiple-times.html rename to navigation-api/navigate-event/intercept-multiple-times.html index d5661a54eba39a..6deaeeb507de77 100644 --- a/navigation-api/navigate-event/transitionWhile-multiple-times.html +++ b/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/navigation-api/navigate-event/transitionWhile-navigation-back.html b/navigation-api/navigate-event/intercept-navigation-back.html similarity index 80% rename from navigation-api/navigate-event/transitionWhile-navigation-back.html rename to navigation-api/navigate-event/intercept-navigation-back.html index 3a4629005be58a..8babf2bcdcc5bd 100644 --- a/navigation-api/navigate-event/transitionWhile-navigation-back.html +++ b/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/navigation-api/navigate-event/transitionWhile-on-synthetic-event.html b/navigation-api/navigate-event/intercept-on-synthetic-event.html similarity index 74% rename from navigation-api/navigate-event/transitionWhile-on-synthetic-event.html rename to navigation-api/navigate-event/intercept-on-synthetic-event.html index 3acf41745811ac..3a4b54de5e9c95 100644 --- a/navigation-api/navigate-event/transitionWhile-on-synthetic-event.html +++ b/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/navigation-api/navigate-event/transitionWhile-popstate.html b/navigation-api/navigate-event/intercept-popstate.html similarity index 82% rename from navigation-api/navigate-event/transitionWhile-popstate.html rename to navigation-api/navigate-event/intercept-popstate.html index a889e40e22b5a4..f5f9d82be7f7ec 100644 --- a/navigation-api/navigate-event/transitionWhile-popstate.html +++ b/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/navigation-api/navigate-event/intercept-reject.html b/navigation-api/navigate-event/intercept-reject.html new file mode 100644 index 00000000000000..4c5ec0163d1ab0 --- /dev/null +++ b/navigation-api/navigate-event/intercept-reject.html @@ -0,0 +1,29 @@ + + + + diff --git a/navigation-api/navigate-event/transitionWhile-resolve.html b/navigation-api/navigate-event/intercept-resolve.html similarity index 77% rename from navigation-api/navigate-event/transitionWhile-resolve.html rename to navigation-api/navigate-event/intercept-resolve.html index b49c66399daee5..b60d89b5dfee2b 100644 --- a/navigation-api/navigate-event/transitionWhile-resolve.html +++ b/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/navigation-api/navigate-event/transitionWhile-same-document-history-back.html b/navigation-api/navigate-event/intercept-same-document-history-back.html similarity index 91% rename from navigation-api/navigate-event/transitionWhile-same-document-history-back.html rename to navigation-api/navigate-event/intercept-same-document-history-back.html index 4c404386fe2160..6faabe1964651a 100644 --- a/navigation-api/navigate-event/transitionWhile-same-document-history-back.html +++ b/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/navigation-api/navigate-event/navigate-anchor-cross-origin.html b/navigation-api/navigate-event/navigate-anchor-cross-origin.html index 38b7d584b88562..d8f2e383124be5 100644 --- a/navigation-api/navigate-event/navigate-anchor-cross-origin.html +++ b/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/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html b/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html index c42f389ba67beb..90a612b7588696 100644 --- a/navigation-api/navigate-event/navigate-anchor-download-userInitiated.html +++ b/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/navigation-api/navigate-event/navigate-anchor-download.html b/navigation-api/navigate-event/navigate-anchor-download.html index 5615e347384454..c5ca306b7908d5 100644 --- a/navigation-api/navigate-event/navigate-anchor-download.html +++ b/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/navigation-api/navigate-event/navigate-anchor-fragment.html b/navigation-api/navigate-event/navigate-anchor-fragment.html index 591ed73dbf164e..b7706b7debea3c 100644 --- a/navigation-api/navigate-event/navigate-anchor-fragment.html +++ b/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/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html b/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html index 822f2f33ba4dfd..b8e925a4dbacd5 100644 --- a/navigation-api/navigate-event/navigate-anchor-same-origin-cross-document.html +++ b/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/navigation-api/navigate-event/navigate-anchor-userInitiated.html b/navigation-api/navigate-event/navigate-anchor-userInitiated.html index 832a3f843e22f4..b746bbe3f028c2 100644 --- a/navigation-api/navigate-event/navigate-anchor-userInitiated.html +++ b/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/navigation-api/navigate-event/navigate-anchor-with-target.html b/navigation-api/navigate-event/navigate-anchor-with-target.html index a0de04d5ea4427..c2053a37b09a45 100644 --- a/navigation-api/navigate-event/navigate-anchor-with-target.html +++ b/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/navigation-api/navigate-event/navigate-form-get.html b/navigation-api/navigate-event/navigate-form-get.html index d3cafa1b3fa347..69a49eb08a6771 100644 --- a/navigation-api/navigate-event/navigate-form-get.html +++ b/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/navigation-api/navigate-event/navigate-form-userInitiated.html b/navigation-api/navigate-event/navigate-form-userInitiated.html index d6fc712c26a091..454f0773962f32 100644 --- a/navigation-api/navigate-event/navigate-form-userInitiated.html +++ b/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/navigation-api/navigate-event/navigate-form-with-target.html b/navigation-api/navigate-event/navigate-form-with-target.html index 12cafe5eb0815b..b23ab3a70ccb2b 100644 --- a/navigation-api/navigate-event/navigate-form-with-target.html +++ b/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/navigation-api/navigate-event/navigate-form.html b/navigation-api/navigate-event/navigate-form.html index bc120420ca3c16..b537a9b58f090c 100644 --- a/navigation-api/navigate-event/navigate-form.html +++ b/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/navigation-api/navigate-event/navigate-history-back-after-fragment.html b/navigation-api/navigate-event/navigate-history-back-after-fragment.html index ddabfaeef5afc0..976754f28a885e 100644 --- a/navigation-api/navigate-event/navigate-history-back-after-fragment.html +++ b/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/navigation-api/navigate-event/navigate-history-back-after-pushState.html b/navigation-api/navigate-event/navigate-history-back-after-pushState.html index 074aa715681593..4d870fb2ae6d0a 100644 --- a/navigation-api/navigate-event/navigate-history-back-after-pushState.html +++ b/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/navigation-api/navigate-event/navigate-history-back-cross-document.html b/navigation-api/navigate-event/navigate-history-back-cross-document.html index 967cf5db0cdb4c..cd7be6e9ad37eb 100644 --- a/navigation-api/navigate-event/navigate-history-back-cross-document.html +++ b/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/navigation-api/navigate-event/navigate-history-go-0.html b/navigation-api/navigate-event/navigate-history-go-0.html index f7453e4805f8cd..96d98cf44c8261 100644 --- a/navigation-api/navigate-event/navigate-history-go-0.html +++ b/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/navigation-api/navigate-event/navigate-history-pushState.html b/navigation-api/navigate-event/navigate-history-pushState.html index 0651c529daa3ed..2f8c81c7090cb9 100644 --- a/navigation-api/navigate-event/navigate-history-pushState.html +++ b/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/navigation-api/navigate-event/navigate-history-replaceState.html b/navigation-api/navigate-event/navigate-history-replaceState.html index d0fe5d949ba17f..d8417fbfd308ae 100644 --- a/navigation-api/navigate-event/navigate-history-replaceState.html +++ b/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/navigation-api/navigate-event/navigate-iframe-location.html b/navigation-api/navigate-event/navigate-iframe-location.html index cbf16c896a8561..059b9950118366 100644 --- a/navigation-api/navigate-event/navigate-iframe-location.html +++ b/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/navigation-api/navigate-event/navigate-location.html b/navigation-api/navigate-event/navigate-location.html index 998da50994caec..c5aa0be97a47be 100644 --- a/navigation-api/navigate-event/navigate-location.html +++ b/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/navigation-api/navigate-event/navigate-meta-refresh.html b/navigation-api/navigate-event/navigate-meta-refresh.html index 9077fec5fa053f..1f8ed306851fd4 100644 --- a/navigation-api/navigate-event/navigate-meta-refresh.html +++ b/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/navigation-api/navigate-event/navigate-navigation-back-cross-document.html b/navigation-api/navigate-event/navigate-navigation-back-cross-document.html index 4847ac8f1be902..214644066e1d12 100644 --- a/navigation-api/navigate-event/navigate-navigation-back-cross-document.html +++ b/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/navigation-api/navigate-event/navigate-navigation-back-same-document.html b/navigation-api/navigate-event/navigate-navigation-back-same-document.html index 626ea33136adbb..8753e6b1c86bab 100644 --- a/navigation-api/navigate-event/navigate-navigation-back-same-document.html +++ b/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/navigation-api/navigate-event/navigate-navigation-navigate.html b/navigation-api/navigate-event/navigate-navigation-navigate.html index adc71a324379a9..76f98c72361060 100644 --- a/navigation-api/navigate-event/navigate-navigation-navigate.html +++ b/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/navigation-api/navigate-event/navigate-to-srcdoc.html b/navigation-api/navigate-event/navigate-to-srcdoc.html index 996fecfceaf67c..26ad135b6ad0b7 100644 --- a/navigation-api/navigate-event/navigate-to-srcdoc.html +++ b/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/navigation-api/navigate-event/navigate-window-open-self.html b/navigation-api/navigate-event/navigate-window-open-self.html index cdfc57c4a022fe..274c8bc4d5762f 100644 --- a/navigation-api/navigate-event/navigate-window-open-self.html +++ b/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/navigation-api/navigate-event/navigate-window-open.html b/navigation-api/navigate-event/navigate-window-open.html index aef333abc4d197..afc998271f6e96 100644 --- a/navigation-api/navigate-event/navigate-window-open.html +++ b/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/navigation-api/navigate-event/signal-abort-transitionWhile.html b/navigation-api/navigate-event/signal-abort-intercept.html similarity index 82% rename from navigation-api/navigate-event/signal-abort-transitionWhile.html rename to navigation-api/navigate-event/signal-abort-intercept.html index ce195cf677229e..1e92d8e445f6c3 100644 --- a/navigation-api/navigate-event/signal-abort-transitionWhile.html +++ b/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/navigation-api/navigate-event/signal-abort-window-stop-after-transitionWhile.html b/navigation-api/navigate-event/signal-abort-window-stop-after-intercept.html similarity index 88% rename from navigation-api/navigate-event/signal-abort-window-stop-after-transitionWhile.html rename to navigation-api/navigate-event/signal-abort-window-stop-after-intercept.html index bc44a07b20e830..51ba7753a8a9f2 100644 --- a/navigation-api/navigate-event/signal-abort-window-stop-after-transitionWhile.html +++ b/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/navigation-api/navigation-history-entry/key-id-location-reload-transitionWhile.html b/navigation-api/navigation-history-entry/key-id-location-reload-intercept.html similarity index 91% rename from navigation-api/navigation-history-entry/key-id-location-reload-transitionWhile.html rename to navigation-api/navigation-history-entry/key-id-location-reload-intercept.html index e5924d243160cd..62ce0974399e80 100644 --- a/navigation-api/navigation-history-entry/key-id-location-reload-transitionWhile.html +++ b/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/navigation-api/navigation-methods/navigate-transitionWhile-history-state.html b/navigation-api/navigation-methods/navigate-intercept-history-state.html similarity index 70% rename from navigation-api/navigation-methods/navigate-transitionWhile-history-state.html rename to navigation-api/navigation-methods/navigate-intercept-history-state.html index c5e1036bff4fc7..7faf6ffb5a294c 100644 --- a/navigation-api/navigation-methods/navigate-transitionWhile-history-state.html +++ b/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/navigation-api/navigation-methods/navigate-state-repeated-await.html b/navigation-api/navigation-methods/navigate-state-repeated-await.html index a003992d66a3b0..539b3dc1da9de9 100644 --- a/navigation-api/navigation-methods/navigate-state-repeated-await.html +++ b/navigation-api/navigation-methods/navigate-state-repeated-await.html @@ -3,7 +3,7 @@ diff --git a/navigation-api/navigation-methods/return-value/back-transitionWhile.html b/navigation-api/navigation-methods/return-value/back-intercept.html similarity index 83% rename from navigation-api/navigation-methods/return-value/back-transitionWhile.html rename to navigation-api/navigation-methods/return-value/back-intercept.html index c1161f895a54dc..2654045c2b0080 100644 --- a/navigation-api/navigation-methods/return-value/back-transitionWhile.html +++ b/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/navigation-api/navigation-methods/return-value/forward-transitionWhile-rejected.html b/navigation-api/navigation-methods/return-value/forward-intercept-rejected.html similarity index 88% rename from navigation-api/navigation-methods/return-value/forward-transitionWhile-rejected.html rename to navigation-api/navigation-methods/return-value/forward-intercept-rejected.html index 7ff0c70f0b9ae8..9e86dcca19760e 100644 --- a/navigation-api/navigation-methods/return-value/forward-transitionWhile-rejected.html +++ b/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/navigation-api/navigation-methods/return-value/forward-transitionWhile.html b/navigation-api/navigation-methods/return-value/forward-intercept.html similarity index 86% rename from navigation-api/navigation-methods/return-value/forward-transitionWhile.html rename to navigation-api/navigation-methods/return-value/forward-intercept.html index 2b8175b619d61a..ce4ab3217070a8 100644 --- a/navigation-api/navigation-methods/return-value/forward-transitionWhile.html +++ b/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/navigation-api/navigation-methods/return-value/navigate-transitionWhile-interrupted.html b/navigation-api/navigation-methods/return-value/navigate-intercept-interrupted.html similarity index 84% rename from navigation-api/navigation-methods/return-value/navigate-transitionWhile-interrupted.html rename to navigation-api/navigation-methods/return-value/navigate-intercept-interrupted.html index fa818b484d327c..36403c892c6c94 100644 --- a/navigation-api/navigation-methods/return-value/navigate-transitionWhile-interrupted.html +++ b/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/navigation-api/navigation-methods/return-value/navigate-transitionWhile-rejected.html b/navigation-api/navigation-methods/return-value/navigate-intercept-rejected.html similarity index 79% rename from navigation-api/navigation-methods/return-value/navigate-transitionWhile-rejected.html rename to navigation-api/navigation-methods/return-value/navigate-intercept-rejected.html index c1d4c4980251c6..79c8bd803e3461 100644 --- a/navigation-api/navigation-methods/return-value/navigate-transitionWhile-rejected.html +++ b/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/navigation-api/navigation-methods/return-value/navigate-transitionWhile.html b/navigation-api/navigation-methods/return-value/navigate-intercept.html similarity index 71% rename from navigation-api/navigation-methods/return-value/navigate-transitionWhile.html rename to navigation-api/navigation-methods/return-value/navigate-intercept.html index 2fe78e53e99f1c..a9946c71ff3a88 100644 --- a/navigation-api/navigation-methods/return-value/navigate-transitionWhile.html +++ b/navigation-api/navigation-methods/return-value/navigate-intercept.html @@ -5,11 +5,11 @@ diff --git a/navigation-api/navigation-methods/return-value/reload-transitionWhile-rejected.html b/navigation-api/navigation-methods/return-value/reload-intercept-rejected.html similarity index 79% rename from navigation-api/navigation-methods/return-value/reload-transitionWhile-rejected.html rename to navigation-api/navigation-methods/return-value/reload-intercept-rejected.html index e6ec928a736859..93cd75c2b99865 100644 --- a/navigation-api/navigation-methods/return-value/reload-transitionWhile-rejected.html +++ b/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/navigation-api/navigation-methods/return-value/reload-transitionWhile.html b/navigation-api/navigation-methods/return-value/reload-intercept.html similarity index 67% rename from navigation-api/navigation-methods/return-value/reload-transitionWhile.html rename to navigation-api/navigation-methods/return-value/reload-intercept.html index 19cea8afc28069..92f1636a6e85bd 100644 --- a/navigation-api/navigation-methods/return-value/reload-transitionWhile.html +++ b/navigation-api/navigation-methods/return-value/reload-intercept.html @@ -5,10 +5,10 @@ diff --git a/navigation-api/navigation-methods/return-value/reload.html b/navigation-api/navigation-methods/return-value/reload.html index 028d5855701ad8..388f0d94b5030c 100644 --- a/navigation-api/navigation-methods/return-value/reload.html +++ b/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/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile-rejected.html b/navigation-api/navigation-methods/return-value/traverseTo-intercept-rejected.html similarity index 88% rename from navigation-api/navigation-methods/return-value/traverseTo-transitionWhile-rejected.html rename to navigation-api/navigation-methods/return-value/traverseTo-intercept-rejected.html index 613531023fa4bc..f934eae5d4c1a3 100644 --- a/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile-rejected.html +++ b/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/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile.html b/navigation-api/navigation-methods/return-value/traverseTo-intercept.html similarity index 83% rename from navigation-api/navigation-methods/return-value/traverseTo-transitionWhile.html rename to navigation-api/navigation-methods/return-value/traverseTo-intercept.html index 430fbe8be79211..a4cb4e711d8c9b 100644 --- a/navigation-api/navigation-methods/return-value/traverseTo-transitionWhile.html +++ b/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/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html b/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html index 25dd134649627e..a0a29188878611 100644 --- a/navigation-api/navigation-methods/traverseTo-detach-between-navigate-and-navigatesuccess.html +++ b/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/navigation-api/ordering-and-transition/README.md b/navigation-api/ordering-and-transition/README.md index 653dd2198c3a23..628b22ec48b7d0 100644 --- a/navigation-api/ordering-and-transition/README.md +++ b/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/navigation-api/ordering-and-transition/anchor-download-transitionWhile-reject.html b/navigation-api/ordering-and-transition/anchor-download-intercept-reject.html similarity index 87% rename from navigation-api/ordering-and-transition/anchor-download-transitionWhile-reject.html rename to navigation-api/ordering-and-transition/anchor-download-intercept-reject.html index 20202777a9f032..4869cedd2528e7 100644 --- a/navigation-api/ordering-and-transition/anchor-download-transitionWhile-reject.html +++ b/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/navigation-api/ordering-and-transition/anchor-download-transitionWhile.html b/navigation-api/ordering-and-transition/anchor-download-intercept.html similarity index 87% rename from navigation-api/ordering-and-transition/anchor-download-transitionWhile.html rename to navigation-api/ordering-and-transition/anchor-download-intercept.html index 822c0a230d506e..23326c827b7a27 100644 --- a/navigation-api/ordering-and-transition/anchor-download-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/anchor-download.html b/navigation-api/ordering-and-transition/anchor-download.html index 0490069c7aa471..c6af13c3e06181 100644 --- a/navigation-api/ordering-and-transition/anchor-download.html +++ b/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/navigation-api/ordering-and-transition/back-same-document-transitionWhile-reject.html b/navigation-api/ordering-and-transition/back-same-document-intercept-reject.html similarity index 87% rename from navigation-api/ordering-and-transition/back-same-document-transitionWhile-reject.html rename to navigation-api/ordering-and-transition/back-same-document-intercept-reject.html index 05d86b4910213a..c0d4f550271371 100644 --- a/navigation-api/ordering-and-transition/back-same-document-transitionWhile-reject.html +++ b/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/navigation-api/ordering-and-transition/back-same-document-transitionWhile.html b/navigation-api/ordering-and-transition/back-same-document-intercept.html similarity index 90% rename from navigation-api/ordering-and-transition/back-same-document-transitionWhile.html rename to navigation-api/ordering-and-transition/back-same-document-intercept.html index d435aab37b4b16..7bd248bc9c5a77 100644 --- a/navigation-api/ordering-and-transition/back-same-document-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/currententrychange-before-popstate-transitionWhile.html b/navigation-api/ordering-and-transition/currententrychange-before-popstate-intercept.html similarity index 96% rename from navigation-api/ordering-and-transition/currententrychange-before-popstate-transitionWhile.html rename to navigation-api/ordering-and-transition/currententrychange-before-popstate-intercept.html index 59f37e97125e6d..c51c7c444cb9a5 100644 --- a/navigation-api/ordering-and-transition/currententrychange-before-popstate-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/intercept-async.html b/navigation-api/ordering-and-transition/intercept-async.html new file mode 100644 index 00000000000000..f2ca0969506bb4 --- /dev/null +++ b/navigation-api/ordering-and-transition/intercept-async.html @@ -0,0 +1,55 @@ + + + + + + + diff --git a/navigation-api/ordering-and-transition/location-href-double-transitionWhile.html b/navigation-api/ordering-and-transition/location-href-double-intercept.html similarity index 86% rename from navigation-api/ordering-and-transition/location-href-double-transitionWhile.html rename to navigation-api/ordering-and-transition/location-href-double-intercept.html index 5ec22b119fa673..36ae5ce4ab52b4 100644 --- a/navigation-api/ordering-and-transition/location-href-double-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/location-href-transitionWhile-reentrant.html b/navigation-api/ordering-and-transition/location-href-intercept-reentrant.html similarity index 85% rename from navigation-api/ordering-and-transition/location-href-transitionWhile-reentrant.html rename to navigation-api/ordering-and-transition/location-href-intercept-reentrant.html index 4dedb58d5b042f..3fabf52bfbab2b 100644 --- a/navigation-api/ordering-and-transition/location-href-transitionWhile-reentrant.html +++ b/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/navigation-api/ordering-and-transition/location-href-transitionWhile-reject.html b/navigation-api/ordering-and-transition/location-href-intercept-reject.html similarity index 86% rename from navigation-api/ordering-and-transition/location-href-transitionWhile-reject.html rename to navigation-api/ordering-and-transition/location-href-intercept-reject.html index dbef3928e30c9d..b4aeb726b3b59c 100644 --- a/navigation-api/ordering-and-transition/location-href-transitionWhile-reject.html +++ b/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/navigation-api/ordering-and-transition/location-href-transitionWhile.html b/navigation-api/ordering-and-transition/location-href-intercept.html similarity index 90% rename from navigation-api/ordering-and-transition/location-href-transitionWhile.html rename to navigation-api/ordering-and-transition/location-href-intercept.html index 0e1d22df7254f8..bb861d37ae54a5 100644 --- a/navigation-api/ordering-and-transition/location-href-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/navigate-double-transitionWhile.html b/navigation-api/ordering-and-transition/navigate-double-intercept.html similarity index 88% rename from navigation-api/ordering-and-transition/navigate-double-transitionWhile.html rename to navigation-api/ordering-and-transition/navigate-double-intercept.html index 556d1737a6e37e..6ce67b9af644ae 100644 --- a/navigation-api/ordering-and-transition/navigate-double-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/navigate-in-transition-finished.html b/navigation-api/ordering-and-transition/navigate-in-transition-finished.html index 8c74ba2f632f7b..9251cfe049d30e 100644 --- a/navigation-api/ordering-and-transition/navigate-in-transition-finished.html +++ b/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/navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html b/navigation-api/ordering-and-transition/navigate-intercept-stop.html similarity index 89% rename from navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html rename to navigation-api/ordering-and-transition/navigate-intercept-stop.html index 9a8c412b3333ef..5d126a8c2ff9b9 100644 --- a/navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html +++ b/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/navigation-api/ordering-and-transition/navigate-transitionWhile.html b/navigation-api/ordering-and-transition/navigate-intercept.html similarity index 90% rename from navigation-api/ordering-and-transition/navigate-transitionWhile.html rename to navigation-api/ordering-and-transition/navigate-intercept.html index b72bf49eae20f5..f76f20bf85efae 100644 --- a/navigation-api/ordering-and-transition/navigate-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reentrant.html b/navigation-api/ordering-and-transition/navigate-same-document-intercept-reentrant.html similarity index 91% rename from navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reentrant.html rename to navigation-api/ordering-and-transition/navigate-same-document-intercept-reentrant.html index 2ef4c4fe27294c..86f4e067313536 100644 --- a/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reentrant.html +++ b/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/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reject.html b/navigation-api/ordering-and-transition/navigate-same-document-intercept-reject.html similarity index 86% rename from navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reject.html rename to navigation-api/ordering-and-transition/navigate-same-document-intercept-reject.html index b3a10b422e9444..88c668e0e99e83 100644 --- a/navigation-api/ordering-and-transition/navigate-same-document-transitionWhile-reject.html +++ b/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/navigation-api/ordering-and-transition/reload-transitionWhile-reject.html b/navigation-api/ordering-and-transition/reload-intercept-reject.html similarity index 88% rename from navigation-api/ordering-and-transition/reload-transitionWhile-reject.html rename to navigation-api/ordering-and-transition/reload-intercept-reject.html index 6939ee2df8208b..334d2108ecdc26 100644 --- a/navigation-api/ordering-and-transition/reload-transitionWhile-reject.html +++ b/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/navigation-api/ordering-and-transition/reload-transitionWhile.html b/navigation-api/ordering-and-transition/reload-intercept.html similarity index 91% rename from navigation-api/ordering-and-transition/reload-transitionWhile.html rename to navigation-api/ordering-and-transition/reload-intercept.html index 31cd813f7419bb..8d4160a4d959f9 100644 --- a/navigation-api/ordering-and-transition/reload-transitionWhile.html +++ b/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/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html b/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html index 859e07df139701..fa38b822166ee4 100644 --- a/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html +++ b/navigation-api/ordering-and-transition/transition-finished-mark-as-handled.html @@ -5,7 +5,7 @@ diff --git a/navigation-api/per-entry-events/dispose-same-document-replace-with-transitionWhile.html b/navigation-api/per-entry-events/dispose-same-document-replace-with-intercept.html similarity index 91% rename from navigation-api/per-entry-events/dispose-same-document-replace-with-transitionWhile.html rename to navigation-api/per-entry-events/dispose-same-document-replace-with-intercept.html index bcb0f02d75d34b..4e492e30aedeb6 100644 --- a/navigation-api/per-entry-events/dispose-same-document-replace-with-transitionWhile.html +++ b/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/navigation-api/scroll-restoration/after-transition-basic.html b/navigation-api/scroll-restoration/after-transition-basic.html index 647b12ba7d011e..8270f8e2ad33d6 100644 --- a/navigation-api/scroll-restoration/after-transition-basic.html +++ b/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/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html b/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html index 5e60ca33721c25..2e762379a53140 100644 --- a/navigation-api/scroll-restoration/after-transition-change-history-scroll-restoration-during-promise.html +++ b/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/navigation-api/scroll-restoration/after-transition-intercept-handler-modifies.html b/navigation-api/scroll-restoration/after-transition-intercept-handler-modifies.html new file mode 100644 index 00000000000000..a11c04c3250cc8 --- /dev/null +++ b/navigation-api/scroll-restoration/after-transition-intercept-handler-modifies.html @@ -0,0 +1,33 @@ + + + + +
+ + diff --git a/navigation-api/scroll-restoration/after-transition-reject.html b/navigation-api/scroll-restoration/after-transition-reject.html index 7a75b8abd037f0..b1cfcede3ee71e 100644 --- a/navigation-api/scroll-restoration/after-transition-reject.html +++ b/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/navigation-api/scroll-restoration/after-transition-timing.html b/navigation-api/scroll-restoration/after-transition-timing.html index 35a9071459f7c3..3bb892054aab6f 100644 --- a/navigation-api/scroll-restoration/after-transition-timing.html +++ b/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/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html b/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html index 6c7a8385606ee2..90dfebd68bf856 100644 --- a/navigation-api/scroll-restoration/after-transition-with-history-scroll-restoration-manual.html +++ b/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/navigation-api/scroll-restoration/manual-basic.html b/navigation-api/scroll-restoration/manual-basic.html index 84732fb532bd20..5421cd66ae6ffd 100644 --- a/navigation-api/scroll-restoration/manual-basic.html +++ b/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/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html b/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html index f0676ea1b37877..c35a77e57d45a7 100644 --- a/navigation-api/scroll-restoration/manual-immediate-restoreScroll.html +++ b/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/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html b/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html index a3d01a52a34f8a..4ebc08eb714955 100644 --- a/navigation-api/scroll-restoration/manual-restoreScroll-after-dispatch.html +++ b/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/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html b/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html index 6cf0fe16061e74..6a98638ffdd541 100644 --- a/navigation-api/scroll-restoration/manual-restoreScroll-after-resolve.html +++ b/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/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html b/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html index 9ca5bfa064345e..f29f533fe07ce8 100644 --- a/navigation-api/scroll-restoration/manual-restoreScroll-repeated.html +++ b/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/navigation-api/scroll-restoration/restoreScroll-exceptions.html b/navigation-api/scroll-restoration/restoreScroll-exceptions.html index 2f2b459d93bd94..0b9ff28d751a88 100644 --- a/navigation-api/scroll-restoration/restoreScroll-exceptions.html +++ b/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;