docshell/base/nsIWebNavigation.idl

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

mercurial