tor-browser

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

commit c5d6450304321a12fe3a0d7e254844af5b4765ad
parent 4799886d2922026538b1121ed719d9a845d551a2
Author: Jan-Niklas Jaeschke <jjaschke@mozilla.com>
Date:   Tue, 28 Oct 2025 17:18:25 +0000

Bug 1970123, part 3 - Navigation API: Update `#navigateevent-finish` to incorporate precommit handlers. r=dom-core,smaug

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

Diffstat:
Mdom/events/NavigateEvent.cpp | 36+++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/dom/events/NavigateEvent.cpp b/dom/events/NavigateEvent.cpp @@ -291,28 +291,38 @@ bool NavigateEvent::IsBeingDispatched() const { // https://html.spec.whatwg.org/#navigateevent-finish void NavigateEvent::Finish(bool aDidFulfill) { - switch (mInterceptionState) { - // Step 1 - case InterceptionState::Intercepted: - case InterceptionState::Finished: - MOZ_DIAGNOSTIC_ASSERT(false); - break; - // Step 2 - case InterceptionState::None: - return; - default: - break; + // Step 1 + MOZ_DIAGNOSTIC_ASSERT(mInterceptionState != InterceptionState::Finished); + + // Step 2 + if (mInterceptionState == InterceptionState::Intercepted) { + // Step 2.1 + MOZ_DIAGNOSTIC_ASSERT(!aDidFulfill); + + // Step 2.2 + MOZ_DIAGNOSTIC_ASSERT(!mNavigationPrecommitHandlerList.IsEmpty()); + + // Step 2.3 + mInterceptionState = InterceptionState::Finished; + + // Step 2.4 + return; } // Step 3 - PotentiallyResetFocus(); + if (mInterceptionState == InterceptionState::None) { + return; + } // Step 4 + PotentiallyResetFocus(); + + // Step 5 if (aDidFulfill) { PotentiallyProcessScrollBehavior(); } - // Step 5 + // Step 6 mInterceptionState = InterceptionState::Finished; }