Bug 1780466 - Increase fuzzy tolerance due to new R-wr-dc3-c variant. r=gfx-reviewers...
[gecko.git] / uriloader / base / nsIWebProgressListener.idl
bloba1f31394f6c75aca1cb251aafab9a0bc7a5e4f23
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 * STATE_BLOCKED_EMAILTRACING_CONTENT
329 * EmailTracking content has been blocked from loading.
331 * STATE_LOADED_EMAILTRACKING_CONTENT
332 * EmailTracking content has been loaded.
334 const unsigned long STATE_BLOCKED_TRACKING_CONTENT = 0x00001000;
335 const unsigned long STATE_LOADED_LEVEL_1_TRACKING_CONTENT = 0x00002000;
336 const unsigned long STATE_LOADED_LEVEL_2_TRACKING_CONTENT = 0x00100000;
337 const unsigned long STATE_BLOCKED_FINGERPRINTING_CONTENT = 0x00000040;
338 const unsigned long STATE_LOADED_FINGERPRINTING_CONTENT = 0x00000400;
339 const unsigned long STATE_BLOCKED_CRYPTOMINING_CONTENT = 0x00000800;
340 const unsigned long STATE_LOADED_CRYPTOMINING_CONTENT = 0x00200000;
341 const unsigned long STATE_BLOCKED_UNSAFE_CONTENT = 0x00004000;
342 const unsigned long STATE_COOKIES_LOADED = 0x00008000;
343 const unsigned long STATE_COOKIES_LOADED_TRACKER = 0x00040000;
344 const unsigned long STATE_COOKIES_LOADED_SOCIALTRACKER = 0x00080000;
345 const unsigned long STATE_COOKIES_BLOCKED_BY_PERMISSION = 0x10000000;
346 const unsigned long STATE_COOKIES_BLOCKED_TRACKER = 0x20000000;
347 const unsigned long STATE_COOKIES_BLOCKED_SOCIALTRACKER = 0x01000000;
348 const unsigned long STATE_COOKIES_BLOCKED_ALL = 0x40000000;
349 const unsigned long STATE_COOKIES_PARTITIONED_FOREIGN = 0x80000000;
350 const unsigned long STATE_COOKIES_BLOCKED_FOREIGN = 0x00000080;
351 const unsigned long STATE_BLOCKED_SOCIALTRACKING_CONTENT = 0x00010000;
352 const unsigned long STATE_LOADED_SOCIALTRACKING_CONTENT = 0x00020000;
353 const unsigned long STATE_REPLACED_TRACKING_CONTENT = 0x00000010;
354 const unsigned long STATE_ALLOWED_TRACKING_CONTENT = 0x00000020;
355 const unsigned long STATE_BLOCKED_EMAILTRACKING_CONTENT = 0x00400000;
356 const unsigned long STATE_LOADED_EMAILTRACKING_CONTENT = 0x00800000;
359 * Flag for HTTPS-Only Mode upgrades
361 * STATE_HTTPS_ONLY_MODE_UPGRADED
362 * When a request has been upgraded by HTTPS-Only Mode
364 * STATE_HTTPS_ONLY_MODE_UPGRADE_FAILED
365 * When an upgraded request failed.
367 const unsigned long STATE_HTTPS_ONLY_MODE_UPGRADED = 0x00400000;
368 const unsigned long STATE_HTTPS_ONLY_MODE_UPGRADE_FAILED = 0x00800000;
371 * Notification indicating the state has changed for one of the requests
372 * associated with aWebProgress.
374 * @param aWebProgress
375 * The nsIWebProgress instance that fired the notification
376 * @param aRequest
377 * The nsIRequest that has changed state.
378 * @param aStateFlags
379 * Flags indicating the new state. This value is a combination of one
380 * of the State Transition Flags and one or more of the State Type
381 * Flags defined above. Any undefined bits are reserved for future
382 * use.
383 * @param aStatus
384 * Error status code associated with the state change. This parameter
385 * should be ignored unless aStateFlags includes the STATE_STOP bit.
386 * The status code indicates success or failure of the request
387 * associated with the state change. NOTE: aStatus may be a success
388 * code even for server generated errors, such as the HTTP 404 error.
389 * In such cases, the request itself should be queried for extended
390 * error information (e.g., for HTTP requests see nsIHttpChannel).
392 void onStateChange(in nsIWebProgress aWebProgress,
393 in nsIRequest aRequest,
394 in unsigned long aStateFlags,
395 in nsresult aStatus);
398 * Notification that the progress has changed for one of the requests
399 * associated with aWebProgress. Progress totals are reset to zero when all
400 * requests in aWebProgress complete (corresponding to onStateChange being
401 * called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW
402 * flags).
404 * @param aWebProgress
405 * The nsIWebProgress instance that fired the notification.
406 * @param aRequest
407 * The nsIRequest that has new progress.
408 * @param aCurSelfProgress
409 * The current progress for aRequest.
410 * @param aMaxSelfProgress
411 * The maximum progress for aRequest.
412 * @param aCurTotalProgress
413 * The current progress for all requests associated with aWebProgress.
414 * @param aMaxTotalProgress
415 * The total progress for all requests associated with aWebProgress.
417 * NOTE: If any progress value is unknown, or if its value would exceed the
418 * maximum value of type long, then its value is replaced with -1.
420 * NOTE: If the object also implements nsIWebProgressListener2 and the caller
421 * knows about that interface, this function will not be called. Instead,
422 * nsIWebProgressListener2::onProgressChange64 will be called.
424 void onProgressChange(in nsIWebProgress aWebProgress,
425 in nsIRequest aRequest,
426 in long aCurSelfProgress,
427 in long aMaxSelfProgress,
428 in long aCurTotalProgress,
429 in long aMaxTotalProgress);
432 * Flags for onLocationChange
434 * LOCATION_CHANGE_SAME_DOCUMENT
435 * This flag is on when |aWebProgress| did not load a new document.
436 * For example, the location change is due to an anchor scroll or a
437 * pushState/popState/replaceState.
439 * LOCATION_CHANGE_ERROR_PAGE
440 * This flag is on when |aWebProgress| redirected from the requested
441 * contents to an internal page to show error status, such as
442 * <about:neterror>, <about:certerror> and so on.
444 * Generally speaking, |aURI| and |aRequest| are the original data. DOM
445 * |window.location.href| is also the original location, while
446 * |document.documentURI| is the redirected location. Sometimes |aURI| is
447 * <about:blank> and |aRequest| is null when the original data does not
448 + remain.
450 * |aWebProgress| does NOT set this flag when it did not try to load a new
451 * document. In this case, it should set LOCATION_CHANGE_SAME_DOCUMENT.
453 * LOCATION_CHANGE_RELOAD
454 * This flag is on when reloading the current page, either from
455 * location.reload() or the browser UI.
457 * LOCATION_CHANGE_HASHCHANGE
458 * This flag is on for same-document location changes where only the URI's
459 * reference fragment has changed. This flag implies
460 * LOCATION_CHANGE_SAME_DOCUMENT.
462 * LOCATION_CHANGE_SESSION_STORE
463 * This flag is on for location changes that are the result of the session
464 * store updating the URI of aWebProgress without actually navigating.
466 const unsigned long LOCATION_CHANGE_SAME_DOCUMENT = 0x00000001;
467 const unsigned long LOCATION_CHANGE_ERROR_PAGE = 0x00000002;
468 const unsigned long LOCATION_CHANGE_RELOAD = 0x00000004;
469 const unsigned long LOCATION_CHANGE_HASHCHANGE = 0x00000008;
470 const unsigned long LOCATION_CHANGE_SESSION_STORE = 0x00000010;
473 * Called when the location of the window being watched changes. This is not
474 * when a load is requested, but rather once it is verified that the load is
475 * going to occur in the given window. For instance, a load that starts in a
476 * window might send progress and status messages for the new site, but it
477 * will not send the onLocationChange until we are sure that we are loading
478 * this new page here.
480 * @param aWebProgress
481 * The nsIWebProgress instance that fired the notification.
482 * @param aRequest
483 * The associated nsIRequest. This may be null in some cases.
484 * @param aLocation
485 * The URI of the location that is being loaded.
486 * @param aFlags
487 * This is a value which explains the situation or the reason why
488 * the location has changed.
490 void onLocationChange(in nsIWebProgress aWebProgress,
491 in nsIRequest aRequest,
492 in nsIURI aLocation,
493 [optional] in unsigned long aFlags);
496 * Notification that the status of a request has changed. The status message
497 * is intended to be displayed to the user (e.g., in the status bar of the
498 * browser).
500 * @param aWebProgress
501 * The nsIWebProgress instance that fired the notification.
502 * @param aRequest
503 * The nsIRequest that has new status.
504 * @param aStatus
505 * This value is not an error code. Instead, it is a numeric value
506 * that indicates the current status of the request. This interface
507 * does not define the set of possible status codes. NOTE: Some
508 * status values are defined by nsITransport and nsISocketTransport.
509 * @param aMessage
510 * Localized text corresponding to aStatus.
512 void onStatusChange(in nsIWebProgress aWebProgress,
513 in nsIRequest aRequest,
514 in nsresult aStatus,
515 in wstring aMessage);
518 * Notification called for security progress. This method will be called on
519 * security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and
520 * after document load completion. It might also be called if an error
521 * occurs during network loading.
523 * @param aWebProgress
524 * The nsIWebProgress instance that fired the notification.
525 * @param aRequest
526 * The nsIRequest that has new security state.
527 * @param aState
528 * A value composed of the Security State Flags and the Security
529 * Strength Flags listed above. Any undefined bits are reserved for
530 * future use.
532 * NOTE: These notifications will only occur if a security package is
533 * installed.
535 void onSecurityChange(in nsIWebProgress aWebProgress,
536 in nsIRequest aRequest,
537 in unsigned long aState);
540 * Notification called for content blocking events. This method will be
541 * called when content gets allowed/blocked for various reasons per the
542 * Content Blocking rules.
544 * @param aWebProgress
545 * The nsIWebProgress instance that fired the notification.
546 * @param aRequest
547 * The nsIRequest that has new security state.
548 * @param aEvent
549 * A value composed of the Content Blocking Event Flags listed above.
550 * Any undefined bits are reserved for future use.
552 void onContentBlockingEvent(in nsIWebProgress aWebProgress,
553 in nsIRequest aRequest,
554 in unsigned long aEvent);