tor-browser

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

commit 974b0546f470bf87a34d636a03607d788ba9305f
parent 3981ee79820708476cd3da13eaaca9c890902f95
Author: Serban Stanca <sstanca@mozilla.com>
Date:   Thu,  8 Jan 2026 20:32:06 +0200

Revert "Bug 2009004 - Navigation API: Implement #dom-navigationprecommitcontroller-addhandler. r=farre,webidl,smaug,saschanaz" for causing wpt failures.

This reverts commit e5bb7184794a52602e9ec0e5d2667ed8f912c2c5.

This reverts commit 79eb0b7215cdafea45f9640df95e067ec855b2f9.

Diffstat:
Mdom/navigation/NavigationPrecommitController.cpp | 31++-----------------------------
Mdom/navigation/NavigationPrecommitController.h | 4+---
Mdom/webidl/NavigationPrecommitController.webidl | 2--
Mtesting/web-platform/meta/html/dom/idlharness.https.html.ini | 4++++
Atesting/web-platform/meta/navigation-api/precommit-handler/precommitHandler-addHandler-throws.html.ini | 6++++++
Atesting/web-platform/meta/navigation-api/precommit-handler/precommitHandler-addHandler.html.ini | 7+++++++
6 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/dom/navigation/NavigationPrecommitController.cpp b/dom/navigation/NavigationPrecommitController.cpp @@ -25,9 +25,7 @@ NS_INTERFACE_MAP_END NavigationPrecommitController::NavigationPrecommitController( NavigateEvent* aEvent, nsIGlobalObject* aGlobalObject) - : mGlobalObject(aGlobalObject), mEvent(aEvent) { - MOZ_DIAGNOSTIC_ASSERT(mEvent); -} + : mGlobalObject(aGlobalObject), mEvent(aEvent) {} NavigationPrecommitController::~NavigationPrecommitController() {} @@ -47,6 +45,7 @@ void NavigationPrecommitController::Redirect( // The redirect(url, options) method steps are: // 1. Assert: this's event's interception state is not "none". + MOZ_DIAGNOSTIC_ASSERT(mEvent); MOZ_DIAGNOSTIC_ASSERT(mEvent->InterceptionState() != NavigateEvent::InterceptionState::None); @@ -151,30 +150,4 @@ void NavigationPrecommitController::Redirect( } } -// https://html.spec.whatwg.org/#dom-navigationprecommitcontroller-addhandler -void NavigationPrecommitController::AddHandler( - NavigationInterceptHandler& aHandler, ErrorResult& aRv) { - // 1. Assert: this's event's interception state is not "none". - MOZ_DIAGNOSTIC_ASSERT(mEvent->InterceptionState() != - NavigateEvent::InterceptionState::None); - - // 2. Perform shared checks given this's event. - mEvent->PerformSharedChecks(aRv); - if (aRv.Failed()) { - return; - } - - // 3. If this's event's interception state is not "intercepted", then throw - // an "InvalidStateError" DOMException. - if (mEvent->InterceptionState() != - NavigateEvent::InterceptionState::Intercepted) { - aRv.ThrowInvalidStateError( - "Cannot add handler after navigation has committed"); - return; - } - - // 4. Append handler to this's event's navigation handler list. - mEvent->NavigationHandlerList().AppendElement(&aHandler); -} - } // namespace mozilla::dom diff --git a/dom/navigation/NavigationPrecommitController.h b/dom/navigation/NavigationPrecommitController.h @@ -17,7 +17,6 @@ namespace mozilla::dom { struct NavigationNavigateOptions; class NavigateEvent; -class NavigationInterceptHandler; } // namespace mozilla::dom class nsIGlobalObject; @@ -43,11 +42,10 @@ class NavigationPrecommitController final : public nsISupports, JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; + // https://html.spec.whatwg.org/#dom-navigationprecommitcontroller-redirect void Redirect(JSContext* aCx, const nsAString& aUrl, const NavigationNavigateOptions& aOptions, ErrorResult& aRv); - void AddHandler(NavigationInterceptHandler& aHandler, ErrorResult& aRv); - private: nsCOMPtr<nsIGlobalObject> mGlobalObject; diff --git a/dom/webidl/NavigationPrecommitController.webidl b/dom/webidl/NavigationPrecommitController.webidl @@ -10,8 +10,6 @@ interface NavigationPrecommitController { [Throws] undefined redirect(USVString url, optional NavigationNavigateOptions options = {}); - [Throws] - undefined addHandler(NavigationInterceptHandler handler); }; callback NavigationPrecommitHandler = Promise<undefined>(NavigationPrecommitController controller); diff --git a/testing/web-platform/meta/html/dom/idlharness.https.html.ini b/testing/web-platform/meta/html/dom/idlharness.https.html.ini @@ -1952,6 +1952,10 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu [NavigationTransition interface: attribute to] expected: FAIL + [NavigationPrecommitController interface: operation addHandler(NavigationInterceptHandler)] + expected: FAIL + + [idlharness.https.html?include=HTML.+] [HTMLElement interface: attribute writingSuggestions] expected: FAIL diff --git a/testing/web-platform/meta/navigation-api/precommit-handler/precommitHandler-addHandler-throws.html.ini b/testing/web-platform/meta/navigation-api/precommit-handler/precommitHandler-addHandler-throws.html.ini @@ -0,0 +1,6 @@ +[precommitHandler-addHandler-throws.html] + [addHandler() after finish] + expected: FAIL + + [addHandler() after commit] + expected: FAIL diff --git a/testing/web-platform/meta/navigation-api/precommit-handler/precommitHandler-addHandler.html.ini b/testing/web-platform/meta/navigation-api/precommit-handler/precommitHandler-addHandler.html.ini @@ -0,0 +1,7 @@ +[precommitHandler-addHandler.html] + expected: ERROR + [handler added in addHandler() delays navigation finish] + expected: FAIL + + [handler added in addHandler() is executed in the correct order] + expected: FAIL