From 2454d5a7ecf7497c68d906361315d8a1f54d2a7e Mon Sep 17 00:00:00 2001 From: Nate Chapin Date: Mon, 13 Jun 2022 16:56:46 -0700 Subject: [PATCH] Implement navigateEvent.intercept() and navigateEvent.canIntercept Follows https://github.com/WICG/navigation-api/pull/235 intercept() works very similarly to transitionWhile(), except that insetad of taking a mandatory Promise, it takes an optional handler function. If a function is provided and it returns a promise, navigation finish will be delayed until the Promise resolve, just as transitionWhile() delays navigation finish for its Promise. canIntercept is identical to canTransition. Bug: 1336000 Change-Id: I94edd7fdc727080594f16fe4511cb7c302d88941 --- ...tml => navigation-navigate-intercept.html} | 4 +-- ...avigation-navigate-replace-intercept.html} | 4 +-- ....html => navigation-reload-intercept.html} | 4 +-- navigation-api/focus-reset/autofocus.html | 14 +++++------ navigation-api/focus-reset/basic.html | 17 ++++++------- ...focus-again-in-blur-during-intercept.html} | 8 +++--- ...cus-back-to-origial-during-intercept.html} | 8 +++--- ...tml => change-focus-during-intercept.html} | 8 +++--- ...e-focus-then-remove-during-intercept.html} | 7 +++--- ...tionWhile.html => multiple-intercept.html} | 24 +++++++++--------- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../click-crossdocument-sameorigin.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../click-samedocument-crossorigin.html | 2 +- .../click-samedocument-sameorigin.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../location-crossdocument-sameorigin.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../location-samedocument-crossorigin.html | 2 +- .../location-samedocument-sameorigin.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../open-crossdocument-sameorigin.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../open-samedocument-crossorigin.html | 2 +- .../open-samedocument-sameorigin.html | 2 +- .../resources/cross-origin-iframe-helper.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../submit-crossdocument-sameorigin.html | 2 +- ...ment-crossorigin-sameorigindomain.sub.html | 2 +- .../submit-samedocument-crossorigin.html | 2 +- .../submit-samedocument-sameorigin.html | 2 +- .../navigate-event/event-constructor.html | 10 ++++---- ...tch.html => intercept-after-dispatch.html} | 4 +-- ...igate.html => intercept-and-navigate.html} | 4 +-- ...ent.html => intercept-canceled-event.html} | 4 +-- ...intercept-cross-document-same-origin.html} | 10 +++++--- ...rigin.html => intercept-cross-origin.html} | 6 ++--- ...hile-detach.html => intercept-detach.html} | 4 +-- ....html => intercept-history-pushState.html} | 8 +++--- ...ml => intercept-history-replaceState.html} | 8 +++--- ...l => intercept-multiple-times-reject.html} | 11 +++++--- ...mes.html => intercept-multiple-times.html} | 20 +++++++-------- ...ck.html => intercept-navigation-back.html} | 4 +-- ...html => intercept-on-synthetic-event.html} | 4 +-- ...-popstate.html => intercept-popstate.html} | 4 +-- ...hile-reject.html => intercept-reject.html} | 7 ++++-- ...le-resolve.html => intercept-resolve.html} | 4 +-- ...intercept-same-document-history-back.html} | 4 +-- .../navigate-anchor-cross-origin.html | 2 +- ...avigate-anchor-download-userInitiated.html | 2 +- .../navigate-anchor-download.html | 2 +- .../navigate-anchor-fragment.html | 2 +- ...ate-anchor-same-origin-cross-document.html | 2 +- .../navigate-anchor-userInitiated.html | 2 +- .../navigate-anchor-with-target.html | 2 +- .../navigate-event/navigate-form-get.html | 2 +- .../navigate-form-userInitiated.html | 2 +- .../navigate-form-with-target.html | 2 +- .../navigate-event/navigate-form.html | 2 +- .../navigate-history-back-after-fragment.html | 2 +- ...navigate-history-back-after-pushState.html | 2 +- .../navigate-history-back-cross-document.html | 2 +- .../navigate-event/navigate-history-go-0.html | 2 +- .../navigate-history-pushState.html | 2 +- .../navigate-history-replaceState.html | 2 +- .../navigate-iframe-location.html | 2 +- .../navigate-event/navigate-location.html | 2 +- .../navigate-event/navigate-meta-refresh.html | 2 +- ...vigate-navigation-back-cross-document.html | 2 +- ...avigate-navigation-back-same-document.html | 2 +- .../navigate-navigation-navigate.html | 2 +- .../navigate-event/navigate-to-srcdoc.html | 2 +- .../navigate-window-open-self.html | 2 +- .../navigate-event/navigate-window-open.html | 2 +- ...While.html => signal-abort-intercept.html} | 4 +-- ...al-abort-window-stop-after-intercept.html} | 4 +-- ... => key-id-location-reload-intercept.html} | 4 +-- ... => navigate-intercept-history-state.html} | 4 +-- .../navigate-state-repeated-await.html | 2 +- .../navigate-state-repeated.html | 2 +- .../reload-state-and-info.html | 2 +- .../reload-state-undefined.html | 2 +- ...cted.html => back-intercept-rejected.html} | 4 +-- ...ansitionWhile.html => back-intercept.html} | 4 +-- ...d.html => forward-intercept-rejected.html} | 4 +-- ...itionWhile.html => forward-intercept.html} | 4 +-- ...ml => navigate-intercept-interrupted.html} | 4 +-- ....html => navigate-intercept-rejected.html} | 4 +-- ...tionWhile.html => navigate-intercept.html} | 4 +-- ...ed.html => reload-intercept-rejected.html} | 4 +-- ...sitionWhile.html => reload-intercept.html} | 4 +-- .../return-value/reload.html | 2 +- ...tml => traverseTo-intercept-rejected.html} | 4 +-- ...onWhile.html => traverseTo-intercept.html} | 4 +-- ...-between-navigate-and-navigatesuccess.html | 2 +- .../ordering-and-transition/README.md | 6 ++--- ... => anchor-download-intercept-reject.html} | 4 +-- ...le.html => anchor-download-intercept.html} | 4 +-- .../anchor-download.html | 2 +- ... back-same-document-intercept-reject.html} | 4 +-- ...html => back-same-document-intercept.html} | 4 +-- ...ntrychange-before-popstate-intercept.html} | 2 +- ...ml => location-href-double-intercept.html} | 4 +-- ...=> location-href-intercept-reentrant.html} | 4 +-- ...ml => location-href-intercept-reject.html} | 4 +-- ...hile.html => location-href-intercept.html} | 4 +-- ...le.html => navigate-double-intercept.html} | 4 +-- .../navigate-in-transition-finished.html | 2 +- ...stop.html => navigate-intercept-stop.html} | 4 +-- ...tionWhile.html => navigate-intercept.html} | 4 +-- ...te-same-document-intercept-reentrant.html} | 2 +- ...igate-same-document-intercept-reject.html} | 4 +-- ...ject.html => reload-intercept-reject.html} | 4 +-- ...sitionWhile.html => reload-intercept.html} | 4 +-- .../transition-finished-mark-as-handled.html | 2 +- .../transition-realms-and-identity.html | 2 +- ...l => dispose-same-document-intercept.html} | 2 +- ...-same-document-reload-with-intercept.html} | 4 +-- ...same-document-replace-with-intercept.html} | 4 +-- .../after-transition-basic.html | 2 +- ...ory-scroll-restoration-during-promise.html | 7 +++--- .../after-transition-reject.html | 6 +++-- .../after-transition-timing.html | 25 +++++++++++-------- ...ith-history-scroll-restoration-manual.html | 2 +- .../scroll-restoration/manual-basic.html | 2 +- .../manual-immediate-restoreScroll.html | 2 +- .../manual-restoreScroll-after-dispatch.html | 7 +++--- .../manual-restoreScroll-after-resolve.html | 2 +- .../manual-restoreScroll-repeated.html | 2 +- .../restoreScroll-exceptions.html | 12 ++++----- 130 files changed, 274 insertions(+), 259 deletions(-) rename navigation-api/currententrychange-event/{navigation-navigate-transitionWhile.html => navigation-navigate-intercept.html} (88%) rename navigation-api/currententrychange-event/{navigation-navigate-replace-transitionWhile.html => navigation-navigate-replace-intercept.html} (88%) rename navigation-api/currententrychange-event/{navigation-reload-transitionWhile.html => navigation-reload-intercept.html} (87%) rename navigation-api/focus-reset/{change-focus-again-in-blur-during-transitionWhile.html => change-focus-again-in-blur-during-intercept.html} (83%) rename navigation-api/focus-reset/{change-focus-back-to-origial-during-transitionWhile.html => change-focus-back-to-origial-during-intercept.html} (83%) rename navigation-api/focus-reset/{change-focus-during-transitionWhile.html => change-focus-during-intercept.html} (82%) rename navigation-api/focus-reset/{change-focus-then-remove-during-transitionWhile.html => change-focus-then-remove-during-intercept.html} (86%) rename navigation-api/focus-reset/{multiple-transitionWhile.html => multiple-intercept.html} (67%) rename navigation-api/navigate-event/{transitionWhile-after-dispatch.html => intercept-after-dispatch.html} (70%) rename navigation-api/navigate-event/{transitionWhile-and-navigate.html => intercept-and-navigate.html} (81%) rename navigation-api/navigate-event/{transitionWhile-canceled-event.html => intercept-canceled-event.html} (72%) rename navigation-api/navigate-event/{transitionWhile-cross-document-same-origin.html => intercept-cross-document-same-origin.html} (73%) rename navigation-api/navigate-event/{transitionWhile-cross-origin.html => intercept-cross-origin.html} (70%) rename navigation-api/navigate-event/{transitionWhile-detach.html => intercept-detach.html} (80%) rename navigation-api/navigate-event/{transitionWhile-history-pushState.html => intercept-history-pushState.html} (78%) rename navigation-api/navigate-event/{transitionWhile-history-replaceState.html => intercept-history-replaceState.html} (78%) rename navigation-api/navigate-event/{transitionWhile-multiple-times-reject.html => intercept-multiple-times-reject.html} (75%) rename navigation-api/navigate-event/{transitionWhile-multiple-times.html => intercept-multiple-times.html} (69%) rename navigation-api/navigate-event/{transitionWhile-navigation-back.html => intercept-navigation-back.html} (80%) rename navigation-api/navigate-event/{transitionWhile-on-synthetic-event.html => intercept-on-synthetic-event.html} (74%) rename navigation-api/navigate-event/{transitionWhile-popstate.html => intercept-popstate.html} (82%) rename navigation-api/navigate-event/{transitionWhile-reject.html => intercept-reject.html} (79%) rename navigation-api/navigate-event/{transitionWhile-resolve.html => intercept-resolve.html} (77%) rename navigation-api/navigate-event/{transitionWhile-same-document-history-back.html => intercept-same-document-history-back.html} (91%) rename navigation-api/navigate-event/{signal-abort-transitionWhile.html => signal-abort-intercept.html} (82%) rename navigation-api/navigate-event/{signal-abort-window-stop-after-transitionWhile.html => signal-abort-window-stop-after-intercept.html} (88%) rename navigation-api/navigation-history-entry/{key-id-location-reload-transitionWhile.html => key-id-location-reload-intercept.html} (91%) rename navigation-api/navigation-methods/{navigate-transitionWhile-history-state.html => navigate-intercept-history-state.html} (70%) rename navigation-api/navigation-methods/return-value/{back-transitionWhile-rejected.html => back-intercept-rejected.html} (87%) rename navigation-api/navigation-methods/return-value/{back-transitionWhile.html => back-intercept.html} (83%) rename navigation-api/navigation-methods/return-value/{forward-transitionWhile-rejected.html => forward-intercept-rejected.html} (88%) rename navigation-api/navigation-methods/return-value/{forward-transitionWhile.html => forward-intercept.html} (86%) rename navigation-api/navigation-methods/return-value/{navigate-transitionWhile-interrupted.html => navigate-intercept-interrupted.html} (84%) rename navigation-api/navigation-methods/return-value/{navigate-transitionWhile-rejected.html => navigate-intercept-rejected.html} (79%) rename navigation-api/navigation-methods/return-value/{navigate-transitionWhile.html => navigate-intercept.html} (71%) rename navigation-api/navigation-methods/return-value/{reload-transitionWhile-rejected.html => reload-intercept-rejected.html} (79%) rename navigation-api/navigation-methods/return-value/{reload-transitionWhile.html => reload-intercept.html} (67%) rename navigation-api/navigation-methods/return-value/{traverseTo-transitionWhile-rejected.html => traverseTo-intercept-rejected.html} (88%) rename navigation-api/navigation-methods/return-value/{traverseTo-transitionWhile.html => traverseTo-intercept.html} (83%) rename navigation-api/ordering-and-transition/{anchor-download-transitionWhile-reject.html => anchor-download-intercept-reject.html} (93%) rename navigation-api/ordering-and-transition/{anchor-download-transitionWhile.html => anchor-download-intercept.html} (91%) rename navigation-api/ordering-and-transition/{back-same-document-transitionWhile-reject.html => back-same-document-intercept-reject.html} (92%) rename navigation-api/ordering-and-transition/{back-same-document-transitionWhile.html => back-same-document-intercept.html} (95%) rename navigation-api/ordering-and-transition/{currententrychange-before-popstate-transitionWhile.html => currententrychange-before-popstate-intercept.html} (96%) rename navigation-api/ordering-and-transition/{location-href-double-transitionWhile.html => location-href-double-intercept.html} (94%) rename navigation-api/ordering-and-transition/{location-href-transitionWhile-reentrant.html => location-href-intercept-reentrant.html} (90%) rename navigation-api/ordering-and-transition/{location-href-transitionWhile-reject.html => location-href-intercept-reject.html} (92%) rename navigation-api/ordering-and-transition/{location-href-transitionWhile.html => location-href-intercept.html} (95%) rename navigation-api/ordering-and-transition/{navigate-double-transitionWhile.html => navigate-double-intercept.html} (95%) rename navigation-api/ordering-and-transition/{navigate-transitionWhile-stop.html => navigate-intercept-stop.html} (93%) rename navigation-api/ordering-and-transition/{navigate-transitionWhile.html => navigate-intercept.html} (94%) rename navigation-api/ordering-and-transition/{navigate-same-document-transitionWhile-reentrant.html => navigate-same-document-intercept-reentrant.html} (95%) rename navigation-api/ordering-and-transition/{navigate-same-document-transitionWhile-reject.html => navigate-same-document-intercept-reject.html} (92%) rename navigation-api/ordering-and-transition/{reload-transitionWhile-reject.html => reload-intercept-reject.html} (94%) rename navigation-api/ordering-and-transition/{reload-transitionWhile.html => reload-intercept.html} (95%) rename navigation-api/per-entry-events/{dispose-same-document-transitionWhile.html => dispose-same-document-intercept.html} (98%) rename navigation-api/per-entry-events/{dispose-same-document-reload-with-transitionWhile.html => dispose-same-document-reload-with-intercept.html} (79%) rename navigation-api/per-entry-events/{dispose-same-document-replace-with-transitionWhile.html => dispose-same-document-replace-with-intercept.html} (91%) 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..ba5c9ec29a1977 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 @@ -3,7 +3,7 @@ const message = { navigationType: e.navigationType, cancelable: e.cancelable, - canTransition: e.canTransition, + canIntercept: e.canIntercept, userInitiated: e.userInitiated, hashChange: e.hashChange, formData: e.formData, diff --git a/navigation-api/navigate-event/cross-window/submit-crossdocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/submit-crossdocument-crossorigin-sameorigindomain.sub.html index 36101a400041bc..f611034617401e 100644 --- a/navigation-api/navigate-event/cross-window/submit-crossdocument-crossorigin-sameorigindomain.sub.html +++ b/navigation-api/navigate-event/cross-window/submit-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/submit-crossdocument-sameorigin.html b/navigation-api/navigate-event/cross-window/submit-crossdocument-sameorigin.html index 93b97351d752cd..05347335a192a6 100644 --- a/navigation-api/navigate-event/cross-window/submit-crossdocument-sameorigin.html +++ b/navigation-api/navigate-event/cross-window/submit-crossdocument-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_false(e.hashChange, "hashChange"); assert_equals(e.formData, null, "formData"); diff --git a/navigation-api/navigate-event/cross-window/submit-samedocument-crossorigin-sameorigindomain.sub.html b/navigation-api/navigate-event/cross-window/submit-samedocument-crossorigin-sameorigindomain.sub.html index 9f5ba8b44afc34..9e64a0124daf5f 100644 --- a/navigation-api/navigate-event/cross-window/submit-samedocument-crossorigin-sameorigindomain.sub.html +++ b/navigation-api/navigate-event/cross-window/submit-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/submit-samedocument-crossorigin.html b/navigation-api/navigate-event/cross-window/submit-samedocument-crossorigin.html index 51a313ac18147b..e53a1f93e7a7a0 100644 --- a/navigation-api/navigate-event/cross-window/submit-samedocument-crossorigin.html +++ b/navigation-api/navigate-event/cross-window/submit-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/submit-samedocument-sameorigin.html b/navigation-api/navigate-event/cross-window/submit-samedocument-sameorigin.html index f0b7b7393711a3..43aa3226fcd6fc 100644 --- a/navigation-api/navigate-event/cross-window/submit-samedocument-sameorigin.html +++ b/navigation-api/navigate-event/cross-window/submit-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/event-constructor.html b/navigation-api/navigate-event/event-constructor.html index 17c89dedd1a30a..065884240e092c 100644 --- a/navigation-api/navigate-event/event-constructor.html +++ b/navigation-api/navigate-event/event-constructor.html @@ -12,7 +12,7 @@ assert_throws_js(TypeError, () => { new NavigateEvent("navigate", { navigationType: "push", - canTransition: false, + canIntercept: false, userInitiated: false, hashChange: false, signal: (new AbortController()).signal, @@ -30,7 +30,7 @@ new NavigateEvent("navigate", { navigationType: "push", destination: e.destination, - canTransition: false, + canIntercept: false, userInitiated: false, hashChange: false, formData: null, @@ -53,7 +53,7 @@ const event = new NavigateEvent("navigate", { navigationType: "replace", destination: e.destination, - canTransition: true, + canIntercept: true, userInitiated: true, hashChange: true, signal, @@ -64,7 +64,7 @@ assert_equals(event.navigationType, "replace"); assert_equals(event.destination, e.destination); - assert_equals(event.canTransition, true); + assert_equals(event.canIntercept, true); assert_equals(event.userInitiated, true); assert_equals(event.hashChange, true); assert_equals(event.signal, signal); @@ -84,7 +84,7 @@ }); assert_equals(event.navigationType, "push"); - assert_equals(event.canTransition, false); + assert_equals(event.canIntercept, false); assert_equals(event.userInitiated, false); assert_equals(event.hashChange, false); assert_equals(event.formData, null); diff --git a/navigation-api/navigate-event/transitionWhile-after-dispatch.html b/navigation-api/navigate-event/intercept-after-dispatch.html similarity index 70% rename from navigation-api/navigate-event/transitionWhile-after-dispatch.html rename to navigation-api/navigate-event/intercept-after-dispatch.html index 910665cb3deb51..abb328050d8807 100644 --- a/navigation-api/navigate-event/transitionWhile-after-dispatch.html +++ b/navigation-api/navigate-event/intercept-after-dispatch.html @@ -7,10 +7,10 @@ navigation.onnavigate = t.step_func(e => { t.step_timeout(t.step_func_done(() => { assert_equals(e.eventPhase, Event.NONE); - assert_throws_dom("InvalidStateError", () => e.transitionWhile(Promise.resolve())); + assert_throws_dom("InvalidStateError", () => e.intercept()); }), 0); }); location.href = "#1"; -}, "event.transitionWhile() throws if used after the dispatch phase"); +}, "event.intercept() throws if used after the dispatch phase"); 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/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/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/transitionWhile-reject.html b/navigation-api/navigate-event/intercept-reject.html similarity index 79% rename from navigation-api/navigate-event/transitionWhile-reject.html rename to navigation-api/navigate-event/intercept-reject.html index 28864b38a5186a..4c5ec0163d1ab0 100644 --- a/navigation-api/navigate-event/transitionWhile-reject.html +++ b/navigation-api/navigate-event/intercept-reject.html @@ -17,10 +17,13 @@ assert_greater_than(e.lineno, 0); }); navigation.onnavigate = e => { - e.transitionWhile(new Promise((resolve, reject) => t.step_timeout(() => reject(err), 0))); + e.intercept({ handler: async () => { + await new Promise(r => t.step_timeout(r, 0)); + return Promise.reject(err); + }}); }; location.href = "#1"; assert_equals(location.hash, "#1"); -}, "event.transitionWhile() should abort if the given promise rejects"); +}, "event.intercept() should abort if the given promise rejects"); 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 93% 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..43792ab86e6284 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler: () => Promise.reject(expectedError) }); }); let a = document.createElement("a"); @@ -46,5 +46,5 @@ ]); 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 91% rename from navigation-api/ordering-and-transition/anchor-download-transitionWhile.html rename to navigation-api/ordering-and-transition/anchor-download-intercept.html index 822c0a230d506e..38ec84a2864e54 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(); }); let a = document.createElement("a"); @@ -43,5 +43,5 @@ ["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 92% 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..17a5c1ac06c247 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler: () => Promise.reject(expectedError) }); }); const result = navigation.back(); @@ -46,5 +46,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 95% 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..fc64341245ad80 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(); }); const result = navigation.back(); @@ -43,5 +43,5 @@ ["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/location-href-double-transitionWhile.html b/navigation-api/ordering-and-transition/location-href-double-intercept.html similarity index 94% 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..c45f4bdf2b40be 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(r => t.step_timeout(r, 1))); + e.intercept({ handler: () => new Promise(r => t.step_timeout(r, 1)) }); if (location.hash === "#1") { fromHash1 = navigation.currentEntry; @@ -52,5 +52,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 90% 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..69eb47ec1c9d1c 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 2))); + e.intercept({ handler: () => new Promise(resolve => t.step_timeout(resolve, 2)) }); if (firstNavigate) { firstNavigate = false; @@ -52,5 +52,5 @@ ]); 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 92% 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..6459f87ba6a7eb 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler: () => Promise.reject(expectedError) }); }); location.href = "/common/blank.html#1"; @@ -42,5 +42,5 @@ ]); 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 95% rename from navigation-api/ordering-and-transition/location-href-transitionWhile.html rename to navigation-api/ordering-and-transition/location-href-intercept.html index 0e1d22df7254f8..26e836171c4344 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(); }); location.href = "/common/blank.html#1"; @@ -39,5 +39,5 @@ ["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 95% rename from navigation-api/ordering-and-transition/navigate-double-transitionWhile.html rename to navigation-api/ordering-and-transition/navigate-double-intercept.html index 556d1737a6e37e..5892068c1385de 100644 --- a/navigation-api/ordering-and-transition/navigate-double-transitionWhile.html +++ b/navigation-api/ordering-and-transition/navigate-double-intercept.html @@ -22,7 +22,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(r => t.step_timeout(r, 1))); + e.intercept({ handler: () => new Promise(r => t.step_timeout(r, 1)) }); if (location.hash === "#1") { fromHash1 = navigation.currentEntry; @@ -59,5 +59,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..94ac18a3e9022a 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(); if (location.hash === "#1") { fromHash1 = navigation.currentEntry; diff --git a/navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html b/navigation-api/ordering-and-transition/navigate-intercept-stop.html similarity index 93% rename from navigation-api/ordering-and-transition/navigate-transitionWhile-stop.html rename to navigation-api/ordering-and-transition/navigate-intercept-stop.html index 9a8c412b3333ef..fe9782bc920b88 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(); }); const result = navigation.navigate("/common/blank.html#1"); @@ -47,5 +47,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 94% rename from navigation-api/ordering-and-transition/navigate-transitionWhile.html rename to navigation-api/ordering-and-transition/navigate-intercept.html index b72bf49eae20f5..5633f491bff74a 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(); }); const result = navigation.navigate("#1"); @@ -42,5 +42,5 @@ ["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 95% 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..669b5755ca9a76 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(new Promise(resolve => t.step_timeout(resolve, 2))); + e.intercept({ handler: () => new Promise(resolve => t.step_timeout(resolve, 2)) }); if (firstNavigate) { firstNavigate = false; 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 92% 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..f850657464ba7e 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,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler: () => Promise.reject(expectedError) }); }); const result = navigation.navigate("#1"); @@ -45,5 +45,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 94% rename from navigation-api/ordering-and-transition/reload-transitionWhile-reject.html rename to navigation-api/ordering-and-transition/reload-intercept-reject.html index 6939ee2df8208b..7d58c19835ec28 100644 --- a/navigation-api/ordering-and-transition/reload-transitionWhile-reject.html +++ b/navigation-api/ordering-and-transition/reload-intercept-reject.html @@ -23,7 +23,7 @@ recorder.setUpNavigationAPIListeners(); navigation.addEventListener("navigate", e => { - e.transitionWhile(Promise.reject(expectedError)); + e.intercept({ handler: () => Promise.reject(expectedError) }); }); const result = navigation.reload(); @@ -45,5 +45,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 95% rename from navigation-api/ordering-and-transition/reload-transitionWhile.html rename to navigation-api/ordering-and-transition/reload-intercept.html index 31cd813f7419bb..3d014ebebf1b57 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(); }); const result = navigation.reload(); @@ -42,5 +42,5 @@ ["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-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;