1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibWeb: Implement the inner navigate event firing algorithm

This algorithm is the meat of firing the NavigateEvent at navigation.
In order to implement it, we also need to add some getters/setters on
NavigateEvent. The implemetentation deviates from the spec in when
exactly the NavigateEvent is created. In following the pattern for other
events. we construct the event from the NavigateEventInit structure from
our native code. This makes the code a lot simpler than adding 10
getters to the NavigateEvent that are only ever used just after
construction. I'm not 100% conviced the promise resolution code is
correct, but we can add tests for that later :^).
This commit is contained in:
Andrew Kaster 2023-09-22 18:35:11 -06:00 committed by Alexander Kalenik
parent 0650edc7d7
commit 3935105d0a
3 changed files with 366 additions and 7 deletions

View file

@ -10,6 +10,8 @@
#include <LibWeb/Bindings/NavigationPrototype.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
#include <LibWeb/HTML/Navigable.h>
#include <LibWeb/HTML/NavigationType.h>
#include <LibWeb/HTML/StructuredSerialize.h>
namespace Web::HTML {
@ -133,6 +135,14 @@ private:
void reject_the_finished_promise(JS::NonnullGCPtr<NavigationAPIMethodTracker>, JS::Value exception);
void clean_up(JS::NonnullGCPtr<NavigationAPIMethodTracker>);
bool inner_navigate_event_firing_algorithm(
Bindings::NavigationType,
JS::NonnullGCPtr<NavigationDestination>,
UserNavigationInvolvement,
Optional<Vector<XHR::FormDataEntry>&> form_data_entry_list,
Optional<String> download_request_filename,
Optional<SerializationRecord> classic_history_api_state);
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-entry-list
// Each Navigation has an associated entry list, a list of NavigationHistoryEntry objects, initially empty.
Vector<JS::NonnullGCPtr<NavigationHistoryEntry>> m_entry_list;