Bug 1867190 - Initialise the PHC allocate delay later r=glandium
[gecko.git] / dom / chrome-webidl / WindowGlobalActors.webidl
blobaa1647e86d9469f2153f642f9aa62b096549456a
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 interface Principal;
7 interface URI;
8 interface nsIDocShell;
9 interface RemoteTab;
10 interface nsIDOMProcessParent;
12 [Exposed=Window, ChromeOnly]
13 interface WindowContext {
14   readonly attribute BrowsingContext? browsingContext;
16   readonly attribute WindowGlobalChild? windowGlobalChild; // in-process only
18   readonly attribute unsigned long long innerWindowId;
20   readonly attribute WindowContext? parentWindowContext;
22   readonly attribute WindowContext topWindowContext;
24   readonly attribute boolean isInProcess;
26   // True if this WindowContext is currently frozen in the BFCache.
27   readonly attribute boolean isInBFCache;
29   // True if this window has registered a "beforeunload" event handler.
30   readonly attribute boolean hasBeforeUnload;
32   // True if the principal of this window is for a local ip address.
33   readonly attribute boolean isLocalIP;
35   readonly attribute boolean shouldResistFingerprinting;
37   // The granular fingerprinting protection overrides for the context. We will
38   // use the granular overrides to decide which fingerprinting protection we
39   // want to enable in the context due to the WebCompat reason. The value can be
40   // null, which means we are using default fingerprinting protection in the
41   // context.
42   [BinaryName="OverriddenFingerprintingSettingsWebIDL"]
43   readonly attribute unsigned long long? overriddenFingerprintingSettings;
45   /**
46    * Partially determines whether script execution is allowed in this
47    * BrowsingContext. Script execution will be permitted only if this
48    * attribute is true and script execution is allowed in the owner
49    * BrowsingContext.
50    *
51    * May only be set in the context's owning process.
52    */
53   [SetterThrows] attribute boolean allowJavascript;
56 // Keep this in sync with nsIDocumentViewer::PermitUnloadAction.
57 enum PermitUnloadAction {
58   "prompt",
59   "dontUnload",
60   "unload",
63 [Exposed=Window, ChromeOnly]
64 interface WindowGlobalParent : WindowContext {
65   readonly attribute boolean isClosed;
67   readonly attribute boolean isCurrentGlobal;
69   readonly attribute unsigned long long outerWindowId;
70   readonly attribute unsigned long long contentParentId;
72   readonly attribute long osPid;
74   // A WindowGlobalParent is the root in its process if it has no parent, or its
75   // embedder is in a different process.
76   readonly attribute boolean isProcessRoot;
78   // Is the document loaded in this WindowGlobalParent the initial document
79   // implicitly created while "creating a new browsing context".
80   // https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-browsing-context
81   readonly attribute boolean isInitialDocument;
83   readonly attribute FrameLoader? rootFrameLoader; // Embedded (browser) only
85   readonly attribute WindowGlobalChild? childActor; // in-process only
87   // Checks for any WindowContexts with "beforeunload" listeners in this
88   // WindowGlobal's subtree. If any exist, a "beforeunload" event is
89   // dispatched to them. If any of those request to block the navigation,
90   // displays a prompt to the user. Returns a boolean which resolves to true
91   // if the navigation should be allowed.
92   //
93   // If `timeout` is greater than 0, it is the maximum time (in milliseconds)
94   // we will wait for a child process to respond with a request to block
95   // navigation before proceeding. If the user needs to be prompted, however,
96   // the promise will not resolve until the user has responded, regardless of
97   // the timeout.
98   [NewObject]
99   Promise<boolean> permitUnload(optional PermitUnloadAction action = "prompt",
100                                 optional unsigned long timeout = 0);
102   // Information about the currently loaded document.
103   readonly attribute Principal documentPrincipal;
104   readonly attribute Principal documentStoragePrincipal;
105   readonly attribute Principal? contentBlockingAllowListPrincipal;
106   readonly attribute URI? documentURI;
107   readonly attribute DOMString documentTitle;
108   readonly attribute nsICookieJarSettings? cookieJarSettings;
110   // True if the the currently loaded document is in fullscreen.
111   attribute boolean fullscreen;
113   // Bit mask containing content blocking events that are recorded in
114   // the document's content blocking log.
115   readonly attribute unsigned long contentBlockingEvents;
117   // String containing serialized content blocking log.
118   readonly attribute DOMString contentBlockingLog;
120   // DOM Process which this window was loaded in. Will be either InProcessParent
121   // for windows loaded in the parent process, or ContentParent for windows
122   // loaded in the content process.
123   readonly attribute nsIDOMProcessParent? domProcess;
125   static WindowGlobalParent? getByInnerWindowId(unsigned long long innerWindowId);
127   /**
128    * Get or create the JSWindowActor with the given name.
129    *
130    * See WindowActorOptions from JSWindowActor.webidl for details on how to
131    * customize actor creation.
132    */
133   [Throws]
134   JSWindowActorParent getActor(UTF8String name);
135   JSWindowActorParent? getExistingActor(UTF8String name);
137   /**
138    * Renders a region of the frame into an image bitmap.
139    *
140    * @param rect Specify the area of the document to render, in CSS pixels,
141    * relative to the page. If null, the currently visible viewport is rendered.
142    * @param scale The scale to render the window at. Use devicePixelRatio
143    * to have comparable rendering to the OS.
144    * @param backgroundColor The background color to use.
145    * @param resetScrollPosition If true, temporarily resets the scroll position
146    * of the root scroll frame to 0, such that position:fixed elements are drawn
147    * at their initial position. This parameter only takes effect when passing a
148    * non-null rect.
149    *
150    * This API can only be used in the parent process, as content processes
151    * cannot access the rendering of out of process iframes. This API works
152    * with remote and local frames.
153    */
154   [NewObject]
155   Promise<ImageBitmap> drawSnapshot(DOMRect? rect,
156                                     double scale,
157                                     UTF8String backgroundColor,
158                                     optional boolean resetScrollPosition = false);
160   // True if any of the windows in the subtree rooted at this window
161   // has active peer connections.  If this is called for a non-top-level
162   // context, it always returns false.
163   boolean hasActivePeerConnections();
166 [Exposed=Window, ChromeOnly]
167 interface WindowGlobalChild {
168   readonly attribute boolean isClosed;
169   readonly attribute boolean isInProcess;
170   readonly attribute BrowsingContext browsingContext;
171   readonly attribute WindowContext windowContext;
173   readonly attribute boolean isCurrentGlobal;
175   readonly attribute unsigned long long innerWindowId;
176   readonly attribute unsigned long long outerWindowId;
177   readonly attribute unsigned long long contentParentId;
179   // A WindowGlobalChild is the root in its process if it has no parent, or its
180   // embedder is in a different process.
181   readonly attribute boolean isProcessRoot;
183   // Is this WindowGlobalChild same-origin with `window.top`?
184   readonly attribute boolean sameOriginWithTop;
186   readonly attribute WindowGlobalParent? parentActor; // in-process only
188   static WindowGlobalChild? getByInnerWindowId(unsigned long long innerWIndowId);
190   BrowsingContext? findBrowsingContextWithName(DOMString name);
192   /**
193    * Get or create the JSWindowActor with the given name.
194    *
195    * See WindowActorOptions from JSWindowActor.webidl for details on how to
196    * customize actor creation.
197    */
198   [Throws]
199   JSWindowActorChild getActor(UTF8String name);
200   JSWindowActorChild? getExistingActor(UTF8String name);