Skip to content

Truly independent web browser

3.6 KB
Raw Blame
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window
[Global=Window, Exposed=Window, LegacyUnenumerableNamedProperties]
interface Window : EventTarget {
    // the current browsing context
    [LegacyUnforgeable] readonly attribute WindowProxy window;
    [Replaceable] readonly attribute WindowProxy self;
    [LegacyUnforgeable, CachedAttribute] readonly attribute Document document;
    attribute DOMString name;
    [PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
    readonly attribute History history;
    [Replaceable] readonly attribute Navigation navigation;
    readonly attribute CustomElementRegistry customElements;
    [Replaceable] readonly attribute BarProp locationbar;
    [Replaceable] readonly attribute BarProp menubar;
    [Replaceable] readonly attribute BarProp personalbar;
    [Replaceable] readonly attribute BarProp scrollbars;
    [Replaceable] readonly attribute BarProp statusbar;
    [Replaceable] readonly attribute BarProp toolbar;
    attribute DOMString status;
    undefined close();
    readonly attribute boolean closed;
    undefined stop();
    undefined focus();
    undefined blur();

    // other browsing contexts
    [Replaceable] readonly attribute WindowProxy frames;
    [Replaceable] readonly attribute unsigned long length;
    [LegacyUnforgeable] readonly attribute WindowProxy? top;
    attribute any opener;
    [Replaceable] readonly attribute WindowProxy? parent;
    readonly attribute Element? frameElement;
    WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = "");

    // Since this is the global object, the IDL named getter adds a NamedPropertiesObject exotic
    // object on the prototype chain. Indeed, this does not make the global object an exotic object.
    // Indexed access is taken care of by the WindowProxy exotic object.
    getter object (DOMString name);

    // the user agent
    readonly attribute Navigator navigator;
    [Replaceable, ImplementedAs=navigator] readonly attribute Navigator clientInformation; // legacy alias of .navigator
    readonly attribute boolean originAgentCluster;

    // user prompts
    undefined alert();
    undefined alert(DOMString message);
    boolean confirm(optional DOMString message = "");
    DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
    undefined print();

    [NeedsCallerRealm] undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
    [NeedsCallerRealm, ImplementedInBindings] undefined postMessage(any message, optional WindowPostMessageOptions options = {});

    // also has obsolete members
};

dictionary WindowPostMessageOptions : StructuredSerializeOptions {
    USVString targetOrigin = "/";
};

// https://dom.spec.whatwg.org/#interface-window-extensions
partial interface Window {
    [Replaceable] readonly attribute (Event or undefined) event; // legacy
};

// https://w3c.github.io/requestidlecallback/#window_extensions
partial interface Window {
    [ImplementedInBindings] unsigned long requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options = {});
    undefined cancelIdleCallback(unsigned long handle);
};

// AD-HOC: Non-standard extensions that other browsers implement.
partial interface Window {
    boolean find(optional DOMString string = "");
};

Window includes AnimationFrameProvider;
Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;
Window includes WindowLocalStorage;
Window includes WindowOrWorkerGlobalScope;
Window includes WindowSessionStorage;