forked from mirrors/gecko-dev
Automatic update from web-platform-tests Make navigation-api/ tests resilient to starting with extra NavigationHistoryEntries (#42232) When WPT are run in-browser or via wptrunner, there may be additional session history entries when the test starts, so the tests shouldn't assume that they start with navigation.entries().length == 1 or navigation.currentEntry.index == 0. This fixes all directories except navigate-event/ and navigation-methods/, which had enough tests to deserve separate treatment. This is a workaround for https://github.com/web-platform-tests/wpt/issues/33590. Change-Id: Ic60de8ffe247b374ef3a0e0939fc4c1a3427c7e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4903245 Auto-Submit: Nate Chapin <japhet@chromium.org> Commit-Queue: Nate Chapin <japhet@chromium.org> Reviewed-by: Domenic Denicola <domenic@chromium.org> Reviewed-by: Weizhong Xia <weizhong@google.com> Cr-Commit-Position: refs/heads/main@{#1204873} Co-authored-by: Nate Chapin <japhet@chromium.org> -- wpt-commits: 0a5ef44bf2e1c9be8f50beee9936771d5adcd35b wpt-pr: 42232
31 lines
1.5 KiB
HTML
31 lines
1.5 KiB
HTML
<!doctype html>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="../navigation-methods/return-value/resources/helpers.js"></script>
|
|
<script src="resources/after-transition-commit-helpers.js"></script>
|
|
<body>
|
|
<script>
|
|
let start_index = navigation.currentEntry.index;
|
|
|
|
let tests = [
|
|
{ mode: "rejectBeforeCommit", destinationIndex: start_index, description: "{ commit: 'after-transition' } for a traverse navigation, reject before commit" },
|
|
{ mode: "rejectAfterCommit", destinationIndex: start_index + 1, description: "{ commit: 'after-transition' } for a traverse navigation, reject after commit" },
|
|
{ mode: "successExplicitCommit", destinationIndex: start_index + 2, description: "{ commit: 'after-transition' } for a traverse navigation, explicit commit()" },
|
|
{ mode: "successNoExplicitCommit", destinationIndex: start_index + 3, description: "{ commit: 'after-transition' } for a traverse navigation, commit when handler resolves" }
|
|
];
|
|
|
|
// Push a bunch of history entries so each test case can target a unique entry.
|
|
history.pushState("", "", "#1");
|
|
history.pushState("", "", "#2");
|
|
history.pushState("", "", "#3");
|
|
history.pushState("", "", "#4");
|
|
|
|
let onload_promise = new Promise(resolve => window.onload = resolve);
|
|
for (let test of tests) {
|
|
promise_test(async t => {
|
|
await onload_promise;
|
|
await testAfterTransitionCommit(t, "traverse", test.mode, test.destinationIndex);
|
|
}, test.description);
|
|
}
|
|
</script>
|
|
</body>
|