nsIWebProgress 编辑

The nsIWebProgress interface is used to add or remove nsIWebProgressListener instances to observe the loading of asynchronous requests (usually in the context of a DOM window).

nsIWebProgress instances may be arranged in a parent-child configuration, corresponding to the parent-child configuration of their respective DOM windows. However, in some cases a nsIWebProgress instance may not have an associated DOM window. The parent-child relationship of nsIWebProgress instances is not made explicit by this interface, but the relationship may exist in some implementations.

A nsIWebProgressListener instance receives notifications for the nsIWebProgress instance to which it added itself, and it may also receive notifications from any nsIWebProgress instances that are children of that nsIWebProgress instance.

uriloader/base/nsIWebProgress.idlScriptable Please add a summary to this article.   Last changed in Gecko 1.8.0

Inherits from: nsISupports

Method overview

void addProgressListener(in nsIWebProgressListener aListener, in unsigned long aNotifyMask);
void removeProgressListener(in nsIWebProgressListener aListener);

Attributes

AttributeTypeDescription
DOMWindownsIDOMWindowThe DOM window associated with this nsIWebProgress instance. Read only.
Exceptions thrown
NS_ERROR_FAILURE
Indicates that there is no associated DOM window.
isLoadingDocumentPRBoolIndicates whether or not a document is currently being loaded in the context of this nsIWebProgress instance. Read only.

Constants

The following flags may be combined to form the aNotifyMask parameter for the addProgressListener() method. They limit the set of events that are delivered to an nsIWebProgressListener instance.

These flags indicate the state transistions to observe, corresponding to nsIWebProgressListener.onStateChange().

ConstantValueDescription
NOTIFY_STATE_REQUEST0x00000001Only receive the nsIWebProgressListener.onStateChange() event if the aStateFlags parameter includes nsIWebProgressListener::STATE_IS_REQUEST.
NOTIFY_STATE_DOCUMENT0x00000002Only receive the nsIWebProgressListener.onStateChange() event if the aStateFlags parameter includes nsIWebProgressListener::STATE_IS_DOCUMENT.
NOTIFY_STATE_NETWORK0x00000004Only receive the nsIWebProgressListener.onStateChange() event if the aStateFlags parameter includes nsIWebProgressListener::STATE_IS_NETWORK.
NOTIFY_STATE_WINDOW0x00000008Only receive the nsIWebProgressListener.onStateChange() event if the aStateFlags parameter includes nsIWebProgressListener::STATE_IS_WINDOW.
NOTIFY_STATE_ALL0x0000000fReceive all nsIWebProgressListener.onStateChange() events.

These flags indicate the other events to observe, corresponding to the other four methods defined on nsIWebProgressListener.

ConstantValueDescription
NOTIFY_PROGRESS0x00000010Receive nsIWebProgressListener.onProgressChange() events.
NOTIFY_STATUS0x00000020Receive nsIWebProgressListener.onStatusChange() events.
NOTIFY_SECURITY0x00000040Receive nsIWebProgressListener.onSecurityChange() events.
NOTIFY_LOCATION0x00000080Receive nsIWebProgressListener.onLocationChange() events.
NOTIFY_REFRESH0x00000100Receive nsIWebProgressListener2.onRefreshAttempted() events. This is defined on nsIWebProgressListener2.
NOTIFY_ALL0x000000ff <= Gecko 1.8.1
0x000001ff > Gecko 1.8.1
This flag enables all notifications.

Methods

addProgressListener()

Registers a listener to receive web progress events.

void addProgressListener(
  in nsIWebProgressListener aListener,
  in unsigned long aNotifyMask
);
Parameters
aListener
The listener interface to be called when a progress event occurs. This object must also implement nsISupportsWeakReference.
aNotifyMask
The types of notifications to receive.
Exceptions thrown
NS_ERROR_INVALID_ARG
Indicates that aListener was either null or that it does not support weak references.
NS_ERROR_FAILURE
Indicates that aListener was already registered.

removeProgressListener()

Removes a previously registered listener of progress events.

void removeProgressListener(
  in nsIWebProgressListener aListener
);
Parameters
aListener
The listener interface previously registered with a call to addProgressListener().
Exceptions thrown
NS_ERROR_FAILURE
Indicates that aListener was not registered.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:25 次

字数:9897

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文