Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #14860 - asajeffrey:constellation-index-past-correctly-…
…when-discarding, r=cbrewster Index the session past correctly when discarding. <!-- Please describe your changes on the following line: --> Oops, indexed from the wrong end when discarding documents in #14312. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes do not require tests because we're not testing document discarding <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14860) <!-- Reviewable:end -->
- Loading branch information
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/wpt/mozilla/tests/mozilla/servo-max-session-history.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html> | ||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body></body> | ||
<script> | ||
// This test goes forward by X pages, then back by Y pages, | ||
// then checks to see if that triggered a reload. | ||
// If it did, the document must have been discarded, | ||
|
||
// The current page number (stored in the URL search string) | ||
var page_number = location.search.substring(1) | 0; | ||
|
||
// The number of pages to go forward by. | ||
// This should be more than go_back_by, to ensure that | ||
// we actually do more than one back traversal. | ||
var go_forward_by = 24; | ||
|
||
// The number of pages to go back by. | ||
// This should be more than the default --max-session-history, | ||
// to ensure that going back reloads the page. | ||
var go_back_by = Math.min(page_number, 20); | ||
|
||
if (history.length < go_forward_by) { | ||
// Keep loading new pages until we have loaded enough of them. | ||
location.assign("?" + (page_number + 1)); | ||
} else if (page_number === 0) { | ||
// If we got back to the beginning, we must have triggered reloads. | ||
test(function() {}, "Forward then back triggered a reload."); | ||
} else { | ||
// Otherwise, go back. | ||
history.go(-go_back_by); | ||
} | ||
</script> | ||
</html> |