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#include "nsISupports.idl" 7 8interface nsFrameLoader; 9interface nsIDocShell; 10interface nsIURI; 11interface nsIFrame; 12interface nsSubDocumentFrame; 13interface nsIMessageSender; 14interface nsIVariant; 15interface nsIDOMElement; 16interface nsITabParent; 17interface nsILoadContext; 18interface nsIPrintSettings; 19interface nsIWebProgressListener; 20 21[builtinclass, uuid(1645af04-1bc7-4363-8f2c-eb9679220ab1)] 22interface nsIFrameLoader : nsISupports 23{ 24 /** 25 * Get the docshell from the frame loader. 26 */ 27 readonly attribute nsIDocShell docShell; 28 29 /** 30 * Get this frame loader's TabParent, if it has a remote frame. Otherwise, 31 * returns null. 32 */ 33 readonly attribute nsITabParent tabParent; 34 35 /** 36 * Get an nsILoadContext for the top-level docshell. For remote 37 * frames, a shim is returned that contains private browsing and app 38 * information. 39 */ 40 readonly attribute nsILoadContext loadContext; 41 42 /** 43 * Start loading the frame. This method figures out what to load 44 * from the owner content in the frame loader. 45 */ 46 void loadFrame(in boolean originalSrc); 47 48 /** 49 * Loads the specified URI in this frame. Behaves identically to loadFrame, 50 * except that this method allows specifying the URI to load. 51 */ 52 void loadURI(in nsIURI aURI, in boolean originalSrc); 53 54 /** 55 * Adds a blocking promise for the current cross process navigation. 56 * This method can only be called while the "BrowserWillChangeProcess" event 57 * is being fired. 58 */ 59 [implicit_jscontext] 60 void addProcessChangeBlockingPromise(in jsval aPromise); 61 62 /** 63 * Destroy the frame loader and everything inside it. This will 64 * clear the weak owner content reference. 65 */ 66 void destroy(); 67 68 /** 69 * Find out whether the loader's frame is at too great a depth in 70 * the frame tree. This can be used to decide what operations may 71 * or may not be allowed on the loader's docshell. 72 */ 73 readonly attribute boolean depthTooGreat; 74 75 /** 76 * Updates the position and size of the subdocument loaded by this frameloader. 77 * 78 * @param aIFrame The nsIFrame for the content node that owns this frameloader 79 */ 80 [noscript] void updatePositionAndSize(in nsSubDocumentFrame aIFrame); 81 82 /** 83 * Activate remote frame. 84 * Throws an exception with non-remote frames. 85 */ 86 void activateRemoteFrame(); 87 88 /** 89 * Deactivate remote frame. 90 * Throws an exception with non-remote frames. 91 */ 92 void deactivateRemoteFrame(); 93 94 /** 95 * @see nsIDOMWindowUtils sendMouseEvent. 96 */ 97 void sendCrossProcessMouseEvent(in AString aType, 98 in float aX, 99 in float aY, 100 in long aButton, 101 in long aClickCount, 102 in long aModifiers, 103 [optional] in boolean aIgnoreRootScrollFrame); 104 105 /** 106 * Activate event forwarding from client (remote frame) to parent. 107 */ 108 void activateFrameEvent(in AString aType, in boolean capture); 109 110 // Note, when frameloaders are swapped, also messageManagers are swapped. 111 readonly attribute nsIMessageSender messageManager; 112 113 /** 114 * Request that the next time a remote layer transaction has been 115 * received by the Compositor, a MozAfterRemoteFrame event be sent 116 * to the window. 117 */ 118 void requestNotifyAfterRemotePaint(); 119 120 /** 121 * Close the window through the ownerElement. 122 */ 123 void requestFrameLoaderClose(); 124 125 /** 126 * Print the current document. 127 * 128 * @param aOuterWindowID the ID of the outer window to print 129 * @param aPrintSettings optional print settings to use; printSilent can be 130 * set to prevent prompting. 131 * @param aProgressListener optional print progress listener. 132 */ 133 void print(in unsigned long long aOuterWindowID, 134 in nsIPrintSettings aPrintSettings, 135 in nsIWebProgressListener aProgressListener); 136 137 /** 138 * The default event mode automatically forwards the events 139 * handled in EventStateManager::HandleCrossProcessEvent to 140 * the child content process when these events are targeted to 141 * the remote browser element. 142 * 143 * Used primarly for input events (mouse, keyboard) 144 */ 145 const unsigned long EVENT_MODE_NORMAL_DISPATCH = 0x00000000; 146 147 /** 148 * With this event mode, it's the application's responsability to 149 * convert and forward events to the content process 150 */ 151 const unsigned long EVENT_MODE_DONT_FORWARD_TO_CHILD = 0x00000001; 152 153 attribute unsigned long eventMode; 154 155 /** 156 * If false, then the subdocument is not clipped to its CSS viewport, and the 157 * subdocument's viewport scrollbar(s) are not rendered. 158 * Defaults to true. 159 */ 160 attribute boolean clipSubdocument; 161 162 /** 163 * If false, then the subdocument's scroll coordinates will not be clamped 164 * to their scroll boundaries. 165 * Defaults to true. 166 */ 167 attribute boolean clampScrollPosition; 168 169 /** 170 * The element which owns this frame loader. 171 * 172 * For example, if this is a frame loader for an <iframe>, this attribute 173 * returns the iframe element. 174 */ 175 readonly attribute nsIDOMElement ownerElement; 176 177 178 /** 179 * Cached childID of the ContentParent owning the TabParent in this frame 180 * loader. This can be used to obtain the childID after the TabParent died. 181 */ 182 readonly attribute unsigned long long childID; 183 184 /** 185 * Find out whether the owner content really is a mozbrowser. <xul:browser> 186 * is not considered to be a mozbrowser frame. 187 */ 188 readonly attribute boolean ownerIsMozBrowserFrame; 189 190 /** 191 * The last known width of the frame. Reading this property will not trigger 192 * a reflow, and therefore may not reflect the current state of things. It 193 * should only be used in asynchronous APIs where values are not guaranteed 194 * to be up-to-date when received. 195 */ 196 readonly attribute unsigned long lazyWidth; 197 198 /** 199 * The last known height of the frame. Reading this property will not trigger 200 * a reflow, and therefore may not reflect the current state of things. It 201 * should only be used in asynchronous APIs where values are not guaranteed 202 * to be up-to-date when received. 203 */ 204 readonly attribute unsigned long lazyHeight; 205 206 /** 207 * Is `true` if the frameloader is dead (destroy has been called on it) 208 */ 209 [infallible] readonly attribute boolean isDead; 210}; 211 212%{C++ 213class nsFrameLoader; 214%} 215 216native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>); 217 218[scriptable, uuid(adc1b3ba-8deb-4943-8045-e6de0044f2ce)] 219interface nsIFrameLoaderOwner : nsISupports 220{ 221 /** 222 * The frame loader owned by this nsIFrameLoaderOwner 223 */ 224 [binaryname(FrameLoaderXPCOM)] readonly attribute nsIFrameLoader frameLoader; 225 [noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader(); 226 227 /** 228 * This method is used internally by SwapFrameLoaders to set the frame loader 229 * on the target nsFrameLoader. 230 * 231 * Avoid using this method outside of that context, and instead prefer using 232 * SwapFrameLoaders. 233 */ 234 [noscript, notxpcom] void 235 internalSetFrameLoader(in nsIFrameLoader aNewFrameLoader); 236}; 237