|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "domstubs.idl" |
|
8 #include "nsIDocShellTreeItem.idl" |
|
9 |
|
10 %{ C++ |
|
11 #include "js/TypeDecls.h" |
|
12 class nsPresContext; |
|
13 class nsIPresShell; |
|
14 %} |
|
15 |
|
16 /** |
|
17 * The nsIDocShell interface. |
|
18 */ |
|
19 |
|
20 [ptr] native nsPresContext(nsPresContext); |
|
21 [ptr] native nsIPresShell(nsIPresShell); |
|
22 |
|
23 interface nsIURI; |
|
24 interface nsIChannel; |
|
25 interface nsIContentViewer; |
|
26 interface nsIURIContentListener; |
|
27 interface nsIDOMEventTarget; |
|
28 interface nsIDocShellLoadInfo; |
|
29 interface nsIEditor; |
|
30 interface nsIWebNavigation; |
|
31 interface nsISimpleEnumerator; |
|
32 interface nsIInputStream; |
|
33 interface nsIRequest; |
|
34 interface nsISHEntry; |
|
35 interface nsILayoutHistoryState; |
|
36 interface nsISecureBrowserUI; |
|
37 interface nsIScriptGlobalObject; |
|
38 interface nsIDOMStorage; |
|
39 interface nsIPrincipal; |
|
40 interface nsIWebBrowserPrint; |
|
41 interface nsIVariant; |
|
42 interface nsIPrivacyTransitionObserver; |
|
43 interface nsIReflowObserver; |
|
44 interface nsIScrollObserver; |
|
45 |
|
46 typedef unsigned long nsLoadFlags; |
|
47 |
|
48 [scriptable, builtinclass, uuid(e46d924d-c20f-4add-8cf5-1e1c817b2181)] |
|
49 interface nsIDocShell : nsIDocShellTreeItem |
|
50 { |
|
51 /** |
|
52 * Loads a given URI. This will give priority to loading the requested URI |
|
53 * in the object implementing this interface. If it can't be loaded here |
|
54 * however, the URL dispatcher will go through its normal process of content |
|
55 * loading. |
|
56 * |
|
57 * @param uri - The URI to load. |
|
58 * @param loadInfo - This is the extended load info for this load. This |
|
59 * most often will be null, but if you need to do |
|
60 * additional setup for this load you can get a loadInfo |
|
61 * object by calling createLoadInfo. Once you have this |
|
62 * object you can set the needed properties on it and |
|
63 * then pass it to loadURI. |
|
64 * @param aLoadFlags - Flags to modify load behaviour. Flags are defined in |
|
65 * nsIWebNavigation. Note that using flags outside |
|
66 * LOAD_FLAGS_MASK is only allowed if passing in a |
|
67 * non-null loadInfo. And even some of those might not |
|
68 * be allowed. Use at your own risk. |
|
69 */ |
|
70 [noscript]void loadURI(in nsIURI uri, |
|
71 in nsIDocShellLoadInfo loadInfo, |
|
72 in unsigned long aLoadFlags, |
|
73 in boolean firstParty); |
|
74 |
|
75 /** |
|
76 * Loads a given stream. This will give priority to loading the requested |
|
77 * stream in the object implementing this interface. If it can't be loaded |
|
78 * here however, the URL dispatched will go through its normal process of |
|
79 * content loading. |
|
80 * |
|
81 * @param aStream - The input stream that provides access to the data |
|
82 * to be loaded. This must be a blocking, threadsafe |
|
83 * stream implementation. |
|
84 * @param aURI - The URI representing the stream, or null. |
|
85 * @param aContentType - The type (MIME) of data being loaded (empty if unknown). |
|
86 * @param aContentCharset - The charset of the data being loaded (empty if unknown). |
|
87 * @param aLoadInfo - This is the extended load info for this load. This |
|
88 * most often will be null, but if you need to do |
|
89 * additional setup for this load you can get a |
|
90 * loadInfo object by calling createLoadInfo. Once |
|
91 * you have this object you can set the needed |
|
92 * properties on it and then pass it to loadStream. |
|
93 */ |
|
94 [noscript]void loadStream(in nsIInputStream aStream, |
|
95 in nsIURI aURI, |
|
96 in ACString aContentType, |
|
97 in ACString aContentCharset, |
|
98 in nsIDocShellLoadInfo aLoadInfo); |
|
99 |
|
100 const long INTERNAL_LOAD_FLAGS_NONE = 0x0; |
|
101 const long INTERNAL_LOAD_FLAGS_INHERIT_OWNER = 0x1; |
|
102 const long INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 0x2; |
|
103 const long INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x4; |
|
104 |
|
105 // This flag marks the first load in this object |
|
106 // @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD |
|
107 const long INTERNAL_LOAD_FLAGS_FIRST_LOAD = 0x8; |
|
108 |
|
109 const long INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10; |
|
110 const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20; |
|
111 |
|
112 // Whether the load should be treated as srcdoc load, rather than a URI one. |
|
113 const long INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40; |
|
114 |
|
115 const long INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x80; |
|
116 |
|
117 /** |
|
118 * Loads the given URI. This method is identical to loadURI(...) except |
|
119 * that its parameter list is broken out instead of being packaged inside |
|
120 * of an nsIDocShellLoadInfo object... |
|
121 * |
|
122 * @param aURI - The URI to load. |
|
123 * @param aReferrer - Referring URI |
|
124 * @param aOwner - Owner (security principal) |
|
125 * @param aInheritOwner - Flag indicating whether the owner of the current |
|
126 * document should be inherited if aOwner is null. |
|
127 * @param aStopActiveDoc - Flag indicating whether loading the current |
|
128 * document should be stopped. |
|
129 * @param aWindowTarget - Window target for the load. |
|
130 * @param aTypeHint - A hint as to the content-type of the resulting |
|
131 * data. May be null or empty if no hint. |
|
132 * @param aFileName - Non-null when the link should be downloaded as |
|
133 the given filename. |
|
134 * @param aPostDataStream - Post data stream (if POSTing) |
|
135 * @param aHeadersStream - Stream containing "extra" request headers... |
|
136 * @param aLoadFlags - Flags to modify load behaviour. Flags are defined |
|
137 * in nsIWebNavigation. |
|
138 * @param aSHEntry - Active Session History entry (if loading from SH) |
|
139 * @param aSrcdoc When INTERNAL_LOAD_FLAGS_IS_SRCDOC is set, the |
|
140 * contents of this parameter will be loaded instead |
|
141 * of aURI. |
|
142 * @param aSourceDocShell - The source browsing context for the navigation. |
|
143 * @param aBaseURI - The base URI to be used for the load. Set in |
|
144 * srcdoc loads as it cannot otherwise be inferred |
|
145 * in certain situations such as view-source. |
|
146 */ |
|
147 [noscript]void internalLoad(in nsIURI aURI, |
|
148 in nsIURI aReferrer, |
|
149 in nsISupports aOwner, |
|
150 in uint32_t aFlags, |
|
151 in wstring aWindowTarget, |
|
152 in string aTypeHint, |
|
153 in AString aFileName, |
|
154 in nsIInputStream aPostDataStream, |
|
155 in nsIInputStream aHeadersStream, |
|
156 in unsigned long aLoadFlags, |
|
157 in nsISHEntry aSHEntry, |
|
158 in boolean firstParty, |
|
159 in AString aSrcdoc, |
|
160 in nsIDocShell aSourceDocShell, |
|
161 in nsIURI aBaseURI, |
|
162 out nsIDocShell aDocShell, |
|
163 out nsIRequest aRequest); |
|
164 |
|
165 /** |
|
166 * Do either a history.pushState() or history.replaceState() operation, |
|
167 * depending on the value of aReplace. |
|
168 */ |
|
169 [implicit_jscontext] |
|
170 void addState(in jsval aData, in DOMString aTitle, |
|
171 in DOMString aURL, in boolean aReplace); |
|
172 |
|
173 /** |
|
174 * Creates a DocShellLoadInfo object that you can manipulate and then pass |
|
175 * to loadURI. |
|
176 */ |
|
177 void createLoadInfo(out nsIDocShellLoadInfo loadInfo); |
|
178 |
|
179 /** |
|
180 * Reset state to a new content model within the current document and the document |
|
181 * viewer. Called by the document before initiating an out of band document.write(). |
|
182 */ |
|
183 void prepareForNewContentModel(); |
|
184 |
|
185 /** |
|
186 * For editors and suchlike who wish to change the URI associated with the |
|
187 * document. Note if you want to get the current URI, use the read-only |
|
188 * property on nsIWebNavigation. |
|
189 */ |
|
190 void setCurrentURI(in nsIURI aURI); |
|
191 |
|
192 /** |
|
193 * Notify the associated content viewer and all child docshells that they are |
|
194 * about to be hidden. If |isUnload| is true, then the document is being |
|
195 * unloaded as well. |
|
196 * |
|
197 * @param isUnload if true, fire the unload event in addition to the pagehide |
|
198 * event. |
|
199 */ |
|
200 [noscript] void firePageHideNotification(in boolean isUnload); |
|
201 |
|
202 /** |
|
203 * Presentation context for the currently loaded document. This may be null. |
|
204 */ |
|
205 [noscript] readonly attribute nsPresContext presContext; |
|
206 |
|
207 /** |
|
208 * Presentation shell for the currently loaded document. This may be null. |
|
209 */ |
|
210 [noscript,notxpcom] nsIPresShell GetPresShell(); |
|
211 |
|
212 /** |
|
213 * Presentation shell for the oldest document, if this docshell is |
|
214 * currently transitioning between documents. |
|
215 */ |
|
216 [noscript] readonly attribute nsIPresShell eldestPresShell; |
|
217 |
|
218 /** |
|
219 * Content Viewer that is currently loaded for this DocShell. This may |
|
220 * change as the underlying content changes. |
|
221 */ |
|
222 readonly attribute nsIContentViewer contentViewer; |
|
223 |
|
224 /** |
|
225 * This attribute allows chrome to tie in to handle DOM events that may |
|
226 * be of interest to chrome. |
|
227 */ |
|
228 attribute nsIDOMEventTarget chromeEventHandler; |
|
229 |
|
230 /** |
|
231 * Whether to allow plugin execution |
|
232 */ |
|
233 attribute boolean allowPlugins; |
|
234 |
|
235 /** |
|
236 * Whether to allow Javascript execution |
|
237 */ |
|
238 attribute boolean allowJavascript; |
|
239 |
|
240 /** |
|
241 * Attribute stating if refresh based redirects can be allowed |
|
242 */ |
|
243 attribute boolean allowMetaRedirects; |
|
244 |
|
245 /** |
|
246 * Attribute stating if it should allow subframes (framesets/iframes) or not |
|
247 */ |
|
248 attribute boolean allowSubframes; |
|
249 |
|
250 /** |
|
251 * Attribute stating whether or not images should be loaded. |
|
252 */ |
|
253 attribute boolean allowImages; |
|
254 |
|
255 /** |
|
256 * Attribute stating whether or not media (audio/video) should be loaded. |
|
257 */ |
|
258 [infallible] attribute boolean allowMedia; |
|
259 |
|
260 /** |
|
261 * Attribute that determines whether DNS prefetch is allowed for this subtree |
|
262 * of the docshell tree. Defaults to true. Setting this will make it take |
|
263 * effect starting with the next document loaded in the docshell. |
|
264 */ |
|
265 attribute boolean allowDNSPrefetch; |
|
266 |
|
267 /** |
|
268 * Attribute that determines whether window control (move/resize) is allowed. |
|
269 */ |
|
270 attribute boolean allowWindowControl; |
|
271 |
|
272 /** |
|
273 * True if the docshell allows its content to be handled by a content listener |
|
274 * other than the docshell itself, including the external helper app service, |
|
275 * and false otherwise. Defaults to true. |
|
276 */ |
|
277 [infallible] attribute boolean allowContentRetargeting; |
|
278 |
|
279 /** |
|
280 * Get an enumerator over this docShell and its children. |
|
281 * |
|
282 * @param aItemType - Only include docShells of this type, or if typeAll, |
|
283 * include all child shells. |
|
284 * Uses types from nsIDocShellTreeItem. |
|
285 * @param aDirection - Whether to enumerate forwards or backwards. |
|
286 */ |
|
287 |
|
288 const long ENUMERATE_FORWARDS = 0; |
|
289 const long ENUMERATE_BACKWARDS = 1; |
|
290 |
|
291 nsISimpleEnumerator getDocShellEnumerator(in long aItemType, |
|
292 in long aDirection); |
|
293 |
|
294 /** |
|
295 * The type of application that created this window |
|
296 */ |
|
297 const unsigned long APP_TYPE_UNKNOWN = 0; |
|
298 const unsigned long APP_TYPE_MAIL = 1; |
|
299 const unsigned long APP_TYPE_EDITOR = 2; |
|
300 |
|
301 attribute unsigned long appType; |
|
302 |
|
303 /** |
|
304 * certain dochshells (like the message pane) |
|
305 * should not throw up auth dialogs |
|
306 * because it can act as a password trojan |
|
307 */ |
|
308 attribute boolean allowAuth; |
|
309 |
|
310 /** |
|
311 * Set/Get the document scale factor. When setting this attribute, a |
|
312 * NS_ERROR_NOT_IMPLEMENTED error may be returned by implementations |
|
313 * not supporting zoom. Implementations not supporting zoom should return |
|
314 * 1.0 all the time for the Get operation. 1.0 by the way is the default |
|
315 * of zoom. This means 100% of normal scaling or in other words normal size |
|
316 * no zoom. |
|
317 */ |
|
318 attribute float zoom; |
|
319 |
|
320 /* |
|
321 * The size, in CSS pixels, of the horizontal margins for the <body> of an |
|
322 * HTML document in this docshel; used to implement the marginwidth attribute |
|
323 * on HTML <frame>/<iframe> elements. A value smaller than zero indicates |
|
324 * that the attribute was not set. |
|
325 */ |
|
326 attribute long marginWidth; |
|
327 |
|
328 /* |
|
329 * The size, in CSS pixels, of the vertical margins for the <body> of an HTML |
|
330 * document in this docshel; used to implement the marginheight attribute on |
|
331 * HTML <frame>/<iframe> elements. A value smaller than zero indicates that |
|
332 * the attribute was not set. |
|
333 */ |
|
334 attribute long marginHeight; |
|
335 |
|
336 /* |
|
337 * Tells the docshell to offer focus to its tree owner. |
|
338 * This is currently only necessary for embedding chrome. |
|
339 */ |
|
340 void tabToTreeOwner(in boolean forward, |
|
341 out boolean tookFocus); |
|
342 |
|
343 /** |
|
344 * Current busy state for DocShell |
|
345 */ |
|
346 const unsigned long BUSY_FLAGS_NONE = 0; |
|
347 const unsigned long BUSY_FLAGS_BUSY = 1; |
|
348 const unsigned long BUSY_FLAGS_BEFORE_PAGE_LOAD = 2; |
|
349 const unsigned long BUSY_FLAGS_PAGE_LOADING = 4; |
|
350 |
|
351 /** |
|
352 * Load commands for the document |
|
353 */ |
|
354 const unsigned long LOAD_CMD_NORMAL = 0x1; // Normal load |
|
355 const unsigned long LOAD_CMD_RELOAD = 0x2; // Reload |
|
356 const unsigned long LOAD_CMD_HISTORY = 0x4; // Load from history |
|
357 const unsigned long LOAD_CMD_PUSHSTATE = 0x8; // History.pushState() |
|
358 |
|
359 readonly attribute unsigned long busyFlags; |
|
360 |
|
361 /* |
|
362 * attribute to access the loadtype for the document |
|
363 */ |
|
364 attribute unsigned long loadType; |
|
365 |
|
366 /* |
|
367 * Default load flags (as defined in nsIRequest) that will be set on all |
|
368 * requests made by this docShell and propagated to all child docShells and |
|
369 * to nsILoadGroup::defaultLoadFlags for the docShell's loadGroup. |
|
370 * Default is no flags. Once set, only future requests initiated by the |
|
371 * docShell are affected, so in general, these flags should be set before |
|
372 * the docShell loads any content. |
|
373 */ |
|
374 attribute nsLoadFlags defaultLoadFlags; |
|
375 |
|
376 /* |
|
377 * returns true if the docshell is being destroyed, false otherwise |
|
378 */ |
|
379 boolean isBeingDestroyed(); |
|
380 |
|
381 /* |
|
382 * Returns true if the docshell is currently executing the onLoad Handler |
|
383 */ |
|
384 readonly attribute boolean isExecutingOnLoadHandler; |
|
385 |
|
386 attribute nsILayoutHistoryState layoutHistoryState; |
|
387 |
|
388 readonly attribute boolean shouldSaveLayoutState; |
|
389 |
|
390 /** |
|
391 * The SecureBrowserUI object for this docshell. This is set by XUL |
|
392 * <browser> or nsWebBrowser for their root docshell. |
|
393 */ |
|
394 attribute nsISecureBrowserUI securityUI; |
|
395 |
|
396 /** |
|
397 * Cancel the XPCOM timers for each meta-refresh URI in this docshell, |
|
398 * and this docshell's children, recursively. The meta-refresh timers can be |
|
399 * restarted using resumeRefreshURIs(). If the timers are already suspended, |
|
400 * this has no effect. |
|
401 */ |
|
402 void suspendRefreshURIs(); |
|
403 |
|
404 /** |
|
405 * Restart the XPCOM timers for each meta-refresh URI in this docshell, |
|
406 * and this docshell's children, recursively. If the timers are already |
|
407 * running, this has no effect. |
|
408 */ |
|
409 void resumeRefreshURIs(); |
|
410 |
|
411 /** |
|
412 * Begin firing WebProgressListener notifications for restoring a page |
|
413 * presentation. |viewer| is the content viewer whose document we are |
|
414 * starting to load. If null, it defaults to the docshell's current content |
|
415 * viewer, creating one if necessary. |top| should be true for the toplevel |
|
416 * docshell that is being restored; it will be set to false when this method |
|
417 * is called for child docshells. This method will post an event to |
|
418 * complete the simulated load after returning to the event loop. |
|
419 */ |
|
420 void beginRestore(in nsIContentViewer viewer, in boolean top); |
|
421 |
|
422 /** |
|
423 * Finish firing WebProgressListener notifications and DOM events for |
|
424 * restoring a page presentation. This should only be called via |
|
425 * beginRestore(). |
|
426 */ |
|
427 void finishRestore(); |
|
428 |
|
429 /* Track whether we're currently restoring a document presentation. */ |
|
430 readonly attribute boolean restoringDocument; |
|
431 |
|
432 /* attribute to access whether error pages are enabled */ |
|
433 attribute boolean useErrorPages; |
|
434 |
|
435 /** |
|
436 * Display a load error in a frame while keeping that frame's currentURI |
|
437 * pointing correctly to the page where the error ocurred, rather than to |
|
438 * the error document page. You must provide either the aURI or aURL parameter. |
|
439 * |
|
440 * @param aError The error code to be displayed |
|
441 * @param aURI nsIURI of the page where the error happened |
|
442 * @param aURL wstring of the page where the error happened |
|
443 * @param aFailedChannel The channel related to this error |
|
444 */ |
|
445 void displayLoadError(in nsresult aError, |
|
446 in nsIURI aURI, |
|
447 in wstring aURL, |
|
448 [optional] in nsIChannel aFailedChannel); |
|
449 |
|
450 |
|
451 /** |
|
452 * Keeps track of the previous SHTransaction index and the current |
|
453 * SHTransaction index at the time that the doc shell begins to load. |
|
454 * Used for ContentViewer eviction. |
|
455 */ |
|
456 readonly attribute long previousTransIndex; |
|
457 readonly attribute long loadedTransIndex; |
|
458 |
|
459 /** |
|
460 * Notification that entries have been removed from the beginning of a |
|
461 * nsSHistory which has this as its rootDocShell. |
|
462 * |
|
463 * @param numEntries - The number of entries removed |
|
464 */ |
|
465 void historyPurged(in long numEntries); |
|
466 |
|
467 /* |
|
468 * @deprecated, use nsIDocShell.QueryInterface(nsIDOMStorageManager) instead. |
|
469 * |
|
470 * Retrieves the WebApps session storage object for the supplied principal. |
|
471 * |
|
472 * @param principal returns a storage for this principal |
|
473 * @param documentURI new storage will be created with reference to this |
|
474 * document.documentURI that will appear in storage event |
|
475 * @param create If true and a session storage object doesn't |
|
476 * already exist, a new one will be created. |
|
477 */ |
|
478 nsIDOMStorage getSessionStorageForPrincipal(in nsIPrincipal principal, |
|
479 in DOMString documentURI, |
|
480 in boolean create); |
|
481 |
|
482 /* |
|
483 * @deprecated, use nsIDocShell.QueryInterface(nsIDOMStorageManager) instead. |
|
484 * |
|
485 * Add a WebApps session storage object to the docshell. |
|
486 * |
|
487 * @param principal the principal the storage object is associated with |
|
488 * @param storage the storage object to add |
|
489 */ |
|
490 void addSessionStorage(in nsIPrincipal principal, in nsIDOMStorage storage); |
|
491 |
|
492 /** |
|
493 * Gets the channel for the currently loaded document, if any. |
|
494 * For a new document load, this will be the channel of the previous document |
|
495 * until after OnLocationChange fires. |
|
496 */ |
|
497 readonly attribute nsIChannel currentDocumentChannel; |
|
498 |
|
499 /** |
|
500 * Set the offset of this child in its container. |
|
501 */ |
|
502 [noscript] void setChildOffset(in unsigned long offset); |
|
503 |
|
504 /** |
|
505 * Find out whether the docshell is currently in the middle of a page |
|
506 * transition. This is set just before the pagehide/unload events fire. |
|
507 */ |
|
508 readonly attribute boolean isInUnload; |
|
509 |
|
510 /** |
|
511 * Find out if the currently loaded document came from a suspicious channel |
|
512 * (such as a JAR channel where the server-returned content type isn't a |
|
513 * known JAR type). |
|
514 */ |
|
515 readonly attribute boolean channelIsUnsafe; |
|
516 |
|
517 /** |
|
518 * This attribute determines whether Mixed Active Content is loaded on the |
|
519 * document. When it is true, mixed active content was not blocked and has |
|
520 * loaded (or is about to load) on the page. When it is false, mixed active content |
|
521 * has not loaded on the page, either because there was no mixed active content |
|
522 * requests on the page or such requests were blocked by nsMixedContentBlocker. |
|
523 * This boolean is set to true in nsMixedContentBlocker if Mixed Active Content |
|
524 * is allowed (either explicitly on the page by the user or when the about:config |
|
525 * setting security.mixed_content.block_active_content is set to false). |
|
526 */ |
|
527 [infallible] readonly attribute boolean hasMixedActiveContentLoaded; |
|
528 |
|
529 /** |
|
530 * This attribute determines whether a document has Mixed Active Content |
|
531 * that has been blocked from loading. When it is true, there is definitely |
|
532 * mixed active content on a page that has been blocked by |
|
533 * nsMixedContentBlocker. When it is false, there may or may not be mixed |
|
534 * active content on a page, but if there is, it will load. Note that if the |
|
535 * about:config setting security.mixed_content.block_active_content is set |
|
536 * false, this boolean will be false, since blocking active content has been |
|
537 * disabled. |
|
538 */ |
|
539 [infallible] readonly attribute boolean hasMixedActiveContentBlocked; |
|
540 |
|
541 /** |
|
542 * This attribute determines whether Mixed Display Content is loaded on the |
|
543 * document. When it is true, mixed display content was not blocked and has |
|
544 * loaded (or is about to load) on the page. Similar behavior to |
|
545 * hasMixedActiveContentLoaded. |
|
546 */ |
|
547 [infallible] readonly attribute boolean hasMixedDisplayContentLoaded; |
|
548 |
|
549 /** |
|
550 * This attribute determines whether a document has Mixed Display Content |
|
551 * that has been blocked from loading. Similar behavior to |
|
552 * hasMixedActiveContentBlocked. |
|
553 */ |
|
554 [infallible] readonly attribute boolean hasMixedDisplayContentBlocked; |
|
555 |
|
556 /** |
|
557 * Disconnects this docshell's editor from its window, and stores the |
|
558 * editor data in the open document's session history entry. This |
|
559 * should be called only during page transitions. |
|
560 */ |
|
561 [noscript, notxpcom] void DetachEditorFromWindow(); |
|
562 |
|
563 /** |
|
564 * If true, this browser is not visible in the traditional sense, but |
|
565 * is actively being rendered to the screen (ex. painted on a canvas) |
|
566 * and should be treated accordingly. |
|
567 **/ |
|
568 attribute boolean isOffScreenBrowser; |
|
569 |
|
570 /** |
|
571 * If the current content viewer isn't initialized for print preview, |
|
572 * it is replaced with one which is and to which an about:blank document |
|
573 * is loaded. |
|
574 */ |
|
575 readonly attribute nsIWebBrowserPrint printPreview; |
|
576 |
|
577 /** |
|
578 * Whether this docshell can execute scripts based on its hierarchy. |
|
579 * The rule of thumb here is that we disable js if this docshell or any |
|
580 * of its parents disallow scripting. |
|
581 */ |
|
582 [infallible] readonly attribute boolean canExecuteScripts; |
|
583 |
|
584 /** |
|
585 * Sets whether a docshell is active. An active docshell is one that is |
|
586 * visible, and thus is not a good candidate for certain optimizations |
|
587 * like image frame discarding. Docshells are active unless told otherwise. |
|
588 */ |
|
589 attribute boolean isActive; |
|
590 |
|
591 /** |
|
592 * The ID of the docshell in the session history. |
|
593 */ |
|
594 readonly attribute unsigned long long historyID; |
|
595 |
|
596 /** |
|
597 * Sets whether a docshell is an app tab. An app tab docshell may behave |
|
598 * differently than a non-app tab docshell in some cases, such as when |
|
599 * handling link clicks. Docshells are not app tabs unless told otherwise. |
|
600 */ |
|
601 attribute boolean isAppTab; |
|
602 |
|
603 /** |
|
604 * Create a new about:blank document and content viewer. |
|
605 * @param aPrincipal the principal to use for the new document. |
|
606 */ |
|
607 void createAboutBlankContentViewer(in nsIPrincipal aPrincipal); |
|
608 |
|
609 /** |
|
610 * Upon getting, returns the canonical encoding label of the document |
|
611 * currently loaded into this docshell. |
|
612 * |
|
613 * Upon setting, sets forcedCharset for compatibility with legacy callers. |
|
614 */ |
|
615 attribute ACString charset; |
|
616 |
|
617 /** |
|
618 * Called when the user chose an encoding override from the character |
|
619 * encoding menu. Separate from the setter for the charset property to avoid |
|
620 * extensions adding noise to the data. |
|
621 */ |
|
622 void gatherCharsetMenuTelemetry(); |
|
623 |
|
624 /** |
|
625 * The charset forced by the user. |
|
626 */ |
|
627 attribute ACString forcedCharset; |
|
628 |
|
629 /** |
|
630 * In a child docshell, this is the charset of the parent docshell |
|
631 */ |
|
632 [noscript, notxpcom, nostdcall] void setParentCharset( |
|
633 in ACString parentCharset, |
|
634 in int32_t parentCharsetSource, |
|
635 in nsIPrincipal parentCharsetPrincipal); |
|
636 [noscript, notxpcom, nostdcall] void getParentCharset( |
|
637 out ACString parentCharset, |
|
638 out int32_t parentCharsetSource, |
|
639 out nsIPrincipal parentCharsetPrincipal); |
|
640 |
|
641 /** |
|
642 * Add an observer to the list of parties to be notified when this docshell's |
|
643 * private browsing status is changed. |obs| must support weak references. |
|
644 */ |
|
645 void addWeakPrivacyTransitionObserver(in nsIPrivacyTransitionObserver obs); |
|
646 |
|
647 /** |
|
648 * Add an observer to the list of parties to be notified when reflows are |
|
649 * occurring. |obs| must support weak references. |
|
650 */ |
|
651 void addWeakReflowObserver(in nsIReflowObserver obs); |
|
652 |
|
653 /** |
|
654 * Remove an observer from the list of parties to be notified about reflows. |
|
655 */ |
|
656 void removeWeakReflowObserver(in nsIReflowObserver obs); |
|
657 |
|
658 /** |
|
659 * Notify all attached observers that a reflow has just occurred. |
|
660 * |
|
661 * @param interruptible if true, the reflow was interruptible. |
|
662 * @param start timestamp when reflow started, in milliseconds since |
|
663 * navigationStart (accurate to 1/1000 of a ms) |
|
664 * @param end timestamp when reflow ended, in milliseconds since |
|
665 * navigationStart (accurate to 1/1000 of a ms) |
|
666 */ |
|
667 [noscript] void notifyReflowObservers(in bool interruptible, |
|
668 in DOMHighResTimeStamp start, |
|
669 in DOMHighResTimeStamp end); |
|
670 |
|
671 /** |
|
672 * Add an observer to the list of parties to be notified when scroll position |
|
673 * of some elements is changed. |
|
674 */ |
|
675 [noscript] void addWeakScrollObserver(in nsIScrollObserver obs); |
|
676 |
|
677 /** |
|
678 * Add an observer to the list of parties to be notified when scroll position |
|
679 * of some elements is changed. |
|
680 */ |
|
681 [noscript] void removeWeakScrollObserver(in nsIScrollObserver obs); |
|
682 |
|
683 /** |
|
684 * Notify all attached observers that the scroll position of some element |
|
685 * has changed. |
|
686 */ |
|
687 [noscript] void notifyScrollObservers(); |
|
688 |
|
689 /** |
|
690 * Returns true if this docshell corresponds to an <iframe mozbrowser>. |
|
691 * (<iframe mozapp mozbrowser> is not considered a browser.) |
|
692 */ |
|
693 [infallible] readonly attribute boolean isBrowserElement; |
|
694 |
|
695 /** |
|
696 * Returns true iff the docshell corresponds to an <iframe mozapp>. |
|
697 */ |
|
698 [infallible] readonly attribute boolean isApp; |
|
699 |
|
700 /** |
|
701 * Returns isBrowserElement || isApp. |
|
702 */ |
|
703 [infallible] readonly attribute boolean isBrowserOrApp; |
|
704 |
|
705 /** |
|
706 * Returns true if this docshell corresponds to an <iframe mozbrowser> or if |
|
707 * the docshell is contained in an <iframe mozbrowser>. (<iframe mozapp |
|
708 * mozbrowser> does not count as a browser.) |
|
709 * |
|
710 * Our notion here of "contained in" means: Walk up the docshell hierarchy in |
|
711 * this process until we hit an <iframe mozapp> or <iframe mozbrowser> (or |
|
712 * until the hierarchy ends). Return true iff the docshell we stopped on has |
|
713 * isBrowserElement == true. |
|
714 */ |
|
715 [infallible] readonly attribute boolean isInBrowserElement; |
|
716 |
|
717 /** |
|
718 * Returns true if this docshell corresponds to an <iframe mozbrowser> or |
|
719 * <iframe mozap>, or if this docshell is contained in an <iframe mozbrowser> |
|
720 * or <iframe mozapp>. |
|
721 * |
|
722 * To compute this value, we walk up the docshell hierarchy. If we encounter |
|
723 * a docshell with isBrowserElement or isApp before we hit the end of the |
|
724 * hierarchy, we return true. Otherwise, we return false. |
|
725 */ |
|
726 [infallible] readonly attribute boolean isInBrowserOrApp; |
|
727 |
|
728 /** |
|
729 * Indicate that this docshell corresponds to an app with the given app id. |
|
730 * |
|
731 * You may pass NO_APP_ID or UNKNOWN_APP_ID for containingAppId. If you |
|
732 * pass NO_APP_ID, then this docshell will return NO_APP_ID for appId. If |
|
733 * you pass UNKNOWN_APP_ID, then this docshell will search its hiearchy for |
|
734 * an app frame and use that frame's appId. |
|
735 * |
|
736 * You can call this method more than once, but there's no guarantee that |
|
737 * other components will update their view of the world if you change a |
|
738 * docshell's app id, so tread lightly. |
|
739 * |
|
740 * If you call this method after calling setIsBrowserInsideApp, this |
|
741 * docshell will forget the fact that it was a browser. |
|
742 */ |
|
743 void setIsApp(in unsigned long ownAppId); |
|
744 |
|
745 /** |
|
746 * Indicate that this docshell corresponds to a browser inside an app with |
|
747 * the given ID. As with setIsApp, you may pass NO_APP_ID or |
|
748 * UNKNOWN_APP_ID. |
|
749 * |
|
750 * As with setIsApp, you may call this more than once, but it's kind of a |
|
751 * hack, so be careful. |
|
752 */ |
|
753 void setIsBrowserInsideApp(in unsigned long containingAppId); |
|
754 |
|
755 /** |
|
756 * Returns the id of the app associated with this docshell. If this docshell |
|
757 * is an <iframe mozbrowser> inside an <iframe mozapp>, we return the app's |
|
758 * appId. |
|
759 * |
|
760 * We compute this value by walking up the docshell hierarchy until we find a |
|
761 * docshell on which setIsApp(x) or setIsBrowserInsideApp(x) was called |
|
762 * (ignoring those docshells where x == UNKNOWN_APP_ID). We return the app |
|
763 * id x. |
|
764 * |
|
765 * If we don't find a docshell with an associated app id in our hierarchy, we |
|
766 * return NO_APP_ID. We never return UNKNOWN_APP_ID. |
|
767 * |
|
768 * Notice that a docshell may have an associated app even if it returns true |
|
769 * for isBrowserElement! |
|
770 */ |
|
771 [infallible] readonly attribute unsigned long appId; |
|
772 |
|
773 /** |
|
774 * Return the manifest URL of the app associated with this docshell. |
|
775 * |
|
776 * If there is no associated app in our hierarchy, we return empty string. |
|
777 */ |
|
778 readonly attribute DOMString appManifestURL; |
|
779 |
|
780 /** |
|
781 * Like nsIDocShellTreeItem::GetSameTypeParent, except this ignores <iframe |
|
782 * mozbrowser> and <iframe mozapp> boundaries. |
|
783 */ |
|
784 nsIDocShell getSameTypeParentIgnoreBrowserAndAppBoundaries(); |
|
785 |
|
786 /** |
|
787 * True iff asynchronous panning and zooming is enabled for this |
|
788 * docshell. |
|
789 */ |
|
790 readonly attribute bool asyncPanZoomEnabled; |
|
791 |
|
792 /** |
|
793 * The sandbox flags on the docshell. These reflect the value of the sandbox |
|
794 * attribute of the associated IFRAME or CSP-protectable content, if |
|
795 * existent. See the HTML5 spec for more details. |
|
796 * These flags on the docshell reflect the current state of the sandbox |
|
797 * attribute, which is modifiable. They are only used when loading new |
|
798 * content, sandbox flags are also immutably set on the document when it is |
|
799 * loaded. |
|
800 * The sandbox flags of a document depend on the sandbox flags on its |
|
801 * docshell and of its parent document, if any. |
|
802 * See nsSandboxFlags.h for the possible flags. |
|
803 */ |
|
804 attribute unsigned long sandboxFlags; |
|
805 |
|
806 /** |
|
807 * When a new browsing context is opened by a sandboxed document, it needs to |
|
808 * keep track of the browsing context that opened it, so that it can be |
|
809 * navigated by it. This is the "one permitted sandboxed navigator". |
|
810 */ |
|
811 attribute nsIDocShell onePermittedSandboxedNavigator; |
|
812 |
|
813 /** |
|
814 * Returns true if we are sandboxed from aTargetDocShell. |
|
815 * aTargetDocShell - the browsing context we are attempting to navigate. |
|
816 */ |
|
817 [noscript,notxpcom,nostdcall] bool isSandboxedFrom(in nsIDocShell aTargetDocShell); |
|
818 |
|
819 /** |
|
820 * This member variable determines whether a document has Mixed Active Content that |
|
821 * was initially blocked from loading, but the user has choosen to override the |
|
822 * block and allow the content to load. mMixedContentChannel is set to the document's |
|
823 * channel when the user allows mixed content. The nsMixedContentBlocker content policy |
|
824 * checks if the document's root channel matches the mMixedContentChannel. If it matches, |
|
825 * then Mixed Content is loaded. If it does match, mixed content is blocked. |
|
826 * |
|
827 * A match implies that there is definitely mixed active content on a page that was |
|
828 * initially blocked by nsMixedContentBlocker and then allowed and loaded by the user. |
|
829 * A miss imples that IF there is mixed active content on the page AND it was |
|
830 * blocked by nsMixedContentBlocker.cpp, the user has not choosen to override |
|
831 * the block. Note that if the about:config setting |
|
832 * security.mixed_content.block_active_content is set to false, this boolean |
|
833 * will be false, mMixedContentChannel will remain null since blocking active content has |
|
834 * been disabled and hence mMixedContentChannel will never be set. |
|
835 */ |
|
836 attribute nsIChannel mixedContentChannel; |
|
837 |
|
838 /** |
|
839 * Checks whether the channel associated with the root docShell is equal to |
|
840 * mMixedContentChannel. If they are the same, allowMixedContent is set to true. |
|
841 * Checks if the root document has a secure connection. If it is, sets |
|
842 * rootHasSecureConnection to true. If the docShell is the root doc shell, |
|
843 * isRootDocShell is set to true. |
|
844 */ |
|
845 void GetAllowMixedContentAndConnectionData(out boolean rootHasSecureConnection, out boolean allowMixedContent, out boolean isRootDocShell); |
|
846 |
|
847 |
|
848 /** |
|
849 * Are plugins allowed in the current document loaded in this docshell ? |
|
850 * (if there is one). This depends on whether plugins are allowed by this |
|
851 * docshell itself or if the document is sandboxed and hence plugins should |
|
852 * not be allowed. |
|
853 */ |
|
854 [noscript, notxpcom] bool pluginsAllowedInCurrentDoc(); |
|
855 |
|
856 |
|
857 /** |
|
858 * Attribute that determines whether fullscreen is allowed to be entered for |
|
859 * this subtree of the docshell tree. This is true when all iframes containing |
|
860 * this docshell have their "allowfullscreen" attribute set to "true". |
|
861 * fullscreenAllowed is only writable at content boundaries, where it is used |
|
862 * to propagate the value of the cross process parent's iframe's |
|
863 * "allowfullscreen" attribute to the child process. Setting |
|
864 * fullscreenAllowed on docshells which aren't content boundaries throws an |
|
865 * exception. |
|
866 */ |
|
867 [infallible] readonly attribute boolean fullscreenAllowed; |
|
868 |
|
869 void setFullscreenAllowed(in boolean allowed); |
|
870 |
|
871 [noscript, infallible] attribute boolean affectPrivateSessionLifetime; |
|
872 |
|
873 /** |
|
874 * Indicates whether the UI may enable the character encoding menu. The UI |
|
875 * must disable the menu when this property is false. |
|
876 */ |
|
877 [infallible] readonly attribute boolean mayEnableCharacterEncodingMenu; |
|
878 |
|
879 attribute nsIEditor editor; |
|
880 readonly attribute boolean editable; /* this docShell is editable */ |
|
881 readonly attribute boolean hasEditingSession; /* this docShell has an editing session */ |
|
882 |
|
883 /** |
|
884 * Make this docShell editable, setting a flag that causes |
|
885 * an editor to get created, either immediately, or after |
|
886 * a url has been loaded. |
|
887 * @param inWaitForUriLoad true to wait for a URI before |
|
888 * creating the editor. |
|
889 */ |
|
890 void makeEditable(in boolean inWaitForUriLoad); |
|
891 |
|
892 /** |
|
893 * Get the SHEntry associated with a child docshell |
|
894 */ |
|
895 nsISHEntry getChildSHEntry(in long aChildOffset); |
|
896 |
|
897 /** |
|
898 * Add a Child SHEntry for a frameset page, given the child's loadtype. |
|
899 * If aCloneChildren is true, then aCloneReference's children will be |
|
900 * cloned onto aHistoryEntry. |
|
901 */ |
|
902 void addChildSHEntry(in nsISHEntry aCloneReference, |
|
903 in nsISHEntry aHistoryEntry, |
|
904 in long aChildOffset, |
|
905 in unsigned long aLoadType, |
|
906 in boolean aCloneChilden); |
|
907 |
|
908 /** |
|
909 * Whether this docshell should save entries in global history. |
|
910 */ |
|
911 attribute boolean useGlobalHistory; |
|
912 |
|
913 /** |
|
914 * Removes nsISHEntry objects related to this docshell from session history. |
|
915 * Use this only with subdocuments, like iframes. |
|
916 */ |
|
917 void removeFromSessionHistory(); |
|
918 |
|
919 /** |
|
920 * Set when an iframe/frame is added dynamically. |
|
921 */ |
|
922 attribute boolean createdDynamically; |
|
923 |
|
924 /** |
|
925 * Returns false for mLSHE, true for mOSHE |
|
926 */ |
|
927 boolean getCurrentSHEntry(out nsISHEntry aEntry); |
|
928 |
|
929 /** |
|
930 * Cherry picked parts of nsIController. |
|
931 * They are here, because we want to call these functions |
|
932 * from JS. |
|
933 */ |
|
934 boolean isCommandEnabled(in string command); |
|
935 void doCommand(in string command); |
|
936 |
|
937 /** |
|
938 * Invisible DocShell are dummy construct to simulate DOM windows |
|
939 * without any actual visual representation. They have to be marked |
|
940 * at construction time, to avoid any painting activity. |
|
941 */ |
|
942 [noscript, notxpcom] bool IsInvisible(); |
|
943 [noscript, notxpcom] void SetInvisible(in bool aIsInvisibleDochsell); |
|
944 |
|
945 /** |
|
946 * Get the script global for the document in this docshell. |
|
947 */ |
|
948 [noscript,notxpcom,nostdcall] nsIScriptGlobalObject GetScriptGlobalObject(); |
|
949 |
|
950 /** |
|
951 * If deviceSizeIsPageSize is set to true, device-width/height media queries |
|
952 * will be calculated from the page size, not the device size. |
|
953 * |
|
954 * Used by the Responsive Design View and B2G Simulator. |
|
955 * |
|
956 * Default is False. |
|
957 * Default value can be overriden with |
|
958 * docshell.device_size_is_page_size pref. |
|
959 */ |
|
960 [infallible] attribute boolean deviceSizeIsPageSize; |
|
961 }; |