michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "domstubs.idl" michael@0: #include "nsIDocShellTreeItem.idl" michael@0: michael@0: %{ C++ michael@0: #include "js/TypeDecls.h" michael@0: class nsPresContext; michael@0: class nsIPresShell; michael@0: %} michael@0: michael@0: /** michael@0: * The nsIDocShell interface. michael@0: */ michael@0: michael@0: [ptr] native nsPresContext(nsPresContext); michael@0: [ptr] native nsIPresShell(nsIPresShell); michael@0: michael@0: interface nsIURI; michael@0: interface nsIChannel; michael@0: interface nsIContentViewer; michael@0: interface nsIURIContentListener; michael@0: interface nsIDOMEventTarget; michael@0: interface nsIDocShellLoadInfo; michael@0: interface nsIEditor; michael@0: interface nsIWebNavigation; michael@0: interface nsISimpleEnumerator; michael@0: interface nsIInputStream; michael@0: interface nsIRequest; michael@0: interface nsISHEntry; michael@0: interface nsILayoutHistoryState; michael@0: interface nsISecureBrowserUI; michael@0: interface nsIScriptGlobalObject; michael@0: interface nsIDOMStorage; michael@0: interface nsIPrincipal; michael@0: interface nsIWebBrowserPrint; michael@0: interface nsIVariant; michael@0: interface nsIPrivacyTransitionObserver; michael@0: interface nsIReflowObserver; michael@0: interface nsIScrollObserver; michael@0: michael@0: typedef unsigned long nsLoadFlags; michael@0: michael@0: [scriptable, builtinclass, uuid(e46d924d-c20f-4add-8cf5-1e1c817b2181)] michael@0: interface nsIDocShell : nsIDocShellTreeItem michael@0: { michael@0: /** michael@0: * Loads a given URI. This will give priority to loading the requested URI michael@0: * in the object implementing this interface. If it can't be loaded here michael@0: * however, the URL dispatcher will go through its normal process of content michael@0: * loading. michael@0: * michael@0: * @param uri - The URI to load. michael@0: * @param loadInfo - This is the extended load info for this load. This michael@0: * most often will be null, but if you need to do michael@0: * additional setup for this load you can get a loadInfo michael@0: * object by calling createLoadInfo. Once you have this michael@0: * object you can set the needed properties on it and michael@0: * then pass it to loadURI. michael@0: * @param aLoadFlags - Flags to modify load behaviour. Flags are defined in michael@0: * nsIWebNavigation. Note that using flags outside michael@0: * LOAD_FLAGS_MASK is only allowed if passing in a michael@0: * non-null loadInfo. And even some of those might not michael@0: * be allowed. Use at your own risk. michael@0: */ michael@0: [noscript]void loadURI(in nsIURI uri, michael@0: in nsIDocShellLoadInfo loadInfo, michael@0: in unsigned long aLoadFlags, michael@0: in boolean firstParty); michael@0: michael@0: /** michael@0: * Loads a given stream. This will give priority to loading the requested michael@0: * stream in the object implementing this interface. If it can't be loaded michael@0: * here however, the URL dispatched will go through its normal process of michael@0: * content loading. michael@0: * michael@0: * @param aStream - The input stream that provides access to the data michael@0: * to be loaded. This must be a blocking, threadsafe michael@0: * stream implementation. michael@0: * @param aURI - The URI representing the stream, or null. michael@0: * @param aContentType - The type (MIME) of data being loaded (empty if unknown). michael@0: * @param aContentCharset - The charset of the data being loaded (empty if unknown). michael@0: * @param aLoadInfo - This is the extended load info for this load. This michael@0: * most often will be null, but if you need to do michael@0: * additional setup for this load you can get a michael@0: * loadInfo object by calling createLoadInfo. Once michael@0: * you have this object you can set the needed michael@0: * properties on it and then pass it to loadStream. michael@0: */ michael@0: [noscript]void loadStream(in nsIInputStream aStream, michael@0: in nsIURI aURI, michael@0: in ACString aContentType, michael@0: in ACString aContentCharset, michael@0: in nsIDocShellLoadInfo aLoadInfo); michael@0: michael@0: const long INTERNAL_LOAD_FLAGS_NONE = 0x0; michael@0: const long INTERNAL_LOAD_FLAGS_INHERIT_OWNER = 0x1; michael@0: const long INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 0x2; michael@0: const long INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x4; michael@0: michael@0: // This flag marks the first load in this object michael@0: // @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD michael@0: const long INTERNAL_LOAD_FLAGS_FIRST_LOAD = 0x8; michael@0: michael@0: const long INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10; michael@0: const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20; michael@0: michael@0: // Whether the load should be treated as srcdoc load, rather than a URI one. michael@0: const long INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40; michael@0: michael@0: const long INTERNAL_LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x80; michael@0: michael@0: /** michael@0: * Loads the given URI. This method is identical to loadURI(...) except michael@0: * that its parameter list is broken out instead of being packaged inside michael@0: * of an nsIDocShellLoadInfo object... michael@0: * michael@0: * @param aURI - The URI to load. michael@0: * @param aReferrer - Referring URI michael@0: * @param aOwner - Owner (security principal) michael@0: * @param aInheritOwner - Flag indicating whether the owner of the current michael@0: * document should be inherited if aOwner is null. michael@0: * @param aStopActiveDoc - Flag indicating whether loading the current michael@0: * document should be stopped. michael@0: * @param aWindowTarget - Window target for the load. michael@0: * @param aTypeHint - A hint as to the content-type of the resulting michael@0: * data. May be null or empty if no hint. michael@0: * @param aFileName - Non-null when the link should be downloaded as michael@0: the given filename. michael@0: * @param aPostDataStream - Post data stream (if POSTing) michael@0: * @param aHeadersStream - Stream containing "extra" request headers... michael@0: * @param aLoadFlags - Flags to modify load behaviour. Flags are defined michael@0: * in nsIWebNavigation. michael@0: * @param aSHEntry - Active Session History entry (if loading from SH) michael@0: * @param aSrcdoc When INTERNAL_LOAD_FLAGS_IS_SRCDOC is set, the michael@0: * contents of this parameter will be loaded instead michael@0: * of aURI. michael@0: * @param aSourceDocShell - The source browsing context for the navigation. michael@0: * @param aBaseURI - The base URI to be used for the load. Set in michael@0: * srcdoc loads as it cannot otherwise be inferred michael@0: * in certain situations such as view-source. michael@0: */ michael@0: [noscript]void internalLoad(in nsIURI aURI, michael@0: in nsIURI aReferrer, michael@0: in nsISupports aOwner, michael@0: in uint32_t aFlags, michael@0: in wstring aWindowTarget, michael@0: in string aTypeHint, michael@0: in AString aFileName, michael@0: in nsIInputStream aPostDataStream, michael@0: in nsIInputStream aHeadersStream, michael@0: in unsigned long aLoadFlags, michael@0: in nsISHEntry aSHEntry, michael@0: in boolean firstParty, michael@0: in AString aSrcdoc, michael@0: in nsIDocShell aSourceDocShell, michael@0: in nsIURI aBaseURI, michael@0: out nsIDocShell aDocShell, michael@0: out nsIRequest aRequest); michael@0: michael@0: /** michael@0: * Do either a history.pushState() or history.replaceState() operation, michael@0: * depending on the value of aReplace. michael@0: */ michael@0: [implicit_jscontext] michael@0: void addState(in jsval aData, in DOMString aTitle, michael@0: in DOMString aURL, in boolean aReplace); michael@0: michael@0: /** michael@0: * Creates a DocShellLoadInfo object that you can manipulate and then pass michael@0: * to loadURI. michael@0: */ michael@0: void createLoadInfo(out nsIDocShellLoadInfo loadInfo); michael@0: michael@0: /** michael@0: * Reset state to a new content model within the current document and the document michael@0: * viewer. Called by the document before initiating an out of band document.write(). michael@0: */ michael@0: void prepareForNewContentModel(); michael@0: michael@0: /** michael@0: * For editors and suchlike who wish to change the URI associated with the michael@0: * document. Note if you want to get the current URI, use the read-only michael@0: * property on nsIWebNavigation. michael@0: */ michael@0: void setCurrentURI(in nsIURI aURI); michael@0: michael@0: /** michael@0: * Notify the associated content viewer and all child docshells that they are michael@0: * about to be hidden. If |isUnload| is true, then the document is being michael@0: * unloaded as well. michael@0: * michael@0: * @param isUnload if true, fire the unload event in addition to the pagehide michael@0: * event. michael@0: */ michael@0: [noscript] void firePageHideNotification(in boolean isUnload); michael@0: michael@0: /** michael@0: * Presentation context for the currently loaded document. This may be null. michael@0: */ michael@0: [noscript] readonly attribute nsPresContext presContext; michael@0: michael@0: /** michael@0: * Presentation shell for the currently loaded document. This may be null. michael@0: */ michael@0: [noscript,notxpcom] nsIPresShell GetPresShell(); michael@0: michael@0: /** michael@0: * Presentation shell for the oldest document, if this docshell is michael@0: * currently transitioning between documents. michael@0: */ michael@0: [noscript] readonly attribute nsIPresShell eldestPresShell; michael@0: michael@0: /** michael@0: * Content Viewer that is currently loaded for this DocShell. This may michael@0: * change as the underlying content changes. michael@0: */ michael@0: readonly attribute nsIContentViewer contentViewer; michael@0: michael@0: /** michael@0: * This attribute allows chrome to tie in to handle DOM events that may michael@0: * be of interest to chrome. michael@0: */ michael@0: attribute nsIDOMEventTarget chromeEventHandler; michael@0: michael@0: /** michael@0: * Whether to allow plugin execution michael@0: */ michael@0: attribute boolean allowPlugins; michael@0: michael@0: /** michael@0: * Whether to allow Javascript execution michael@0: */ michael@0: attribute boolean allowJavascript; michael@0: michael@0: /** michael@0: * Attribute stating if refresh based redirects can be allowed michael@0: */ michael@0: attribute boolean allowMetaRedirects; michael@0: michael@0: /** michael@0: * Attribute stating if it should allow subframes (framesets/iframes) or not michael@0: */ michael@0: attribute boolean allowSubframes; michael@0: michael@0: /** michael@0: * Attribute stating whether or not images should be loaded. michael@0: */ michael@0: attribute boolean allowImages; michael@0: michael@0: /** michael@0: * Attribute stating whether or not media (audio/video) should be loaded. michael@0: */ michael@0: [infallible] attribute boolean allowMedia; michael@0: michael@0: /** michael@0: * Attribute that determines whether DNS prefetch is allowed for this subtree michael@0: * of the docshell tree. Defaults to true. Setting this will make it take michael@0: * effect starting with the next document loaded in the docshell. michael@0: */ michael@0: attribute boolean allowDNSPrefetch; michael@0: michael@0: /** michael@0: * Attribute that determines whether window control (move/resize) is allowed. michael@0: */ michael@0: attribute boolean allowWindowControl; michael@0: michael@0: /** michael@0: * True if the docshell allows its content to be handled by a content listener michael@0: * other than the docshell itself, including the external helper app service, michael@0: * and false otherwise. Defaults to true. michael@0: */ michael@0: [infallible] attribute boolean allowContentRetargeting; michael@0: michael@0: /** michael@0: * Get an enumerator over this docShell and its children. michael@0: * michael@0: * @param aItemType - Only include docShells of this type, or if typeAll, michael@0: * include all child shells. michael@0: * Uses types from nsIDocShellTreeItem. michael@0: * @param aDirection - Whether to enumerate forwards or backwards. michael@0: */ michael@0: michael@0: const long ENUMERATE_FORWARDS = 0; michael@0: const long ENUMERATE_BACKWARDS = 1; michael@0: michael@0: nsISimpleEnumerator getDocShellEnumerator(in long aItemType, michael@0: in long aDirection); michael@0: michael@0: /** michael@0: * The type of application that created this window michael@0: */ michael@0: const unsigned long APP_TYPE_UNKNOWN = 0; michael@0: const unsigned long APP_TYPE_MAIL = 1; michael@0: const unsigned long APP_TYPE_EDITOR = 2; michael@0: michael@0: attribute unsigned long appType; michael@0: michael@0: /** michael@0: * certain dochshells (like the message pane) michael@0: * should not throw up auth dialogs michael@0: * because it can act as a password trojan michael@0: */ michael@0: attribute boolean allowAuth; michael@0: michael@0: /** michael@0: * Set/Get the document scale factor. When setting this attribute, a michael@0: * NS_ERROR_NOT_IMPLEMENTED error may be returned by implementations michael@0: * not supporting zoom. Implementations not supporting zoom should return michael@0: * 1.0 all the time for the Get operation. 1.0 by the way is the default michael@0: * of zoom. This means 100% of normal scaling or in other words normal size michael@0: * no zoom. michael@0: */ michael@0: attribute float zoom; michael@0: michael@0: /* michael@0: * The size, in CSS pixels, of the horizontal margins for the of an michael@0: * HTML document in this docshel; used to implement the marginwidth attribute michael@0: * on HTML /