|
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
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/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 interface nsIDOMWindow; |
|
10 interface nsIWebProgressListener; |
|
11 |
|
12 /** |
|
13 * The nsIWebProgress interface is used to add or remove nsIWebProgressListener |
|
14 * instances to observe the loading of asynchronous requests (usually in the |
|
15 * context of a DOM window). |
|
16 * |
|
17 * nsIWebProgress instances may be arranged in a parent-child configuration, |
|
18 * corresponding to the parent-child configuration of their respective DOM |
|
19 * windows. However, in some cases a nsIWebProgress instance may not have an |
|
20 * associated DOM window. The parent-child relationship of nsIWebProgress |
|
21 * instances is not made explicit by this interface, but the relationship may |
|
22 * exist in some implementations. |
|
23 * |
|
24 * A nsIWebProgressListener instance receives notifications for the |
|
25 * nsIWebProgress instance to which it added itself, and it may also receive |
|
26 * notifications from any nsIWebProgress instances that are children of that |
|
27 * nsIWebProgress instance. |
|
28 */ |
|
29 [scriptable, uuid(bd0efb3b-1c81-4fb0-b16d-576a2be48a95)] |
|
30 interface nsIWebProgress : nsISupports |
|
31 { |
|
32 /** |
|
33 * The following flags may be combined to form the aNotifyMask parameter for |
|
34 * the addProgressListener method. They limit the set of events that are |
|
35 * delivered to an nsIWebProgressListener instance. |
|
36 */ |
|
37 |
|
38 /** |
|
39 * These flags indicate the state transistions to observe, corresponding to |
|
40 * nsIWebProgressListener::onStateChange. |
|
41 * |
|
42 * NOTIFY_STATE_REQUEST |
|
43 * Only receive the onStateChange event if the aStateFlags parameter |
|
44 * includes nsIWebProgressListener::STATE_IS_REQUEST. |
|
45 * |
|
46 * NOTIFY_STATE_DOCUMENT |
|
47 * Only receive the onStateChange event if the aStateFlags parameter |
|
48 * includes nsIWebProgressListener::STATE_IS_DOCUMENT. |
|
49 * |
|
50 * NOTIFY_STATE_NETWORK |
|
51 * Only receive the onStateChange event if the aStateFlags parameter |
|
52 * includes nsIWebProgressListener::STATE_IS_NETWORK. |
|
53 * |
|
54 * NOTIFY_STATE_WINDOW |
|
55 * Only receive the onStateChange event if the aStateFlags parameter |
|
56 * includes nsIWebProgressListener::STATE_IS_WINDOW. |
|
57 * |
|
58 * NOTIFY_STATE_ALL |
|
59 * Receive all onStateChange events. |
|
60 */ |
|
61 const unsigned long NOTIFY_STATE_REQUEST = 0x00000001; |
|
62 const unsigned long NOTIFY_STATE_DOCUMENT = 0x00000002; |
|
63 const unsigned long NOTIFY_STATE_NETWORK = 0x00000004; |
|
64 const unsigned long NOTIFY_STATE_WINDOW = 0x00000008; |
|
65 const unsigned long NOTIFY_STATE_ALL = 0x0000000f; |
|
66 |
|
67 /** |
|
68 * These flags indicate the other events to observe, corresponding to the |
|
69 * other four methods defined on nsIWebProgressListener. |
|
70 * |
|
71 * NOTIFY_PROGRESS |
|
72 * Receive onProgressChange events. |
|
73 * |
|
74 * NOTIFY_STATUS |
|
75 * Receive onStatusChange events. |
|
76 * |
|
77 * NOTIFY_SECURITY |
|
78 * Receive onSecurityChange events. |
|
79 * |
|
80 * NOTIFY_LOCATION |
|
81 * Receive onLocationChange events. |
|
82 * |
|
83 * NOTIFY_REFRESH |
|
84 * Receive onRefreshAttempted events. |
|
85 * This is defined on nsIWebProgressListener2. |
|
86 */ |
|
87 const unsigned long NOTIFY_PROGRESS = 0x00000010; |
|
88 const unsigned long NOTIFY_STATUS = 0x00000020; |
|
89 const unsigned long NOTIFY_SECURITY = 0x00000040; |
|
90 const unsigned long NOTIFY_LOCATION = 0x00000080; |
|
91 const unsigned long NOTIFY_REFRESH = 0x00000100; |
|
92 |
|
93 /** |
|
94 * This flag enables all notifications. |
|
95 */ |
|
96 const unsigned long NOTIFY_ALL = 0x000001ff; |
|
97 |
|
98 /** |
|
99 * Registers a listener to receive web progress events. |
|
100 * |
|
101 * @param aListener |
|
102 * The listener interface to be called when a progress event occurs. |
|
103 * This object must also implement nsISupportsWeakReference. |
|
104 * @param aNotifyMask |
|
105 * The types of notifications to receive. |
|
106 * |
|
107 * @throw NS_ERROR_INVALID_ARG |
|
108 * Indicates that aListener was either null or that it does not |
|
109 * support weak references. |
|
110 * @throw NS_ERROR_FAILURE |
|
111 * Indicates that aListener was already registered. |
|
112 */ |
|
113 void addProgressListener(in nsIWebProgressListener aListener, |
|
114 in unsigned long aNotifyMask); |
|
115 |
|
116 /** |
|
117 * Removes a previously registered listener of progress events. |
|
118 * |
|
119 * @param aListener |
|
120 * The listener interface previously registered with a call to |
|
121 * addProgressListener. |
|
122 * |
|
123 * @throw NS_ERROR_FAILURE |
|
124 * Indicates that aListener was not registered. |
|
125 */ |
|
126 void removeProgressListener(in nsIWebProgressListener aListener); |
|
127 |
|
128 /** |
|
129 * The DOM window associated with this nsIWebProgress instance. |
|
130 * |
|
131 * @throw NS_ERROR_FAILURE |
|
132 * Indicates that there is no associated DOM window. |
|
133 */ |
|
134 readonly attribute nsIDOMWindow DOMWindow; |
|
135 readonly attribute uint64_t DOMWindowID; |
|
136 |
|
137 /** |
|
138 * Indicates whether DOMWindow.top == DOMWindow. |
|
139 */ |
|
140 readonly attribute boolean isTopLevel; |
|
141 |
|
142 /** |
|
143 * Indicates whether or not a document is currently being loaded |
|
144 * in the context of this nsIWebProgress instance. |
|
145 */ |
|
146 readonly attribute boolean isLoadingDocument; |
|
147 |
|
148 /** |
|
149 * Contains a load type as specified by the load* constants in |
|
150 * nsIDocShellLoadInfo.idl. |
|
151 */ |
|
152 readonly attribute unsigned long loadType; |
|
153 }; |