Bug 1772603 [wpt PR 34303] - Add WPT test writing and reading back a 0.5 alpha fillSt...
[gecko.git] / uriloader / base / nsIWebProgress.idl
blob10d6593381f7625b0ba0601d748caee6fd4c39cc
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 mozIDOMWindowProxy;
10 interface nsIEventTarget;
11 interface nsIRequest;
12 interface nsIWebProgressListener;
13 webidl BrowsingContext;
15 /**
16 * The nsIWebProgress interface is used to add or remove nsIWebProgressListener
17 * instances to observe the loading of asynchronous requests (usually in the
18 * context of a DOM window).
20 * nsIWebProgress instances may be arranged in a parent-child configuration,
21 * corresponding to the parent-child configuration of their respective DOM
22 * windows. However, in some cases a nsIWebProgress instance may not have an
23 * associated DOM window. The parent-child relationship of nsIWebProgress
24 * instances is not made explicit by this interface, but the relationship may
25 * exist in some implementations.
27 * A nsIWebProgressListener instance receives notifications for the
28 * nsIWebProgress instance to which it added itself, and it may also receive
29 * notifications from any nsIWebProgress instances that are children of that
30 * nsIWebProgress instance.
32 [scriptable, builtinclass, uuid(c4d64640-b332-4db6-a2a5-e08566000dc9)]
33 interface nsIWebProgress : nsISupports
35 /**
36 * The following flags may be combined to form the aNotifyMask parameter for
37 * the addProgressListener method. They limit the set of events that are
38 * delivered to an nsIWebProgressListener instance.
41 /**
42 * These flags indicate the state transistions to observe, corresponding to
43 * nsIWebProgressListener::onStateChange.
45 * NOTIFY_STATE_REQUEST
46 * Only receive the onStateChange event if the aStateFlags parameter
47 * includes nsIWebProgressListener::STATE_IS_REQUEST.
49 * NOTIFY_STATE_DOCUMENT
50 * Only receive the onStateChange event if the aStateFlags parameter
51 * includes nsIWebProgressListener::STATE_IS_DOCUMENT.
53 * NOTIFY_STATE_NETWORK
54 * Only receive the onStateChange event if the aStateFlags parameter
55 * includes nsIWebProgressListener::STATE_IS_NETWORK.
57 * NOTIFY_STATE_WINDOW
58 * Only receive the onStateChange event if the aStateFlags parameter
59 * includes nsIWebProgressListener::STATE_IS_WINDOW.
61 * NOTIFY_STATE_ALL
62 * Receive all onStateChange events.
64 const unsigned long NOTIFY_STATE_REQUEST = 0x00000001;
65 const unsigned long NOTIFY_STATE_DOCUMENT = 0x00000002;
66 const unsigned long NOTIFY_STATE_NETWORK = 0x00000004;
67 const unsigned long NOTIFY_STATE_WINDOW = 0x00000008;
68 const unsigned long NOTIFY_STATE_ALL = 0x0000000f;
70 /**
71 * These flags indicate the other events to observe, corresponding to the
72 * other four methods defined on nsIWebProgressListener.
74 * NOTIFY_PROGRESS
75 * Receive onProgressChange events.
77 * NOTIFY_STATUS
78 * Receive onStatusChange events.
80 * NOTIFY_SECURITY
81 * Receive onSecurityChange events.
83 * NOTIFY_LOCATION
84 * Receive onLocationChange events.
86 * NOTIFY_CONTENT_BLOCKING
87 * Receive onContentBlockingEvent events.
89 * NOTIFY_REFRESH
90 * Receive onRefreshAttempted events.
91 * This is defined on nsIWebProgressListener2.
93 const unsigned long NOTIFY_PROGRESS = 0x00000010;
94 const unsigned long NOTIFY_STATUS = 0x00000020;
95 const unsigned long NOTIFY_SECURITY = 0x00000040;
96 const unsigned long NOTIFY_LOCATION = 0x00000080;
97 const unsigned long NOTIFY_REFRESH = 0x00000100;
98 const unsigned long NOTIFY_CONTENT_BLOCKING = 0x00000200;
101 * This flag enables all notifications.
103 const unsigned long NOTIFY_ALL = 0x000003ff;
106 * Registers a listener to receive web progress events.
108 * @param aListener
109 * The listener interface to be called when a progress event occurs.
110 * This object must also implement nsISupportsWeakReference.
111 * @param aNotifyMask
112 * The types of notifications to receive.
114 * @throw NS_ERROR_INVALID_ARG
115 * Indicates that aListener was either null or that it does not
116 * support weak references.
117 * @throw NS_ERROR_FAILURE
118 * Indicates that aListener was already registered.
120 void addProgressListener(in nsIWebProgressListener aListener,
121 in unsigned long aNotifyMask);
124 * Removes a previously registered listener of progress events.
126 * @param aListener
127 * The listener interface previously registered with a call to
128 * addProgressListener.
130 * @throw NS_ERROR_FAILURE
131 * Indicates that aListener was not registered.
133 void removeProgressListener(in nsIWebProgressListener aListener);
136 * BrowsingContext associated with this nsIWebProgress instance, or `null` if
137 * there is no BrowsingContext.
139 [binaryname(BrowsingContextXPCOM)]
140 readonly attribute BrowsingContext browsingContext;
142 [noscript,notxpcom,nostdcall] BrowsingContext getBrowsingContext();
145 * The DOM window associated with this nsIWebProgress instance.
147 * @throw NS_ERROR_FAILURE
148 * Indicates that there is no associated DOM window.
150 readonly attribute mozIDOMWindowProxy DOMWindow;
153 * Indicates whether DOMWindow.top == DOMWindow.
155 readonly attribute boolean isTopLevel;
158 * Indicates whether or not a document is currently being loaded
159 * in the context of this nsIWebProgress instance.
161 readonly attribute boolean isLoadingDocument;
164 * Contains a load type as specified by the load* constants in
165 * nsIDocShell:LoadCommand.
167 readonly attribute unsigned long loadType;
170 * Main thread event target to which progress updates should be
171 * dispatched. This typically will be a SchedulerEventTarget
172 * corresponding to the tab requesting updates.
174 attribute nsIEventTarget target;
177 * The request for the currently loading document. It is null if
178 * isLoadingDocument is false.
179 * Note, the request may not be the actual nsIChannel instance used for
180 * loading, but a dummy RemoteWebProgressRequest. And since redirects are
181 * hidden from the child processes, this may not reflect the complete
182 * redirect state of the load.
184 readonly attribute nsIRequest documentRequest;