diff --git a/app-history/currentchange-event/currentchange-app-history-back-forward-same-doc.html b/app-history/currentchange-event/currentchange-app-history-back-forward-same-doc.html index 85a93a21bd0f4a..9b1b777614b9d2 100644 --- a/app-history/currentchange-event/currentchange-app-history-back-forward-same-doc.html +++ b/app-history/currentchange-event/currentchange-app-history-back-forward-same-doc.html @@ -6,7 +6,7 @@ // Wait for after the load event so that the navigation doesn't get converted // into a replace navigation. await new Promise(resolve => window.onload = t.step_timeout(resolve, 0)); - await appHistory.navigate("#foo"); + await appHistory.navigate("#foo").committed; assert_equals(appHistory.entries().length, 2); let oncurrentchange_back_called = false; diff --git a/app-history/navigate-event/transitionWhile-and-navigate.html b/app-history/navigate-event/transitionWhile-and-navigate.html index 66a43b25ec2a9f..65e9d049278436 100644 --- a/app-history/navigate-event/transitionWhile-and-navigate.html +++ b/app-history/navigate-event/transitionWhile-and-navigate.html @@ -16,12 +16,12 @@ assert_equals(appHistory.entries().length, 2); appHistory.navigate("#2"); } - } + }; let back_result = appHistory.back(); - await promise_rejects_dom(t, "AbortError", back_result.committed); - await promise_rejects_dom(t, "AbortError", back_result.finished); + await back_result.committed; assert_equals(location.hash, "#2"); + await promise_rejects_dom(t, "AbortError", back_result.finished); assert_equals(appHistory.current.index, 1); assert_equals(appHistory.entries().length, 2); -}, "Using transitionWhile then navigate() in the ensuing currentchange should abort the transitionWhile"); +}, "Using transitionWhile() then navigate() in the ensuing currentchange should abort the finished promise (but not the committed promise)"); diff --git a/app-history/navigate/navigate-same-document-event-order.html b/app-history/navigate/navigate-same-document-event-order.html deleted file mode 100644 index 4be537fb7ae1c2..00000000000000 --- a/app-history/navigate/navigate-same-document-event-order.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - diff --git a/app-history/navigate/navigate-transitionWhile-reject-event-order.html b/app-history/navigate/navigate-transitionWhile-reject-event-order.html deleted file mode 100644 index 96e742766cccc8..00000000000000 --- a/app-history/navigate/navigate-transitionWhile-reject-event-order.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - diff --git a/app-history/ordering/README.md b/app-history/ordering/README.md new file mode 100644 index 00000000000000..9ae6c7b19ff77c --- /dev/null +++ b/app-history/ordering/README.md @@ -0,0 +1,24 @@ +# App history ordering tests + +These are meant to test the ordering between various events and promises; they +don't fit into any particular sibling directory. + +Some of them test simple cases rather-exhaustively, and others test tricky cases +(e.g. reentrancy or navigations aborting previous navigations) in a more focused +way. + +Note: + +* Variants specifically exist for `currentchange` because an event listener + existing for `currentchange` 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 + navigations. + +TODOs: + +* Also test `appHistory.transition.finished` when it is implemented. +* Also test `popstate` and `hashchange` once + is fixed. diff --git a/app-history/ordering/back-same-document.html b/app-history/ordering/back-same-document.html new file mode 100644 index 00000000000000..f4a2c382b8b9fd --- /dev/null +++ b/app-history/ordering/back-same-document.html @@ -0,0 +1,63 @@ + + + + + + + + + diff --git a/app-history/currentchange-event/currentchange-dispose-ordering.html b/app-history/ordering/currentchange-dispose-ordering.html similarity index 100% rename from app-history/currentchange-event/currentchange-dispose-ordering.html rename to app-history/ordering/currentchange-dispose-ordering.html diff --git a/app-history/navigate/navigate-cross-document-event-order.html b/app-history/ordering/navigate-cross-document-event-order.html similarity index 100% rename from app-history/navigate/navigate-cross-document-event-order.html rename to app-history/ordering/navigate-cross-document-event-order.html diff --git a/app-history/ordering/navigate-same-document-transitionWhile-reject.html b/app-history/ordering/navigate-same-document-transitionWhile-reject.html new file mode 100644 index 00000000000000..84e95eea752595 --- /dev/null +++ b/app-history/ordering/navigate-same-document-transitionWhile-reject.html @@ -0,0 +1,57 @@ + + + + + + + diff --git a/app-history/ordering/navigate-same-document.html b/app-history/ordering/navigate-same-document.html new file mode 100644 index 00000000000000..0d30eeddfb67da --- /dev/null +++ b/app-history/ordering/navigate-same-document.html @@ -0,0 +1,61 @@ + + + + + + + + + diff --git a/app-history/navigate-event/navigateerror-ordering-location-api-reentrant.html b/app-history/ordering/navigateerror-ordering-location-api-reentrant.html similarity index 100% rename from app-history/navigate-event/navigateerror-ordering-location-api-reentrant.html rename to app-history/ordering/navigateerror-ordering-location-api-reentrant.html diff --git a/app-history/navigate-event/navigateerror-ordering-location-api.html b/app-history/ordering/navigateerror-ordering-location-api.html similarity index 100% rename from app-history/navigate-event/navigateerror-ordering-location-api.html rename to app-history/ordering/navigateerror-ordering-location-api.html diff --git a/app-history/navigate-event/navigateerror-ordering-cross-document.html b/app-history/ordering/navigateerror-ordering-navigate-cross-document.html similarity index 100% rename from app-history/navigate-event/navigateerror-ordering-cross-document.html rename to app-history/ordering/navigateerror-ordering-navigate-cross-document.html diff --git a/app-history/navigate-event/navigateerror-ordering-transitionWhile-reentrant.html b/app-history/ordering/navigateerror-ordering-transitionWhile-reentrant.html similarity index 100% rename from app-history/navigate-event/navigateerror-ordering-transitionWhile-reentrant.html rename to app-history/ordering/navigateerror-ordering-transitionWhile-reentrant.html diff --git a/app-history/navigate-event/navigateerror-ordering-transitionWhile.html b/app-history/ordering/navigateerror-ordering-transitionWhile.html similarity index 100% rename from app-history/navigate-event/navigateerror-ordering-transitionWhile.html rename to app-history/ordering/navigateerror-ordering-transitionWhile.html diff --git a/app-history/navigate/resources/notify-top-early.html b/app-history/ordering/resources/notify-top-early.html similarity index 100% rename from app-history/navigate/resources/notify-top-early.html rename to app-history/ordering/resources/notify-top-early.html