Bug 1728955: part 8) Refactor `DisplayErrCode` in Windows' `nsClipboard`. r=masayuki
[gecko.git] / uriloader / base / nsIWebProgressListener.idl
blob7b0ac91f1a83f893b0a47e365f6a69cfee83f821
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 interface nsIWebProgress;
10 interface nsIRequest;
11 interface nsIURI;
13 /**
14 * The nsIWebProgressListener interface is implemented by clients wishing to
15 * listen in on the progress associated with the loading of asynchronous
16 * requests in the context of a nsIWebProgress instance as well as any child
17 * nsIWebProgress instances. nsIWebProgress.idl describes the parent-child
18 * relationship of nsIWebProgress instances.
20 [scriptable, uuid(a9df523b-efe2-421e-9d8e-3d7f807dda4c)]
21 interface nsIWebProgressListener : nsISupports
23 /**
24 * State Transition Flags
26 * These flags indicate the various states that requests may transition
27 * through as they are being loaded. These flags are mutually exclusive.
29 * For any given request, onStateChange is called once with the STATE_START
30 * flag, zero or more times with the STATE_TRANSFERRING flag or once with the
31 * STATE_REDIRECTING flag, and then finally once with the STATE_STOP flag.
32 * NOTE: For document requests, a second STATE_STOP is generated (see the
33 * description of STATE_IS_WINDOW for more details).
35 * STATE_START
36 * This flag indicates the start of a request. This flag is set when a
37 * request is initiated. The request is complete when onStateChange is
38 * called for the same request with the STATE_STOP flag set.
40 * STATE_REDIRECTING
41 * This flag indicates that a request is being redirected. The request
42 * passed to onStateChange is the request that is being redirected. When a
43 * redirect occurs, a new request is generated automatically to process the
44 * new request. Expect a corresponding STATE_START event for the new
45 * request, and a STATE_STOP for the redirected request.
47 * STATE_TRANSFERRING
48 * This flag indicates that data for a request is being transferred to an
49 * end consumer. This flag indicates that the request has been targeted,
50 * and that the user may start seeing content corresponding to the request.
52 * STATE_NEGOTIATING
53 * This flag is not used.
55 * STATE_STOP
56 * This flag indicates the completion of a request. The aStatus parameter
57 * to onStateChange indicates the final status of the request.
59 const unsigned long STATE_START = 0x00000001;
60 const unsigned long STATE_REDIRECTING = 0x00000002;
61 const unsigned long STATE_TRANSFERRING = 0x00000004;
62 const unsigned long STATE_NEGOTIATING = 0x00000008;
63 const unsigned long STATE_STOP = 0x00000010;
66 /**
67 * State Type Flags
69 * These flags further describe the entity for which the state transition is
70 * occuring. These flags are NOT mutually exclusive (i.e., an onStateChange
71 * event may indicate some combination of these flags).
73 * STATE_IS_REQUEST
74 * This flag indicates that the state transition is for a request, which
75 * includes but is not limited to document requests. (See below for a
76 * description of document requests.) Other types of requests, such as
77 * requests for inline content (e.g., images and stylesheets) are
78 * considered normal requests.
80 * STATE_IS_DOCUMENT
81 * This flag indicates that the state transition is for a document request.
82 * This flag is set in addition to STATE_IS_REQUEST. A document request
83 * supports the nsIChannel interface and its loadFlags attribute includes
84 * the nsIChannel::LOAD_DOCUMENT_URI flag.
86 * A document request does not complete until all requests associated with
87 * the loading of its corresponding document have completed. This includes
88 * other document requests (e.g., corresponding to HTML <iframe> elements).
89 * The document corresponding to a document request is available via the
90 * DOMWindow attribute of onStateChange's aWebProgress parameter.
92 * STATE_IS_NETWORK
93 * This flag indicates that the state transition corresponds to the start
94 * or stop of activity in the indicated nsIWebProgress instance. This flag
95 * is accompanied by either STATE_START or STATE_STOP, and it may be
96 * combined with other State Type Flags.
98 * Unlike STATE_IS_WINDOW, this flag is only set when activity within the
99 * nsIWebProgress instance being observed starts or stops. If activity
100 * only occurs in a child nsIWebProgress instance, then this flag will be
101 * set to indicate the start and stop of that activity.
103 * For example, in the case of navigation within a single frame of a HTML
104 * frameset, a nsIWebProgressListener instance attached to the
105 * nsIWebProgress of the frameset window will receive onStateChange calls
106 * with the STATE_IS_NETWORK flag set to indicate the start and stop of
107 * said navigation. In other words, an observer of an outer window can
108 * determine when activity, that may be constrained to a child window or
109 * set of child windows, starts and stops.
111 * STATE_IS_WINDOW
112 * This flag indicates that the state transition corresponds to the start
113 * or stop of activity in the indicated nsIWebProgress instance. This flag
114 * is accompanied by either STATE_START or STATE_STOP, and it may be
115 * combined with other State Type Flags.
117 * This flag is similar to STATE_IS_DOCUMENT. However, when a document
118 * request completes, two onStateChange calls with STATE_STOP are
119 * generated. The document request is passed as aRequest to both calls.
120 * The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second
121 * has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag
122 * set as well -- see above for a description of when the STATE_IS_NETWORK
123 * flag may be set). This second STATE_STOP event may be useful as a way
124 * to partition the work that occurs when a document request completes.
126 * STATE_IS_REDIRECTED_DOCUMENT
127 * Same as STATE_IS_DOCUMENT, but sent only after a redirect has occured.
128 * Introduced in order not to confuse existing code with extra state change
129 * events. See |nsDocLoader::OnStartRequest| for more info.
131 const unsigned long STATE_IS_REQUEST = 0x00010000;
132 const unsigned long STATE_IS_DOCUMENT = 0x00020000;
133 const unsigned long STATE_IS_NETWORK = 0x00040000;
134 const unsigned long STATE_IS_WINDOW = 0x00080000;
135 const unsigned long STATE_IS_REDIRECTED_DOCUMENT = 0x00100000;
138 * State Modifier Flags
140 * These flags further describe the transition which is occuring. These
141 * flags are NOT mutually exclusive (i.e., an onStateChange event may
142 * indicate some combination of these flags).
144 * STATE_RESTORING
145 * This flag indicates that the state transition corresponds to the start
146 * or stop of activity for restoring a previously-rendered presentation.
147 * As such, there is no actual network activity associated with this
148 * request, and any modifications made to the document or presentation
149 * when it was originally loaded will still be present.
151 const unsigned long STATE_RESTORING = 0x01000000;
154 * State Security Flags
156 * These flags describe the security state reported by a call to the
157 * onSecurityChange method. These flags are mutually exclusive.
159 * STATE_IS_INSECURE
160 * This flag indicates that the data corresponding to the request
161 * was received over an insecure channel.
163 * STATE_IS_BROKEN
164 * This flag indicates an unknown security state. This may mean that the
165 * request is being loaded as part of a page in which some content was
166 * received over an insecure channel.
168 * STATE_IS_SECURE
169 * This flag indicates that the data corresponding to the request was
170 * received over a secure channel. The degree of security is expressed by
171 * STATE_SECURE_HIGH, STATE_SECURE_MED, or STATE_SECURE_LOW.
173 const unsigned long STATE_IS_INSECURE = 0x00000004;
174 const unsigned long STATE_IS_BROKEN = 0x00000001;
175 const unsigned long STATE_IS_SECURE = 0x00000002;
178 * Mixed active content flags
180 * NOTE: IF YOU ARE ADDING MORE OF THESE FLAGS, MAKE SURE TO EDIT
181 * nsSecureBrowserUIImpl::CheckForBlockedContent().
183 * May be set in addition to the State Security Flags, to indicate that
184 * mixed active content has been encountered.
186 * STATE_BLOCKED_MIXED_ACTIVE_CONTENT
187 * Mixed active content has been blocked from loading.
189 * STATE_LOADED_MIXED_ACTIVE_CONTENT
190 * Mixed active content has been loaded. State should be STATE_IS_BROKEN.
192 const unsigned long STATE_BLOCKED_MIXED_ACTIVE_CONTENT = 0x00000010;
193 const unsigned long STATE_LOADED_MIXED_ACTIVE_CONTENT = 0x00000020;
196 * Mixed display content flags
198 * NOTE: IF YOU ARE ADDING MORE OF THESE FLAGS, MAKE SURE TO EDIT
199 * nsSecureBrowserUIImpl::CheckForBlockedContent().
201 * May be set in addition to the State Security Flags, to indicate that
202 * mixed display content has been encountered.
204 * STATE_BLOCKED_MIXED_DISPLAY_CONTENT
205 * Mixed display content has been blocked from loading.
207 * STATE_LOADED_MIXED_DISPLAY_CONTENT
208 * Mixed display content has been loaded. State should be STATE_IS_BROKEN.
210 const unsigned long STATE_BLOCKED_MIXED_DISPLAY_CONTENT = 0x00000100;
211 const unsigned long STATE_LOADED_MIXED_DISPLAY_CONTENT = 0x00000200;
214 * State bits for EV == Extended Validation == High Assurance
216 * These flags describe the level of identity verification
217 * in a call to the onSecurityChange method.
219 * STATE_IDENTITY_EV_TOPLEVEL
220 * The topmost document uses an EV cert.
221 * NOTE: Available since Gecko 1.9
224 const unsigned long STATE_IDENTITY_EV_TOPLEVEL = 0x00100000;
227 * Broken state flags
229 * These flags describe the reason of the broken state.
231 * STATE_USES_SSL_3
232 * The topmost document uses SSL 3.0.
234 * STATE_USES_WEAK_CRYPTO
235 * The topmost document uses a weak cipher suite such as RC4.
237 * STATE_CERT_USER_OVERRIDDEN
238 * The user has added a security exception for the site.
240 const unsigned long STATE_USES_SSL_3 = 0x01000000;
241 const unsigned long STATE_USES_WEAK_CRYPTO = 0x02000000;
242 const unsigned long STATE_CERT_USER_OVERRIDDEN = 0x04000000;
245 * Content Blocking Event flags
247 * NOTE: IF YOU ARE ADDING MORE OF THESE FLAGS, MAKE SURE TO EDIT
248 * nsSecureBrowserUIImpl::CheckForBlockedContent() AND UPDATE THE
249 * CORRESPONDING LIST IN ContentBlockingController.java
251 * These flags describe the reason of cookie jar rejection.
253 * STATE_BLOCKED_TRACKING_CONTENT
254 * Tracking content has been blocked from loading.
256 * STATE_LOADED_LEVEL_1_TRACKING_CONTENT
257 * Tracking content from the Disconnect Level 1 list has been loaded.
259 * STATE_LOADED_LEVEL_2_TRACKING_CONTENT
260 * Tracking content from the Disconnect Level 2 list has been loaded.
262 * STATE_BLOCKED_FINGERPRINTING_CONTENT
263 * Fingerprinting content has been blocked from loading.
265 * STATE_LOADED_FINGERPRINTING_CONTENT
266 * Fingerprinting content has been loaded.
268 * STATE_BLOCKED_CRYPTOMINING_CONTENT
269 * Cryptomining content has been blocked from loading.
271 * STATE_LOADED_CRYPTOMINING_CONTENT
272 * Cryptomining content has been loaded.
274 * STATE_BLOCKED_UNSAFE_CONTENT
275 * Content which againts SafeBrowsing list has been blocked from loading.
277 * STATE_COOKIES_LOADED
278 * Performed a storage access check, which usually means something like a
279 * cookie or a storage item was loaded/stored on the current tab.
280 * Alternatively this could indicate that something in the current tab
281 * attempted to communicate with its same-origin counterparts in other
282 * tabs.
284 * STATE_COOKIES_LOADED_TRACKER
285 * Similar to STATE_COOKIES_LOADED, but only sent if the subject of the
286 * action was a third-party tracker when the active cookie policy imposes
287 * restrictions on such content.
289 * STATE_COOKIES_LOADED_SOCIALTRACKER
290 * Similar to STATE_COOKIES_LOADED, but only sent if the subject of the
291 * action was a third-party social tracker when the active cookie policy
292 * imposes restrictions on such content.
294 * STATE_COOKIES_BLOCKED_BY_PERMISSION
295 * Rejected for custom site permission.
297 * STATE_COOKIES_BLOCKED_TRACKER
298 * Rejected because the resource is a tracker and cookie policy doesn't
299 * allow its loading.
301 * STATE_COOKIES_BLOCKED_SOCIALTRACKER
302 * Rejected because the resource is a tracker from a social origin and
303 * cookie policy doesn't allow its loading.
305 * STATE_COOKIES_PARTITIONED_FOREIGN
306 * Rejected because the resource is a third-party and cookie policy forces
307 * third-party resources to be partitioned.
309 * STATE_COOKIES_BLOCKED_ALL
310 * Rejected because cookie policy blocks all cookies.
312 * STATE_COOKIES_BLOCKED_FOREIGN
313 * Rejected because cookie policy blocks 3rd party cookies.
315 * STATE_BLOCKED_SOCIALTRACKING_CONTENT
316 * SocialTracking content has been blocked from loading.
318 * STATE_LOADED_SOCIALTRACKING_CONTENT
319 * SocialTracking content has been loaded.
321 * STATE_REPLACED_TRACKING_CONTENT
322 * Tracking content which should be blocked from loading was replaced with a
323 * shim.
325 * STATE_ALLOWED_TRACKING_CONTENT
326 * Tracking content which should be blocked from loading was allowed.
328 const unsigned long STATE_BLOCKED_TRACKING_CONTENT = 0x00001000;
329 const unsigned long STATE_LOADED_LEVEL_1_TRACKING_CONTENT = 0x00002000;
330 const unsigned long STATE_LOADED_LEVEL_2_TRACKING_CONTENT = 0x00100000;
331 const unsigned long STATE_BLOCKED_FINGERPRINTING_CONTENT = 0x00000040;
332 const unsigned long STATE_LOADED_FINGERPRINTING_CONTENT = 0x00000400;
333 const unsigned long STATE_BLOCKED_CRYPTOMINING_CONTENT = 0x00000800;
334 const unsigned long STATE_LOADED_CRYPTOMINING_CONTENT = 0x00200000;
335 const unsigned long STATE_BLOCKED_UNSAFE_CONTENT = 0x00004000;
336 const unsigned long STATE_COOKIES_LOADED = 0x00008000;
337 const unsigned long STATE_COOKIES_LOADED_TRACKER = 0x00040000;
338 const unsigned long STATE_COOKIES_LOADED_SOCIALTRACKER = 0x00080000;
339 const unsigned long STATE_COOKIES_BLOCKED_BY_PERMISSION = 0x10000000;
340 const unsigned long STATE_COOKIES_BLOCKED_TRACKER = 0x20000000;
341 const unsigned long STATE_COOKIES_BLOCKED_SOCIALTRACKER = 0x01000000;
342 const unsigned long STATE_COOKIES_BLOCKED_ALL = 0x40000000;
343 const unsigned long STATE_COOKIES_PARTITIONED_FOREIGN = 0x80000000;
344 const unsigned long STATE_COOKIES_BLOCKED_FOREIGN = 0x00000080;
345 const unsigned long STATE_BLOCKED_SOCIALTRACKING_CONTENT = 0x00010000;
346 const unsigned long STATE_LOADED_SOCIALTRACKING_CONTENT = 0x00020000;
347 const unsigned long STATE_REPLACED_TRACKING_CONTENT = 0x00000010;
348 const unsigned long STATE_ALLOWED_TRACKING_CONTENT = 0x00000020;
351 * Flag for HTTPS-Only Mode upgrades
353 * STATE_HTTPS_ONLY_MODE_UPGRADED
354 * When a request has been upgraded by HTTPS-Only Mode
356 * STATE_HTTPS_ONLY_MODE_UPGRADE_FAILED
357 * When an upgraded request failed.
359 const unsigned long STATE_HTTPS_ONLY_MODE_UPGRADED = 0x00400000;
360 const unsigned long STATE_HTTPS_ONLY_MODE_UPGRADE_FAILED = 0x00800000;
363 * Notification indicating the state has changed for one of the requests
364 * associated with aWebProgress.
366 * @param aWebProgress
367 * The nsIWebProgress instance that fired the notification
368 * @param aRequest
369 * The nsIRequest that has changed state.
370 * @param aStateFlags
371 * Flags indicating the new state. This value is a combination of one
372 * of the State Transition Flags and one or more of the State Type
373 * Flags defined above. Any undefined bits are reserved for future
374 * use.
375 * @param aStatus
376 * Error status code associated with the state change. This parameter
377 * should be ignored unless aStateFlags includes the STATE_STOP bit.
378 * The status code indicates success or failure of the request
379 * associated with the state change. NOTE: aStatus may be a success
380 * code even for server generated errors, such as the HTTP 404 error.
381 * In such cases, the request itself should be queried for extended
382 * error information (e.g., for HTTP requests see nsIHttpChannel).
384 void onStateChange(in nsIWebProgress aWebProgress,
385 in nsIRequest aRequest,
386 in unsigned long aStateFlags,
387 in nsresult aStatus);
390 * Notification that the progress has changed for one of the requests
391 * associated with aWebProgress. Progress totals are reset to zero when all
392 * requests in aWebProgress complete (corresponding to onStateChange being
393 * called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW
394 * flags).
396 * @param aWebProgress
397 * The nsIWebProgress instance that fired the notification.
398 * @param aRequest
399 * The nsIRequest that has new progress.
400 * @param aCurSelfProgress
401 * The current progress for aRequest.
402 * @param aMaxSelfProgress
403 * The maximum progress for aRequest.
404 * @param aCurTotalProgress
405 * The current progress for all requests associated with aWebProgress.
406 * @param aMaxTotalProgress
407 * The total progress for all requests associated with aWebProgress.
409 * NOTE: If any progress value is unknown, or if its value would exceed the
410 * maximum value of type long, then its value is replaced with -1.
412 * NOTE: If the object also implements nsIWebProgressListener2 and the caller
413 * knows about that interface, this function will not be called. Instead,
414 * nsIWebProgressListener2::onProgressChange64 will be called.
416 void onProgressChange(in nsIWebProgress aWebProgress,
417 in nsIRequest aRequest,
418 in long aCurSelfProgress,
419 in long aMaxSelfProgress,
420 in long aCurTotalProgress,
421 in long aMaxTotalProgress);
424 * Flags for onLocationChange
426 * LOCATION_CHANGE_SAME_DOCUMENT
427 * This flag is on when |aWebProgress| did not load a new document.
428 * For example, the location change is due to an anchor scroll or a
429 * pushState/popState/replaceState.
431 * LOCATION_CHANGE_ERROR_PAGE
432 * This flag is on when |aWebProgress| redirected from the requested
433 * contents to an internal page to show error status, such as
434 * <about:neterror>, <about:certerror> and so on.
436 * Generally speaking, |aURI| and |aRequest| are the original data. DOM
437 * |window.location.href| is also the original location, while
438 * |document.documentURI| is the redirected location. Sometimes |aURI| is
439 * <about:blank> and |aRequest| is null when the original data does not
440 + remain.
442 * |aWebProgress| does NOT set this flag when it did not try to load a new
443 * document. In this case, it should set LOCATION_CHANGE_SAME_DOCUMENT.
445 * LOCATION_CHANGE_RELOAD
446 * This flag is on when reloading the current page, either from
447 * location.reload() or the browser UI.
449 * LOCATION_CHANGE_HASHCHANGE
450 * This flag is on for same-document location changes where only the URI's
451 * reference fragment has changed. This flag implies
452 * LOCATION_CHANGE_SAME_DOCUMENT.
454 const unsigned long LOCATION_CHANGE_SAME_DOCUMENT = 0x00000001;
455 const unsigned long LOCATION_CHANGE_ERROR_PAGE = 0x00000002;
456 const unsigned long LOCATION_CHANGE_RELOAD = 0x00000004;
457 const unsigned long LOCATION_CHANGE_HASHCHANGE = 0x00000008;
460 * Called when the location of the window being watched changes. This is not
461 * when a load is requested, but rather once it is verified that the load is
462 * going to occur in the given window. For instance, a load that starts in a
463 * window might send progress and status messages for the new site, but it
464 * will not send the onLocationChange until we are sure that we are loading
465 * this new page here.
467 * @param aWebProgress
468 * The nsIWebProgress instance that fired the notification.
469 * @param aRequest
470 * The associated nsIRequest. This may be null in some cases.
471 * @param aLocation
472 * The URI of the location that is being loaded.
473 * @param aFlags
474 * This is a value which explains the situation or the reason why
475 * the location has changed.
477 void onLocationChange(in nsIWebProgress aWebProgress,
478 in nsIRequest aRequest,
479 in nsIURI aLocation,
480 [optional] in unsigned long aFlags);
483 * Notification that the status of a request has changed. The status message
484 * is intended to be displayed to the user (e.g., in the status bar of the
485 * browser).
487 * @param aWebProgress
488 * The nsIWebProgress instance that fired the notification.
489 * @param aRequest
490 * The nsIRequest that has new status.
491 * @param aStatus
492 * This value is not an error code. Instead, it is a numeric value
493 * that indicates the current status of the request. This interface
494 * does not define the set of possible status codes. NOTE: Some
495 * status values are defined by nsITransport and nsISocketTransport.
496 * @param aMessage
497 * Localized text corresponding to aStatus.
499 void onStatusChange(in nsIWebProgress aWebProgress,
500 in nsIRequest aRequest,
501 in nsresult aStatus,
502 in wstring aMessage);
505 * Notification called for security progress. This method will be called on
506 * security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and
507 * after document load completion. It might also be called if an error
508 * occurs during network loading.
510 * @param aWebProgress
511 * The nsIWebProgress instance that fired the notification.
512 * @param aRequest
513 * The nsIRequest that has new security state.
514 * @param aState
515 * A value composed of the Security State Flags and the Security
516 * Strength Flags listed above. Any undefined bits are reserved for
517 * future use.
519 * NOTE: These notifications will only occur if a security package is
520 * installed.
522 void onSecurityChange(in nsIWebProgress aWebProgress,
523 in nsIRequest aRequest,
524 in unsigned long aState);
527 * Notification called for content blocking events. This method will be
528 * called when content gets allowed/blocked for various reasons per the
529 * Content Blocking rules.
531 * @param aWebProgress
532 * The nsIWebProgress instance that fired the notification.
533 * @param aRequest
534 * The nsIRequest that has new security state.
535 * @param aEvent
536 * A value composed of the Content Blocking Event Flags listed above.
537 * Any undefined bits are reserved for future use.
539 void onContentBlockingEvent(in nsIWebProgress aWebProgress,
540 in nsIRequest aRequest,
541 in unsigned long aEvent);