docshell/base/nsIDocShell.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial