michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 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 "nsISupports.idl" michael@0: michael@0: interface nsIDOMDocument; michael@0: interface nsIInputStream; michael@0: interface nsISHistory; michael@0: interface nsIURI; michael@0: michael@0: /** michael@0: * The nsIWebNavigation interface defines an interface for navigating the web. michael@0: * It provides methods and attributes to direct an object to navigate to a new michael@0: * location, stop or restart an in process load, or determine where the object michael@0: * has previously gone. michael@0: */ michael@0: [scriptable, uuid(b7568a50-4c50-442c-a6be-3a340a48d89a)] michael@0: interface nsIWebNavigation : nsISupports michael@0: { michael@0: /** michael@0: * Indicates if the object can go back. If true this indicates that michael@0: * there is back session history available for navigation. michael@0: */ michael@0: readonly attribute boolean canGoBack; michael@0: michael@0: /** michael@0: * Indicates if the object can go forward. If true this indicates that michael@0: * there is forward session history available for navigation michael@0: */ michael@0: readonly attribute boolean canGoForward; michael@0: michael@0: /** michael@0: * Tells the object to navigate to the previous session history item. When a michael@0: * page is loaded from session history, all content is loaded from the cache michael@0: * (if available) and page state (such as form values and scroll position) is michael@0: * restored. michael@0: * michael@0: * @throw NS_ERROR_UNEXPECTED michael@0: * Indicates that the call was unexpected at this time, which implies michael@0: * that canGoBack is false. michael@0: */ michael@0: void goBack(); michael@0: michael@0: /** michael@0: * Tells the object to navigate to the next session history item. When a michael@0: * page is loaded from session history, all content is loaded from the cache michael@0: * (if available) and page state (such as form values and scroll position) is michael@0: * restored. michael@0: * michael@0: * @throw NS_ERROR_UNEXPECTED michael@0: * Indicates that the call was unexpected at this time, which implies michael@0: * that canGoForward is false. michael@0: */ michael@0: void goForward(); michael@0: michael@0: /** michael@0: * Tells the object to navigate to the session history item at a given index. michael@0: * michael@0: * @throw NS_ERROR_UNEXPECTED michael@0: * Indicates that the call was unexpected at this time, which implies michael@0: * that session history entry at the given index does not exist. michael@0: */ michael@0: void gotoIndex(in long index); michael@0: michael@0: /**************************************************************************** michael@0: * The following flags may be bitwise combined to form the load flags michael@0: * parameter passed to either the loadURI or reload method. Some of these michael@0: * flags are only applicable to loadURI. michael@0: */ michael@0: michael@0: /** michael@0: * This flags defines the range of bits that may be specified. Flags michael@0: * outside this range may be used, but may not be passed to Reload(). michael@0: */ michael@0: const unsigned long LOAD_FLAGS_MASK = 0xffff; michael@0: michael@0: /** michael@0: * This is the default value for the load flags parameter. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_NONE = 0x0000; michael@0: michael@0: /** michael@0: * Flags 0x1, 0x2, 0x4, 0x8 are reserved for internal use by michael@0: * nsIWebNavigation implementations for now. michael@0: */ michael@0: michael@0: /** michael@0: * This flag specifies that the load should have the semantics of an HTML michael@0: * Meta-refresh tag (i.e., that the cache should be bypassed). This flag michael@0: * is only applicable to loadURI. michael@0: * XXX the meaning of this flag is poorly defined. michael@0: * XXX no one uses this, so we should probably deprecate and remove it. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_IS_REFRESH = 0x0010; michael@0: michael@0: /** michael@0: * This flag specifies that the load should have the semantics of a link michael@0: * click. This flag is only applicable to loadURI. michael@0: * XXX the meaning of this flag is poorly defined. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_IS_LINK = 0x0020; michael@0: michael@0: /** michael@0: * This flag specifies that history should not be updated. This flag is only michael@0: * applicable to loadURI. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_BYPASS_HISTORY = 0x0040; michael@0: michael@0: /** michael@0: * This flag specifies that any existing history entry should be replaced. michael@0: * This flag is only applicable to loadURI. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_REPLACE_HISTORY = 0x0080; michael@0: michael@0: /** michael@0: * This flag specifies that the local web cache should be bypassed, but an michael@0: * intermediate proxy cache could still be used to satisfy the load. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_BYPASS_CACHE = 0x0100; michael@0: michael@0: /** michael@0: * This flag specifies that any intermediate proxy caches should be bypassed michael@0: * (i.e., that the content should be loaded from the origin server). michael@0: */ michael@0: const unsigned long LOAD_FLAGS_BYPASS_PROXY = 0x0200; michael@0: michael@0: /** michael@0: * This flag specifies that a reload was triggered as a result of detecting michael@0: * an incorrect character encoding while parsing a previously loaded michael@0: * document. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_CHARSET_CHANGE = 0x0400; michael@0: michael@0: /** michael@0: * If this flag is set, Stop() will be called before the load starts michael@0: * and will stop both content and network activity (the default is to michael@0: * only stop network activity). Effectively, this passes the michael@0: * STOP_CONTENT flag to Stop(), in addition to the STOP_NETWORK flag. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_STOP_CONTENT = 0x0800; michael@0: michael@0: /** michael@0: * A hint this load was prompted by an external program: take care! michael@0: */ michael@0: const unsigned long LOAD_FLAGS_FROM_EXTERNAL = 0x1000; michael@0: michael@0: /** michael@0: This flag is set when a user explicitly disables the Mixed Content michael@0: Blocker, and allows Mixed Content to load on an https page. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_ALLOW_MIXED_CONTENT = 0x2000; michael@0: michael@0: /** michael@0: * This flag specifies that this is the first load in this object. michael@0: * Set with care, since setting incorrectly can cause us to assume that michael@0: * nothing was actually loaded in this object if the load ends up being michael@0: * handled by an external application. This flag must not be passed to michael@0: * Reload. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_FIRST_LOAD = 0x4000; michael@0: michael@0: /** michael@0: * This flag specifies that the load should not be subject to popup michael@0: * blocking checks. This flag must not be passed to Reload. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_ALLOW_POPUPS = 0x8000; michael@0: michael@0: /** michael@0: * This flag specifies that the URI classifier should not be checked for michael@0: * this load. This flag must not be passed to Reload. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10000; michael@0: michael@0: /** michael@0: * Force relevant cookies to be sent with this load even if normally they michael@0: * wouldn't be. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20000; michael@0: michael@0: /** michael@0: * Prevent the owner principal from being inherited for this load. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_DISALLOW_INHERIT_OWNER = 0x40000; michael@0: michael@0: /** michael@0: * This flag specifies that the URI may be submitted to a third-party michael@0: * server for correction. This should only be applied to non-sensitive michael@0: * URIs entered by users. This flag must not be passed to Reload. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x100000; michael@0: michael@0: /** michael@0: * This flag specifies that common scheme typos should be corrected. michael@0: */ michael@0: const unsigned long LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x200000; michael@0: michael@0: /* Note that flag 0x80000 is available. */ 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 URI dispatcher will go through its normal process of content michael@0: * loading. michael@0: * michael@0: * @param aURI michael@0: * The URI string to load. For HTTP and FTP URLs and possibly others, michael@0: * characters above U+007F will be converted to UTF-8 and then URL- michael@0: * escaped per the rules of RFC 2396. michael@0: * @param aLoadFlags michael@0: * Flags modifying load behaviour. This parameter is a bitwise michael@0: * combination of the load flags defined above. (Undefined bits are michael@0: * reserved for future use.) Generally you will pass LOAD_FLAGS_NONE michael@0: * for this parameter. michael@0: * @param aReferrer michael@0: * The referring URI. If this argument is null, then the referring michael@0: * URI will be inferred internally. michael@0: * @param aPostData michael@0: * If the URI corresponds to a HTTP request, then this stream is michael@0: * appended directly to the HTTP request headers. It may be prefixed michael@0: * with additional HTTP headers. This stream must contain a "\r\n" michael@0: * sequence separating any HTTP headers from the HTTP request body. michael@0: * This parameter is optional and may be null. michael@0: * @param aHeaders michael@0: * If the URI corresponds to a HTTP request, then any HTTP headers michael@0: * contained in this stream are set on the HTTP request. The HTTP michael@0: * header stream is formatted as: michael@0: * ( HEADER "\r\n" )* michael@0: * This parameter is optional and may be null. michael@0: */ michael@0: void loadURI(in wstring aURI, michael@0: in unsigned long aLoadFlags, michael@0: in nsIURI aReferrer, michael@0: in nsIInputStream aPostData, michael@0: in nsIInputStream aHeaders); 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 URI dispatcher will go through its normal process of content michael@0: * loading. michael@0: * Behaves like loadURI, except an additional parameter is provided to supply michael@0: * a base URI to be used in specific situations where one cannot be inferred michael@0: * by other means, for example when this is called to view selection source. michael@0: * Outside of these situations, the behaviour of this function is no michael@0: * different to loadURI. michael@0: * michael@0: * @param aURI michael@0: * The URI string to load. For HTTP and FTP URLs and possibly others, michael@0: * characters above U+007F will be converted to UTF-8 and then URL- michael@0: * escaped per the rules of RFC 2396. michael@0: * @param aLoadFlags michael@0: * Flags modifying load behaviour. This parameter is a bitwise michael@0: * combination of the load flags defined above. (Undefined bits are michael@0: * reserved for future use.) Generally you will pass LOAD_FLAGS_NONE michael@0: * for this parameter. michael@0: * @param aReferrer michael@0: * The referring URI. If this argument is null, then the referring michael@0: * URI will be inferred internally. michael@0: * @param aPostData michael@0: * If the URI corresponds to a HTTP request, then this stream is michael@0: * appended directly to the HTTP request headers. It may be prefixed michael@0: * with additional HTTP headers. This stream must contain a "\r\n" michael@0: * sequence separating any HTTP headers from the HTTP request body. michael@0: * This parameter is optional and may be null. michael@0: * @param aHeaders michael@0: * If the URI corresponds to a HTTP request, then any HTTP headers michael@0: * contained in this stream are set on the HTTP request. The HTTP michael@0: * header stream is formatted as: michael@0: * ( HEADER "\r\n" )* michael@0: * This parameter is optional and may be null. michael@0: * @param aBaseURI michael@0: * Set to indicate a base URI to be associated with the load. Note michael@0: * that at present this argument is only used with view-source aURIs michael@0: * and cannot be used to resolve aURI. michael@0: * This parameter is optional and may be null. michael@0: */ michael@0: void loadURIWithBase(in wstring aURI, michael@0: in unsigned long aLoadFlags, michael@0: in nsIURI aReferrer, michael@0: in nsIInputStream aPostData, michael@0: in nsIInputStream aHeaders, michael@0: in nsIURI aBaseURI); michael@0: michael@0: /** michael@0: * Tells the Object to reload the current page. There may be cases where the michael@0: * user will be asked to confirm the reload (for example, when it is michael@0: * determined that the request is non-idempotent). michael@0: * michael@0: * @param aReloadFlags michael@0: * Flags modifying load behaviour. This parameter is a bitwise michael@0: * combination of the Load Flags defined above. (Undefined bits are michael@0: * reserved for future use.) Generally you will pass LOAD_FLAGS_NONE michael@0: * for this parameter. michael@0: * michael@0: * @throw NS_BINDING_ABORTED michael@0: * Indicating that the user canceled the reload. michael@0: */ michael@0: void reload(in unsigned long aReloadFlags); michael@0: michael@0: /**************************************************************************** michael@0: * The following flags may be passed as the stop flags parameter to the stop michael@0: * method defined on this interface. michael@0: */ michael@0: michael@0: /** michael@0: * This flag specifies that all network activity should be stopped. This michael@0: * includes both active network loads and pending META-refreshes. michael@0: */ michael@0: const unsigned long STOP_NETWORK = 0x01; michael@0: michael@0: /** michael@0: * This flag specifies that all content activity should be stopped. This michael@0: * includes animated images, plugins and pending Javascript timeouts. michael@0: */ michael@0: const unsigned long STOP_CONTENT = 0x02; michael@0: michael@0: /** michael@0: * This flag specifies that all activity should be stopped. michael@0: */ michael@0: const unsigned long STOP_ALL = 0x03; michael@0: michael@0: /** michael@0: * Stops a load of a URI. michael@0: * michael@0: * @param aStopFlags michael@0: * This parameter is one of the stop flags defined above. michael@0: */ michael@0: void stop(in unsigned long aStopFlags); michael@0: michael@0: /** michael@0: * Retrieves the current DOM document for the frame, or lazily creates a michael@0: * blank document if there is none. This attribute never returns null except michael@0: * for unexpected error situations. michael@0: */ michael@0: readonly attribute nsIDOMDocument document; michael@0: michael@0: /** michael@0: * The currently loaded URI or null. michael@0: */ michael@0: readonly attribute nsIURI currentURI; michael@0: michael@0: /** michael@0: * The referring URI for the currently loaded URI or null. michael@0: */ michael@0: readonly attribute nsIURI referringURI; michael@0: michael@0: /** michael@0: * The session history object used by this web navigation instance. michael@0: */ michael@0: attribute nsISHistory sessionHistory; michael@0: };