From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../soft-navigation-heuristics/back.tentative.html | 36 +++ .../click-event-bubbles.tentative.html | 28 ++ .../tests/soft-navigation-heuristics/disabled.html | 31 ++ .../dropped-entries.tentative.html | 42 +++ .../first-interaction-not-softnav.tentative.html | 36 +++ .../soft-navigation-heuristics/hash.tentative.html | 29 ++ ...-before-detection-second-softnav.tentative.html | 60 ++++ .../image-lcp-before-detection.tentative.html | 54 ++++ ...cp-followed-by-image-softnav-lcp.tentative.html | 32 ++ ...lcp-followed-by-text-softnav-lcp.tentative.html | 31 ++ ...llowed-by-two-image-softnavs-lcp.tentative.html | 75 +++++ .../innertext.tentative.html | 32 ++ ...teraction-with-paint-before-back.tentative.html | 76 +++++ ...load-classic-script-history-push.tentative.html | 31 ++ .../load-module-script-history-push.tentative.html | 32 ++ .../multiple-nested-events.tentative.html | 40 +++ .../multiple-paint-entries-buffered.tentative.html | 43 +++ .../soft-navigation-heuristics/navigate-child.html | 30 ++ ...tion-api-after-transition-commit.tentative.html | 28 ++ .../navigation-api-back.tentative.html | 45 +++ .../navigation-api-forward.tentative.html | 48 +++ .../navigation-api-hash.tentative.html | 28 ++ .../navigation-api-preventDefault.tentative.html | 35 ++ .../navigation-api-rejected.tentative.html | 28 ++ .../navigation-api-traverseto.tentative.html | 49 +++ .../navigation-api-view-transition.tentative.html | 54 ++++ .../navigation-api.tentative.html | 26 ++ .../popstate-multiple-backs.tentative.html | 64 ++++ .../popstate.tentative.html | 50 +++ .../replacestate-null-then-push.tentative.html | 34 ++ .../replacestate.tentative.html | 28 ++ .../resources/empty.html | 2 + .../resources/history_push.js | 1 + .../resources/soft-navigation-helper.js | 356 +++++++++++++++++++++ .../second-interaction-not-softnav.tentative.html | 35 ++ ...gation-detection-main-descendent.tentative.html | 30 ++ ...ft-navigation-detection-non-main.tentative.html | 25 ++ ...etection-web-component-lifecycle.tentative.html | 46 +++ .../soft-navigation-detection.tentative.html | 26 ++ .../soft-navigation-no-url.tentative.html | 31 ++ ...r-lcp-paint-larger-than-viewport.tentative.html | 70 ++++ .../softnav-after-lcp-paint.tentative.html | 42 +++ .../softnav-before-lcp-paint.tentative.html | 52 +++ ...nav-between-lcp-render-and-paint.tentative.html | 36 +++ .../supported-entry-types.tentative.html | 15 + ...-before-detection-second-softnav.tentative.html | 62 ++++ .../text-lcp-before-detection.tentative.html | 55 ++++ ...llowed-by-anim-image-softnav-lcp.tentative.html | 32 ++ ...cp-followed-by-image-softnav-lcp.tentative.html | 31 ++ ...lcp-followed-by-text-softnav-lcp.tentative.html | 34 ++ .../visited-link.tentative.html | 48 +++ 51 files changed, 2284 insertions(+) create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/back.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/click-event-bubbles.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/disabled.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/dropped-entries.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/first-interaction-not-softnav.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/hash.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection-second-softnav.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-image-softnav-lcp.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-text-softnav-lcp.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-two-image-softnavs-lcp.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/innertext.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/load-classic-script-history-push.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/load-module-script-history-push.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/multiple-nested-events.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/multiple-paint-entries-buffered.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigate-child.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-after-transition-commit.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-back.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-forward.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-hash.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-preventDefault.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-rejected.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-traverseto.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api-view-transition.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/navigation-api.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/popstate-multiple-backs.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/popstate.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/replacestate-null-then-push.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/replacestate.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/resources/empty.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/resources/history_push.js create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-helper.js create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/second-interaction-not-softnav.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-main-descendent.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-non-main.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-web-component-lifecycle.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-no-url.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint-larger-than-viewport.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/softnav-before-lcp-paint.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/softnav-between-lcp-render-and-paint.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/supported-entry-types.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection-second-softnav.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-anim-image-softnav-lcp.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-image-softnav-lcp.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-text-softnav-lcp.tentative.html create mode 100644 testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html (limited to 'testing/web-platform/tests/soft-navigation-heuristics') diff --git a/testing/web-platform/tests/soft-navigation-heuristics/back.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/back.tentative.html new file mode 100644 index 0000000000..349eaf465c --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/back.tentative.html @@ -0,0 +1,36 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ Click me! +
+
+ + + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/click-event-bubbles.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/click-event-bubbles.tentative.html new file mode 100644 index 0000000000..ee9d1e1233 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/click-event-bubbles.tentative.html @@ -0,0 +1,28 @@ + + + + + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/disabled.html b/testing/web-platform/tests/soft-navigation-heuristics/disabled.html new file mode 100644 index 0000000000..b53c2f7012 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/disabled.html @@ -0,0 +1,31 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/dropped-entries.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/dropped-entries.tentative.html new file mode 100644 index 0000000000..d27ad452be --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/dropped-entries.tentative.html @@ -0,0 +1,42 @@ + + + + + +Detect simple soft navigation. + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/first-interaction-not-softnav.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/first-interaction-not-softnav.tentative.html new file mode 100644 index 0000000000..e026202183 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/first-interaction-not-softnav.tentative.html @@ -0,0 +1,36 @@ + + + + + + + + + + + +
+

Click me!

+

Then click me!

+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/hash.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/hash.tentative.html new file mode 100644 index 0000000000..3a8419c71d --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/hash.tentative.html @@ -0,0 +1,29 @@ + + + + +Detect hashchange event. + + + + + + + +
+
+ Click me! +
+
+ + + \ No newline at end of file diff --git a/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection-second-softnav.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection-second-softnav.tentative.html new file mode 100644 index 0000000000..4d26bb9269 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection-second-softnav.tentative.html @@ -0,0 +1,60 @@ + + + + + + + + + + + +
+
+ +
+
+ + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection.tentative.html new file mode 100644 index 0000000000..0de675d372 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-before-detection.tentative.html @@ -0,0 +1,54 @@ + + + + + + + + + + + +
+
+ +
+
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-image-softnav-lcp.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-image-softnav-lcp.tentative.html new file mode 100644 index 0000000000..7a2018d20e --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-image-softnav-lcp.tentative.html @@ -0,0 +1,32 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ +
+
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-text-softnav-lcp.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-text-softnav-lcp.tentative.html new file mode 100644 index 0000000000..501d1c5fb6 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-text-softnav-lcp.tentative.html @@ -0,0 +1,31 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ +
+
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-two-image-softnavs-lcp.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-two-image-softnavs-lcp.tentative.html new file mode 100644 index 0000000000..66a9e5136f --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/image-lcp-followed-by-two-image-softnavs-lcp.tentative.html @@ -0,0 +1,75 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ +
+
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/innertext.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/innertext.tentative.html new file mode 100644 index 0000000000..d40b604792 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/innertext.tentative.html @@ -0,0 +1,32 @@ + + + + + + + + + + + +
+ Click me! + +

+
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html new file mode 100644 index 0000000000..b587411991 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/interaction-with-paint-before-back.tentative.html @@ -0,0 +1,76 @@ + + + + + + + + + + + +
+
+ + +
+
+ + + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/load-classic-script-history-push.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/load-classic-script-history-push.tentative.html new file mode 100644 index 0000000000..4e375b2164 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/load-classic-script-history-push.tentative.html @@ -0,0 +1,31 @@ + + + + +Detect a soft navigation triggered by an external classic script. + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/load-module-script-history-push.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/load-module-script-history-push.tentative.html new file mode 100644 index 0000000000..e82cd13f4a --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/load-module-script-history-push.tentative.html @@ -0,0 +1,32 @@ + + + + +Detect a soft navigation triggered by an external module script. + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/multiple-nested-events.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/multiple-nested-events.tentative.html new file mode 100644 index 0000000000..e51841865d --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/multiple-nested-events.tentative.html @@ -0,0 +1,40 @@ + + + + + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/multiple-paint-entries-buffered.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/multiple-paint-entries-buffered.tentative.html new file mode 100644 index 0000000000..dbb945a0a8 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/multiple-paint-entries-buffered.tentative.html @@ -0,0 +1,43 @@ + + + + + +Detect multiple soft navigations and ensure they buffer paint entries. + + + + + + + +
+ Click me! +
+ + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigate-child.html b/testing/web-platform/tests/soft-navigation-heuristics/navigate-child.html new file mode 100644 index 0000000000..e3c17e2dba --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigate-child.html @@ -0,0 +1,30 @@ + + + + +Navigate a child window. + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-after-transition-commit.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-after-transition-commit.tentative.html new file mode 100644 index 0000000000..ae17db7d59 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-after-transition-commit.tentative.html @@ -0,0 +1,28 @@ + + + + +Detect intercepted navigate event with after-transition commit. + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-back.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-back.tentative.html new file mode 100644 index 0000000000..cb96d9caf9 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-back.tentative.html @@ -0,0 +1,45 @@ + + + + +Detect navigation.back() + + + + + + + +
+
+ Click me! +
+
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-forward.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-forward.tentative.html new file mode 100644 index 0000000000..f483ad376b --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-forward.tentative.html @@ -0,0 +1,48 @@ + + + + +Detect navigation.forward() + + + + + + + +
+
+ Click me! +
+
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-hash.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-hash.tentative.html new file mode 100644 index 0000000000..e20578ea79 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-hash.tentative.html @@ -0,0 +1,28 @@ + + + + +Detect intercepted navigate event. + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-preventDefault.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-preventDefault.tentative.html new file mode 100644 index 0000000000..b7b2a24c94 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-preventDefault.tentative.html @@ -0,0 +1,35 @@ + + + + +Don't detect a navigate event which got aborted as a soft navigation. + + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-rejected.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-rejected.tentative.html new file mode 100644 index 0000000000..693f876b6e --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-rejected.tentative.html @@ -0,0 +1,28 @@ + + + + +Detect a rejected intercepted navigate event. + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-traverseto.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-traverseto.tentative.html new file mode 100644 index 0000000000..e4cabb095a --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-traverseto.tentative.html @@ -0,0 +1,49 @@ + + + + +Detect navigation.traverseTo() + + + + + + + +
+
+ Click me! +
+
+ + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-view-transition.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-view-transition.tentative.html new file mode 100644 index 0000000000..4d88f3d0b7 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api-view-transition.tentative.html @@ -0,0 +1,54 @@ + + + + +Navigation API + ViewTransition trigger a soft navigation. + + + + + + + +
+
+ Click me! +
+
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/navigation-api.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api.tentative.html new file mode 100644 index 0000000000..2d61736a48 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/navigation-api.tentative.html @@ -0,0 +1,26 @@ + + + + +Detect intercepted navigate event. + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/popstate-multiple-backs.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/popstate-multiple-backs.tentative.html new file mode 100644 index 0000000000..fd87f5f03e --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/popstate-multiple-backs.tentative.html @@ -0,0 +1,64 @@ + + + + +Soft navigation with multiple popstate calls. + + + + + + + +
+
+ Click me! +
+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/popstate.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/popstate.tentative.html new file mode 100644 index 0000000000..f89991d76b --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/popstate.tentative.html @@ -0,0 +1,50 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ Click me! +
+
+ + + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/replacestate-null-then-push.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/replacestate-null-then-push.tentative.html new file mode 100644 index 0000000000..8a81c6be20 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/replacestate-null-then-push.tentative.html @@ -0,0 +1,34 @@ + + + + +Detect soft navigation with replaceState that has a null URL, then + pushState with the URL. + + + + + + + +
+ Click me! +
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/replacestate.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/replacestate.tentative.html new file mode 100644 index 0000000000..42e9a71899 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/replacestate.tentative.html @@ -0,0 +1,28 @@ + + + + +Detect soft navigation with replaceState. + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/resources/empty.html b/testing/web-platform/tests/soft-navigation-heuristics/resources/empty.html new file mode 100644 index 0000000000..5fa1cdf5e6 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/resources/empty.html @@ -0,0 +1,2 @@ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/resources/history_push.js b/testing/web-platform/tests/soft-navigation-heuristics/resources/history_push.js new file mode 100644 index 0000000000..6647dd740a --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/resources/history_push.js @@ -0,0 +1 @@ +history.pushState({}, '', URL); diff --git a/testing/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-helper.js b/testing/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-helper.js new file mode 100644 index 0000000000..d405adb4e7 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/resources/soft-navigation-helper.js @@ -0,0 +1,356 @@ +var counter = 0; +var interacted; +var timestamps = [] +const MAX_CLICKS = 50; +// Entries for one hard navigation + 50 soft navigations. +const MAX_PAINT_ENTRIES = 51; +const URL = "foobar.html"; +const readValue = (value, defaultValue) => { + return value !== undefined ? value : defaultValue; +} +const testSoftNavigation = + options => { + const addContent = options.addContent; + const link = options.link; + const pushState = readValue(options.pushState, + url=>{history.pushState({}, '', url)}); + const clicks = readValue(options.clicks, 1); + const extraValidations = readValue(options.extraValidations, + () => {}); + const testName = options.testName; + const pushUrl = readValue(options.pushUrl, true); + const eventType = readValue(options.eventType, "click"); + const interactionFunc = options.interactionFunc; + const eventPrepWork = options.eventPrepWork; + promise_test(async t => { + await waitInitialLCP(); + const preClickLcp = await getLcpEntries(); + setEvent(t, link, pushState, addContent, pushUrl, eventType, + eventPrepWork); + let first_navigation_id; + for (let i = 0; i < clicks; ++i) { + const firstClick = (i === 0); + let paint_entries_promise = + waitOnPaintEntriesPromise(firstClick); + interacted = false; + interact(link, interactionFunc); + + const navigation_id = await waitOnSoftNav(); + if (!first_navigation_id) { + first_navigation_id = navigation_id; + } + // Ensure paint timing entries are fired before moving on to the next + // click. + await paint_entries_promise; + } + assert_equals( + document.softNavigations, clicks, + 'Soft Navigations detected are the same as the number of clicks'); + await validateSoftNavigationEntry( + clicks, extraValidations, pushUrl); + + await runEntryValidations(preClickLcp, first_navigation_id, clicks + 1, options.validate); + }, testName); + }; + +const testNavigationApi = (testName, navigateEventHandler, link) => { + promise_test(async t => { + navigation.addEventListener('navigate', navigateEventHandler); + const navigated = new Promise(resolve => { + navigation.addEventListener('navigatesuccess', resolve); + navigation.addEventListener('navigateerror', resolve); + }); + await waitInitialLCP(); + const preClickLcp = await getLcpEntries(); + let paint_entries_promise = waitOnPaintEntriesPromise(); + interact(link); + const first_navigation_id = await waitOnSoftNav(); + await navigated; + await paint_entries_promise; + assert_equals(document.softNavigations, 1, 'Soft Navigation detected'); + await validateSoftNavigationEntry(1, () => {}, 'foobar.html'); + + await runEntryValidations(preClickLcp, first_navigation_id); + }, testName); +}; + +const testSoftNavigationNotDetected = options => { + promise_test(async t => { + const preClickLcp = await getLcpEntries(); + options.eventTarget.addEventListener(options.eventName, options.eventHandler); + interact(options.link); + await new Promise((resolve, reject) => { + (new PerformanceObserver(() => + reject("Soft navigation should not be triggered"))).observe({ + type: 'soft-navigation', + buffered: true + }); + t.step_timeout(resolve, 1000); + }); + if (document.softNavigations) { + assert_equals( + document.softNavigations, 0, 'Soft Navigation not detected'); + } + const postClickLcp = await getLcpEntries(); + assert_equals( + preClickLcp.length, postClickLcp.length, 'No LCP entries accumulated'); + }, options.testName); + }; + +const runEntryValidations = + async (preClickLcp, first_navigation_id, entries_expected_number = 2, + validate = null) => { + await validatePaintEntries('first-contentful-paint', entries_expected_number, + first_navigation_id); + await validatePaintEntries('first-paint', entries_expected_number, + first_navigation_id); + const postClickLcp = await getLcpEntries(); + const postClickLcpWithoutSoftNavs = await getLcpEntriesWithoutSoftNavs(); + assert_greater_than( + postClickLcp.length, preClickLcp.length, + 'Soft navigation should have triggered at least an LCP entry'); + + if (validate) { + await validate(); + } + assert_equals( + postClickLcpWithoutSoftNavs.length, preClickLcp.length, + 'Soft navigation should not have triggered an LCP entry when the ' + + 'observer did not opt in'); + assert_not_equals( + postClickLcp[postClickLcp.length - 1].size, + preClickLcp[preClickLcp.length - 1].size, + 'Soft navigation LCP element should not have identical size to the hard ' + + 'navigation LCP element'); + assert_equals( + postClickLcp[preClickLcp.length].navigationId, + first_navigation_id, 'Soft navigation LCP should have the same navigation ' + + 'ID as the last soft nav entry') +}; + +const interact = + (link, interactionFunc = undefined) => { + if (test_driver) { + if (interactionFunc) { + interactionFunc(); + } else { + test_driver.click(link); + } + timestamps[counter] = {"syncPostInteraction": performance.now()}; + } + } + +const setEvent = (t, button, pushState, addContent, pushUrl, eventType, prepWork) => { + const eventObject = + (eventType == 'click' || eventType.startsWith("key")) ? button : window; + eventObject.addEventListener(eventType, async e => { + let prepWorkFailed = false; + if (prepWork &&!prepWork(t)) { + prepWorkFailed = true; + } + // This is the end of the event's sync processing. + if (!timestamps[counter]["eventEnd"]) { + timestamps[counter]["eventEnd"] = performance.now(); + } + if (prepWorkFailed) { + return; + } + // Jump through a task, to ensure task tracking is working properly. + await new Promise(r => t.step_timeout(r, 0)); + + const url = URL + "?" + counter; + if (pushState) { + // Change the URL + if (pushUrl) { + pushState(url); + } else { + pushState(); + } + } + + // Wait 10 ms to make sure the timestamps are correct. + await new Promise(r => t.step_timeout(r, 10)); + + await addContent(url); + + interacted = true; + ++counter; + }); +}; + +const validateSoftNavigationEntry = async (clicks, extraValidations, + pushUrl) => { + const [entries, options] = await new Promise(resolve => { + (new PerformanceObserver((list, obs, options) => resolve( + [list.getEntries(), options]))).observe( + {type: 'soft-navigation', buffered: true}); + }); + const expectedClicks = Math.min(clicks, MAX_CLICKS); + + assert_equals(entries.length, expectedClicks, + "Performance observer got an entry"); + for (let i = 0; i < entries.length; ++i) { + const entry = entries[i]; + assert_true(entry.name.includes(pushUrl ? URL : document.location.href), + "The soft navigation name is properly set"); + const entryTimestamp = entry.startTime; + assert_less_than_equal(timestamps[i]["syncPostInteraction"], entryTimestamp, + "Entry timestamp is lower than the post interaction one"); + assert_greater_than_equal( + entryTimestamp, timestamps[i]['eventEnd'], + 'Event start timestamp matches'); + assert_not_equals(entry.navigationId, + performance.getEntriesByType("navigation")[0].navigationId, + "The navigation ID was re-generated and different from the initial one."); + if (i > 0) { + assert_not_equals(entry.navigationId, + entries[i-1].navigationId, + "The navigation ID was re-generated between clicks"); + } + } + assert_equals(performance.getEntriesByType("soft-navigation").length, + expectedClicks, "Performance timeline got an entry"); + await extraValidations(entries, options); + +}; + +const validatePaintEntries = async (type, entries_number, first_navigation_id) => { + if (!performance.softNavPaintMetricsSupported) { + return; + } + const expected_entries_number = Math.min(entries_number, MAX_PAINT_ENTRIES); + const entries = await new Promise(resolve => { + const entries = []; + (new PerformanceObserver(list => { + entries.push(...list.getEntriesByName(type)); + if (entries.length >= expected_entries_number) { + resolve(entries); + } + })).observe( + {type: 'paint', buffered: true, includeSoftNavigationObservations: true}); + }); + const entries_without_softnavs = await new Promise(resolve => { + (new PerformanceObserver(list => resolve( + list.getEntriesByName(type)))).observe( + {type: 'paint', buffered: true}); + }); + assert_equals(entries.length, expected_entries_number, + `There are ${entries_number} entries for ${type}`); + assert_equals(entries_without_softnavs.length, 1, + `There is one non-softnav entry for ${type}`); + if (entries_number > 1) { + assert_not_equals(entries[0].startTime, entries[1].startTime, + "Entries have different timestamps for " + type); + } + if (expected_entries_number > entries_without_softnavs.length) { + assert_equals(entries[entries_without_softnavs.length].navigationId, + first_navigation_id, + "First paint entry should have the same navigation ID as the last soft " + + "navigation entry"); + } +}; + +const waitInitialLCP = () => { + return new Promise(resolve => { + new PerformanceObserver(list => resolve()).observe({ + type: 'largest-contentful-paint', + buffered: true + }); + }); +} + +const waitOnSoftNav = () => { + return new Promise(resolve => { + (new PerformanceObserver(list => { + const entries = list.getEntries(); + assert_equals(entries.length, 1, + "Only one soft navigation entry"); + resolve(entries[0].navigationId); + })).observe({ + type: 'soft-navigation' + }); + }); +}; + +const getLcpEntries = async () => { + const entries = await new Promise(resolve => { + (new PerformanceObserver(list => resolve( + list.getEntries()))).observe( + {type: 'largest-contentful-paint', buffered: true, + includeSoftNavigationObservations: true}); + }); + return entries; +}; + +const getLcpEntriesWithoutSoftNavs = async () => { + const entries = await new Promise(resolve => { + (new PerformanceObserver(list => resolve( + list.getEntries()))).observe( + {type: 'largest-contentful-paint', buffered: true}); + }); + return entries; +}; + +const addImage = async (element, url="blue.png", id = "imagelcp") => { + const img = new Image(); + img.src = '/images/'+ url + "?" + Math.random(); + img.id=id + img.setAttribute("elementtiming", id); + await img.decode(); + element.appendChild(img); +}; +const addImageToMain = async (url="blue.png", id = "imagelcp") => { + await addImage(document.getElementById('main'), url, id); +}; + +const addTextParagraphToMain = (text, element_timing = "") => { + const main = document.getElementById("main"); + const p = document.createElement("p"); + const textNode = document.createTextNode(text); + p.appendChild(textNode); + if (element_timing) { + p.setAttribute("elementtiming", element_timing); + } + p.style = "font-size: 3em"; + main.appendChild(p); + return p; +}; +const addTextToDivOnMain = () => { + const main = document.getElementById("main"); + const prevDiv = document.getElementsByTagName("div")[0]; + if (prevDiv) { + main.removeChild(prevDiv); + } + const div = document.createElement("div"); + const text = document.createTextNode("Lorem Ipsum"); + div.appendChild(text); + div.style = "font-size: 3em"; + main.appendChild(div); +} + +const waitOnPaintEntriesPromise = (expectLCP = true) => { + return new Promise((resolve, reject) => { + if (performance.softNavPaintMetricsSupported) { + const paint_entries = [] + new PerformanceObserver(list => { + paint_entries.push(...list.getEntries()); + if (paint_entries.length == 2) { + resolve(); + } else if (paint_entries.length > 2) { + reject(); + } + }).observe({type: 'paint', includeSoftNavigationObservations: true}); + } else if (expectLCP) { + new PerformanceObserver(list => { + resolve(); + }).observe({ + type: 'largest-contentful-paint', + includeSoftNavigationObservations: true + }); + } else { + step_timeout( + () => requestAnimationFrame(() => requestAnimationFrame(resolve)), + 100); + } + }); +}; diff --git a/testing/web-platform/tests/soft-navigation-heuristics/second-interaction-not-softnav.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/second-interaction-not-softnav.tentative.html new file mode 100644 index 0000000000..a9bb337060 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/second-interaction-not-softnav.tentative.html @@ -0,0 +1,35 @@ + + + + + + + + + + + +
+

Click me!

+

Then click me!

+
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-main-descendent.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-main-descendent.tentative.html new file mode 100644 index 0000000000..96ff55260c --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-main-descendent.tentative.html @@ -0,0 +1,30 @@ + + + + +Detect soft navigation adding content to a main descendent. + + + + + + + +
+ Click me! +
+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-non-main.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-non-main.tentative.html new file mode 100644 index 0000000000..86da167c33 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-non-main.tentative.html @@ -0,0 +1,25 @@ + + + + +Detect simple soft navigation. + + + + + + + + Click me! + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-web-component-lifecycle.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-web-component-lifecycle.tentative.html new file mode 100644 index 0000000000..7e27b0073c --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection-web-component-lifecycle.tentative.html @@ -0,0 +1,46 @@ + + + + +Detect simple soft navigation. + + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection.tentative.html new file mode 100644 index 0000000000..618984d859 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-detection.tentative.html @@ -0,0 +1,26 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+ Click me! +
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-no-url.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-no-url.tentative.html new file mode 100644 index 0000000000..a0055c654c --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/soft-navigation-no-url.tentative.html @@ -0,0 +1,31 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+ Click me! +
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint-larger-than-viewport.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint-larger-than-viewport.tentative.html new file mode 100644 index 0000000000..3c930d8be4 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint-larger-than-viewport.tentative.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + +
+
+ +
+
+
+
+ + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint.tentative.html new file mode 100644 index 0000000000..cf9a9942ca --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/softnav-after-lcp-paint.tentative.html @@ -0,0 +1,42 @@ + + + + +Detect simple soft navigation. + + + + + + + + +
+
+ +
+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/softnav-before-lcp-paint.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/softnav-before-lcp-paint.tentative.html new file mode 100644 index 0000000000..d5dc4b74fb --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/softnav-before-lcp-paint.tentative.html @@ -0,0 +1,52 @@ + + + + +Detect simple soft navigation. + + + + + + + + +
+
+ +
+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/softnav-between-lcp-render-and-paint.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/softnav-between-lcp-render-and-paint.tentative.html new file mode 100644 index 0000000000..56c7073de6 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/softnav-between-lcp-render-and-paint.tentative.html @@ -0,0 +1,36 @@ + + + + +Detect simple soft navigation. + + + + + + + + +
+
+ +
+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/supported-entry-types.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/supported-entry-types.tentative.html new file mode 100644 index 0000000000..4ab408e10b --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/supported-entry-types.tentative.html @@ -0,0 +1,15 @@ + + + + +Soft navigations are a supported entry type + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection-second-softnav.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection-second-softnav.tentative.html new file mode 100644 index 0000000000..bed27c3506 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection-second-softnav.tentative.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + +
+
+ +
+
+ + + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection.tentative.html new file mode 100644 index 0000000000..11e82e539f --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-before-detection.tentative.html @@ -0,0 +1,55 @@ + + + + + + + + + + + + +
+
+ +
+
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-anim-image-softnav-lcp.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-anim-image-softnav-lcp.tentative.html new file mode 100644 index 0000000000..0615b513e6 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-anim-image-softnav-lcp.tentative.html @@ -0,0 +1,32 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ Click me! +
+
+ + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-image-softnav-lcp.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-image-softnav-lcp.tentative.html new file mode 100644 index 0000000000..3a8398347c --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-image-softnav-lcp.tentative.html @@ -0,0 +1,31 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ Click me! +
+
+ + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-text-softnav-lcp.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-text-softnav-lcp.tentative.html new file mode 100644 index 0000000000..929f59f019 --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/text-lcp-followed-by-text-softnav-lcp.tentative.html @@ -0,0 +1,34 @@ + + + + +Detect simple soft navigation. + + + + + + + +
+
+ Click me! +
+
+ + + + + + diff --git a/testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html b/testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html new file mode 100644 index 0000000000..0bb149f00e --- /dev/null +++ b/testing/web-platform/tests/soft-navigation-heuristics/visited-link.tentative.html @@ -0,0 +1,48 @@ + + + + +Soft navigation visited link paint tests. + + + + + + + +
+ Click me! + link that is really long so it is the LCP +
+ + + -- cgit v1.2.3