CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / uriloader / base / nsIWebProgressListener.idl
blob010bef874ca9c951c3c848bd33adbb5a601d8380
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Travis Bogard <travis@netscape.com>
25 * Darin Fisher <darin@meer.net>
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
39 * ***** END LICENSE BLOCK ***** */
41 #include "nsISupports.idl"
43 interface nsIWebProgress;
44 interface nsIRequest;
45 interface nsIURI;
47 /**
48 * The nsIWebProgressListener interface is implemented by clients wishing to
49 * listen in on the progress associated with the loading of asynchronous
50 * requests in the context of a nsIWebProgress instance as well as any child
51 * nsIWebProgress instances. nsIWebProgress.idl describes the parent-child
52 * relationship of nsIWebProgress instances.
54 [scriptable, uuid(570F39D1-EFD0-11d3-B093-00A024FFC08C)]
55 interface nsIWebProgressListener : nsISupports
57 /**
58 * State Transition Flags
60 * These flags indicate the various states that requests may transition
61 * through as they are being loaded. These flags are mutually exclusive.
63 * For any given request, onStateChange is called once with the STATE_START
64 * flag, zero or more times with the STATE_TRANSFERRING flag or once with the
65 * STATE_REDIRECTING flag, and then finally once with the STATE_STOP flag.
66 * NOTE: For document requests, a second STATE_STOP is generated (see the
67 * description of STATE_IS_WINDOW for more details).
69 * STATE_START
70 * This flag indicates the start of a request. This flag is set when a
71 * request is initiated. The request is complete when onStateChange is
72 * called for the same request with the STATE_STOP flag set.
74 * STATE_REDIRECTING
75 * This flag indicates that a request is being redirected. The request
76 * passed to onStateChange is the request that is being redirected. When a
77 * redirect occurs, a new request is generated automatically to process the
78 * new request. Expect a corresponding STATE_START event for the new
79 * request, and a STATE_STOP for the redirected request.
81 * STATE_TRANSFERRING
82 * This flag indicates that data for a request is being transferred to an
83 * end consumer. This flag indicates that the request has been targeted,
84 * and that the user may start seeing content corresponding to the request.
86 * STATE_NEGOTIATING
87 * This flag is not used.
89 * STATE_STOP
90 * This flag indicates the completion of a request. The aStatus parameter
91 * to onStateChange indicates the final status of the request.
93 const unsigned long STATE_START = 0x00000001;
94 const unsigned long STATE_REDIRECTING = 0x00000002;
95 const unsigned long STATE_TRANSFERRING = 0x00000004;
96 const unsigned long STATE_NEGOTIATING = 0x00000008;
97 const unsigned long STATE_STOP = 0x00000010;
101 * State Type Flags
103 * These flags further describe the entity for which the state transition is
104 * occuring. These flags are NOT mutually exclusive (i.e., an onStateChange
105 * event may indicate some combination of these flags).
107 * STATE_IS_REQUEST
108 * This flag indicates that the state transition is for a request, which
109 * includes but is not limited to document requests. (See below for a
110 * description of document requests.) Other types of requests, such as
111 * requests for inline content (e.g., images and stylesheets) are
112 * considered normal requests.
114 * STATE_IS_DOCUMENT
115 * This flag indicates that the state transition is for a document request.
116 * This flag is set in addition to STATE_IS_REQUEST. A document request
117 * supports the nsIChannel interface and its loadFlags attribute includes
118 * the nsIChannel::LOAD_DOCUMENT_URI flag.
120 * A document request does not complete until all requests associated with
121 * the loading of its corresponding document have completed. This includes
122 * other document requests (e.g., corresponding to HTML <iframe> elements).
123 * The document corresponding to a document request is available via the
124 * DOMWindow attribute of onStateChange's aWebProgress parameter.
126 * STATE_IS_NETWORK
127 * This flag indicates that the state transition corresponds to the start
128 * or stop of activity in the indicated nsIWebProgress instance. This flag
129 * is accompanied by either STATE_START or STATE_STOP, and it may be
130 * combined with other State Type Flags.
132 * Unlike STATE_IS_WINDOW, this flag is only set when activity within the
133 * nsIWebProgress instance being observed starts or stops. If activity
134 * only occurs in a child nsIWebProgress instance, then this flag will be
135 * set to indicate the start and stop of that activity.
137 * For example, in the case of navigation within a single frame of a HTML
138 * frameset, a nsIWebProgressListener instance attached to the
139 * nsIWebProgress of the frameset window will receive onStateChange calls
140 * with the STATE_IS_NETWORK flag set to indicate the start and stop of
141 * said navigation. In other words, an observer of an outer window can
142 * determine when activity, that may be constrained to a child window or
143 * set of child windows, starts and stops.
145 * STATE_IS_WINDOW
146 * This flag indicates that the state transition corresponds to the start
147 * or stop of activity in the indicated nsIWebProgress instance. This flag
148 * is accompanied by either STATE_START or STATE_STOP, and it may be
149 * combined with other State Type Flags.
151 * This flag is similar to STATE_IS_DOCUMENT. However, when a document
152 * request completes, two onStateChange calls with STATE_STOP are
153 * generated. The document request is passed as aRequest to both calls.
154 * The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second
155 * has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag
156 * set as well -- see above for a description of when the STATE_IS_NETWORK
157 * flag may be set). This second STATE_STOP event may be useful as a way
158 * to partition the work that occurs when a document request completes.
160 const unsigned long STATE_IS_REQUEST = 0x00010000;
161 const unsigned long STATE_IS_DOCUMENT = 0x00020000;
162 const unsigned long STATE_IS_NETWORK = 0x00040000;
163 const unsigned long STATE_IS_WINDOW = 0x00080000;
167 * State Modifier Flags
169 * These flags further describe the transition which is occuring. These
170 * flags are NOT mutually exclusive (i.e., an onStateChange event may
171 * indicate some combination of these flags).
173 * STATE_RESTORING
174 * This flag indicates that the state transition corresponds to the start
175 * or stop of activity for restoring a previously-rendered presentation.
176 * As such, there is no actual network activity associated with this
177 * request, and any modifications made to the document or presentation
178 * when it was originally loaded will still be present.
180 const unsigned long STATE_RESTORING = 0x01000000;
183 * State Security Flags
185 * These flags describe the security state reported by a call to the
186 * onSecurityChange method. These flags are mutually exclusive.
188 * STATE_IS_INSECURE
189 * This flag indicates that the data corresponding to the request
190 * was received over an insecure channel.
192 * STATE_IS_BROKEN
193 * This flag indicates an unknown security state. This may mean that the
194 * request is being loaded as part of a page in which some content was
195 * received over an insecure channel.
197 * STATE_IS_SECURE
198 * This flag indicates that the data corresponding to the request was
199 * received over a secure channel. The degree of security is expressed by
200 * STATE_SECURE_HIGH, STATE_SECURE_MED, or STATE_SECURE_LOW.
202 const unsigned long STATE_IS_INSECURE = 0x00000004;
203 const unsigned long STATE_IS_BROKEN = 0x00000001;
204 const unsigned long STATE_IS_SECURE = 0x00000002;
207 * Security Strength Flags
209 * These flags describe the security strength and accompany STATE_IS_SECURE
210 * in a call to the onSecurityChange method. These flags are mutually
211 * exclusive.
213 * These flags are not meant to provide a precise description of data
214 * transfer security. These are instead intended as a rough indicator that
215 * may be used to, for example, color code a security indicator or otherwise
216 * provide basic data transfer security feedback to the user.
218 * STATE_SECURE_HIGH
219 * This flag indicates a high degree of security.
221 * STATE_SECURE_MED
222 * This flag indicates a medium degree of security.
224 * STATE_SECURE_LOW
225 * This flag indicates a low degree of security.
227 const unsigned long STATE_SECURE_HIGH = 0x00040000;
228 const unsigned long STATE_SECURE_MED = 0x00010000;
229 const unsigned long STATE_SECURE_LOW = 0x00020000;
232 * State bits for EV == Extended Validation == High Assurance
234 * These flags describe the level of identity verification
235 * in a call to the onSecurityChange method.
237 * STATE_IDENTITY_EV_TOPLEVEL
238 * The topmost document uses an EV cert.
239 * NOTE: Available since Gecko 1.9
242 const unsigned long STATE_IDENTITY_EV_TOPLEVEL = 0x00100000;
245 * Notification indicating the state has changed for one of the requests
246 * associated with aWebProgress.
248 * @param aWebProgress
249 * The nsIWebProgress instance that fired the notification
250 * @param aRequest
251 * The nsIRequest that has changed state.
252 * @param aStateFlags
253 * Flags indicating the new state. This value is a combination of one
254 * of the State Transition Flags and one or more of the State Type
255 * Flags defined above. Any undefined bits are reserved for future
256 * use.
257 * @param aStatus
258 * Error status code associated with the state change. This parameter
259 * should be ignored unless aStateFlags includes the STATE_STOP bit.
260 * The status code indicates success or failure of the request
261 * associated with the state change. NOTE: aStatus may be a success
262 * code even for server generated errors, such as the HTTP 404 error.
263 * In such cases, the request itself should be queried for extended
264 * error information (e.g., for HTTP requests see nsIHttpChannel).
266 void onStateChange(in nsIWebProgress aWebProgress,
267 in nsIRequest aRequest,
268 in unsigned long aStateFlags,
269 in nsresult aStatus);
272 * Notification that the progress has changed for one of the requests
273 * associated with aWebProgress. Progress totals are reset to zero when all
274 * requests in aWebProgress complete (corresponding to onStateChange being
275 * called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW
276 * flags).
278 * @param aWebProgress
279 * The nsIWebProgress instance that fired the notification.
280 * @param aRequest
281 * The nsIRequest that has new progress.
282 * @param aCurSelfProgress
283 * The current progress for aRequest.
284 * @param aMaxSelfProgress
285 * The maximum progress for aRequest.
286 * @param aCurTotalProgress
287 * The current progress for all requests associated with aWebProgress.
288 * @param aMaxTotalProgress
289 * The total progress for all requests associated with aWebProgress.
291 * NOTE: If any progress value is unknown, or if its value would exceed the
292 * maximum value of type long, then its value is replaced with -1.
294 * NOTE: If the object also implements nsIWebProgressListener2 and the caller
295 * knows about that interface, this function will not be called. Instead,
296 * nsIWebProgressListener2::onProgressChange64 will be called.
298 void onProgressChange(in nsIWebProgress aWebProgress,
299 in nsIRequest aRequest,
300 in long aCurSelfProgress,
301 in long aMaxSelfProgress,
302 in long aCurTotalProgress,
303 in long aMaxTotalProgress);
306 * Called when the location of the window being watched changes. This is not
307 * when a load is requested, but rather once it is verified that the load is
308 * going to occur in the given window. For instance, a load that starts in a
309 * window might send progress and status messages for the new site, but it
310 * will not send the onLocationChange until we are sure that we are loading
311 * this new page here.
313 * @param aWebProgress
314 * The nsIWebProgress instance that fired the notification.
315 * @param aRequest
316 * The associated nsIRequest. This may be null in some cases.
317 * @param aLocation
318 * The URI of the location that is being loaded.
320 void onLocationChange(in nsIWebProgress aWebProgress,
321 in nsIRequest aRequest,
322 in nsIURI aLocation);
325 * Notification that the status of a request has changed. The status message
326 * is intended to be displayed to the user (e.g., in the status bar of the
327 * browser).
329 * @param aWebProgress
330 * The nsIWebProgress instance that fired the notification.
331 * @param aRequest
332 * The nsIRequest that has new status.
333 * @param aStatus
334 * This value is not an error code. Instead, it is a numeric value
335 * that indicates the current status of the request. This interface
336 * does not define the set of possible status codes. NOTE: Some
337 * status values are defined by nsITransport and nsISocketTransport.
338 * @param aMessage
339 * Localized text corresponding to aStatus.
341 void onStatusChange(in nsIWebProgress aWebProgress,
342 in nsIRequest aRequest,
343 in nsresult aStatus,
344 in wstring aMessage);
347 * Notification called for security progress. This method will be called on
348 * security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and
349 * after document load completion. It might also be called if an error
350 * occurs during network loading.
352 * @param aWebProgress
353 * The nsIWebProgress instance that fired the notification.
354 * @param aRequest
355 * The nsIRequest that has new security state.
356 * @param aState
357 * A value composed of the Security State Flags and the Security
358 * Strength Flags listed above. Any undefined bits are reserved for
359 * future use.
361 * NOTE: These notifications will only occur if a security package is
362 * installed.
364 void onSecurityChange(in nsIWebProgress aWebProgress,
365 in nsIRequest aRequest,
366 in unsigned long aState);