Source code

Revision control

Other Tools

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
#include "nsIRequest.idl"
10
11
%{ C++
12
#include "js/TypeDecls.h"
13
#include "mozilla/Maybe.h"
14
#include "mozilla/NotNull.h"
15
#include "mozilla/UniquePtr.h"
16
#include "nsCOMPtr.h"
17
#include "nsIURI.h"
18
class nsCommandManager;
19
class nsPresContext;
20
class nsDocShellLoadState;
21
namespace mozilla {
22
class Encoding;
23
class HTMLEditor;
24
class PresShell;
25
namespace dom {
26
class BrowsingContext;
27
class ClientSource;
28
} // namespace dom
29
}
30
%}
31
32
/**
33
* The nsIDocShell interface.
34
*/
35
36
[ptr] native nsPresContext(nsPresContext);
37
[ptr] native nsCommandManager(nsCommandManager);
38
[ptr] native PresShell(mozilla::PresShell);
39
[ref] native MaybeURI(mozilla::Maybe<nsCOMPtr<nsIURI>>);
40
[ref] native Encoding(const mozilla::Encoding*);
41
native UniqueClientSource(mozilla::UniquePtr<mozilla::dom::ClientSource>);
42
43
interface nsIURI;
44
interface nsIChannel;
45
interface nsIContentViewer;
46
interface nsIContentSecurityPolicy;
47
interface nsIDocShellLoadInfo;
48
interface nsIEditor;
49
interface nsIEditingSession;
50
interface nsIInputStream;
51
interface nsIRequest;
52
interface nsISHEntry;
53
interface nsILayoutHistoryState;
54
interface nsISecureBrowserUI;
55
interface nsIScriptGlobalObject;
56
interface nsIStructuredCloneContainer;
57
interface nsIDOMStorage;
58
interface nsIPrincipal;
59
interface nsIWebBrowserPrint;
60
interface nsIPrivacyTransitionObserver;
61
interface nsIReflowObserver;
62
interface nsIScrollObserver;
63
interface nsIRemoteTab;
64
interface nsIBrowserChild;
65
interface nsICommandParams;
66
interface nsILoadURIDelegate;
67
native BrowserChildRef(already_AddRefed<nsIBrowserChild>);
68
native nsDocShellLoadStatePtr(nsDocShellLoadState*);
69
70
webidl BrowsingContext;
71
webidl ContentFrameMessageManager;
72
webidl EventTarget;
73
webidl Document;
74
75
[scriptable, builtinclass, uuid(049234fe-da10-478b-bc5d-bc6f9a1ba63d)]
76
interface nsIDocShell : nsIDocShellTreeItem
77
{
78
void setCancelContentJSEpoch(in long aEpoch);
79
80
/**
81
* Loads a given URI. This will give priority to loading the requested URI
82
* in the object implementing this interface. If it can't be loaded here
83
* however, the URL dispatcher will go through its normal process of content
84
* loading.
85
*
86
* @param aLoadState This is the extended load info for this load.
87
* @param aSetNavigating If we should set isNavigating to true while initiating
88
* the load.
89
*/
90
[noscript]void loadURI(in nsDocShellLoadStatePtr aLoadState, in boolean aSetNavigating);
91
92
/**
93
* Do either a history.pushState() or history.replaceState() operation,
94
* depending on the value of aReplace.
95
*/
96
[implicit_jscontext]
97
void addState(in jsval aData, in AString aTitle,
98
in AString aURL, in boolean aReplace);
99
100
/**
101
* Helper for addState and document.open that does just the
102
* history-manipulation guts.
103
*
104
* Arguments the spec defines:
105
*
106
* @param aDocument the document we're manipulating. This will get the new URI.
107
* @param aNewURI the new URI.
108
* @param aData The serialized state data. May be null.
109
* @param aTitle The new title. May be empty.
110
* @param aReplace whether this should replace the exising SHEntry.
111
*
112
* Arguments we need internally because deriving them from the
113
* others is a bit complicated:
114
*
115
* @param aCurrentURI the current URI we're working with. Might be null.
116
* @param aEqualURIs whether the two URIs involved are equal.
117
*/
118
[nostdcall]
119
void updateURLAndHistory(in Document aDocument, in nsIURI aNewURI,
120
in nsIStructuredCloneContainer aData, in AString aTitle,
121
in boolean aReplace, in nsIURI aCurrentURI,
122
in boolean aEqualURIs);
123
124
/**
125
* Reset state to a new content model within the current document and the document
126
* viewer. Called by the document before initiating an out of band document.write().
127
*/
128
void prepareForNewContentModel();
129
130
/**
131
* For editors and suchlike who wish to change the URI associated with the
132
* document. Note if you want to get the current URI, use the read-only
133
* property on nsIWebNavigation.
134
*/
135
void setCurrentURI(in nsIURI aURI);
136
137
/**
138
* Notify the associated content viewer and all child docshells that they are
139
* about to be hidden. If |isUnload| is true, then the document is being
140
* unloaded and all dynamic subframe history entries are removed as well.
141
*
142
* @param isUnload
143
* True to fire the unload event in addition to the pagehide event,
144
* and remove all dynamic subframe history entries.
145
*/
146
[noscript] void firePageHideNotification(in boolean isUnload);
147
148
/**
149
* Presentation context for the currently loaded document. This may be null.
150
*/
151
[notxpcom,nostdcall] readonly attribute nsPresContext presContext;
152
153
/**
154
* Presentation shell for the currently loaded document. This may be null.
155
*/
156
[notxpcom,nostdcall] readonly attribute PresShell presShell;
157
158
/**
159
* Presentation shell for the oldest document, if this docshell is
160
* currently transitioning between documents.
161
*/
162
[notxpcom,nostdcall] readonly attribute PresShell eldestPresShell;
163
164
/**
165
* Content Viewer that is currently loaded for this DocShell. This may
166
* change as the underlying content changes.
167
*/
168
readonly attribute nsIContentViewer contentViewer;
169
170
/**
171
* Get the id of the outer window that is or will be in this docshell.
172
*/
173
[infallible] readonly attribute unsigned long long outerWindowID;
174
175
/**
176
* This attribute allows chrome to tie in to handle DOM events that may
177
* be of interest to chrome.
178
*/
179
attribute EventTarget chromeEventHandler;
180
181
/**
182
* This allows chrome to set a custom User agent on a specific docshell
183
*/
184
attribute AString customUserAgent;
185
186
/**
187
* Whether CSS error reporting is enabled.
188
*/
189
attribute boolean cssErrorReportingEnabled;
190
191
/**
192
* Whether to allow plugin execution
193
*/
194
attribute boolean allowPlugins;
195
196
/**
197
* Whether to allow Javascript execution
198
*/
199
attribute boolean allowJavascript;
200
201
/**
202
* Attribute stating if refresh based redirects can be allowed
203
*/
204
attribute boolean allowMetaRedirects;
205
206
/**
207
* Attribute stating if it should allow subframes (framesets/iframes) or not
208
*/
209
attribute boolean allowSubframes;
210
211
/**
212
* Attribute stating whether or not images should be loaded.
213
*/
214
attribute boolean allowImages;
215
216
/**
217
* Attribute stating whether or not media (audio/video) should be loaded.
218
*/
219
[infallible] attribute boolean allowMedia;
220
221
/**
222
* Attribute that determines whether DNS prefetch is allowed for this subtree
223
* of the docshell tree. Defaults to true. Setting this will make it take
224
* effect starting with the next document loaded in the docshell.
225
*/
226
attribute boolean allowDNSPrefetch;
227
228
/**
229
* Attribute that determines whether window control (move/resize) is allowed.
230
*/
231
attribute boolean allowWindowControl;
232
233
/**
234
* True if the docshell allows its content to be handled by a content listener
235
* other than the docshell itself, including the external helper app service,
236
* and false otherwise. Defaults to true.
237
*/
238
[infallible] attribute boolean allowContentRetargeting;
239
240
/**
241
* True if new child docshells should allow content retargeting.
242
* Setting allowContentRetargeting also overwrites this value.
243
*/
244
[infallible] attribute boolean allowContentRetargetingOnChildren;
245
246
/**
247
* True if this docShell should inherit the private browsing ID from
248
* its parent when reparented.
249
*
250
* NOTE: This should *not* be set false in new code, or for docShells
251
* inserted anywhere other than as children of panels.
252
*/
253
[infallible] attribute boolean inheritPrivateBrowsingId;
254
255
/**
256
* Get an array of this docShell and its children.
257
*
258
* @param aItemType - Only include docShells of this type, or if typeAll,
259
* include all child shells.
260
* Uses types from nsIDocShellTreeItem.
261
* @param aDirection - Whether to enumerate forwards or backwards.
262
*/
263
264
cenum DocShellEnumeratorDirection : 8 {
265
ENUMERATE_FORWARDS = 0,
266
ENUMERATE_BACKWARDS = 1
267
};
268
269
Array<nsIDocShell> getAllDocShellsInSubtree(in long aItemType,
270
in nsIDocShell_DocShellEnumeratorDirection aDirection);
271
272
/**
273
* The type of application that created this window.
274
*
275
* DO NOT DELETE, see bug 176166. For firefox, this value will always be
276
* UNKNOWN. However, it is used heavily in Thunderbird/comm-central and we
277
* don't really have a great replacement at the moment, so we'll just leave it
278
* here.
279
*/
280
cenum AppType : 8 {
281
APP_TYPE_UNKNOWN = 0,
282
APP_TYPE_MAIL = 1,
283
APP_TYPE_EDITOR = 2
284
};
285
286
[infallible] attribute nsIDocShell_AppType appType;
287
288
/**
289
* certain docshells (like the message pane)
290
* should not throw up auth dialogs
291
* because it can act as a password trojan
292
*/
293
attribute boolean allowAuth;
294
295
/**
296
* Set/Get the document scale factor. When setting this attribute, a
297
* NS_ERROR_NOT_IMPLEMENTED error may be returned by implementations
298
* not supporting zoom. Implementations not supporting zoom should return
299
* 1.0 all the time for the Get operation. 1.0 by the way is the default
300
* of zoom. This means 100% of normal scaling or in other words normal size
301
* no zoom.
302
*/
303
attribute float zoom;
304
305
/*
306
* Tells the docshell to offer focus to its tree owner.
307
* This is currently only necessary for embedding chrome.
308
* If forDocumentNavigation is true, then document navigation should be
309
* performed, where only the root of documents are selected. Otherwise, the
310
* next element in the parent should be returned. Returns true if focus was
311
* successfully taken by the tree owner.
312
*/
313
bool tabToTreeOwner(in boolean forward, in boolean forDocumentNavigation);
314
315
/**
316
* Current busy state for DocShell
317
*/
318
cenum BusyFlags : 8 {
319
BUSY_FLAGS_NONE = 0,
320
BUSY_FLAGS_BUSY = 1,
321
BUSY_FLAGS_BEFORE_PAGE_LOAD = 2,
322
BUSY_FLAGS_PAGE_LOADING = 4,
323
};
324
325
[infallible] readonly attribute nsIDocShell_BusyFlags busyFlags;
326
327
/**
328
* Load commands for the document
329
*/
330
cenum LoadCommand : 8 {
331
LOAD_CMD_NORMAL = 0x1, // Normal load
332
LOAD_CMD_RELOAD = 0x2, // Reload
333
LOAD_CMD_HISTORY = 0x4, // Load from history
334
LOAD_CMD_PUSHSTATE = 0x8, // History.pushState()
335
};
336
337
/*
338
* Attribute to access the loadtype for the document. LoadType Enum is
339
* defined in nsDocShellLoadTypes.h
340
*/
341
[infallible] attribute unsigned long loadType;
342
343
/*
344
* Default load flags (as defined in nsIRequest) that will be set on all
345
* requests made by this docShell and propagated to all child docShells and
346
* to nsILoadGroup::defaultLoadFlags for the docShell's loadGroup.
347
* Default is no flags. Once set, only future requests initiated by the
348
* docShell are affected, so in general, these flags should be set before
349
* the docShell loads any content.
350
*/
351
attribute nsLoadFlags defaultLoadFlags;
352
353
/*
354
* returns true if the docshell is being destroyed, false otherwise
355
*/
356
boolean isBeingDestroyed();
357
358
/*
359
* Returns true if the docshell is currently executing the onLoad Handler
360
*/
361
readonly attribute boolean isExecutingOnLoadHandler;
362
363
attribute nsILayoutHistoryState layoutHistoryState;
364
365
/**
366
* The SecureBrowserUI object for this docshell. This is set by XUL
367
* <browser> or nsWebBrowser for their root docshell.
368
*/
369
attribute nsISecureBrowserUI securityUI;
370
371
/**
372
* Object used to delegate URI loading to an upper context.
373
* Currently only set for GeckoView to allow handling of load requests
374
* at the application level.
375
*/
376
readonly attribute nsILoadURIDelegate loadURIDelegate;
377
378
/**
379
* Cancel the XPCOM timers for each meta-refresh URI in this docshell,
380
* and this docshell's children, recursively. The meta-refresh timers can be
381
* restarted using resumeRefreshURIs(). If the timers are already suspended,
382
* this has no effect.
383
*/
384
void suspendRefreshURIs();
385
386
/**
387
* Restart the XPCOM timers for each meta-refresh URI in this docshell,
388
* and this docshell's children, recursively. If the timers are already
389
* running, this has no effect.
390
*/
391
void resumeRefreshURIs();
392
393
/**
394
* Begin firing WebProgressListener notifications for restoring a page
395
* presentation. |viewer| is the content viewer whose document we are
396
* starting to load. If null, it defaults to the docshell's current content
397
* viewer, creating one if necessary. |top| should be true for the toplevel
398
* docshell that is being restored; it will be set to false when this method
399
* is called for child docshells. This method will post an event to
400
* complete the simulated load after returning to the event loop.
401
*/
402
void beginRestore(in nsIContentViewer viewer, in boolean top);
403
404
/**
405
* Finish firing WebProgressListener notifications and DOM events for
406
* restoring a page presentation. This should only be called via
407
* beginRestore().
408
*/
409
void finishRestore();
410
411
/* Track whether we're currently restoring a document presentation. */
412
readonly attribute boolean restoringDocument;
413
414
/* attribute to access whether error pages are enabled */
415
attribute boolean useErrorPages;
416
417
/**
418
* Display a load error in a frame while keeping that frame's currentURI
419
* pointing correctly to the page where the error ocurred, rather than to
420
* the error document page. You must provide either the aURI or aURL parameter.
421
*
422
* @param aError The error code to be displayed
423
* @param aURI nsIURI of the page where the error happened
424
* @param aURL wstring of the page where the error happened
425
* @param aFailedChannel The channel related to this error
426
*
427
* Returns whether or not we displayed an error page (note: will always
428
* return false if in-content error pages are disabled!)
429
*/
430
boolean displayLoadError(in nsresult aError,
431
in nsIURI aURI,
432
in wstring aURL,
433
[optional] in nsIChannel aFailedChannel);
434
435
/**
436
* The channel that failed to load and resulted in an error page.
437
* May be null. Relevant only to error pages.
438
*/
439
readonly attribute nsIChannel failedChannel;
440
441
/**
442
* Keeps track of the previous nsISHEntry index and the current
443
* nsISHEntry index at the time that the doc shell begins to load.
444
* Used for ContentViewer eviction.
445
*/
446
readonly attribute long previousEntryIndex;
447
readonly attribute long loadedEntryIndex;
448
449
/**
450
* Notification that entries have been removed from the beginning of a
451
* nsSHistory which has this as its rootDocShell.
452
*
453
* @param numEntries - The number of entries removed
454
*/
455
void historyPurged(in long numEntries);
456
457
/**
458
* Gets the channel for the currently loaded document, if any.
459
* For a new document load, this will be the channel of the previous document
460
* until after OnLocationChange fires.
461
*/
462
readonly attribute nsIChannel currentDocumentChannel;
463
464
/**
465
* The original offset of this child in its container. This property is -1 for
466
* dynamically added docShells.
467
*/
468
[notxpcom,nostdcall] attribute long childOffset;
469
470
/**
471
* Find out whether the docshell is currently in the middle of a page
472
* transition. This is set just before the pagehide/unload events fire.
473
*/
474
readonly attribute boolean isInUnload;
475
476
/**
477
* This attribute determines whether Mixed Active Content is loaded on the
478
* document. When it is true, mixed active content was not blocked and has
479
* loaded (or is about to load) on the page. When it is false, mixed active content
480
* has not loaded on the page, either because there was no mixed active content
481
* requests on the page or such requests were blocked by nsMixedContentBlocker.
482
* This boolean is set to true in nsMixedContentBlocker if Mixed Active Content
483
* is allowed (either explicitly on the page by the user or when the about:config
484
* setting security.mixed_content.block_active_content is set to false).
485
*/
486
[infallible] readonly attribute boolean hasMixedActiveContentLoaded;
487
488
/**
489
* This attribute determines whether a document has Mixed Active Content
490
* that has been blocked from loading. When it is true, there is definitely
491
* mixed active content on a page that has been blocked by
492
* nsMixedContentBlocker. When it is false, there may or may not be mixed
493
* active content on a page, but if there is, it will load. Note that if the
494
* about:config setting security.mixed_content.block_active_content is set
495
* false, this boolean will be false, since blocking active content has been
496
* disabled.
497
*/
498
[infallible] readonly attribute boolean hasMixedActiveContentBlocked;
499
500
/**
501
* This attribute determines whether Mixed Display Content is loaded on the
502
* document. When it is true, mixed display content was not blocked and has
503
* loaded (or is about to load) on the page. Similar behavior to
504
* hasMixedActiveContentLoaded.
505
*/
506
[infallible] readonly attribute boolean hasMixedDisplayContentLoaded;
507
508
/**
509
* This attribute determines whether a document has Mixed Display Content
510
* that has been blocked from loading. Similar behavior to
511
* hasMixedActiveContentBlocked.
512
*/
513
[infallible] readonly attribute boolean hasMixedDisplayContentBlocked;
514
515
/**
516
* Disconnects this docshell's editor from its window, and stores the
517
* editor data in the open document's session history entry. This
518
* should be called only during page transitions.
519
*/
520
[noscript, notxpcom] void DetachEditorFromWindow();
521
522
/**
523
* If true, this browser is not visible in the traditional sense, but
524
* is actively being rendered to the screen (ex. painted on a canvas)
525
* and should be treated accordingly.
526
**/
527
attribute boolean isOffScreenBrowser;
528
529
/**
530
* Allows nsDocumentViewer to tell the top-level same-type docshell that
531
* one of the documents under it is printing.
532
*/
533
[noscript, notxpcom] void setIsPrinting(in boolean aIsPrinting);
534
535
/**
536
* This method should only be called on a docShell that has been specifically
537
* created to display a print preview document. If the current document
538
* viewer isn't initialized for print preview when this method is called, it
539
* is replaced with a new viewer with an about:blank document (with the URL
540
* about:printpreview). The viewer is then returned, ready for the print
541
* preview document to be constructed when viewer.printPreview() is called.
542
*
543
* The same viewer will be returned on subsequent calls since various bits of
544
* code assume that, once created, the viewer is never replaced. Note,
545
* however, that the viewer's document will be replaced with a new document
546
* each time printPreview() is called on it (which is what we do to take
547
* account of print preview settings changes). Replacing the document
548
* viewer's document breaks the normally unchanging 1:1 relationship between
549
* a document and its viewer, but that seems to be okay.
550
*/
551
nsIWebBrowserPrint initOrReusePrintPreviewViewer();
552
553
/**
554
* Propagated to the print preview document viewer. Must only be called on
555
* a document viewer that has been initialized for print preview.
556
*/
557
void exitPrintPreview();
558
559
/**
560
* Whether this docshell can execute scripts based on its hierarchy.
561
* The rule of thumb here is that we disable js if this docshell or any
562
* of its parents disallow scripting.
563
*/
564
[infallible] readonly attribute boolean canExecuteScripts;
565
566
/**
567
* Sets whether a docshell is active. An active docshell is one that is
568
* visible, and thus is not a good candidate for certain optimizations
569
* like image frame discarding. Docshells are active unless told otherwise.
570
*/
571
[infallible] attribute boolean isActive;
572
573
/**
574
* The ID of the docshell in the session history.
575
*/
576
readonly attribute nsIDPtr historyID;
577
578
/**
579
* Helper method for accessing this value from C++
580
*/
581
[noscript, notxpcom] nsID HistoryID();
582
583
/**
584
* Sets whether a docshell is an app tab. An app tab docshell may behave
585
* differently than a non-app tab docshell in some cases, such as when
586
* handling link clicks. Docshells are not app tabs unless told otherwise.
587
*/
588
attribute boolean isAppTab;
589
590
/**
591
* Create a new about:blank document and content viewer.
592
* @param aPrincipal the principal to use for the new document.
593
* @param aStoragePrincipal the storage principal to use for the new document.
594
* @param aCsp the CSP to use for the new document.
595
*/
596
void createAboutBlankContentViewer(in nsIPrincipal aPrincipal,
597
in nsIPrincipal aStoragePrincipal,
598
[optional] in nsIContentSecurityPolicy aCSP);
599
600
/**
601
* Upon getting, returns the canonical encoding label of the document
602
* currently loaded into this docshell.
603
*
604
* Upon setting, sets forcedCharset for compatibility with legacy callers.
605
*/
606
attribute ACString charset;
607
608
/**
609
* Called when the user chose an encoding override from the character
610
* encoding menu. Separate from the setter for the charset property to avoid
611
* extensions adding noise to the data.
612
*/
613
void gatherCharsetMenuTelemetry();
614
615
/**
616
* The charset forced by the user.
617
*/
618
attribute ACString forcedCharset;
619
620
/**
621
* In a child docshell, this is the charset of the parent docshell
622
*/
623
[noscript, notxpcom, nostdcall] void setParentCharset(
624
in Encoding parentCharset,
625
in int32_t parentCharsetSource,
626
in nsIPrincipal parentCharsetPrincipal);
627
[noscript, notxpcom, nostdcall] void getParentCharset(
628
out Encoding parentCharset,
629
out int32_t parentCharsetSource,
630
out nsIPrincipal parentCharsetPrincipal);
631
632
/**
633
* Whether the docShell records profile timeline markers at the moment
634
*/
635
[infallible] attribute boolean recordProfileTimelineMarkers;
636
637
/**
638
* Return a DOMHighResTimeStamp representing the number of
639
* milliseconds from an arbitrary point in time. The reference
640
* point is shared by all DocShells and is also used by timestamps
641
* on markers.
642
*/
643
DOMHighResTimeStamp now();
644
645
/**
646
* Returns and flushes the profile timeline markers gathered by the docShell
647
*/
648
[implicit_jscontext]
649
jsval popProfileTimelineMarkers();
650
651
/**
652
* Add an observer to the list of parties to be notified when this docshell's
653
* private browsing status is changed. |obs| must support weak references.
654
*/
655
void addWeakPrivacyTransitionObserver(in nsIPrivacyTransitionObserver obs);
656
657
/**
658
* Add an observer to the list of parties to be notified when reflows are
659
* occurring. |obs| must support weak references.
660
*/
661
void addWeakReflowObserver(in nsIReflowObserver obs);
662
663
/**
664
* Remove an observer from the list of parties to be notified about reflows.
665
*/
666
void removeWeakReflowObserver(in nsIReflowObserver obs);
667
668
/**
669
* Notify all attached observers that a reflow has just occurred.
670
*
671
* @param interruptible if true, the reflow was interruptible.
672
* @param start timestamp when reflow started, in milliseconds since
673
* navigationStart (accurate to 1/1000 of a ms)
674
* @param end timestamp when reflow ended, in milliseconds since
675
* navigationStart (accurate to 1/1000 of a ms)
676
*/
677
[noscript] void notifyReflowObservers(in bool interruptible,
678
in DOMHighResTimeStamp start,
679
in DOMHighResTimeStamp end);
680
681
/**
682
* Add an observer to the list of parties to be notified when scroll position
683
* of some elements is changed.
684
*/
685
[noscript] void addWeakScrollObserver(in nsIScrollObserver obs);
686
687
/**
688
* Add an observer to the list of parties to be notified when scroll position
689
* of some elements is changed.
690
*/
691
[noscript] void removeWeakScrollObserver(in nsIScrollObserver obs);
692
693
/**
694
* Notify all attached observers that the scroll position of some element
695
* has changed.
696
*/
697
[noscript] void notifyScrollObservers();
698
699
/**
700
* The type of iframe that this docshell lives.
701
*/
702
cenum FrameType : 8 {
703
FRAME_TYPE_REGULAR = 0,
704
FRAME_TYPE_BROWSER = 1,
705
};
706
[infallible] attribute nsIDocShell_FrameType frameType;
707
708
/**
709
* Returns true if this docshell corresponds to an <iframe mozbrowser>.
710
* <xul:browser> returns false here.
711
*/
712
[infallible] readonly attribute boolean isMozBrowser;
713
714
/**
715
* Returns true if this docshell corresponds to an <iframe mozbrowser>, or
716
* if this docshell is contained in an <iframe mozbrowser>. <xul:browser>
717
* returns false here.
718
*
719
* To compute this value, we walk up the docshell hierarchy. If we encounter
720
* a docshell with isMozBrowser before we hit the end of the hierarchy,
721
* we return true. Otherwise, we return false.
722
*/
723
[infallible] readonly attribute boolean isInMozBrowser;
724
725
/**
726
* Returns true if this docshell is the top level content docshell.
727
*/
728
[infallible] readonly attribute boolean isTopLevelContentDocShell;
729
730
/**
731
* Like nsIDocShellTreeItem::GetSameTypeParent, except this ignores <iframe
732
* mozbrowser> boundaries.
733
*
734
* @deprecated: Use `BrowsingContext::GetParent()` in the future.
735
*/
736
nsIDocShell getSameTypeParentIgnoreBrowserBoundaries();
737
738
/**
739
* Like nsIDocShellTreeItem::GetSameTypeRootTreeItem, except this ignores
740
* <iframe mozbrowser> boundaries.
741
*
742
* @deprecated: Use `BrowsingContext::Top()` in the future.
743
*/
744
nsIDocShell getSameTypeRootTreeItemIgnoreBrowserBoundaries();
745
746
/**
747
* True iff asynchronous panning and zooming is enabled for this
748
* docshell.
749
*/
750
readonly attribute bool asyncPanZoomEnabled;
751
752
/**
753
* Returns true if we are sandboxed from aTargetDocShell.
754
* aTargetDocShell - the browsing context we are attempting to navigate.
755
*/
756
[noscript,notxpcom,nostdcall] bool isSandboxedFrom(in BrowsingContext aTargetBC);
757
758
/**
759
* This member variable determines whether a document has Mixed Active Content that
760
* was initially blocked from loading, but the user has choosen to override the
761
* block and allow the content to load. mMixedContentChannel is set to the document's
762
* channel when the user allows mixed content. The nsMixedContentBlocker content policy
763
* checks if the document's root channel matches the mMixedContentChannel. If it matches,
764
* then Mixed Content is loaded. If it does match, mixed content is blocked.
765
*
766
* A match implies that there is definitely mixed active content on a page that was
767
* initially blocked by nsMixedContentBlocker and then allowed and loaded by the user.
768
* A miss imples that IF there is mixed active content on the page AND it was
769
* blocked by nsMixedContentBlocker.cpp, the user has not choosen to override
770
* the block. Note that if the about:config setting
771
* security.mixed_content.block_active_content is set to false, this boolean
772
* will be false, mMixedContentChannel will remain null since blocking active content has
773
* been disabled and hence mMixedContentChannel will never be set.
774
*/
775
attribute nsIChannel mixedContentChannel;
776
777
/**
778
* Checks whether the channel associated with the root docShell is equal to
779
* mMixedContentChannel. If they are the same, allowMixedContent is set to true.
780
* Checks if the root document has a secure connection. If it is, sets
781
* rootHasSecureConnection to true. If the docShell is the root doc shell,
782
* isRootDocShell is set to true.
783
*/
784
void GetAllowMixedContentAndConnectionData(out boolean rootHasSecureConnection, out boolean allowMixedContent, out boolean isRootDocShell);
785
786
787
/**
788
* Are plugins allowed in the current document loaded in this docshell ?
789
* (if there is one). This depends on whether plugins are allowed by this
790
* docshell itself or if the document is sandboxed and hence plugins should
791
* not be allowed.
792
*/
793
[noscript, notxpcom] bool pluginsAllowedInCurrentDoc();
794
795
796
/**
797
* Attribute that determines whether fullscreen is allowed to be entered for
798
* this subtree of the docshell tree. This is true when all iframes containing
799
* this docshell have their "allowfullscreen" attribute set to "true".
800
* fullscreenAllowed is only writable at content boundaries, where it is used
801
* to propagate the value of the cross process parent's iframe's
802
* "allowfullscreen" attribute to the child process. Setting
803
* fullscreenAllowed on docshells which aren't content boundaries throws an
804
* exception.
805
*/
806
[infallible] readonly attribute boolean fullscreenAllowed;
807
808
void setFullscreenAllowed(in boolean allowed);
809
810
[notxpcom] uint32_t orientationLock();
811
[notxpcom] void setOrientationLock(in uint32_t orientationLock);
812
813
[noscript, infallible] attribute boolean affectPrivateSessionLifetime;
814
815
/**
816
* Indicates whether the UI may enable the character encoding menu. The UI
817
* must disable the menu when this property is false.
818
*/
819
[infallible] readonly attribute boolean mayEnableCharacterEncodingMenu;
820
821
/**
822
* Indicates that the character encoding was autodetected.
823
*/
824
[infallible] readonly attribute boolean charsetAutodetected;
825
826
attribute nsIEditor editor;
827
readonly attribute boolean editable; /* this docShell is editable */
828
readonly attribute boolean hasEditingSession; /* this docShell has an editing session */
829
830
/**
831
* Make this docShell editable, setting a flag that causes
832
* an editor to get created, either immediately, or after
833
* a url has been loaded.
834
* @param inWaitForUriLoad true to wait for a URI before
835
* creating the editor.
836
*/
837
void makeEditable(in boolean inWaitForUriLoad);
838
839
840
/**
841
* Add a Child SHEntry for a frameset page, given the child's loadtype.
842
* If aCloneChildren is true, then aCloneReference's children will be
843
* cloned onto aHistoryEntry.
844
*/
845
void addChildSHEntry(in nsISHEntry aCloneReference,
846
in nsISHEntry aHistoryEntry,
847
in long aChildOffset,
848
in unsigned long aLoadType,
849
in boolean aCloneChilden);
850
851
/**
852
* Whether this docshell should save entries in global history.
853
*/
854
attribute boolean useGlobalHistory;
855
856
/**
857
* Removes nsISHEntry objects related to this docshell from session history.
858
* Use this only with subdocuments, like iframes.
859
*/
860
void removeFromSessionHistory();
861
862
/**
863
* Set when an iframe/frame is added dynamically.
864
*/
865
[infallible] attribute boolean createdDynamically;
866
867
/**
868
* Returns false for mLSHE, true for mOSHE
869
*/
870
boolean getCurrentSHEntry(out nsISHEntry aEntry);
871
872
/**
873
* Cherry picked parts of nsIController.
874
* They are here, because we want to call these functions
875
* from JS.
876
*/
877
boolean isCommandEnabled(in string command);
878
[can_run_script]
879
void doCommand(in string command);
880
[can_run_script]
881
void doCommandWithParams(in string command, in nsICommandParams aParams);
882
883
/**
884
* Invisible DocShell are dummy construct to simulate DOM windows
885
* without any actual visual representation. They have to be marked
886
* at construction time, to avoid any painting activity.
887
*/
888
[noscript, notxpcom] bool IsInvisible();
889
[noscript, notxpcom] void SetInvisible(in bool aIsInvisibleDocshell);
890
891
/**
892
* Get the script global for the document in this docshell.
893
*/
894
[noscript,notxpcom,nostdcall] nsIScriptGlobalObject GetScriptGlobalObject();
895
896
/**
897
* If deviceSizeIsPageSize is set to true, device-width/height media queries
898
* will be calculated from the page size, not the device size.
899
*
900
* Used by the Responsive Design Mode and B2G Simulator.
901
*
902
* Default is False.
903
* Default value can be overriden with
904
* docshell.device_size_is_page_size pref.
905
*/
906
[infallible] attribute boolean deviceSizeIsPageSize;
907
908
/**
909
* Regarding setOpener / getOpener - We can't use XPIDL's "attribute"
910
* for notxpcom, so we're relegated to using explicit gets / sets. This
911
* should be fine, considering that these methods should only ever be
912
* called from native code.
913
*/
914
[noscript,notxpcom,nostdcall] void setOpener(in nsIRemoteTab aOpener);
915
[noscript,notxpcom,nostdcall] nsIRemoteTab getOpener();
916
917
/**
918
* Notify DocShell when the browser is about to start executing JS, and after
919
* that execution has stopped. This only occurs when the Timeline devtool
920
* is collecting information.
921
*/
922
[noscript,notxpcom,nostdcall] void notifyJSRunToCompletionStart(in string aReason,
923
in AString functionName,
924
in AString fileName,
925
in unsigned long lineNumber,
926
in jsval asyncStack,
927
in string asyncCause);
928
[noscript,notxpcom,nostdcall] void notifyJSRunToCompletionStop();
929
930
[noscript] void GetOSHEId(out uint32_t aSHEntryId);
931
932
/**
933
* This attribute determines whether a document which is not about:blank has
934
* already be loaded by this docShell.
935
*/
936
[infallible] readonly attribute boolean hasLoadedNonBlankURI;
937
938
/**
939
* Allow usage of -moz-window-dragging:drag for content docshells.
940
* True for top level chrome docshells. Throws if set to false with
941
* top level chrome docshell.
942
*/
943
attribute boolean windowDraggingAllowed;
944
945
/**
946
* Sets/gets the current scroll restoration mode.
948
*/
949
attribute boolean currentScrollRestorationIsManual;
950
951
/**
952
* Setter and getter for the origin attributes living on this docshell.
953
*/
954
[implicit_jscontext]
955
jsval getOriginAttributes();
956
957
[implicit_jscontext]
958
void setOriginAttributes(in jsval aAttrs);
959
960
/**
961
* The editing session for this docshell.
962
*/
963
readonly attribute nsIEditingSession editingSession;
964
965
/**
966
* The browser child for this docshell.
967
*/
968
[binaryname(ScriptableBrowserChild)] readonly attribute nsIBrowserChild browserChild;
969
[noscript,notxpcom,nostdcall] BrowserChildRef GetBrowserChild();
970
971
[noscript,nostdcall,notxpcom] nsCommandManager GetCommandManager();
972
973
cenum TouchEventsOverride: 8 {
974
/**
975
* Override platform/pref default behaviour and force-disable touch events.
976
*/
977
TOUCHEVENTS_OVERRIDE_DISABLED = 0,
978
/**
979
* Override platform/pref default behaviour and force-enable touch events.
980
*/
981
TOUCHEVENTS_OVERRIDE_ENABLED = 1,
982
/**
983
* Don't override the platform/pref default behaviour for touch events.
984
*/
985
TOUCHEVENTS_OVERRIDE_NONE = 2,
986
};
987
988
/**
989
* This allows chrome to override the default choice of whether touch events
990
* are available on a specific docshell. Possible values are listed below.
991
*/
992
[infallible] attribute nsIDocShell_TouchEventsOverride touchEventsOverride;
993
994
cenum MetaViewportOverride: 8 {
995
/**
996
* Override platform/pref default behaviour and force-disable support for
997
* <meta name="viewport">.
998
*/
999
META_VIEWPORT_OVERRIDE_DISABLED = 0,
1000
/**
1001
* Override platform/pref default behaviour and force-enable support for
1002
* <meta name="viewport">.
1003
*/
1004
META_VIEWPORT_OVERRIDE_ENABLED = 1,
1005
/**
1006
* Don't override the platform/pref default behaviour for support for
1007
* <meta name="viewport">.
1008
*/
1009
META_VIEWPORT_OVERRIDE_NONE = 2,
1010
};
1011
1012
/**
1013
* This allows chrome to override the default choice of whether the
1014
* <meta name="viewport"> tag is respected in a specific docshell.
1015
* Possible values are listed above.
1016
*/
1017
[infallible] attribute nsIDocShell_MetaViewportOverride metaViewportOverride;
1018
1019
/**
1020
* Returns `true` if this docshell was created due to a Large-Allocation
1021
* header, and has not seen the initiating load yet.
1022
*/
1023
[infallible] readonly attribute boolean awaitingLargeAlloc;
1024
1025
/**
1026
* Attribute that determines whether tracking protection is enabled.
1027
*/
1028
attribute boolean useTrackingProtection;
1029
1030
/**
1031
* Fire a dummy location change event asynchronously.
1032
*/
1033
[noscript] void dispatchLocationChangeEvent();
1034
1035
1036
/**
1037
* Start delayed autoplay media which are in the current document.
1038
*/
1039
[noscript] void startDelayedAutoplayMediaComponents();
1040
1041
/**
1042
* Take ownership of the ClientSource representing an initial about:blank
1043
* document that was never needed. As an optimization we avoid creating
1044
* this document if no code calls GetDocument(), but we still need a
1045
* ClientSource object to represent the about:blank window. This may return
1046
* nullptr; for example if the docshell has created a real window and document
1047
* already.
1048
*/
1049
[noscript, nostdcall, notxpcom]
1050
UniqueClientSource TakeInitialClientSource();
1051
1052
void setColorMatrix(in Array<float> aMatrix);
1053
1054
/**
1055
* Returns true if the current load is a forced reload,
1056
* e.g. started by holding shift whilst triggering reload.
1057
*/
1058
readonly attribute bool isForceReloading;
1059
1060
Array<float> getColorMatrix();
1061
1062
/**
1063
* Initialize session history for this docshell. The docshell must be the root
1064
* docshell.
1065
*/
1066
void initSessionHistory();
1067
1068
%{C++
1069
/**
1070
* These methods call nsDocShell::GetHTMLEditorInternal() and
1071
* nsDocShell::SetHTMLEditorInternal() with static_cast.
1072
*/
1073
mozilla::HTMLEditor* GetHTMLEditor();
1074
nsresult SetHTMLEditor(mozilla::HTMLEditor* aHTMLEditor);
1075
%}
1076
1077
/**
1078
* Allowed CSS display modes. This needs to be kept in
1079
* sync with similar values in ServoStyleConsts.h
1080
*/
1081
cenum DisplayMode: 8 {
1082
DISPLAY_MODE_BROWSER = 0,
1083
DISPLAY_MODE_MINIMAL_UI = 1,
1084
DISPLAY_MODE_STANDALONE = 2,
1085
DISPLAY_MODE_FULLSCREEN = 3,
1086
};
1087
1088
/**
1089
* Display mode for this docshell. Defaults to DISPLAY_MODE_BROWSER.
1090
* Media queries only look at the value in the top-most docshell.
1091
*/
1092
[infallible] attribute nsIDocShell_DisplayMode displayMode;
1093
1094
/**
1095
* The message manager for this docshell. This does not throw, but
1096
* can return null if the docshell has no message manager.
1097
*/
1098
[infallible] readonly attribute ContentFrameMessageManager messageManager;
1099
1100
/**
1101
* Asynchronously retrieve a JSON string representing a log of the
1102
* content blocking events happened so far in the current tab from the
1103
* content process.
1104
*
1105
* This returns a Promise which resolves to a string on success, and is
1106
* rejected on failure. For documentation on the string format, please
1107
* see nsISecureBrowserUI.contentBlockingLogJSON.
1108
*/
1109
Promise getContentBlockingLog();
1110
1111
/**
1112
* This returns a Promise which resolves to a boolean. True when the
1113
* document has Tracking Content that has been blocked from loading, false
1114
* otherwise.
1115
*/
1116
Promise getHasTrackingContentBlocked();
1117
1118
/**
1119
* Return whether this docshell is "attempting to navigate" in the
1120
* sense that's relevant to document.open.
1121
*/
1122
[notxpcom, nostdcall] readonly attribute boolean isAttemptingToNavigate;
1123
1124
/**
1125
* Whether developer tools are watching activity in this docshell.
1126
*/
1127
[infallible] attribute boolean watchedByDevtools;
1128
1129
/*
1130
* Whether or not this docshell is executing a nsIWebNavigation navigation
1131
* method.
1132
*
1133
* This will be true when the following methods are executing:
1134
* nsIWebNavigation.binaryLoadURI
1135
* nsIWebNavigation.goBack
1136
* nsIWebNavigation.goForward
1137
* nsIWebNavigation.gotoIndex
1138
* nsIWebNavigation.loadURI
1139
*/
1140
[infallible] readonly attribute boolean isNavigating;
1141
1142
/**
1143
* @see nsISHEntry synchronizeLayoutHistoryState().
1144
*/
1145
void synchronizeLayoutHistoryState();
1146
};