[soft navs] Add support for replaceState [chromium/src : main]

0 views
Skip to first unread message

Scott Haseley (Gerrit)

unread,
Jan 29, 2026, 3:10:28 PM (yesterday) Jan 29
to Michal Mocny, Annie Sullivan, Johannes Henkel, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Nate Chapin, android-web...@chromium.org, ashleynewson+w...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, core-timi...@chromium.org, core-web-vita...@chromium.org, csharris...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, lighthouse-eng-extern...@google.com, loading-rev...@chromium.org, loading...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
Attention needed from Annie Sullivan, Johannes Henkel and Michal Mocny

Scott Haseley voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Annie Sullivan
  • Johannes Henkel
  • Michal Mocny
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I4143540c68f2e7c879a52320762cfd407835d5c6
Gerrit-Change-Number: 7530377
Gerrit-PatchSet: 2
Gerrit-Owner: Scott Haseley <shas...@chromium.org>
Gerrit-Reviewer: Annie Sullivan <sull...@chromium.org>
Gerrit-Reviewer: Johannes Henkel <joha...@chromium.org>
Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Johannes Henkel <joha...@chromium.org>
Gerrit-Attention: Annie Sullivan <sull...@chromium.org>
Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
Gerrit-Comment-Date: Thu, 29 Jan 2026 20:10:18 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Michal Mocny (Gerrit)

unread,
Jan 29, 2026, 3:33:55 PM (yesterday) Jan 29
to Scott Haseley, Annie Sullivan, Johannes Henkel, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Nate Chapin, android-web...@chromium.org, ashleynewson+w...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, core-timi...@chromium.org, core-web-vita...@chromium.org, csharris...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, lighthouse-eng-extern...@google.com, loading-rev...@chromium.org, loading...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
Attention needed from Annie Sullivan, Johannes Henkel and Scott Haseley

Michal Mocny voted and added 7 comments

Votes added by Michal Mocny

Code-Review+1

7 comments

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Michal Mocny . resolved

This is great! So much plumbing and test updates for a tiny implementation change >< but I love that this is literally returning the NavigationType value.

Commit Message
Line 12, Patchset 2 (Latest):flag (SoftNavigationDetectionIncludeReplaceState).
Michal Mocny . resolved

I'm fine with this, but I wonder if we should have a common "SNH_Experimental" flag for all the new features?

File third_party/blink/public/web/web_performance_metrics_for_reporting.h
Line 48, Patchset 2 (Latest):enum class SoftNavigationTypeForReporting {
Michal Mocny . unresolved

I'm fine with this, but wonder if we can/should re-use `V8NavigationType::Enum`?

Perhaps we need a redefinition for public/ exposure, anyway, but maybe that enum also needs to be added to the LINT check?

File third_party/blink/renderer/core/timing/soft_navigation_context.h
Line 182, Patchset 2 (Latest): WebFrameLoadType load_type_ = WebFrameLoadType::kStandard;
Michal Mocny . unresolved

Nit: Would it be cleaner to just convert to V8NavigationType::Enum here?

Perhaps before AddUrl() call, even. This way the soft-nav parts only think in navigation API terms...

Especially with the direction of "url is all you need" for soft-navs, I think there is no value in being lazy about converting.

File third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc
Line 204, Patchset 2 (Latest): switch (NavigationApi::WebFrameLoadTypeToNavigationType(type)) {
Michal Mocny . unresolved

...This seems like another sign that we should convert eagerly?

File third_party/blink/web_tests/external/wpt/soft-navigation-heuristics/resources/soft-navigation-test-helper.js
Line 132, Patchset 2 (Latest): navigate();
Michal Mocny . unresolved

`clickAndExpectSoftNavigation` expects a `url` param, but then blindly calls `navigate()`.

Consider passing `url` to `navigate()` callback so that the test can just pass that to push/replaceState and you don't have to duplicate strings and risk getting out of sync.

(and you can just ignore for traversals)

Line 134, Patchset 2 (Latest): history.pushState({}, '', url);
Michal Mocny . unresolved

Super minor nit, but perhaps override navigate with a default value at the top, instead of doing this here.

```if (!navigate) navigate = () => history.pushState(...)```

Open in Gerrit

Related details

Attention is currently required from:
  • Annie Sullivan
  • Johannes Henkel
  • Scott Haseley
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4143540c68f2e7c879a52320762cfd407835d5c6
    Gerrit-Change-Number: 7530377
    Gerrit-PatchSet: 2
    Gerrit-Owner: Scott Haseley <shas...@chromium.org>
    Gerrit-Reviewer: Annie Sullivan <sull...@chromium.org>
    Gerrit-Reviewer: Johannes Henkel <joha...@chromium.org>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Johannes Henkel <joha...@chromium.org>
    Gerrit-Attention: Scott Haseley <shas...@chromium.org>
    Gerrit-Attention: Annie Sullivan <sull...@chromium.org>
    Gerrit-Comment-Date: Thu, 29 Jan 2026 20:33:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Annie Sullivan (Gerrit)

    unread,
    Jan 29, 2026, 4:57:39 PM (yesterday) Jan 29
    to Scott Haseley, Michal Mocny, Johannes Henkel, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Nate Chapin, android-web...@chromium.org, ashleynewson+w...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, core-timi...@chromium.org, core-web-vita...@chromium.org, csharris...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, lighthouse-eng-extern...@google.com, loading-rev...@chromium.org, loading...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
    Attention needed from Johannes Henkel and Scott Haseley

    Annie Sullivan voted and added 1 comment

    Votes added by Annie Sullivan

    Code-Review+1

    1 comment

    Patchset-level comments
    Annie Sullivan . resolved

    Looks good to me % Michal's comments.

    Also for the new UKM did you follow the process at go/ukm#adding-ukms ?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Johannes Henkel
    • Scott Haseley
    Gerrit-Comment-Date: Thu, 29 Jan 2026 21:57:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Scott Haseley (Gerrit)

    unread,
    Jan 29, 2026, 5:07:54 PM (yesterday) Jan 29
    to Annie Sullivan, Michal Mocny, Johannes Henkel, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Nate Chapin, android-web...@chromium.org, ashleynewson+w...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, core-timi...@chromium.org, core-web-vita...@chromium.org, csharris...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, lighthouse-eng-extern...@google.com, loading-rev...@chromium.org, loading...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
    Attention needed from Johannes Henkel

    Scott Haseley added 1 comment

    Patchset-level comments
    Annie Sullivan . resolved

    Looks good to me % Michal's comments.

    Also for the new UKM did you follow the process at go/ukm#adding-ukms ?

    Scott Haseley

    Thanks, meant to ask you earlier for that. First time!

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Johannes Henkel
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4143540c68f2e7c879a52320762cfd407835d5c6
    Gerrit-Change-Number: 7530377
    Gerrit-PatchSet: 2
    Gerrit-Owner: Scott Haseley <shas...@chromium.org>
    Gerrit-Reviewer: Annie Sullivan <sull...@chromium.org>
    Gerrit-Reviewer: Johannes Henkel <joha...@chromium.org>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Attention: Johannes Henkel <joha...@chromium.org>
    Gerrit-Comment-Date: Thu, 29 Jan 2026 22:07:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Annie Sullivan <sull...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Johannes Henkel (Gerrit)

    unread,
    Jan 29, 2026, 5:19:54 PM (yesterday) Jan 29
    to Scott Haseley, Annie Sullivan, Michal Mocny, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, Nate Chapin, android-web...@chromium.org, ashleynewson+w...@chromium.org, asvitkine...@chromium.org, blink-re...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, bmcquad...@chromium.org, core-timi...@chromium.org, core-web-vita...@chromium.org, csharris...@chromium.org, gavinp...@chromium.org, ipc-securi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, lighthouse-eng-extern...@google.com, loading-rev...@chromium.org, loading...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org

    Johannes Henkel voted and added 7 comments

    Votes added by Johannes Henkel

    Code-Review+1

    7 comments

    Patchset-level comments
    Johannes Henkel . resolved

    Nice cl!!!

    File chrome/browser/page_load_metrics/integration_tests/soft_navigation_metrics_browsertest.cc
    Line 736, Patchset 2 (Latest): "http://example.com:%d/soft_navigation_basics.html#text", port)));
    Johannes Henkel . resolved

    I think this is what you mentioned during the meeting and it's cool imho - basically a result of not doing an additional pushstate when the back button is pressed, but rather it reflects what url the browser puts.

    File chrome/browser/page_load_metrics/observers/core/ukm_page_load_metrics_observer.cc
    Line 653, Patchset 2 (Latest): PAGE_LOAD_HISTOGRAM("PageLoad.SoftNavigation.StartTime",
    Johannes Henkel . unresolved

    Do you want to put a histogram, in the spirit of this one as well? I don't know what it takes exactly but figure it may be cool to get a grand summary.

    File components/page_load_metrics/common/page_load_metrics.mojom
    Line 636, Patchset 2 (Latest):// These values are persisted to logs. Entries should not be renumbered and
    // numeric values should never be reused.
    Johannes Henkel . unresolved

    What you write here feels like a subset of go/protodosdonts, maybe scan through that and see if there's any other consideration that may apply. I was thinking about go/protodosdonts#unspecified-enum in particular. Or maybe not, but I think it's healthy to think before committing. :-)

    File components/page_load_metrics/common/page_load_timing.cc
    Line 38, Patchset 2 (Latest): timing->navigation_type = mojom::SoftNavigationType::kPush;
    Johannes Henkel . unresolved

    This is where the unspecified value would be set instead, if we were to follow the advice from go/protodosdonts#unspecified-enum

    File third_party/blink/renderer/core/timing/soft_navigation_heuristics.cc
    Line 211, Patchset 2 (Latest): case V8NavigationType::Enum::kReplace:
    return SoftNavigationTypeForReporting::kReplace;
    Johannes Henkel . unresolved

    Maybe below this case, put
    NOTREACHED();
    ?

    File third_party/blink/web_tests/external/wpt/soft-navigation-heuristics/navigation-type.tentative.html
    Line 20, Patchset 2 (Latest): type: 'push',
    Johannes Henkel . unresolved

    I think making these two field names slightly more elaborate may make it friendlier to read for someone who isn't completely familiar with soft navs etc. ?

    type -> expectedNavigationType
    url -> expectedURL

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I4143540c68f2e7c879a52320762cfd407835d5c6
    Gerrit-Change-Number: 7530377
    Gerrit-PatchSet: 2
    Gerrit-Owner: Scott Haseley <shas...@chromium.org>
    Gerrit-Reviewer: Annie Sullivan <sull...@chromium.org>
    Gerrit-Reviewer: Johannes Henkel <joha...@chromium.org>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Scott Haseley <shas...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-Comment-Date: Thu, 29 Jan 2026 22:19:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages