WindowGlobalActors.webidl (8645B)
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/. */ 5 6 interface Principal; 7 interface URI; 8 interface nsIDocShell; 9 interface RemoteTab; 10 interface nsIDOMProcessParent; 11 interface nsIRFPTargetSetIDL; 12 13 [Exposed=Window, ChromeOnly] 14 interface WindowContext { 15 readonly attribute BrowsingContext? browsingContext; 16 17 readonly attribute WindowGlobalChild? windowGlobalChild; // in-process only 18 19 readonly attribute unsigned long long innerWindowId; 20 21 readonly attribute WindowContext? parentWindowContext; 22 23 readonly attribute WindowContext topWindowContext; 24 25 readonly attribute boolean isInProcess; 26 27 // True if this WindowContext is currently frozen in the BFCache. 28 readonly attribute boolean isInBFCache; 29 30 // True if this window has registered a "beforeunload" event handler, and/or 31 // if this context is top level and has registered a "navigate" event handler. 32 readonly attribute boolean hasBeforeUnload; 33 34 // True if the principal of this window is for a local ip address. 35 readonly attribute boolean isLocalIP; 36 37 // True if the principal of this window has an active CloseWatcher 38 readonly attribute boolean hasActiveCloseWatcher; 39 40 // Request the windows CloseWatcher manager to close the top-most CloseWatcher 41 undefined processCloseRequest(); 42 43 readonly attribute boolean shouldResistFingerprinting; 44 45 // True if this window is using unpartitioned cookies. 46 readonly attribute boolean usingStorageAccess; 47 48 // The granular fingerprinting protection overrides for the context. We will 49 // use the granular overrides to decide which fingerprinting protection we 50 // want to enable in the context due to the WebCompat reason. The value can be 51 // null, which means we are using default fingerprinting protection in the 52 // context. 53 [BinaryName="OverriddenFingerprintingSettingsWebIDL"] 54 readonly attribute nsIRFPTargetSetIDL? overriddenFingerprintingSettings; 55 56 /** 57 * Partially determines whether script execution is allowed in this 58 * BrowsingContext. Script execution will be permitted only if this 59 * attribute is true and script execution is allowed in the owner 60 * BrowsingContext. 61 * 62 * May only be set in the context's owning process. 63 */ 64 [SetterThrows] attribute boolean allowJavascript; 65 }; 66 67 // Keep this in sync with nsIDocumentViewer::PermitUnloadAction. 68 enum PermitUnloadAction { 69 "prompt", 70 "dontUnload", 71 "unload", 72 }; 73 74 [Exposed=Window, ChromeOnly] 75 interface WindowGlobalParent : WindowContext { 76 readonly attribute boolean isClosed; 77 78 readonly attribute boolean isCurrentGlobal; 79 80 // This should return true if the window is currently visible in its tab. 81 // (A more technically accurate name would be something like 82 // "isActiveInRootNavigable".) 83 readonly attribute boolean isActiveInTab; 84 85 readonly attribute unsigned long long outerWindowId; 86 readonly attribute unsigned long long contentParentId; 87 88 readonly attribute long osPid; 89 90 // A WindowGlobalParent is the root in its process if it has no parent, or its 91 // embedder is in a different process. 92 readonly attribute boolean isProcessRoot; 93 94 // True if the document loaded in this WindowGlobalParent has the 95 // isInitialDocument flag set. 96 readonly attribute boolean isInitialDocument; 97 98 // True if the document loaded in this WindowGlobalParent has the 99 // isUncommittedInitialDocument flag set. 100 readonly attribute boolean isUncommittedInitialDocument; 101 102 readonly attribute FrameLoader? rootFrameLoader; // Embedded (browser) only 103 104 readonly attribute WindowGlobalChild? childActor; // in-process only 105 106 // Checks for any WindowContexts with "beforeunload" listeners in this 107 // WindowGlobal's subtree. If any exist, a "beforeunload" event is 108 // dispatched to them. If any of those request to block the navigation, 109 // displays a prompt to the user. Returns a boolean which resolves to true 110 // if the navigation should be allowed. 111 // 112 // If `timeout` is greater than 0, it is the maximum time (in milliseconds) 113 // we will wait for a child process to respond with a request to block 114 // navigation before proceeding. If the user needs to be prompted, however, 115 // the promise will not resolve until the user has responded, regardless of 116 // the timeout. 117 [NewObject] 118 Promise<boolean> permitUnload(optional PermitUnloadAction action = "prompt", 119 optional unsigned long timeout = 0); 120 121 // Information about the currently loaded document. 122 readonly attribute Principal documentPrincipal; 123 readonly attribute Principal documentStoragePrincipal; 124 readonly attribute Principal? contentBlockingAllowListPrincipal; 125 readonly attribute URI? documentURI; 126 readonly attribute DOMString documentTitle; 127 readonly attribute nsICookieJarSettings? cookieJarSettings; 128 129 // True if the the currently loaded document is in fullscreen. 130 attribute boolean fullscreen; 131 132 // Bit mask containing content blocking events that are recorded in 133 // the document's content blocking log. 134 readonly attribute unsigned long contentBlockingEvents; 135 136 // String containing serialized content blocking log. 137 readonly attribute DOMString contentBlockingLog; 138 139 // DOM Process which this window was loaded in. Will be either InProcessParent 140 // for windows loaded in the parent process, or ContentParent for windows 141 // loaded in the content process. 142 readonly attribute nsIDOMProcessParent? domProcess; 143 144 static WindowGlobalParent? getByInnerWindowId(unsigned long long innerWindowId); 145 146 /** 147 * Get or create the JSWindowActor with the given name. 148 * 149 * See WindowActorOptions from JSWindowActor.webidl for details on how to 150 * customize actor creation. 151 */ 152 [Throws] 153 JSWindowActorParent getActor(UTF8String name); 154 JSWindowActorParent? getExistingActor(UTF8String name); 155 156 /** 157 * Renders a region of the frame into an image bitmap. 158 * 159 * @param rect Specify the area of the document to render, in CSS pixels, 160 * relative to the page. If null, the currently visible viewport is rendered. 161 * @param scale The scale to render the window at. Use devicePixelRatio 162 * to have comparable rendering to the OS. 163 * @param backgroundColor The background color to use. 164 * @param resetScrollPosition If true, temporarily resets the scroll position 165 * of the root scroll frame to 0, such that position:fixed elements are drawn 166 * at their initial position. This parameter only takes effect when passing a 167 * non-null rect. 168 * 169 * This API can only be used in the parent process, as content processes 170 * cannot access the rendering of out of process iframes. This API works 171 * with remote and local frames. 172 */ 173 [NewObject] 174 Promise<ImageBitmap> drawSnapshot(DOMRect? rect, 175 double scale, 176 UTF8String backgroundColor, 177 optional boolean resetScrollPosition = false); 178 179 // True if any of the windows in the subtree rooted at this window 180 // has active peer connections. If this is called for a non-top-level 181 // context, it always returns false. 182 boolean hasActivePeerConnections(); 183 }; 184 185 [Exposed=Window, ChromeOnly] 186 interface WindowGlobalChild { 187 readonly attribute boolean isClosed; 188 readonly attribute boolean isInProcess; 189 readonly attribute BrowsingContext browsingContext; 190 readonly attribute WindowContext windowContext; 191 readonly attribute WindowProxy? contentWindow; 192 193 readonly attribute boolean isCurrentGlobal; 194 195 readonly attribute unsigned long long innerWindowId; 196 readonly attribute unsigned long long outerWindowId; 197 readonly attribute unsigned long long contentParentId; 198 199 // A WindowGlobalChild is the root in its process if it has no parent, or its 200 // embedder is in a different process. 201 readonly attribute boolean isProcessRoot; 202 203 // Is this WindowGlobalChild same-origin with `window.top`? 204 readonly attribute boolean sameOriginWithTop; 205 206 readonly attribute WindowGlobalParent? parentActor; // in-process only 207 208 static WindowGlobalChild? getByInnerWindowId(unsigned long long innerWIndowId); 209 210 BrowsingContext? findBrowsingContextWithName(DOMString name); 211 212 /** 213 * Get or create the JSWindowActor with the given name. 214 * 215 * See WindowActorOptions from JSWindowActor.webidl for details on how to 216 * customize actor creation. 217 */ 218 [Throws] 219 JSWindowActorChild getActor(UTF8String name); 220 JSWindowActorChild? getExistingActor(UTF8String name); 221 };