LibWeb: Implement the "check if unloading is canceled" AO

This method is responsible for firing `beforeunload` events.
This commit is contained in:
Tim Ledbetter 2024-10-02 23:56:26 +01:00 committed by Andreas Kling
commit 1fa948f114
Notes: github-actions[bot] 2024-10-05 07:18:28 +00:00
7 changed files with 231 additions and 8 deletions

View file

@ -97,6 +97,13 @@ public:
void paint(Web::DevicePixelRect const&, Painting::BackingStore&, Web::PaintOptions);
enum class CheckIfUnloadingIsCanceledResult {
CanceledByBeforeUnload,
CanceledByNavigate,
Continue,
};
CheckIfUnloadingIsCanceledResult check_if_unloading_is_canceled(Vector<JS::Handle<Navigable>> navigables_that_need_before_unload);
private:
TraversableNavigable(JS::NonnullGCPtr<Page>);
@ -112,6 +119,8 @@ private:
Optional<Bindings::NavigationType> navigation_type,
SynchronousNavigation);
CheckIfUnloadingIsCanceledResult check_if_unloading_is_canceled(Vector<JS::Handle<Navigable>> navigables_that_need_before_unload, JS::GCPtr<TraversableNavigable> traversable, Optional<int> target_step, Optional<UserNavigationInvolvement> user_involvement_for_navigate_events);
Vector<JS::NonnullGCPtr<SessionHistoryEntry>> get_session_history_entries_for_the_navigation_api(JS::NonnullGCPtr<Navigable>, int);
[[nodiscard]] bool can_go_forward() const;