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