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/.
5 */
6
7// invalid widl
8//interface LoadContext;
9//interface TabParent;
10//interface URI;
11//interface nsIDocShell;
12//interface nsIPrintSettings;
13//interface nsIWebBrowserPersistDocumentReceiver;
14//interface nsIWebProgressListener;
15
16[ChromeOnly]
17interface FrameLoader {
18  /**
19   * Get the docshell from the frame loader.
20   */
21  [GetterThrows]
22  readonly attribute nsIDocShell? docShell;
23
24  /**
25   * Get this frame loader's TabParent, if it has a remote frame.  Otherwise,
26   * returns null.
27   */
28  readonly attribute TabParent? tabParent;
29
30  /**
31   * Get an nsILoadContext for the top-level docshell. For remote
32   * frames, a shim is returned that contains private browsing and app
33   * information.
34   */
35  readonly attribute LoadContext loadContext;
36
37  /**
38   * Get the ParentSHistory for the nsFrameLoader. May return null if this
39   * frameloader is not for a toplevel frame.
40   */
41  readonly attribute ParentSHistory? parentSHistory;
42
43  /**
44   * Adds a blocking promise for the current cross process navigation.
45   * This method can only be called while the "BrowserWillChangeProcess" event
46   * is being fired.
47   */
48  [Throws]
49  void addProcessChangeBlockingPromise(Promise<any> aPromise);
50
51  /**
52   * Find out whether the loader's frame is at too great a depth in
53   * the frame tree.  This can be used to decide what operations may
54   * or may not be allowed on the loader's docshell.
55   */
56  [Pure]
57  readonly attribute boolean depthTooGreat;
58
59  /**
60   * Activate remote frame.
61   * Throws an exception with non-remote frames.
62   */
63  [Throws]
64  void activateRemoteFrame();
65
66  /**
67   * Deactivate remote frame.
68   * Throws an exception with non-remote frames.
69   */
70  [Throws]
71  void deactivateRemoteFrame();
72
73  /**
74   * @see nsIDOMWindowUtils sendMouseEvent.
75   */
76  [Throws]
77  void sendCrossProcessMouseEvent(DOMString aType,
78                                  float aX,
79                                  float aY,
80                                  long aButton,
81                                  long aClickCount,
82                                  long aModifiers,
83                                  optional boolean aIgnoreRootScrollFrame = false);
84
85  /**
86   * Activate event forwarding from client (remote frame) to parent.
87   */
88  [Throws]
89  void activateFrameEvent(DOMString aType, boolean capture);
90
91  // Note, when frameloaders are swapped, also messageManagers are swapped.
92  readonly attribute MessageSender? messageManager;
93
94  /**
95   * Request that the next time a remote layer transaction has been
96   * received by the Compositor, a MozAfterRemoteFrame event be sent
97   * to the window.
98   */
99  void requestNotifyAfterRemotePaint();
100
101  /**
102   * Close the window through the ownerElement.
103   */
104  [Throws]
105  void requestFrameLoaderClose();
106
107  /**
108   * Force a remote browser to recompute its dimension and screen position.
109   */
110  [Throws]
111  void requestUpdatePosition();
112
113  /**
114   * Print the current document.
115   *
116   * @param aOuterWindowID the ID of the outer window to print
117   * @param aPrintSettings optional print settings to use; printSilent can be
118   *                       set to prevent prompting.
119   * @param aProgressListener optional print progress listener.
120   */
121  [Throws]
122  void print(unsigned long long aOuterWindowID,
123             nsIPrintSettings aPrintSettings,
124             optional nsIWebProgressListener? aProgressListener = null);
125
126  /**
127   * If false, then the subdocument is not clipped to its CSS viewport, and the
128   * subdocument's viewport scrollbar(s) are not rendered.
129   * Defaults to true.
130   */
131  attribute boolean clipSubdocument;
132
133  /**
134   * If false, then the subdocument's scroll coordinates will not be clamped
135   * to their scroll boundaries.
136   * Defaults to true.
137   */
138  attribute boolean clampScrollPosition;
139
140  /**
141   * The element which owns this frame loader.
142   *
143   * For example, if this is a frame loader for an <iframe>, this attribute
144   * returns the iframe element.
145   */
146  [Pure]
147  readonly attribute Element? ownerElement;
148
149
150  /**
151   * Cached childID of the ContentParent owning the TabParent in this frame
152   * loader. This can be used to obtain the childID after the TabParent died.
153   */
154  [Pure]
155  readonly attribute unsigned long long childID;
156
157  /**
158   * Find out whether the owner content really is a mozbrowser. <xul:browser>
159   * is not considered to be a mozbrowser frame.
160   */
161  [Pure]
162  readonly attribute boolean ownerIsMozBrowserFrame;
163
164  /**
165   * The last known width of the frame. Reading this property will not trigger
166   * a reflow, and therefore may not reflect the current state of things. It
167   * should only be used in asynchronous APIs where values are not guaranteed
168   * to be up-to-date when received.
169   */
170  [Pure]
171  readonly attribute unsigned long lazyWidth;
172
173  /**
174   * The last known height of the frame. Reading this property will not trigger
175   * a reflow, and therefore may not reflect the current state of things. It
176   * should only be used in asynchronous APIs where values are not guaranteed
177   * to be up-to-date when received.
178   */
179  [Pure]
180  readonly attribute unsigned long lazyHeight;
181
182  /**
183   * Is `true` if the frameloader is dead (destroy has been called on it)
184   */
185  [Pure]
186  readonly attribute boolean isDead;
187};
188
189/**
190 * Interface for objects which represent a document that can be
191 * serialized with nsIWebBrowserPersist.  This interface is
192 * asynchronous because the actual document can be in another process
193 * (e.g., if this object is a FrameLoader for an out-of-process
194 * frame).
195 *
196 * XXXbz This method should really just return a Promise...
197 *
198 * @see nsIWebBrowserPersistDocumentReceiver
199 * @see nsIWebBrowserPersistDocument
200 * @see nsIWebBrowserPersist
201 *
202 * @param aOuterWindowID
203 *        The outer window ID of the subframe we'd like to persist.
204 *        If set at 0, WebBrowserPersistable will attempt to persist
205 *        the top-level document. If the outer window ID is for a subframe
206 *        that does not exist, or is not held beneath the WebBrowserPersistable,
207 *        aRecv's onError method will be called with NS_ERROR_NO_CONTENT.
208 * @param aRecv
209 *        The nsIWebBrowserPersistDocumentReceiver is a callback that
210 *        will be fired once the document is ready for persisting.
211 */
212interface mixin WebBrowserPersistable
213{
214  [Throws]
215  void startPersistence(unsigned long long aOuterWindowID,
216                        nsIWebBrowserPersistDocumentReceiver aRecv);
217};
218
219FrameLoader includes WebBrowserPersistable;
220