feat: expose shouldSkipOnBackForwardUI on NavigationEntry#51961
Open
MarshallOfSound wants to merge 2 commits into
Open
feat: expose shouldSkipOnBackForwardUI on NavigationEntry#51961MarshallOfSound wants to merge 2 commits into
MarshallOfSound wants to merge 2 commits into
Conversation
Chromium's history manipulation intervention marks a history entry skippable when the page created it and navigated away without a user gesture. goBack()/goForward()/canGoBack() honor the flag; goToIndex() does not. Expose the flag as a read-only boolean on the NavigationEntry structures returned by navigationHistory.getEntryAtIndex() and navigationHistory.getAllEntries() so apps that drive history navigation through index-based APIs can honor the intervention using Chromium's own ground truth. Adds a minimal Chromium patch exposing a public const accessor on content::NavigationEntry, since the flag previously lived only on content::NavigationEntryImpl.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Chromium's history manipulation intervention marks a history entry "skippable" when the page created it and then navigated away without a user gesture (client-side redirectors, login bounces,
pushStateback-traps). The nativegoBack()/goForward()/canGoBack()honor the flag and skip such entries;goToIndex()deliberately does not. The flag lives internally oncontent::NavigationEntryImpl, and Electron'sNavigationEntrystructures don't expose it.This PR exposes the flag as a read-only boolean property —
shouldSkipOnBackForwardUI— on theNavigationEntrystructures returned bynavigationHistory.getEntryAtIndex()andnavigationHistory.getAllEntries(). The property name mirrors the internal Chromium name and is open to API-WG bikeshedding.Motivating use case: an embedder that needs deterministic, policy-gated history navigation peeks the target entry (
navigationHistory.getEntryAtIndex(active ± 1)), validates it against a security policy, then commits withgoToIndex()so the gated URL is exactly what commits. Without the skippable flag, that pattern can't honor the intervention — on a stack[A, R, B]whereRauto-redirects forward, "back" fromBlands onRand bounces, while nativegoBack()would have skipped toA. Exposing the flag lets the embedder walk the peek past skippable entries using Chromium's own ground truth instead of re-implementing the heuristic.Implementation:
feat_expose_shouldskiponbackforwardui_on_content_navigationentry.patch) adds a public const accessorShouldSkipOnBackForwardUI()tocontent::NavigationEntry, implemented byNavigationEntryImplwhich already owns the flag. This is a reasonable candidate to upstream to Chromium proper, as noted in the patch header.dict.Set()in thecontent::NavigationEntry*→ V8 converter, which backs allNavigationEntry-structure-producing APIs.NavigationEntryis also the input type ofnavigationHistory.restore(), where the property is ignored).[A, R, B]stack against the spec HTTP server whereRnavigates away via renderer-initiatedlocation.assignwith no user gesture, and assert the flag is[false, true, false]plus the existing behavior contrast:goBack()fromBcommitsAwhilegetEntryAtIndex(active - 1)still returnsR.Checklist
Release Notes
Notes: Added
shouldSkipOnBackForwardUIto theNavigationEntrystructure, exposing whether Chromium's history manipulation intervention will skip the entry on back/forward navigations.