Truly independent web browser
LibWeb: Implement NavigationPrecommitController
Andreas Klingc39e6b605e14
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txtindex dbb40f80c5c..b3d73cfcee4 100644--- a/Libraries/LibWeb/CMakeLists.txt+++ b/Libraries/LibWeb/CMakeLists.txt@@ -598,6 +598,7 @@ set(SOURCESHTML/NavigationObserver.cppHTML/NavigationParams.cppHTML/NavigationParamsDescriptor.cpp+ HTML/NavigationPrecommitController.cppHTML/NavigationTransition.cppHTML/Navigator.cppHTML/NavigatorBeacon.cppdiff --git a/Libraries/LibWeb/HTML/NavigateEvent.cpp b/Libraries/LibWeb/HTML/NavigateEvent.cppindex ab1ecb2428b..d00190e18f8 100644--- a/Libraries/LibWeb/HTML/NavigateEvent.cpp+++ b/Libraries/LibWeb/HTML/NavigateEvent.cpp@@ -126,6 +126,7 @@ NavigateEvent::~NavigateEvent() = default;void NavigateEvent::visit_edges(GC::Cell::Visitor& visitor){Base::visit_edges(visitor);+ visitor.visit(m_navigation_precommit_handler_list);visitor.visit(m_navigation_handler_list);visitor.visit(m_abort_controller);visitor.visit(m_destination);@@ -153,17 +154,27 @@ WebIDL::ExceptionOr<void> NavigateEvent::intercept(JS::Realm& realm, NavigationIif (!this->dispatched())return WebIDL::InvalidStateError::create("NavigationEvent is not dispatched yet"_utf16);- // 4. Assert: this's interception state is either "none" or "intercepted".+ // 4. If options["precommitHandler"] exists:+ if (options.precommit_handler) {+ // 1. If this's cancelable attribute is initialized to false, then throw an "InvalidStateError" DOMException.+ if (!cancelable())+ return WebIDL::InvalidStateError::create("Cannot use a precommit handler with a NavigateEvent that is not cancelable"_utf16);++ // 2. Append options["precommitHandler"] to this's navigation precommit handler list.+ TRY_OR_THROW_OOM(vm, m_navigation_precommit_handler_list.try_append(*options.precommit_handler));+ }++ // 5. Assert: this's interception state is either "none" or "intercepted".VERIFY(m_interception_state == InterceptionState::None || m_interception_state == InterceptionState::Intercepted);- // 5. Set this's interception state to "intercepted".+ // 6. Set this's interception state to "intercepted".m_interception_state = InterceptionState::Intercepted;- // 6. If options["handler"] exists, then append it to this's navigation handler list.+ // 7. If options["handler"] exists, then append it to this's navigation handler list.if (options.handler)TRY_OR_THROW_OOM(vm, m_navigation_handler_list.try_append(*options.handler));- // 7. If options["focusReset"] exists, then:+ // 8. If options["focusReset"] exists, then:if (options.focus_reset.has_value()) {auto focus_reset = *options.focus_reset;@@ -181,7 +192,7 @@ WebIDL::ExceptionOr<void> NavigateEvent::intercept(JS::Realm& realm, NavigationIm_focus_reset_behavior = focus_reset;}- // 8. If options["scroll"] exists, then:+ // 9. If options["scroll"] exists, then:if (options.scroll.has_value()) {auto scroll = *options.scroll;diff --git a/Libraries/LibWeb/HTML/NavigateEvent.h b/Libraries/LibWeb/HTML/NavigateEvent.hindex 2f79218863e..3b2e389cd0b 100644--- a/Libraries/LibWeb/HTML/NavigateEvent.h+++ b/Libraries/LibWeb/HTML/NavigateEvent.h@@ -47,6 +47,9 @@ class Window;// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationintercepthandlerusing NavigationInterceptHandler = GC::Ref<WebIDL::CallbackType>;+// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationprecommithandler+using NavigationPrecommitHandler = GC::Ref<WebIDL::CallbackType>;+using NavigationFocusReset = Bindings::NavigationFocusReset;using NavigationScrollBehavior = Bindings::NavigationScrollBehavior;@@ -112,7 +115,9 @@ public:GC::Ref<DOM::AbortController> abort_controller() const { return *m_abort_controller; }InterceptionState interception_state() const { return m_interception_state; }+ Vector<NavigationPrecommitHandler> const& navigation_precommit_handler_list() const { return m_navigation_precommit_handler_list; }Vector<NavigationInterceptHandler> const& navigation_handler_list() const { return m_navigation_handler_list; }+ void append_to_navigation_handler_list(NavigationInterceptHandler handler) { m_navigation_handler_list.append(handler); }Optional<StorageSerializationRecord> classic_history_api_state() const { return m_classic_history_api_state; }bool has_started_navigate_event_intercept_commit_handler_steps() const { return m_has_started_navigate_event_intercept_commit_handler_steps; }Optional<CrossProcessId> resume_traversal_operation_id() const { return m_resume_traversal_operation_id; }@@ -120,18 +125,21 @@ public:void set_abort_controller(GC::Ref<DOM::AbortController> c) { m_abort_controller = c; }void set_interception_state(InterceptionState s) { m_interception_state = s; }void set_classic_history_api_state(Optional<StorageSerializationRecord> r) { m_classic_history_api_state = move(r); }+ void set_navigation_type(NavigationType navigation_type) { m_navigation_type = navigation_type; }+ void set_info(JS::Value info) { m_info = info; }void set_has_started_navigate_event_intercept_commit_handler_steps() { m_has_started_navigate_event_intercept_commit_handler_steps = true; }void set_resume_traversal_operation_id(CrossProcessId id) { m_resume_traversal_operation_id = id; }void finish(bool did_fulfill);+ WebIDL::ExceptionOr<void> perform_shared_checks();+private:NavigateEvent(Window&, FlyString const& event_name, NavigateEventInit const& event_init, HighResolutionTime::DOMHighResTimeStamp);NavigateEvent(Window&, Utf16FlyString const& event_name, NavigateEventInit const& event_init, HighResolutionTime::DOMHighResTimeStamp);virtual void visit_edges(GC::Cell::Visitor&) override;- WebIDL::ExceptionOr<void> perform_shared_checks();void process_scroll_behavior();void potentially_process_scroll_behavior();void potentially_reset_the_focus();@@ -147,6 +155,9 @@ private:// The history operation resuming this intercepted traverse, which is revoked if the event is aborted first.Optional<CrossProcessId> m_resume_traversal_operation_id;+ // https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigateevent-navigation-precommit-handler-list+ Vector<NavigationPrecommitHandler> m_navigation_precommit_handler_list;+// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigateevent-navigation-handler-listVector<NavigationInterceptHandler> m_navigation_handler_list;diff --git a/Libraries/LibWeb/HTML/NavigateEvent.idl b/Libraries/LibWeb/HTML/NavigateEvent.idlindex c7a343e17e0..d013945d804 100644--- a/Libraries/LibWeb/HTML/NavigateEvent.idl+++ b/Libraries/LibWeb/HTML/NavigateEvent.idl@@ -34,6 +34,7 @@ dictionary NavigateEventInit : EventInit {};dictionary NavigationInterceptOptions {+ NavigationPrecommitHandler precommitHandler;NavigationInterceptHandler handler;NavigationFocusReset focusReset;NavigationScrollBehavior scroll;diff --git a/Libraries/LibWeb/HTML/Navigation.cpp b/Libraries/LibWeb/HTML/Navigation.cppindex a983e6bafb6..832f8b79ceb 100644--- a/Libraries/LibWeb/HTML/Navigation.cpp+++ b/Libraries/LibWeb/HTML/Navigation.cpp@@ -23,6 +23,7 @@#include <LibWeb/HTML/NavigationCurrentEntryChangeEvent.h>#include <LibWeb/HTML/NavigationDestination.h>#include <LibWeb/HTML/NavigationHistoryEntry.h>+#include <LibWeb/HTML/NavigationPrecommitController.h>#include <LibWeb/HTML/NavigationTransition.h>#include <LibWeb/HTML/Scripting/Environments.h>#include <LibWeb/HTML/Scripting/ExceptionReporter.h>@@ -1265,8 +1266,41 @@ bool Navigation::inner_navigate_event_firing_algorithm(}// 30. If event's navigation precommit handler list is empty then commit event given apiMethodTracker.- // FIXME: 31. Otherwise, invoke the precommit handlers and commit event once they have all fulfilled.- commit_a_navigate_event(event, api_method_tracker);+ if (event->navigation_precommit_handler_list().is_empty()) {+ commit_a_navigate_event(event, api_method_tracker);+ }+ // 31. Otherwise:+ else {+ // NB: Like for the transition above, the precommit handlers can be invoked from a session history traversal+ // task with no JavaScript on the stack.+ TemporaryExecutionContext execution_context { realm, TemporaryExecutionContext::CallbacksEnabled::Yes };++ // 1. Let precommitController be a new NavigationPrecommitController created in navigation's relevant realm,+ // whose event is event.+ auto precommit_controller = NavigationPrecommitController::create(event);+ JS::Value precommit_controller_value = Bindings::wrap(Bindings::host_defined_wrapper_world(realm), realm, precommit_controller);++ // 2. Let precommitPromisesList be an empty list.+ GC::RootVector<GC::Ref<WebIDL::Promise>> precommit_promises_list;++ // 3. For each handler of event's navigation precommit handler list:+ for (auto const& handler : event->navigation_precommit_handler_list()) {+ // 1. Append the result of invoking handler with « precommitController » to precommitPromisesList.+ precommit_promises_list.append(WebIDL::invoke_promise_callback(handler, {}, ReadonlySpan<JS::Value> { &precommit_controller_value, 1 }));+ }++ // 4. Wait for all precommitPromisesList with the following success steps: commit event given apiMethodTracker,+ // and the following failure step given reason: process navigate event handler failure given event and+ // reason.+ WebIDL::wait_for_all(+ realm, precommit_promises_list,+ [this, event, api_method_tracker](auto const&) {+ commit_a_navigate_event(event, api_method_tracker);+ },+ [this, event](JS::Value reason) {+ process_navigate_event_handler_failure(event, reason);+ });+ }// 32. If event's interception state is "none", then return true.// 33. Return false.diff --git a/Libraries/LibWeb/HTML/Navigation.h b/Libraries/LibWeb/HTML/Navigation.hindex 47ce423e590..05875d12be8 100644--- a/Libraries/LibWeb/HTML/Navigation.h+++ b/Libraries/LibWeb/HTML/Navigation.h@@ -153,6 +153,7 @@ public:// Internal Getters/SettersGC::Ptr<NavigateEvent> ongoing_navigate_event() const { return m_ongoing_navigate_event; }void set_ongoing_navigate_event(GC::Ptr<NavigateEvent> event) { m_ongoing_navigate_event = event; }+ GC::Ptr<NavigationAPIMethodTracker> ongoing_api_method_tracker() const { return m_ongoing_api_method_tracker; }void set_ongoing_api_method_tracker(GC::Ptr<NavigationAPIMethodTracker> tracker) { m_ongoing_api_method_tracker = tracker; }bool focus_changed_during_ongoing_navigation() const { return m_focus_changed_during_ongoing_navigation; }diff --git a/Libraries/LibWeb/HTML/NavigationPrecommitController.cpp b/Libraries/LibWeb/HTML/NavigationPrecommitController.cppnew file mode 100644index 00000000000..26f329f8c67--- /dev/null+++ b/Libraries/LibWeb/HTML/NavigationPrecommitController.cpp@@ -0,0 +1,123 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#include <LibGC/Heap.h>+#include <LibWeb/DOM/Document.h>+#include <LibWeb/HTML/History.h>+#include <LibWeb/HTML/NavigateEvent.h>+#include <LibWeb/HTML/Navigation.h>+#include <LibWeb/HTML/NavigationDestination.h>+#include <LibWeb/HTML/NavigationPrecommitController.h>+#include <LibWeb/HTML/Scripting/Environments.h>+#include <LibWeb/HTML/StructuredSerialize.h>+#include <LibWeb/HTML/Window.h>++namespace Web::HTML {++GC_DEFINE_ALLOCATOR(NavigationPrecommitController);++GC::Ref<NavigationPrecommitController> NavigationPrecommitController::create(GC::Ref<NavigateEvent> event)+{+ return GC::Heap::the().allocate<NavigationPrecommitController>(event);+}++NavigationPrecommitController::NavigationPrecommitController(GC::Ref<NavigateEvent> event)+ : m_event(event)+{+}++NavigationPrecommitController::~NavigationPrecommitController() = default;++void NavigationPrecommitController::visit_edges(GC::Cell::Visitor& visitor)+{+ Base::visit_edges(visitor);+ visitor.visit(m_event);+}++// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationprecommitcontroller-redirect+WebIDL::ExceptionOr<void> NavigationPrecommitController::redirect(Utf16String const& url, Bindings::NavigationNavigateOptions const& options)+{+ // 1. Assert: this's event's interception state is not "none".+ VERIFY(m_event->interception_state() != NavigateEvent::InterceptionState::None);++ // 2. Perform shared checks given this's event.+ TRY(m_event->perform_shared_checks());++ // 3. If this's event's interception state is not "intercepted", then throw an "InvalidStateError" DOMException.+ if (m_event->interception_state() != NavigateEvent::InterceptionState::Intercepted)+ return WebIDL::InvalidStateError::create("Cannot redirect a navigation that is no longer intercepted"_utf16);++ // 4. If this's event's navigationType is neither "push" nor "replace", then throw an "InvalidStateError"+ // DOMException.+ if (m_event->navigation_type() != Bindings::NavigationType::Push && m_event->navigation_type() != Bindings::NavigationType::Replace)+ return WebIDL::InvalidStateError::create("Cannot redirect a navigation that is not a push or replace"_utf16);++ // 5. Let document be this's relevant global object's associated Document.+ auto& window = m_event->relevant_window();+ auto& document = window.associated_document();++ // 6. Let destinationURL be the result of parsing url given document.+ auto destination_url = document.relevant_settings_object().parse_url(url.utf16_view());++ // 7. If destinationURL is failure, then throw a "SyntaxError" DOMException.+ if (!destination_url.has_value())+ return WebIDL::SyntaxError::create("Cannot redirect to an invalid URL"_utf16);++ // 8. If document cannot have its URL rewritten to destinationURL, then throw a "SecurityError" DOMException.+ if (!can_have_its_url_rewritten(document, *destination_url))+ return WebIDL::SecurityError::create("Cannot redirect to a URL that the document cannot be rewritten to"_utf16);++ // 9. If options["history"] is "push" or "replace", then set this's event's navigationType to options["history"].+ if (options.history == Bindings::NavigationHistoryBehavior::Push)+ m_event->set_navigation_type(Bindings::NavigationType::Push);+ else if (options.history == Bindings::NavigationHistoryBehavior::Replace)+ m_event->set_navigation_type(Bindings::NavigationType::Replace);++ // 10. If options["state"] exists:+ if (options.state.has_value()) {+ // 1. Let serializedState be the result of calling StructuredSerializeForStorage(options["state"]). This may+ // throw an exception.+ auto serialized_state = TRY(structured_serialize_for_storage(window.principal_realm().vm(), *options.state));++ // 2. Set this's event's destination's state to serializedState.+ m_event->destination()->set_state(serialized_state);++ // 3. If this's event's target's ongoing API method tracker is non-null, then set this's event's target's+ // ongoing API method tracker's serialized state to serializedState.+ if (auto api_method_tracker = window.navigation()->ongoing_api_method_tracker())+ api_method_tracker->serialized_state = move(serialized_state);+ }++ // 11. Set this's event's destination's URL to destinationURL.+ m_event->destination()->set_url(*destination_url);++ // 12. If options["info"] exists, then set this's event's info to options["info"].+ if (options.info.has_value())+ m_event->set_info(*options.info);++ return {};+}++// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationprecommitcontroller-addhandler+WebIDL::ExceptionOr<void> NavigationPrecommitController::add_handler(GC::Ref<WebIDL::CallbackType> handler)+{+ // 1. Assert: this's event's interception state is not "none".+ VERIFY(m_event->interception_state() != NavigateEvent::InterceptionState::None);++ // 2. Perform shared checks given this's event.+ TRY(m_event->perform_shared_checks());++ // 3. If this's event's interception state is not "intercepted", then throw an "InvalidStateError" DOMException.+ if (m_event->interception_state() != NavigateEvent::InterceptionState::Intercepted)+ return WebIDL::InvalidStateError::create("Cannot add a handler to a navigation that is no longer intercepted"_utf16);++ // 4. Append handler to this's event's navigation handler list.+ m_event->append_to_navigation_handler_list(handler);++ return {};+}++}diff --git a/Libraries/LibWeb/HTML/NavigationPrecommitController.h b/Libraries/LibWeb/HTML/NavigationPrecommitController.hnew file mode 100644index 00000000000..618cd431ba2--- /dev/null+++ b/Libraries/LibWeb/HTML/NavigationPrecommitController.h@@ -0,0 +1,40 @@+/*+ * Copyright (c) 2026-present, the Ladybird developers.+ *+ * SPDX-License-Identifier: BSD-2-Clause+ */++#pragma once++#include <LibWeb/Bindings/Navigation.h>+#include <LibWeb/Bindings/Wrappable.h>+#include <LibWeb/WebIDL/CallbackType.h>+#include <LibWeb/WebIDL/ExceptionOr.h>++namespace Web::HTML {++class NavigateEvent;++// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationprecommitcontroller+class NavigationPrecommitController : public Bindings::GCAllocatedWrappable {+ WEB_WRAPPABLE(NavigationPrecommitController, Bindings::GCAllocatedWrappable);+ GC_DECLARE_ALLOCATOR(NavigationPrecommitController);++public:+ [[nodiscard]] static GC::Ref<NavigationPrecommitController> create(GC::Ref<NavigateEvent>);++ virtual ~NavigationPrecommitController() override;++ WebIDL::ExceptionOr<void> redirect(Utf16String const& url, Bindings::NavigationNavigateOptions const&);+ WebIDL::ExceptionOr<void> add_handler(GC::Ref<WebIDL::CallbackType> handler);++private:+ explicit NavigationPrecommitController(GC::Ref<NavigateEvent>);++ virtual void visit_edges(GC::Cell::Visitor&) override;++ // https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationprecommitcontroller-event+ GC::Ref<NavigateEvent> m_event;+};++}diff --git a/Libraries/LibWeb/HTML/NavigationPrecommitController.idl b/Libraries/LibWeb/HTML/NavigationPrecommitController.idlnew file mode 100644index 00000000000..3cde79d641b--- /dev/null+++ b/Libraries/LibWeb/HTML/NavigationPrecommitController.idl@@ -0,0 +1,8 @@+// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationprecommitcontroller+[Exposed=Window]+interface NavigationPrecommitController {+ undefined redirect(USVString url, optional NavigationNavigateOptions options = {});+ undefined addHandler(NavigationInterceptHandler handler);+};++callback NavigationPrecommitHandler = Promise<undefined> (NavigationPrecommitController controller);diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmakeindex e7242019ce6..4bda606e214 100644--- a/Libraries/LibWeb/idl_files.cmake+++ b/Libraries/LibWeb/idl_files.cmake@@ -340,6 +340,7 @@ libweb_js_bindings(HTML/NavigationActivation)libweb_js_bindings(HTML/NavigationCurrentEntryChangeEvent)libweb_js_bindings(HTML/NavigationDestination)libweb_js_bindings(HTML/NavigationHistoryEntry)+libweb_js_bindings(HTML/NavigationPrecommitController)libweb_js_bindings(HTML/NavigationTransition)libweb_js_bindings(HTML/NavigationType)libweb_js_bindings(HTML/Navigator)diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txtindex 75f8201e163..1fb72072329 100644--- a/Tests/LibWeb/Text/expected/all-window-properties.txt+++ b/Tests/LibWeb/Text/expected/all-window-properties.txt@@ -343,6 +343,7 @@ NavigationActivationNavigationCurrentEntryChangeEventNavigationDestinationNavigationHistoryEntry+NavigationPrecommitControllerNavigationTransitionNavigatorNodediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-addHandler.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-addHandler.txtindex 76fdcdb203a..bba8308e146 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-addHandler.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-addHandler.txt@@ -2,6 +2,6 @@ Harness status: OKFound 2 tests-2 Fail-Fail handler added in addHandler() delays navigation finish-Fail handler added in addHandler() is executed in the correct order\ No newline at end of file+2 Pass+Pass handler added in addHandler() delays navigation finish+Pass handler added in addHandler() is executed in the correct order\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-back-and-forth.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-back-and-forth.txtindex 5a8f1a83306..e658e8f08e4 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-back-and-forth.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-back-and-forth.txt@@ -2,7 +2,7 @@ Harness status: OKFound 1 tests-1 Fail-Fail+1 Pass+PassTest that going back and forward during a precommitHandler ends up in thecorrect entrydiff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-new-navigation-before-commit.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-new-navigation-before-commit.txtindex d19e5739da9..36d4d9c9c62 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-new-navigation-before-commit.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-new-navigation-before-commit.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Cancel a navigation with a precommitHandler before commit by starting a new navigation\ No newline at end of file+1 Pass+Pass Cancel a navigation with a precommitHandler before commit by starting a new navigation\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-push.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-push.txtindex 7703f6bf7d0..c497210c925 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-push.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-push.txt@@ -2,8 +2,7 @@ Harness status: OKFound 3 tests-2 Pass-1 Fail-Fail precommitHandler for a push navigation, reject before commit+3 Pass+Pass precommitHandler for a push navigation, reject before commitPass precommitHandler for a push navigation, reject after commitPass precommitHandler for a push navigation, success\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-non-api-navigation.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-non-api-navigation.txtindex 338e668491c..f731592f50b 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-non-api-navigation.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-non-api-navigation.txt@@ -2,6 +2,6 @@ Harness status: OKFound 2 tests-2 Fail-Fail precommitHandler redirect() on non-API navigation does not serialize state-Fail precommitHandler redirect() with state on non-API navigation (link click)\ No newline at end of file+2 Pass+Pass precommitHandler redirect() on non-API navigation does not serialize state+Pass precommitHandler redirect() with state on non-API navigation (link click)\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-options.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-options.txtindex 8efe20865a4..94c196c8d6d 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-options.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-options.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail precommitHandler redirect() with options dictionary\ No newline at end of file+1 Pass+Pass precommitHandler redirect() with options dictionary\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push-changed-to-replace.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push-changed-to-replace.txtindex c572d1c885c..3ae8605c6b2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push-changed-to-replace.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push-changed-to-replace.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail precommitHandler redirect() push changed to replace\ No newline at end of file+1 Pass+Pass precommitHandler redirect() push changed to replace\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push.txtindex 77f08196901..2d6e3656a1f 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-push.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail precommitHandler redirect() push\ No newline at end of file+1 Pass+Pass precommitHandler redirect() push\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace-changed-to-push.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace-changed-to-push.txtindex 52bbbd35674..988338b8eb4 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace-changed-to-push.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace-changed-to-push.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail precommitHandler redirect() replace changed to push\ No newline at end of file+1 Pass+Pass precommitHandler redirect() replace changed to push\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace.txtindex 18dc304ba63..61b8ae166a3 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-redirect-replace.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail precommitHandler redirect() replace\ No newline at end of file+1 Pass+Pass precommitHandler redirect() replace\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-reload.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-reload.txtindex e923b62f3aa..907e2870cf7 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-reload.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-reload.txt@@ -2,8 +2,7 @@ Harness status: OKFound 3 tests-2 Pass-1 Fail-Fail precommitHandler for a reload navigation, reject before commit+3 Pass+Pass precommitHandler for a reload navigation, reject before commitPass precommitHandler for a reload navigation, reject after commitPass precommitHandler for a reload navigation, success\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-replace.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-replace.txtindex a58310393b7..e8e0b46e0c9 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-replace.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-replace.txt@@ -2,8 +2,7 @@ Harness status: OKFound 3 tests-2 Pass-1 Fail-Fail precommitHandler for a replace navigation, reject before commit+3 Pass+Pass precommitHandler for a replace navigation, reject before commitPass precommitHandler for a replace navigation, reject after commitPass precommitHandler for a replace navigation, success\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-traverse.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-traverse.txtindex 68cbd883159..1a9ced28e11 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-traverse.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-traverse.txt@@ -2,7 +2,7 @@ Harness status: OKFound 3 tests-3 Fail-Fail precommitHandler for a traverse navigation, reject before commit-Fail precommitHandler for a traverse navigation, reject after commit-Fail precommitHandler for a traverse navigation, success\ No newline at end of file+3 Pass+Pass precommitHandler for a traverse navigation, reject before commit+Pass precommitHandler for a traverse navigation, reject after commit+Pass precommitHandler for a traverse navigation, success\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-uncancelable.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-uncancelable.txtindex 6c0b2631535..67398266b96 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-uncancelable.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/precommit-handler/precommitHandler-uncancelable.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail precommitHandler for an uncancelable traverse navigation\ No newline at end of file+1 Pass+Pass precommitHandler for an uncancelable traverse navigation\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/scroll-behavior/manual-scroll-in-precommit-handler.txt b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/scroll-behavior/manual-scroll-in-precommit-handler.txtindex 48a0ad11fa1..1e720d658df 100644--- a/Tests/LibWeb/Text/expected/wpt-import/navigation-api/scroll-behavior/manual-scroll-in-precommit-handler.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/navigation-api/scroll-behavior/manual-scroll-in-precommit-handler.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail scroll: scroll() in precommitHandler throws\ No newline at end of file+1 Pass+Pass scroll: scroll() in precommitHandler throws\ No newline at end of file