| State Type Flags
These flags further describe the entity for which the state transition is
occuring. These flags are NOT mutually exclusive (i.e., an onStateChange
event may indicate some combination of these flags).
STATE_IS_REQUEST
This flag indicates that the state transition is for a request, which
includes but is not limited to document requests. (See below for a
description of document requests.) Other types of requests, such as
requests for inline content (e.g., images and stylesheets) are
considered normal requests.
STATE_IS_DOCUMENT
This flag indicates that the state transition is for a document request.
This flag is set in addition to STATE_IS_REQUEST. A document request
supports the nsIChannel interface and its loadFlags attribute includes
the nsIChannel::LOAD_DOCUMENT_URI flag.
A document request does not complete until all requests associated with
the loading of its corresponding document have completed. This includes
other document requests (e.g., corresponding to HTML iframe elements).
The document corresponding to a document request is available via the
DOMWindow attribute of onStateChange's aWebProgress parameter.
STATE_IS_NETWORK
This flag indicates that the state transition corresponds to the start
or stop of activity in the indicated nsIWebProgress instance. This flag
is accompanied by either STATE_START or STATE_STOP, and it may be
combined with other State Type Flags.
Unlike STATE_IS_WINDOW, this flag is only set when activity within the
nsIWebProgress instance being observed starts or stops. If activity
only occurs in a child nsIWebProgress instance, then this flag will be
set to indicate the start and stop of that activity.
For example, in the case of navigation within a single frame of a HTML
frameset, a nsIWebProgressListener instance attached to the
nsIWebProgress of the frameset window will receive onStateChange calls
with the STATE_IS_NETWORK flag set to indicate the start and stop of
said navigation. In other words, an observer of an outer window can
determine when activity, that may be constrained to a child window or
set of child windows, starts and stops.
STATE_IS_WINDOW
This flag indicates that the state transition corresponds to the start
or stop of activity in the indicated nsIWebProgress instance. This flag
is accompanied by either STATE_START or STATE_STOP, and it may be
combined with other State Type Flags.
This flag is similar to STATE_IS_DOCUMENT. However, when a document
request completes, two onStateChange calls with STATE_STOP are
generated. The document request is passed as aRequest to both calls.
The first has STATE_IS_REQUEST and STATE_IS_DOCUMENT set, and the second
has the STATE_IS_WINDOW flag set (and possibly the STATE_IS_NETWORK flag
set as well -- see above for a description of when the STATE_IS_NETWORK
flag may be set). This second STATE_STOP event may be useful as a way
to partition the work that occurs when a document request completes.
|