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 file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
10 interface nsIDocShell;
11 interface nsIPrintSettings;
12 interface nsIWebBrowserPersistDocumentReceiver;
13 interface nsIWebProgressListener;
16 interface FrameLoader {
18 * Get the docshell from the frame loader.
21 readonly attribute nsIDocShell? docShell;
24 * Get this frame loader's TabParent, if it has a remote frame. Otherwise,
27 readonly attribute TabParent? tabParent;
30 * Get an nsILoadContext for the top-level docshell. For remote
31 * frames, a shim is returned that contains private browsing and app
34 readonly attribute LoadContext loadContext;
37 * Get the root BrowsingContext within the frame.
38 * This may be null immediately after creating a remote frame.
40 readonly attribute BrowsingContext? browsingContext;
43 * Get the ParentSHistory for the nsFrameLoader. May return null if this
44 * frameloader is not for a toplevel frame.
46 readonly attribute ParentSHistory? parentSHistory;
49 * Find out whether the loader's frame is at too great a depth in
50 * the frame tree. This can be used to decide what operations may
51 * or may not be allowed on the loader's docshell.
54 readonly attribute boolean depthTooGreat;
57 * Activate remote frame.
58 * Throws an exception with non-remote frames.
61 void activateRemoteFrame();
64 * Deactivate remote frame.
65 * Throws an exception with non-remote frames.
68 void deactivateRemoteFrame();
71 * @see nsIDOMWindowUtils sendMouseEvent.
74 void sendCrossProcessMouseEvent(DOMString aType,
80 optional boolean aIgnoreRootScrollFrame = false);
83 * Activate event forwarding from client (remote frame) to parent.
86 void activateFrameEvent(DOMString aType, boolean capture);
88 // Note, when frameloaders are swapped, also messageManagers are swapped.
89 readonly attribute MessageSender? messageManager;
92 * Request that the next time a remote layer transaction has been
93 * received by the Compositor, a MozAfterRemoteFrame event be sent
96 void requestNotifyAfterRemotePaint();
99 * Force a remote browser to recompute its dimension and screen position.
102 void requestUpdatePosition();
105 * Print the current document.
107 * @param aOuterWindowID the ID of the outer window to print
108 * @param aPrintSettings optional print settings to use; printSilent can be
109 * set to prevent prompting.
110 * @param aProgressListener optional print progress listener.
113 void print(unsigned long long aOuterWindowID,
114 nsIPrintSettings aPrintSettings,
115 optional nsIWebProgressListener? aProgressListener = null);
118 * Renders a region of the frame into an image bitmap.
123 * @param h Specify the area of the window to render, in CSS
124 * pixels. This is relative to the current scroll position.
125 * @param scale The scale to render the window at. Use devicePixelRatio
126 * to have comparable rendering to the OS.
127 * @param backgroundColor The background color to use.
129 * This API can only be used in the parent process, as content processes
130 * cannot access the rendering of out of process iframes. This API works
131 * with remote and local frames.
134 Promise<ImageBitmap> drawSnapshot(double x,
139 DOMString backgroundColor);
142 * The element which owns this frame loader.
144 * For example, if this is a frame loader for an <iframe>, this attribute
145 * returns the iframe element.
148 readonly attribute Element? ownerElement;
152 * Cached childID of the ContentParent owning the TabParent in this frame
153 * loader. This can be used to obtain the childID after the TabParent died.
156 readonly attribute unsigned long long childID;
159 * Find out whether the owner content really is a mozbrowser. <xul:browser>
160 * is not considered to be a mozbrowser frame.
163 readonly attribute boolean ownerIsMozBrowserFrame;
166 * The last known width of the frame. Reading this property will not trigger
167 * a reflow, and therefore may not reflect the current state of things. It
168 * should only be used in asynchronous APIs where values are not guaranteed
169 * to be up-to-date when received.
172 readonly attribute unsigned long lazyWidth;
175 * The last known height of the frame. Reading this property will not trigger
176 * a reflow, and therefore may not reflect the current state of things. It
177 * should only be used in asynchronous APIs where values are not guaranteed
178 * to be up-to-date when received.
181 readonly attribute unsigned long lazyHeight;
184 * Is `true` if the frameloader is dead (destroy has been called on it)
187 readonly attribute boolean isDead;
191 * Interface for objects which represent a document that can be
192 * serialized with nsIWebBrowserPersist. This interface is
193 * asynchronous because the actual document can be in another process
194 * (e.g., if this object is a FrameLoader for an out-of-process
197 * XXXbz This method should really just return a Promise...
199 * @see nsIWebBrowserPersistDocumentReceiver
200 * @see nsIWebBrowserPersistDocument
201 * @see nsIWebBrowserPersist
203 * @param aOuterWindowID
204 * The outer window ID of the subframe we'd like to persist.
205 * If set at 0, WebBrowserPersistable will attempt to persist
206 * the top-level document. If the outer window ID is for a subframe
207 * that does not exist, or is not held beneath the WebBrowserPersistable,
208 * aRecv's onError method will be called with NS_ERROR_NO_CONTENT.
210 * The nsIWebBrowserPersistDocumentReceiver is a callback that
211 * will be fired once the document is ready for persisting.
214 interface WebBrowserPersistable
217 void startPersistence(unsigned long long aOuterWindowID,
218 nsIWebBrowserPersistDocumentReceiver aRecv);
221 FrameLoader implements WebBrowserPersistable;