Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIDOMDocument; |
michael@0 | 9 | interface nsIInputStream; |
michael@0 | 10 | interface nsISHistory; |
michael@0 | 11 | interface nsIURI; |
michael@0 | 12 | |
michael@0 | 13 | /** |
michael@0 | 14 | * The nsIWebNavigation interface defines an interface for navigating the web. |
michael@0 | 15 | * It provides methods and attributes to direct an object to navigate to a new |
michael@0 | 16 | * location, stop or restart an in process load, or determine where the object |
michael@0 | 17 | * has previously gone. |
michael@0 | 18 | */ |
michael@0 | 19 | [scriptable, uuid(b7568a50-4c50-442c-a6be-3a340a48d89a)] |
michael@0 | 20 | interface nsIWebNavigation : nsISupports |
michael@0 | 21 | { |
michael@0 | 22 | /** |
michael@0 | 23 | * Indicates if the object can go back. If true this indicates that |
michael@0 | 24 | * there is back session history available for navigation. |
michael@0 | 25 | */ |
michael@0 | 26 | readonly attribute boolean canGoBack; |
michael@0 | 27 | |
michael@0 | 28 | /** |
michael@0 | 29 | * Indicates if the object can go forward. If true this indicates that |
michael@0 | 30 | * there is forward session history available for navigation |
michael@0 | 31 | */ |
michael@0 | 32 | readonly attribute boolean canGoForward; |
michael@0 | 33 | |
michael@0 | 34 | /** |
michael@0 | 35 | * Tells the object to navigate to the previous session history item. When a |
michael@0 | 36 | * page is loaded from session history, all content is loaded from the cache |
michael@0 | 37 | * (if available) and page state (such as form values and scroll position) is |
michael@0 | 38 | * restored. |
michael@0 | 39 | * |
michael@0 | 40 | * @throw NS_ERROR_UNEXPECTED |
michael@0 | 41 | * Indicates that the call was unexpected at this time, which implies |
michael@0 | 42 | * that canGoBack is false. |
michael@0 | 43 | */ |
michael@0 | 44 | void goBack(); |
michael@0 | 45 | |
michael@0 | 46 | /** |
michael@0 | 47 | * Tells the object to navigate to the next session history item. When a |
michael@0 | 48 | * page is loaded from session history, all content is loaded from the cache |
michael@0 | 49 | * (if available) and page state (such as form values and scroll position) is |
michael@0 | 50 | * restored. |
michael@0 | 51 | * |
michael@0 | 52 | * @throw NS_ERROR_UNEXPECTED |
michael@0 | 53 | * Indicates that the call was unexpected at this time, which implies |
michael@0 | 54 | * that canGoForward is false. |
michael@0 | 55 | */ |
michael@0 | 56 | void goForward(); |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * Tells the object to navigate to the session history item at a given index. |
michael@0 | 60 | * |
michael@0 | 61 | * @throw NS_ERROR_UNEXPECTED |
michael@0 | 62 | * Indicates that the call was unexpected at this time, which implies |
michael@0 | 63 | * that session history entry at the given index does not exist. |
michael@0 | 64 | */ |
michael@0 | 65 | void gotoIndex(in long index); |
michael@0 | 66 | |
michael@0 | 67 | /**************************************************************************** |
michael@0 | 68 | * The following flags may be bitwise combined to form the load flags |
michael@0 | 69 | * parameter passed to either the loadURI or reload method. Some of these |
michael@0 | 70 | * flags are only applicable to loadURI. |
michael@0 | 71 | */ |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * This flags defines the range of bits that may be specified. Flags |
michael@0 | 75 | * outside this range may be used, but may not be passed to Reload(). |
michael@0 | 76 | */ |
michael@0 | 77 | const unsigned long LOAD_FLAGS_MASK = 0xffff; |
michael@0 | 78 | |
michael@0 | 79 | /** |
michael@0 | 80 | * This is the default value for the load flags parameter. |
michael@0 | 81 | */ |
michael@0 | 82 | const unsigned long LOAD_FLAGS_NONE = 0x0000; |
michael@0 | 83 | |
michael@0 | 84 | /** |
michael@0 | 85 | * Flags 0x1, 0x2, 0x4, 0x8 are reserved for internal use by |
michael@0 | 86 | * nsIWebNavigation implementations for now. |
michael@0 | 87 | */ |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * This flag specifies that the load should have the semantics of an HTML |
michael@0 | 91 | * Meta-refresh tag (i.e., that the cache should be bypassed). This flag |
michael@0 | 92 | * is only applicable to loadURI. |
michael@0 | 93 | * XXX the meaning of this flag is poorly defined. |
michael@0 | 94 | * XXX no one uses this, so we should probably deprecate and remove it. |
michael@0 | 95 | */ |
michael@0 | 96 | const unsigned long LOAD_FLAGS_IS_REFRESH = 0x0010; |
michael@0 | 97 | |
michael@0 | 98 | /** |
michael@0 | 99 | * This flag specifies that the load should have the semantics of a link |
michael@0 | 100 | * click. This flag is only applicable to loadURI. |
michael@0 | 101 | * XXX the meaning of this flag is poorly defined. |
michael@0 | 102 | */ |
michael@0 | 103 | const unsigned long LOAD_FLAGS_IS_LINK = 0x0020; |
michael@0 | 104 | |
michael@0 | 105 | /** |
michael@0 | 106 | * This flag specifies that history should not be updated. This flag is only |
michael@0 | 107 | * applicable to loadURI. |
michael@0 | 108 | */ |
michael@0 | 109 | const unsigned long LOAD_FLAGS_BYPASS_HISTORY = 0x0040; |
michael@0 | 110 | |
michael@0 | 111 | /** |
michael@0 | 112 | * This flag specifies that any existing history entry should be replaced. |
michael@0 | 113 | * This flag is only applicable to loadURI. |
michael@0 | 114 | */ |
michael@0 | 115 | const unsigned long LOAD_FLAGS_REPLACE_HISTORY = 0x0080; |
michael@0 | 116 | |
michael@0 | 117 | /** |
michael@0 | 118 | * This flag specifies that the local web cache should be bypassed, but an |
michael@0 | 119 | * intermediate proxy cache could still be used to satisfy the load. |
michael@0 | 120 | */ |
michael@0 | 121 | const unsigned long LOAD_FLAGS_BYPASS_CACHE = 0x0100; |
michael@0 | 122 | |
michael@0 | 123 | /** |
michael@0 | 124 | * This flag specifies that any intermediate proxy caches should be bypassed |
michael@0 | 125 | * (i.e., that the content should be loaded from the origin server). |
michael@0 | 126 | */ |
michael@0 | 127 | const unsigned long LOAD_FLAGS_BYPASS_PROXY = 0x0200; |
michael@0 | 128 | |
michael@0 | 129 | /** |
michael@0 | 130 | * This flag specifies that a reload was triggered as a result of detecting |
michael@0 | 131 | * an incorrect character encoding while parsing a previously loaded |
michael@0 | 132 | * document. |
michael@0 | 133 | */ |
michael@0 | 134 | const unsigned long LOAD_FLAGS_CHARSET_CHANGE = 0x0400; |
michael@0 | 135 | |
michael@0 | 136 | /** |
michael@0 | 137 | * If this flag is set, Stop() will be called before the load starts |
michael@0 | 138 | * and will stop both content and network activity (the default is to |
michael@0 | 139 | * only stop network activity). Effectively, this passes the |
michael@0 | 140 | * STOP_CONTENT flag to Stop(), in addition to the STOP_NETWORK flag. |
michael@0 | 141 | */ |
michael@0 | 142 | const unsigned long LOAD_FLAGS_STOP_CONTENT = 0x0800; |
michael@0 | 143 | |
michael@0 | 144 | /** |
michael@0 | 145 | * A hint this load was prompted by an external program: take care! |
michael@0 | 146 | */ |
michael@0 | 147 | const unsigned long LOAD_FLAGS_FROM_EXTERNAL = 0x1000; |
michael@0 | 148 | |
michael@0 | 149 | /** |
michael@0 | 150 | This flag is set when a user explicitly disables the Mixed Content |
michael@0 | 151 | Blocker, and allows Mixed Content to load on an https page. |
michael@0 | 152 | */ |
michael@0 | 153 | const unsigned long LOAD_FLAGS_ALLOW_MIXED_CONTENT = 0x2000; |
michael@0 | 154 | |
michael@0 | 155 | /** |
michael@0 | 156 | * This flag specifies that this is the first load in this object. |
michael@0 | 157 | * Set with care, since setting incorrectly can cause us to assume that |
michael@0 | 158 | * nothing was actually loaded in this object if the load ends up being |
michael@0 | 159 | * handled by an external application. This flag must not be passed to |
michael@0 | 160 | * Reload. |
michael@0 | 161 | */ |
michael@0 | 162 | const unsigned long LOAD_FLAGS_FIRST_LOAD = 0x4000; |
michael@0 | 163 | |
michael@0 | 164 | /** |
michael@0 | 165 | * This flag specifies that the load should not be subject to popup |
michael@0 | 166 | * blocking checks. This flag must not be passed to Reload. |
michael@0 | 167 | */ |
michael@0 | 168 | const unsigned long LOAD_FLAGS_ALLOW_POPUPS = 0x8000; |
michael@0 | 169 | |
michael@0 | 170 | /** |
michael@0 | 171 | * This flag specifies that the URI classifier should not be checked for |
michael@0 | 172 | * this load. This flag must not be passed to Reload. |
michael@0 | 173 | */ |
michael@0 | 174 | const unsigned long LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10000; |
michael@0 | 175 | |
michael@0 | 176 | /** |
michael@0 | 177 | * Force relevant cookies to be sent with this load even if normally they |
michael@0 | 178 | * wouldn't be. |
michael@0 | 179 | */ |
michael@0 | 180 | const unsigned long LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20000; |
michael@0 | 181 | |
michael@0 | 182 | /** |
michael@0 | 183 | * Prevent the owner principal from being inherited for this load. |
michael@0 | 184 | */ |
michael@0 | 185 | const unsigned long LOAD_FLAGS_DISALLOW_INHERIT_OWNER = 0x40000; |
michael@0 | 186 | |
michael@0 | 187 | /** |
michael@0 | 188 | * This flag specifies that the URI may be submitted to a third-party |
michael@0 | 189 | * server for correction. This should only be applied to non-sensitive |
michael@0 | 190 | * URIs entered by users. This flag must not be passed to Reload. |
michael@0 | 191 | */ |
michael@0 | 192 | const unsigned long LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x100000; |
michael@0 | 193 | |
michael@0 | 194 | /** |
michael@0 | 195 | * This flag specifies that common scheme typos should be corrected. |
michael@0 | 196 | */ |
michael@0 | 197 | const unsigned long LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x200000; |
michael@0 | 198 | |
michael@0 | 199 | /* Note that flag 0x80000 is available. */ |
michael@0 | 200 | |
michael@0 | 201 | /** |
michael@0 | 202 | * Loads a given URI. This will give priority to loading the requested URI |
michael@0 | 203 | * in the object implementing this interface. If it can't be loaded here |
michael@0 | 204 | * however, the URI dispatcher will go through its normal process of content |
michael@0 | 205 | * loading. |
michael@0 | 206 | * |
michael@0 | 207 | * @param aURI |
michael@0 | 208 | * The URI string to load. For HTTP and FTP URLs and possibly others, |
michael@0 | 209 | * characters above U+007F will be converted to UTF-8 and then URL- |
michael@0 | 210 | * escaped per the rules of RFC 2396. |
michael@0 | 211 | * @param aLoadFlags |
michael@0 | 212 | * Flags modifying load behaviour. This parameter is a bitwise |
michael@0 | 213 | * combination of the load flags defined above. (Undefined bits are |
michael@0 | 214 | * reserved for future use.) Generally you will pass LOAD_FLAGS_NONE |
michael@0 | 215 | * for this parameter. |
michael@0 | 216 | * @param aReferrer |
michael@0 | 217 | * The referring URI. If this argument is null, then the referring |
michael@0 | 218 | * URI will be inferred internally. |
michael@0 | 219 | * @param aPostData |
michael@0 | 220 | * If the URI corresponds to a HTTP request, then this stream is |
michael@0 | 221 | * appended directly to the HTTP request headers. It may be prefixed |
michael@0 | 222 | * with additional HTTP headers. This stream must contain a "\r\n" |
michael@0 | 223 | * sequence separating any HTTP headers from the HTTP request body. |
michael@0 | 224 | * This parameter is optional and may be null. |
michael@0 | 225 | * @param aHeaders |
michael@0 | 226 | * If the URI corresponds to a HTTP request, then any HTTP headers |
michael@0 | 227 | * contained in this stream are set on the HTTP request. The HTTP |
michael@0 | 228 | * header stream is formatted as: |
michael@0 | 229 | * ( HEADER "\r\n" )* |
michael@0 | 230 | * This parameter is optional and may be null. |
michael@0 | 231 | */ |
michael@0 | 232 | void loadURI(in wstring aURI, |
michael@0 | 233 | in unsigned long aLoadFlags, |
michael@0 | 234 | in nsIURI aReferrer, |
michael@0 | 235 | in nsIInputStream aPostData, |
michael@0 | 236 | in nsIInputStream aHeaders); |
michael@0 | 237 | |
michael@0 | 238 | /** |
michael@0 | 239 | * Loads a given URI. This will give priority to loading the requested URI |
michael@0 | 240 | * in the object implementing this interface. If it can't be loaded here |
michael@0 | 241 | * however, the URI dispatcher will go through its normal process of content |
michael@0 | 242 | * loading. |
michael@0 | 243 | * Behaves like loadURI, except an additional parameter is provided to supply |
michael@0 | 244 | * a base URI to be used in specific situations where one cannot be inferred |
michael@0 | 245 | * by other means, for example when this is called to view selection source. |
michael@0 | 246 | * Outside of these situations, the behaviour of this function is no |
michael@0 | 247 | * different to loadURI. |
michael@0 | 248 | * |
michael@0 | 249 | * @param aURI |
michael@0 | 250 | * The URI string to load. For HTTP and FTP URLs and possibly others, |
michael@0 | 251 | * characters above U+007F will be converted to UTF-8 and then URL- |
michael@0 | 252 | * escaped per the rules of RFC 2396. |
michael@0 | 253 | * @param aLoadFlags |
michael@0 | 254 | * Flags modifying load behaviour. This parameter is a bitwise |
michael@0 | 255 | * combination of the load flags defined above. (Undefined bits are |
michael@0 | 256 | * reserved for future use.) Generally you will pass LOAD_FLAGS_NONE |
michael@0 | 257 | * for this parameter. |
michael@0 | 258 | * @param aReferrer |
michael@0 | 259 | * The referring URI. If this argument is null, then the referring |
michael@0 | 260 | * URI will be inferred internally. |
michael@0 | 261 | * @param aPostData |
michael@0 | 262 | * If the URI corresponds to a HTTP request, then this stream is |
michael@0 | 263 | * appended directly to the HTTP request headers. It may be prefixed |
michael@0 | 264 | * with additional HTTP headers. This stream must contain a "\r\n" |
michael@0 | 265 | * sequence separating any HTTP headers from the HTTP request body. |
michael@0 | 266 | * This parameter is optional and may be null. |
michael@0 | 267 | * @param aHeaders |
michael@0 | 268 | * If the URI corresponds to a HTTP request, then any HTTP headers |
michael@0 | 269 | * contained in this stream are set on the HTTP request. The HTTP |
michael@0 | 270 | * header stream is formatted as: |
michael@0 | 271 | * ( HEADER "\r\n" )* |
michael@0 | 272 | * This parameter is optional and may be null. |
michael@0 | 273 | * @param aBaseURI |
michael@0 | 274 | * Set to indicate a base URI to be associated with the load. Note |
michael@0 | 275 | * that at present this argument is only used with view-source aURIs |
michael@0 | 276 | * and cannot be used to resolve aURI. |
michael@0 | 277 | * This parameter is optional and may be null. |
michael@0 | 278 | */ |
michael@0 | 279 | void loadURIWithBase(in wstring aURI, |
michael@0 | 280 | in unsigned long aLoadFlags, |
michael@0 | 281 | in nsIURI aReferrer, |
michael@0 | 282 | in nsIInputStream aPostData, |
michael@0 | 283 | in nsIInputStream aHeaders, |
michael@0 | 284 | in nsIURI aBaseURI); |
michael@0 | 285 | |
michael@0 | 286 | /** |
michael@0 | 287 | * Tells the Object to reload the current page. There may be cases where the |
michael@0 | 288 | * user will be asked to confirm the reload (for example, when it is |
michael@0 | 289 | * determined that the request is non-idempotent). |
michael@0 | 290 | * |
michael@0 | 291 | * @param aReloadFlags |
michael@0 | 292 | * Flags modifying load behaviour. This parameter is a bitwise |
michael@0 | 293 | * combination of the Load Flags defined above. (Undefined bits are |
michael@0 | 294 | * reserved for future use.) Generally you will pass LOAD_FLAGS_NONE |
michael@0 | 295 | * for this parameter. |
michael@0 | 296 | * |
michael@0 | 297 | * @throw NS_BINDING_ABORTED |
michael@0 | 298 | * Indicating that the user canceled the reload. |
michael@0 | 299 | */ |
michael@0 | 300 | void reload(in unsigned long aReloadFlags); |
michael@0 | 301 | |
michael@0 | 302 | /**************************************************************************** |
michael@0 | 303 | * The following flags may be passed as the stop flags parameter to the stop |
michael@0 | 304 | * method defined on this interface. |
michael@0 | 305 | */ |
michael@0 | 306 | |
michael@0 | 307 | /** |
michael@0 | 308 | * This flag specifies that all network activity should be stopped. This |
michael@0 | 309 | * includes both active network loads and pending META-refreshes. |
michael@0 | 310 | */ |
michael@0 | 311 | const unsigned long STOP_NETWORK = 0x01; |
michael@0 | 312 | |
michael@0 | 313 | /** |
michael@0 | 314 | * This flag specifies that all content activity should be stopped. This |
michael@0 | 315 | * includes animated images, plugins and pending Javascript timeouts. |
michael@0 | 316 | */ |
michael@0 | 317 | const unsigned long STOP_CONTENT = 0x02; |
michael@0 | 318 | |
michael@0 | 319 | /** |
michael@0 | 320 | * This flag specifies that all activity should be stopped. |
michael@0 | 321 | */ |
michael@0 | 322 | const unsigned long STOP_ALL = 0x03; |
michael@0 | 323 | |
michael@0 | 324 | /** |
michael@0 | 325 | * Stops a load of a URI. |
michael@0 | 326 | * |
michael@0 | 327 | * @param aStopFlags |
michael@0 | 328 | * This parameter is one of the stop flags defined above. |
michael@0 | 329 | */ |
michael@0 | 330 | void stop(in unsigned long aStopFlags); |
michael@0 | 331 | |
michael@0 | 332 | /** |
michael@0 | 333 | * Retrieves the current DOM document for the frame, or lazily creates a |
michael@0 | 334 | * blank document if there is none. This attribute never returns null except |
michael@0 | 335 | * for unexpected error situations. |
michael@0 | 336 | */ |
michael@0 | 337 | readonly attribute nsIDOMDocument document; |
michael@0 | 338 | |
michael@0 | 339 | /** |
michael@0 | 340 | * The currently loaded URI or null. |
michael@0 | 341 | */ |
michael@0 | 342 | readonly attribute nsIURI currentURI; |
michael@0 | 343 | |
michael@0 | 344 | /** |
michael@0 | 345 | * The referring URI for the currently loaded URI or null. |
michael@0 | 346 | */ |
michael@0 | 347 | readonly attribute nsIURI referringURI; |
michael@0 | 348 | |
michael@0 | 349 | /** |
michael@0 | 350 | * The session history object used by this web navigation instance. |
michael@0 | 351 | */ |
michael@0 | 352 | attribute nsISHistory sessionHistory; |
michael@0 | 353 | }; |