uriloader/base/nsIWebProgressListener.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 *
michael@0 3 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "nsISupports.idl"
michael@0 8
michael@0 9 interface nsIWebProgress;
michael@0 10 interface nsIRequest;
michael@0 11 interface nsIURI;
michael@0 12
michael@0 13 /**
michael@0 14 * The nsIWebProgressListener interface is implemented by clients wishing to
michael@0 15 * listen in on the progress associated with the loading of asynchronous
michael@0 16 * requests in the context of a nsIWebProgress instance as well as any child
michael@0 17 * nsIWebProgress instances. nsIWebProgress.idl describes the parent-child
michael@0 18 * relationship of nsIWebProgress instances.
michael@0 19 */
michael@0 20 [scriptable, uuid(a0cda7e4-c6ca-11e0-b6a5-001320257da5)]
michael@0 21 interface nsIWebProgressListener : nsISupports
michael@0 22 {
michael@0 23 /**
michael@0 24 * State Transition Flags
michael@0 25 *
michael@0 26 * These flags indicate the various states that requests may transition
michael@0 27 * through as they are being loaded. These flags are mutually exclusive.
michael@0 28 *
michael@0 29 * For any given request, onStateChange is called once with the STATE_START
michael@0 30 * flag, zero or more times with the STATE_TRANSFERRING flag or once with the
michael@0 31 * STATE_REDIRECTING flag, and then finally once with the STATE_STOP flag.
michael@0 32 * NOTE: For document requests, a second STATE_STOP is generated (see the
michael@0 33 * description of STATE_IS_WINDOW for more details).
michael@0 34 *
michael@0 35 * STATE_START
michael@0 36 * This flag indicates the start of a request. This flag is set when a
michael@0 37 * request is initiated. The request is complete when onStateChange is
michael@0 38 * called for the same request with the STATE_STOP flag set.
michael@0 39 *
michael@0 40 * STATE_REDIRECTING
michael@0 41 * This flag indicates that a request is being redirected. The request
michael@0 42 * passed to onStateChange is the request that is being redirected. When a
michael@0 43 * redirect occurs, a new request is generated automatically to process the
michael@0 44 * new request. Expect a corresponding STATE_START event for the new
michael@0 45 * request, and a STATE_STOP for the redirected request.
michael@0 46 *
michael@0 47 * STATE_TRANSFERRING
michael@0 48 * This flag indicates that data for a request is being transferred to an
michael@0 49 * end consumer. This flag indicates that the request has been targeted,
michael@0 50 * and that the user may start seeing content corresponding to the request.
michael@0 51 *
michael@0 52 * STATE_NEGOTIATING
michael@0 53 * This flag is not used.
michael@0 54 *
michael@0 55 * STATE_STOP
michael@0 56 * This flag indicates the completion of a request. The aStatus parameter
michael@0 57 * to onStateChange indicates the final status of the request.
michael@0 58 */
michael@0 59 const unsigned long STATE_START = 0x00000001;
michael@0 60 const unsigned long STATE_REDIRECTING = 0x00000002;
michael@0 61 const unsigned long STATE_TRANSFERRING = 0x00000004;
michael@0 62 const unsigned long STATE_NEGOTIATING = 0x00000008;
michael@0 63 const unsigned long STATE_STOP = 0x00000010;
michael@0 64
michael@0 65
michael@0 66 /**
michael@0 67 * State Type Flags
michael@0 68 *
michael@0 69 * These flags further describe the entity for which the state transition is
michael@0 70 * occuring. These flags are NOT mutually exclusive (i.e., an onStateChange
michael@0 71 * event may indicate some combination of these flags).
michael@0 72 *
michael@0 73 * STATE_IS_REQUEST
michael@0 74 * This flag indicates that the state transition is for a request, which
michael@0 75 * includes but is not limited to document requests. (See below for a
michael@0 76 * description of document requests.) Other types of requests, such as
michael@0 77 * requests for inline content (e.g., images and stylesheets) are
michael@0 78 * considered normal requests.
michael@0 79 *
michael@0 80 * STATE_IS_DOCUMENT
michael@0 81 * This flag indicates that the state transition is for a document request.
michael@0 82 * This flag is set in addition to STATE_IS_REQUEST. A document request
michael@0 83 * supports the nsIChannel interface and its loadFlags attribute includes
michael@0 84 * the nsIChannel::LOAD_DOCUMENT_URI flag.
michael@0 85 *
michael@0 86 * A document request does not complete until all requests associated with
michael@0 87 * the loading of its corresponding document have completed. This includes
michael@0 88 * other document requests (e.g., corresponding to HTML <iframe> elements).
michael@0 89 * The document corresponding to a document request is available via the
michael@0 90 * DOMWindow attribute of onStateChange's aWebProgress parameter.
michael@0 91 *
michael@0 92 * STATE_IS_NETWORK
michael@0 93 * This flag indicates that the state transition corresponds to the start
michael@0 94 * or stop of activity in the indicated nsIWebProgress instance. This flag
michael@0 95 * is accompanied by either STATE_START or STATE_STOP, and it may be
michael@0 96 * combined with other State Type Flags.
michael@0 97 *
michael@0 98 * Unlike STATE_IS_WINDOW, this flag is only set when activity within the
michael@0 99 * nsIWebProgress instance being observed starts or stops. If activity
michael@0 100 * only occurs in a child nsIWebProgress instance, then this flag will be
michael@0 101 * set to indicate the start and stop of that activity.
michael@0 102 *
michael@0 103 * For example, in the case of navigation within a single frame of a HTML
michael@0 104 * frameset, a nsIWebProgressListener instance attached to the
michael@0 105 * nsIWebProgress of the frameset window will receive onStateChange calls
michael@0 106 * with the STATE_IS_NETWORK flag set to indicate the start and stop of
michael@0 107 * said navigation. In other words, an observer of an outer window can
michael@0 108 * determine when activity, that may be constrained to a child window or
michael@0 109 * set of child windows, starts and stops.
michael@0 110 *
michael@0 111 * STATE_IS_WINDOW
michael@0 112 * This flag indicates that the state transition corresponds to the start
michael@0 113 * or stop of activity in the indicated nsIWebProgress instance. This flag
michael@0 114 * is accompanied by either STATE_START or STATE_STOP, and it may be
michael@0 115 * combined with other State Type Flags.
michael@0 116 *
michael@0 117 * This flag is similar to STATE_IS_DOCUMENT. However, when a document
michael@0 118 * request completes, two onStateChange calls with STATE_STOP are
michael@0 119 * generated. The document request is passed as aRequest to both calls.
michael@0 120 * The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second
michael@0 121 * has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag
michael@0 122 * set as well -- see above for a description of when the STATE_IS_NETWORK
michael@0 123 * flag may be set). This second STATE_STOP event may be useful as a way
michael@0 124 * to partition the work that occurs when a document request completes.
michael@0 125 */
michael@0 126 const unsigned long STATE_IS_REQUEST = 0x00010000;
michael@0 127 const unsigned long STATE_IS_DOCUMENT = 0x00020000;
michael@0 128 const unsigned long STATE_IS_NETWORK = 0x00040000;
michael@0 129 const unsigned long STATE_IS_WINDOW = 0x00080000;
michael@0 130
michael@0 131
michael@0 132 /**
michael@0 133 * State Modifier Flags
michael@0 134 *
michael@0 135 * These flags further describe the transition which is occuring. These
michael@0 136 * flags are NOT mutually exclusive (i.e., an onStateChange event may
michael@0 137 * indicate some combination of these flags).
michael@0 138 *
michael@0 139 * STATE_RESTORING
michael@0 140 * This flag indicates that the state transition corresponds to the start
michael@0 141 * or stop of activity for restoring a previously-rendered presentation.
michael@0 142 * As such, there is no actual network activity associated with this
michael@0 143 * request, and any modifications made to the document or presentation
michael@0 144 * when it was originally loaded will still be present.
michael@0 145 */
michael@0 146 const unsigned long STATE_RESTORING = 0x01000000;
michael@0 147
michael@0 148 /**
michael@0 149 * State Security Flags
michael@0 150 *
michael@0 151 * These flags describe the security state reported by a call to the
michael@0 152 * onSecurityChange method. These flags are mutually exclusive.
michael@0 153 *
michael@0 154 * STATE_IS_INSECURE
michael@0 155 * This flag indicates that the data corresponding to the request
michael@0 156 * was received over an insecure channel.
michael@0 157 *
michael@0 158 * STATE_IS_BROKEN
michael@0 159 * This flag indicates an unknown security state. This may mean that the
michael@0 160 * request is being loaded as part of a page in which some content was
michael@0 161 * received over an insecure channel.
michael@0 162 *
michael@0 163 * STATE_IS_SECURE
michael@0 164 * This flag indicates that the data corresponding to the request was
michael@0 165 * received over a secure channel. The degree of security is expressed by
michael@0 166 * STATE_SECURE_HIGH, STATE_SECURE_MED, or STATE_SECURE_LOW.
michael@0 167 */
michael@0 168 const unsigned long STATE_IS_INSECURE = 0x00000004;
michael@0 169 const unsigned long STATE_IS_BROKEN = 0x00000001;
michael@0 170 const unsigned long STATE_IS_SECURE = 0x00000002;
michael@0 171
michael@0 172 /**
michael@0 173 * Mixed active content flags
michael@0 174 *
michael@0 175 * May be set in addition to the State Security Flags, to indicate that
michael@0 176 * mixed active content has been encountered.
michael@0 177 *
michael@0 178 * STATE_BLOCKED_MIXED_ACTIVE_CONTENT
michael@0 179 * Mixed active content has been blocked from loading.
michael@0 180 *
michael@0 181 * STATE_LOADED_MIXED_ACTIVE_CONTENT
michael@0 182 * Mixed active content has been loaded. State should be STATE_IS_BROKEN.
michael@0 183 */
michael@0 184 const unsigned long STATE_BLOCKED_MIXED_ACTIVE_CONTENT = 0x00000010;
michael@0 185 const unsigned long STATE_LOADED_MIXED_ACTIVE_CONTENT = 0x00000020;
michael@0 186
michael@0 187 /**
michael@0 188 * Mixed display content flags
michael@0 189 *
michael@0 190 * May be set in addition to the State Security Flags, to indicate that
michael@0 191 * mixed display content has been encountered.
michael@0 192 *
michael@0 193 * STATE_BLOCKED_MIXED_DISPLAY_CONTENT
michael@0 194 * Mixed display content has been blocked from loading.
michael@0 195 *
michael@0 196 * STATE_LOADED_MIXED_DISPLAY_CONTENT
michael@0 197 * Mixed display content has been loaded. State should be STATE_IS_BROKEN.
michael@0 198 */
michael@0 199 const unsigned long STATE_BLOCKED_MIXED_DISPLAY_CONTENT = 0x00000100;
michael@0 200 const unsigned long STATE_LOADED_MIXED_DISPLAY_CONTENT = 0x00000200;
michael@0 201
michael@0 202 /**
michael@0 203 * Security Strength Flags
michael@0 204 *
michael@0 205 * These flags describe the security strength and accompany STATE_IS_SECURE
michael@0 206 * in a call to the onSecurityChange method. These flags are mutually
michael@0 207 * exclusive.
michael@0 208 *
michael@0 209 * These flags are not meant to provide a precise description of data
michael@0 210 * transfer security. These are instead intended as a rough indicator that
michael@0 211 * may be used to, for example, color code a security indicator or otherwise
michael@0 212 * provide basic data transfer security feedback to the user.
michael@0 213 *
michael@0 214 * STATE_SECURE_HIGH
michael@0 215 * This flag indicates a high degree of security.
michael@0 216 *
michael@0 217 * STATE_SECURE_MED
michael@0 218 * This flag indicates a medium degree of security.
michael@0 219 *
michael@0 220 * STATE_SECURE_LOW
michael@0 221 * This flag indicates a low degree of security.
michael@0 222 */
michael@0 223 const unsigned long STATE_SECURE_HIGH = 0x00040000;
michael@0 224 const unsigned long STATE_SECURE_MED = 0x00010000;
michael@0 225 const unsigned long STATE_SECURE_LOW = 0x00020000;
michael@0 226
michael@0 227 /**
michael@0 228 * State bits for EV == Extended Validation == High Assurance
michael@0 229 *
michael@0 230 * These flags describe the level of identity verification
michael@0 231 * in a call to the onSecurityChange method.
michael@0 232 *
michael@0 233 * STATE_IDENTITY_EV_TOPLEVEL
michael@0 234 * The topmost document uses an EV cert.
michael@0 235 * NOTE: Available since Gecko 1.9
michael@0 236 */
michael@0 237
michael@0 238 const unsigned long STATE_IDENTITY_EV_TOPLEVEL = 0x00100000;
michael@0 239
michael@0 240 /**
michael@0 241 * Notification indicating the state has changed for one of the requests
michael@0 242 * associated with aWebProgress.
michael@0 243 *
michael@0 244 * @param aWebProgress
michael@0 245 * The nsIWebProgress instance that fired the notification
michael@0 246 * @param aRequest
michael@0 247 * The nsIRequest that has changed state.
michael@0 248 * @param aStateFlags
michael@0 249 * Flags indicating the new state. This value is a combination of one
michael@0 250 * of the State Transition Flags and one or more of the State Type
michael@0 251 * Flags defined above. Any undefined bits are reserved for future
michael@0 252 * use.
michael@0 253 * @param aStatus
michael@0 254 * Error status code associated with the state change. This parameter
michael@0 255 * should be ignored unless aStateFlags includes the STATE_STOP bit.
michael@0 256 * The status code indicates success or failure of the request
michael@0 257 * associated with the state change. NOTE: aStatus may be a success
michael@0 258 * code even for server generated errors, such as the HTTP 404 error.
michael@0 259 * In such cases, the request itself should be queried for extended
michael@0 260 * error information (e.g., for HTTP requests see nsIHttpChannel).
michael@0 261 */
michael@0 262 void onStateChange(in nsIWebProgress aWebProgress,
michael@0 263 in nsIRequest aRequest,
michael@0 264 in unsigned long aStateFlags,
michael@0 265 in nsresult aStatus);
michael@0 266
michael@0 267 /**
michael@0 268 * Notification that the progress has changed for one of the requests
michael@0 269 * associated with aWebProgress. Progress totals are reset to zero when all
michael@0 270 * requests in aWebProgress complete (corresponding to onStateChange being
michael@0 271 * called with aStateFlags including the STATE_STOP and STATE_IS_WINDOW
michael@0 272 * flags).
michael@0 273 *
michael@0 274 * @param aWebProgress
michael@0 275 * The nsIWebProgress instance that fired the notification.
michael@0 276 * @param aRequest
michael@0 277 * The nsIRequest that has new progress.
michael@0 278 * @param aCurSelfProgress
michael@0 279 * The current progress for aRequest.
michael@0 280 * @param aMaxSelfProgress
michael@0 281 * The maximum progress for aRequest.
michael@0 282 * @param aCurTotalProgress
michael@0 283 * The current progress for all requests associated with aWebProgress.
michael@0 284 * @param aMaxTotalProgress
michael@0 285 * The total progress for all requests associated with aWebProgress.
michael@0 286 *
michael@0 287 * NOTE: If any progress value is unknown, or if its value would exceed the
michael@0 288 * maximum value of type long, then its value is replaced with -1.
michael@0 289 *
michael@0 290 * NOTE: If the object also implements nsIWebProgressListener2 and the caller
michael@0 291 * knows about that interface, this function will not be called. Instead,
michael@0 292 * nsIWebProgressListener2::onProgressChange64 will be called.
michael@0 293 */
michael@0 294 void onProgressChange(in nsIWebProgress aWebProgress,
michael@0 295 in nsIRequest aRequest,
michael@0 296 in long aCurSelfProgress,
michael@0 297 in long aMaxSelfProgress,
michael@0 298 in long aCurTotalProgress,
michael@0 299 in long aMaxTotalProgress);
michael@0 300
michael@0 301 /**
michael@0 302 * Flags for onLocationChange
michael@0 303 *
michael@0 304 * LOCATION_CHANGE_SAME_DOCUMENT
michael@0 305 * This flag is on when |aWebProgress| did not load a new document.
michael@0 306 * For example, the location change is due to an anchor scroll or a
michael@0 307 * pushState/popState/replaceState.
michael@0 308 *
michael@0 309 * LOCATION_CHANGE_ERROR_PAGE
michael@0 310 * This flag is on when |aWebProgress| redirected from the requested
michael@0 311 * contents to an internal page to show error status, such as
michael@0 312 * <about:neterror>, <about:certerror> and so on.
michael@0 313 *
michael@0 314 * Generally speaking, |aURI| and |aRequest| are the original data. DOM
michael@0 315 * |window.location.href| is also the original location, while
michael@0 316 * |document.documentURI| is the redirected location. Sometimes |aURI| is
michael@0 317 * <about:blank> and |aRequest| is null when the original data does not
michael@0 318 + remain.
michael@0 319 *
michael@0 320 * |aWebProgress| does NOT set this flag when it did not try to load a new
michael@0 321 * document. In this case, it should set LOCATION_CHANGE_SAME_DOCUMENT.
michael@0 322 */
michael@0 323 const unsigned long LOCATION_CHANGE_SAME_DOCUMENT = 0x00000001;
michael@0 324 const unsigned long LOCATION_CHANGE_ERROR_PAGE = 0x00000002;
michael@0 325
michael@0 326 /**
michael@0 327 * Called when the location of the window being watched changes. This is not
michael@0 328 * when a load is requested, but rather once it is verified that the load is
michael@0 329 * going to occur in the given window. For instance, a load that starts in a
michael@0 330 * window might send progress and status messages for the new site, but it
michael@0 331 * will not send the onLocationChange until we are sure that we are loading
michael@0 332 * this new page here.
michael@0 333 *
michael@0 334 * @param aWebProgress
michael@0 335 * The nsIWebProgress instance that fired the notification.
michael@0 336 * @param aRequest
michael@0 337 * The associated nsIRequest. This may be null in some cases.
michael@0 338 * @param aLocation
michael@0 339 * The URI of the location that is being loaded.
michael@0 340 * @param aFlags
michael@0 341 * This is a value which explains the situation or the reason why
michael@0 342 * the location has changed.
michael@0 343 */
michael@0 344 void onLocationChange(in nsIWebProgress aWebProgress,
michael@0 345 in nsIRequest aRequest,
michael@0 346 in nsIURI aLocation,
michael@0 347 [optional] in unsigned long aFlags);
michael@0 348
michael@0 349 /**
michael@0 350 * Notification that the status of a request has changed. The status message
michael@0 351 * is intended to be displayed to the user (e.g., in the status bar of the
michael@0 352 * browser).
michael@0 353 *
michael@0 354 * @param aWebProgress
michael@0 355 * The nsIWebProgress instance that fired the notification.
michael@0 356 * @param aRequest
michael@0 357 * The nsIRequest that has new status.
michael@0 358 * @param aStatus
michael@0 359 * This value is not an error code. Instead, it is a numeric value
michael@0 360 * that indicates the current status of the request. This interface
michael@0 361 * does not define the set of possible status codes. NOTE: Some
michael@0 362 * status values are defined by nsITransport and nsISocketTransport.
michael@0 363 * @param aMessage
michael@0 364 * Localized text corresponding to aStatus.
michael@0 365 */
michael@0 366 void onStatusChange(in nsIWebProgress aWebProgress,
michael@0 367 in nsIRequest aRequest,
michael@0 368 in nsresult aStatus,
michael@0 369 in wstring aMessage);
michael@0 370
michael@0 371 /**
michael@0 372 * Notification called for security progress. This method will be called on
michael@0 373 * security transitions (eg HTTP -> HTTPS, HTTPS -> HTTP, FOO -> HTTPS) and
michael@0 374 * after document load completion. It might also be called if an error
michael@0 375 * occurs during network loading.
michael@0 376 *
michael@0 377 * @param aWebProgress
michael@0 378 * The nsIWebProgress instance that fired the notification.
michael@0 379 * @param aRequest
michael@0 380 * The nsIRequest that has new security state.
michael@0 381 * @param aState
michael@0 382 * A value composed of the Security State Flags and the Security
michael@0 383 * Strength Flags listed above. Any undefined bits are reserved for
michael@0 384 * future use.
michael@0 385 *
michael@0 386 * NOTE: These notifications will only occur if a security package is
michael@0 387 * installed.
michael@0 388 */
michael@0 389 void onSecurityChange(in nsIWebProgress aWebProgress,
michael@0 390 in nsIRequest aRequest,
michael@0 391 in unsigned long aState);
michael@0 392 };

mercurial