[
  EnabledBySetting=NavigationAPIEnabled,
  GenerateIsReachable=ReachableFromDOMWindow,
  Exposed=Window
] interface Navigation : EventTarget {
  sequence<NavigationHistoryEntry> entries();
  readonly attribute NavigationHistoryEntry? currentEntry;
  undefined updateCurrentEntry(NavigationUpdateCurrentEntryOptions options);
  readonly attribute NavigationTransition? transition;
  readonly attribute NavigationActivation? activation;

  readonly attribute boolean canGoBack;
  readonly attribute boolean canGoForward;

  [ReturnsPromisePair] NavigationResult navigate(USVString url, optional NavigationNavigateOptions options = {});
  [ReturnsPromisePair] NavigationResult reload(optional NavigationReloadOptions options = {});

  [ReturnsPromisePair] NavigationResult traverseTo(DOMString key, optional NavigationOptions options = {});
  [ReturnsPromisePair] NavigationResult back(optional NavigationOptions options = {});
  [ReturnsPromisePair] 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;
};

[
    JSGenerateToJSObject,
] 
dictionary NavigationResult {
  [BypassDocumentFullyActiveCheck] Promise<NavigationHistoryEntry> committed;
  [BypassDocumentFullyActiveCheck] Promise<NavigationHistoryEntry> finished;
};

enum NavigationHistoryBehavior {
  "auto",
  "push",
  "replace"
};
