1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

LibWeb: Implement the start of the Navigation API

This API is how JavaScript can manipulate the new Navigable concepts
directly. We are still missing most of the interesting algorithms on
Navigation that do the actual navigation steps, and call into the
currently WIP navigable AOs.
This commit is contained in:
Andrew Kaster 2023-08-23 10:57:12 -06:00 committed by Andrew Kaster
parent 51c2835044
commit 0c2f758067
9 changed files with 378 additions and 0 deletions

View file

@ -0,0 +1,56 @@
#import <DOM/EventHandler.idl>
#import <DOM/EventTarget.idl>
#import <HTML/NavigationHistoryEntry.idl>
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-interface
[Exposed=Window]
interface Navigation : EventTarget {
sequence<NavigationHistoryEntry> entries();
readonly attribute NavigationHistoryEntry? currentEntry;
undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options);
// FIXME: readonly attribute NavigationTransition? transition;
readonly attribute boolean canGoBack;
readonly attribute boolean canGoForward;
// TODO: Actually implement navigation algorithms
// NavigationResult navigate(USVString url, optional NavigationNavigateOptions options = {});
// NavigationResult reload(optional NavigationReloadOptions options = {});
// NavigationResult traverseTo(DOMString key, optional NavigationOptions options = {});
// NavigationResult back(optional NavigationOptions options = {});
// NavigationResult forward(optional NavigationOptions options = {});
attribute EventHandler onnavigate;
attribute EventHandler onnavigatesuccess;
attribute EventHandler onnavigateerror;
attribute EventHandler oncurrententrychange;
};
dictionary NavigationUpdateCurrentEntryOptions {
required any state;
};
dictionary NavigationOptions {
any info;
};
dictionary NavigationNavigateOptions : NavigationOptions {
any state;
NavigationHistoryBehavior history = "auto";
};
dictionary NavigationReloadOptions : NavigationOptions {
any state;
};
dictionary NavigationResult {
Promise<NavigationHistoryEntry> committed;
Promise<NavigationHistoryEntry> finished;
};
enum NavigationHistoryBehavior {
"auto",
"push",
"replace"
};