summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js')
-rw-r--r--testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js b/testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js
new file mode 100644
index 0000000000..8488dd60cc
--- /dev/null
+++ b/testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js
@@ -0,0 +1,21 @@
+// META: title=Aborting a parser should block bfcache
+// META: timeout=long
+
+
+async_test(t => {
+ if (!sessionStorage.getItem("pageVisited")) {
+ // This is the first time loading the page.
+ sessionStorage.setItem("pageVisited", 1);
+ t.step_timeout(() => {
+ // Go to another page and instantly come back to this page.
+ location.href = new URL("../resources/going-back.html", window.location);
+ }, 0);
+ // Abort parsing in the middle of loading the page.
+ window.stop();
+ } else {
+ const nrr = performance.getEntriesByType('navigation')[0].notRestoredReasons;
+ assert_equals(nrr.reasons.length, 1);
+ assert_equals(nrr.reasons[0], "parser-aborted");
+ t.done();
+ }
+}, "aborting a parser should block bfcache.");