Skip to content

Commit

Permalink
Bug 1856740 [wpt PR 42233] - Make navigation-api/navigate-event/ resi…
Browse files Browse the repository at this point in the history
…lient to starting with extra NavigationHistoryEntries, a=testonly

Automatic update from web-platform-tests
Make navigation-api/navigate-event/ resilient to starting with extra NavigationHistoryEntries

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 is a workaround for web-platform-tests/wpt#33590.

Change-Id: I978d492d5d31d110716d6a1d84732aff792aca14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4904223
Reviewed-by: Domenic Denicola <domenicchromium.org>
Auto-Submit: Nate Chapin <japhetchromium.org>
Commit-Queue: Nate Chapin <japhetchromium.org>
Cr-Commit-Position: refs/heads/main{#1204863}

--

wpt-commits: 4cd570dc80fec7b17cad121e7ac866badf62df38
wpt-pr: 42233

UltraBlame original commit: 0ffb634e43b9353a7b4d17a11b06b1ca4cb3f779
  • Loading branch information
marco-c committed Oct 13, 2023
1 parent f970bb9 commit 24630e5
Show file tree
Hide file tree
Showing 15 changed files with 357 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@
=
>
{
let
start_length
=
navigation
.
entries
(
)
.
length
;
let
start_index
=
navigation
.
currentEntry
.
index
;
/
/
Wait
Expand Down Expand Up @@ -157,7 +177,7 @@
currentEntry
.
index
0
start_index
)
;
assert_equals
Expand All @@ -169,7 +189,9 @@
)
.
length
2
start_length
+
1
)
;
navigation
Expand Down Expand Up @@ -229,6 +251,8 @@
currentEntry
.
index
start_index
+
1
)
;
Expand All @@ -241,7 +265,9 @@
)
.
length
2
start_length
+
1
)
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@
=
>
{
let
start_length
=
navigation
.
entries
(
)
.
length
;
let
start_index
=
navigation
.
currentEntry
.
index
;
/
/
Wait
Expand Down Expand Up @@ -159,7 +179,9 @@
)
.
length
2
start_length
+
1
)
;
assert_equals
Expand All @@ -173,7 +195,7 @@
(
)
[
0
start_index
]
)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@
=
>
{
let
start_length
=
navigation
.
entries
(
)
.
length
;
let
start_index
=
navigation
.
currentEntry
.
index
;
/
/
Wait
Expand Down Expand Up @@ -149,7 +169,9 @@
)
.
length
3
start_length
+
2
)
;
assert_equals
Expand All @@ -159,6 +181,8 @@
currentEntry
.
index
start_index
+
1
)
;
Expand Down Expand Up @@ -193,7 +217,9 @@
)
.
length
3
start_length
+
2
)
;
assert_equals
Expand All @@ -203,7 +229,7 @@
currentEntry
.
index
0
start_index
)
;
assert_equals
Expand Down Expand Up @@ -278,7 +304,9 @@
)
.
length
3
start_length
+
2
)
;
assert_equals
Expand All @@ -288,6 +316,8 @@
currentEntry
.
index
start_index
+
2
)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@
=
>
{
let
start_index
=
navigation
.
currentEntry
.
index
;
/
/
Wait
Expand Down Expand Up @@ -164,7 +173,7 @@
back_destination
.
index
0
start_index
)
;
}
Expand Down Expand Up @@ -262,6 +271,8 @@
destination
.
index
start_index
+
1
)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@
length
;
let
start_index
=
navigation
.
currentEntry
.
index
;
let
target_key
=
navigation
Expand Down Expand Up @@ -218,7 +227,7 @@
destination
.
index
0
start_index
)
;
assert_equals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,22 @@
>
{
let
start_length
start_history_length
=
history
.
length
;
let
start_index
=
navigation
.
currentEntry
.
index
;
let
target_key
=
navigation
Expand Down Expand Up @@ -107,7 +116,7 @@
history
.
length
start_length
start_history_length
+
1
)
Expand Down Expand Up @@ -223,7 +232,7 @@
destination
.
index
0
start_index
)
;
assert_equals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,33 @@
=
>
{
let
start_length
=
navigation
.
entries
(
)
.
length
;
let
start_index
=
navigation
.
currentEntry
.
index
;
let
start_history_length
=
history
.
length
;
/
/
Wait
Expand Down Expand Up @@ -172,7 +199,7 @@
)
.
length
1
start_length
)
;
assert_equals
Expand All @@ -182,15 +209,17 @@
currentEntry
.
index
0
start_index
)
;
assert_equals
(
history
.
length
2
start_history_length
+
1
)
;
i
Expand All @@ -208,7 +237,7 @@
)
.
length
1
start_length
)
;
assert_equals
Expand All @@ -218,15 +247,17 @@
currentEntry
.
index
0
start_index
)
;
assert_equals
(
history
.
length
2
start_history_length
+
1
)
;
/
Expand Down
Loading

0 comments on commit 24630e5

Please sign in to comment.