1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibWeb: Add NavigateEvent, the main event of the Navigation API

This event is the star of the show, and the main way that web content
can react to either programmatic or user-initiated navigation.

All of the fun algorithms will have to come later though.
This commit is contained in:
Andrew Kaster 2023-08-23 18:40:42 -06:00 committed by Andrew Kaster
parent 5374fbfbcf
commit d1aea87889
9 changed files with 408 additions and 0 deletions

View file

@ -0,0 +1,56 @@
#import <DOM/AbortSignal.idl>
#import <DOM/Event.idl>
#import <HTML/NavigationDestination.idl>
#import <HTML/NavigationType.idl>
#import <XHR/FormData.idl>
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-navigateevent-interface
[Exposed=Window, UseNewAKString]
interface NavigateEvent : Event {
constructor(DOMString type, NavigateEventInit eventInitDict);
readonly attribute NavigationType navigationType;
readonly attribute NavigationDestination destination;
readonly attribute boolean canIntercept;
readonly attribute boolean userInitiated;
readonly attribute boolean hashChange;
readonly attribute AbortSignal signal;
readonly attribute FormData? formData;
readonly attribute DOMString? downloadRequest;
readonly attribute any info;
readonly attribute boolean hasUAVisualTransition;
undefined intercept(optional NavigationInterceptOptions options = {});
undefined scroll();
};
dictionary NavigateEventInit : EventInit {
NavigationType navigationType = "push";
required NavigationDestination destination;
boolean canIntercept = false;
boolean userInitiated = false;
boolean hashChange = false;
required AbortSignal signal;
FormData? formData = null;
DOMString? downloadRequest = null;
any info;
boolean hasUAVisualTransition = false;
};
dictionary NavigationInterceptOptions {
NavigationInterceptHandler handler;
NavigationFocusReset focusReset;
NavigationScrollBehavior scroll;
};
enum NavigationFocusReset {
"after-transition",
"manual"
};
enum NavigationScrollBehavior {
"after-transition",
"manual"
};
callback NavigationInterceptHandler = Promise<undefined> ();