summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/performance-timeline/not-restored-reasons/abort-block-bfcache.window.js
blob: 8488dd60ccf0a1d6ed032c461e6bb714e24950a7 (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: 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.");