tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 2c5f2a0d7a11cc741d35b9ed5be3289d3fd26847
parent 5fce2b527303670e554f0cfd62c533974981ba39
Author: Adam Vandolder <avandolder@mozilla.com>
Date:   Tue, 14 Oct 2025 14:21:09 +0000

Bug 1966674 - Part 1: Pass serializedState to BrowsingContext::Navigate and use it to set nsDocShellLoadState::SetNavigationAPIState. r=dom-core,jjaschke

Differential Revision: https://phabricator.services.mozilla.com/D268071

Diffstat:
Mdocshell/base/BrowsingContext.cpp | 10++++++----
Mdocshell/base/BrowsingContext.h | 3++-
Mdom/navigation/Navigation.cpp | 3++-
3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp @@ -2435,10 +2435,11 @@ BrowsingContext::CheckURLAndCreateLoadState(nsIURI* aURI, // https://html.spec.whatwg.org/#navigate // In its current state, this method is not closely following the spec. // https://bugzil.la/1974717 tracks the work to align this method with the spec. -void BrowsingContext::Navigate(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal, - ErrorResult& aRv, - NavigationHistoryBehavior aHistoryHandling, - bool aNeedsCompletelyLoadedDocument) { +void BrowsingContext::Navigate( + nsIURI* aURI, nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv, + NavigationHistoryBehavior aHistoryHandling, + bool aNeedsCompletelyLoadedDocument, + nsIStructuredCloneContainer* aNavigationAPIState) { MOZ_LOG_FMT(gNavigationAPILog, LogLevel::Debug, "Navigate to {} as {}", *aURI, aHistoryHandling); CallerType callerType = aSubjectPrincipal.IsSystemPrincipal() @@ -2480,6 +2481,7 @@ void BrowsingContext::Navigate(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal, loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE); loadState->SetFirstParty(true); + loadState->SetNavigationAPIState(aNavigationAPIState); rv = LoadURI(loadState); if (NS_WARN_IF(NS_FAILED(rv))) { diff --git a/docshell/base/BrowsingContext.h b/docshell/base/BrowsingContext.h @@ -459,7 +459,8 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache { void Navigate(nsIURI* aURI, nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv, NavigationHistoryBehavior aHistoryHandling = NavigationHistoryBehavior::Auto, - bool aNeedsCompletelyLoadedDocument = false); + bool aNeedsCompletelyLoadedDocument = false, + nsIStructuredCloneContainer* aNavigationAPIState = nullptr); // Removes the root document for this BrowsingContext tree from the BFCache, // if it is cached, and returns true if it was. diff --git a/dom/navigation/Navigation.cpp b/dom/navigation/Navigation.cpp @@ -564,7 +564,8 @@ void Navigation::Navigate(JSContext* aCx, const nsAString& aUrl, MOZ_DIAGNOSTIC_ASSERT(bc); bc->Navigate(urlRecord, *document->NodePrincipal(), /* per spec, error handling defaults to false */ IgnoreErrors(), - aOptions.mHistory); + aOptions.mHistory, /* aNeedsCompletelyLoadedDocument */ false, + serializedState); // 13. If this's upcoming non-traverse API method tracker is apiMethodTracker, // then: