Skip to content

Commit

Permalink
[bfcache] Start blocking on parser abort
Browse files Browse the repository at this point in the history
This CL adds a new NotRestoredReason when parser is aborted. This is a
sticky feature because you can't recover from cancelling the parser.

Bug: 327094393
Change-Id: I1bbce4ec707fc5c06a18e738549d0c3348a18fc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5320657
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Rakina Zata Amni <[email protected]>
Commit-Queue: Yuzu Saijo <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1266269}
  • Loading branch information
rubberyuzu authored and chromium-wpt-export-bot committed Feb 28, 2024
1 parent 17a755e commit 135e301
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// META: title=Aborting a parser should block bfcache
// META: script=./test-helper.js
// META: timeout=long


Expand All @@ -14,8 +15,7 @@ async_test(t => {
window.stop();
} else {
const nrr = performance.getEntriesByType('navigation')[0].notRestoredReasons;
assert_equals(nrr.reasons[0].reason, "parser-aborted");
assert_equals(nrr.reasons.length, 1);
assert_true(ReasonsInclude(nrr.reasons, "parser-aborted"));
t.done();
}
}, "aborting a parser should block bfcache.");
9 changes: 9 additions & 0 deletions performance-timeline/not-restored-reasons/test-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ function assertReasonsStructEquals(
}
}

function ReasonsInclude(reasons, targetReason) {
for (const reason of reasons) {
if (reason.reason == targetReason) {
return true;
}
}
return false;
}

// Requires:
// - /websockets/constants.sub.js in the test file and pass the domainPort
// constant here.
Expand Down

0 comments on commit 135e301

Please sign in to comment.