-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly report soft navigation name in multiple entry cases
In cases where we had multiple entries operations (specifically, replaceState with a null URL followed by a pushState with the actual URL), we saw that the reported URL corresponds to the previous page, rather than to the navigated page's URL. This CL fixes that. It also changes the soft navigation heuristics to ignore history stack operations that don't modify the URL. Bug: 1371808 Change-Id: I0ab1002e8dd9ec13fa3153950521c7477fcbe2f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4046223 Commit-Queue: Yoav Weiss <[email protected]> Reviewed-by: Ian Clelland <[email protected]> Cr-Commit-Position: refs/heads/main@{#1074723}
- Loading branch information
1 parent
f910727
commit f5e9057
Showing
5 changed files
with
96 additions
and
30 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
34 changes: 34 additions & 0 deletions
34
soft-navigation-heuristics/replacestate-null-then-push.tentative.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,34 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Detect soft navigation with replaceState that has a null URL, then | ||
pushState with the URL.</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="resources/soft-navigation-helper.js"></script> | ||
</head> | ||
<body> | ||
<main id=main> | ||
<a id=link>Click me!</a> | ||
</main> | ||
<script> | ||
const link = document.getElementById("link"); | ||
testSoftNavigation({ | ||
addContent: async (url) => { | ||
await addImageToMain(); | ||
history.pushState({}, '', url); | ||
}, | ||
link: link, | ||
pushState: async (url) =>{ | ||
history.replaceState({}, ''); | ||
}, | ||
test: "Detect soft navigation with replaceState that has a null URL," + | ||
" then pushState with the URL"}); | ||
</script> | ||
</body> | ||
</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,28 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Detect soft navigation with replaceState.</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="resources/soft-navigation-helper.js"></script> | ||
</head> | ||
<body> | ||
<main id=main> | ||
<a id=link>Click me!</a> | ||
</main> | ||
<script> | ||
const link = document.getElementById("link"); | ||
testSoftNavigation({ | ||
addContent: async () => { | ||
await addImageToMain(); | ||
}, | ||
link: link, | ||
pushState: (url)=>{history.replaceState({}, '', url);}, | ||
test: "Detect soft navigation with replaceState"}); | ||
</script> | ||
</body> | ||
</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
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