summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js
blob: e5dbb0f43c8dd3d447e7bfe455d4ae1ad7ae8e91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// META: title=Aborting a parser should block bfcache
// META: script=./test-helper.js
// 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_true(ReasonsInclude(nrr.reasons, "parser-aborted"));
    t.done();
  }
}, "aborting a parser should block bfcache.");