Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / netwerk / base / public / nsIRequest.idl
blob4586abb8bb88b62219a4283b3fcf00a7e28f9b11
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "nsISupports.idl"
40 interface nsILoadGroup;
42 typedef unsigned long nsLoadFlags;
44 /**
45 * nsIRequest
47 * @status FROZEN
49 [scriptable, uuid(ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe)]
50 interface nsIRequest : nsISupports
52 /**
53 * The name of the request. Often this is the URI of the request.
55 readonly attribute AUTF8String name;
57 /**
58 * Indicates whether the request is pending. nsIRequest::isPending is
59 * true when there is an outstanding asynchronous event that will make
60 * the request no longer be pending. Requests do not necessarily start
61 * out pending; in some cases, requests have to be explicitly initiated
62 * (e.g. nsIChannel implementations are only pending once asyncOpen
63 * returns successfully).
65 * Requests can become pending multiple times during their lifetime.
67 * @return TRUE if the request has yet to reach completion.
68 * @return FALSE if the request has reached completion (e.g., after
69 * OnStopRequest has fired).
70 * @note Suspended requests are still considered pending.
72 boolean isPending();
74 /**
75 * The error status associated with the request.
77 readonly attribute nsresult status;
79 /**
80 * Cancels the current request. This will close any open input or
81 * output streams and terminate any async requests. Users should
82 * normally pass NS_BINDING_ABORTED, although other errors may also
83 * be passed. The error passed in will become the value of the
84 * status attribute.
86 * Implementations must not send any notifications (e.g. via
87 * nsIRequestObserver) synchronously from this function. Similarly,
88 * removal from the load group (if any) must also happen asynchronously.
90 * Requests that use nsIStreamListener must not call onDataAvailable
91 * anymore after cancel has been called.
93 * @param aStatus the reason for canceling this request.
95 * NOTE: most nsIRequest implementations expect aStatus to be a
96 * failure code; however, some implementations may allow aStatus to
97 * be a success code such as NS_OK. In general, aStatus should be
98 * a failure code.
100 void cancel(in nsresult aStatus);
103 * Suspends the current request. This may have the effect of closing
104 * any underlying transport (in order to free up resources), although
105 * any open streams remain logically opened and will continue delivering
106 * data when the transport is resumed.
108 * Calling cancel() on a suspended request must not send any
109 * notifications (such as onstopRequest) until the request is resumed.
111 * NOTE: some implementations are unable to immediately suspend, and
112 * may continue to deliver events already posted to an event queue. In
113 * general, callers should be capable of handling events even after
114 * suspending a request.
116 void suspend();
119 * Resumes the current request. This may have the effect of re-opening
120 * any underlying transport and will resume the delivery of data to
121 * any open streams.
123 void resume();
126 * The load group of this request. While pending, the request is a
127 * member of the load group. It is the responsibility of the request
128 * to implement this policy.
130 attribute nsILoadGroup loadGroup;
133 * The load flags of this request. Bits 0-15 are reserved.
135 * When added to a load group, this request's load flags are merged with
136 * the load flags of the load group.
138 attribute nsLoadFlags loadFlags;
140 /**************************************************************************
141 * Listed below are the various load flags which may be or'd together.
145 * No special load flags:
147 const unsigned long LOAD_NORMAL = 0;
149 /**
150 * Don't deliver status notifications to the nsIProgressEventSink, or keep
151 * this load from completing the nsILoadGroup it may belong to.
153 const unsigned long LOAD_BACKGROUND = 1 << 0;
155 /**************************************************************************
156 * The following flags control the flow of data into the cache.
160 * This flag prevents caching of any kind. It does not, however, prevent
161 * cached content from being used to satisfy this request.
163 const unsigned long INHIBIT_CACHING = 1 << 7;
166 * This flag prevents caching on disk (or other persistent media), which
167 * may be needed to preserve privacy. For HTTPS, this flag is set auto-
168 * matically.
170 const unsigned long INHIBIT_PERSISTENT_CACHING = 1 << 8;
172 /**************************************************************************
173 * The following flags control what happens when the cache contains data
174 * that could perhaps satisfy this request. They are listed in descending
175 * order of precidence.
179 * Force an end-to-end download of content data from the origin server.
180 * This flag is used for a shift-reload.
182 const unsigned long LOAD_BYPASS_CACHE = 1 << 9;
185 * Load from the cache, bypassing protocol specific validation logic. This
186 * flag is used when browsing via history. It is not recommended for normal
187 * browsing as it may likely violate reasonable assumptions made by the
188 * server and confuse users.
190 const unsigned long LOAD_FROM_CACHE = 1 << 10;
193 * The following flags control the frequency of cached content validation
194 * when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set. By default,
195 * cached content is automatically validated if necessary before reuse.
197 * VALIDATE_ALWAYS forces validation of any cached content independent of
198 * its expiration time.
200 * VALIDATE_NEVER disables validation of expired content.
202 * VALIDATE_ONCE_PER_SESSION disables validation of expired content,
203 * provided it has already been validated (at least once) since the start
204 * of this session.
206 * NOTE TO IMPLEMENTORS:
207 * These flags are intended for normal browsing, and they should therefore
208 * not apply to content that must be validated before each use. Consider,
209 * for example, a HTTP response with a "Cache-control: no-cache" header.
210 * According to RFC2616, this response must be validated before it can
211 * be taken from a cache. Breaking this requirement could result in
212 * incorrect and potentially undesirable side-effects.
214 const unsigned long VALIDATE_ALWAYS = 1 << 11;
215 const unsigned long VALIDATE_NEVER = 1 << 12;
216 const unsigned long VALIDATE_ONCE_PER_SESSION = 1 << 13;
219 * When set, this flag indicates that no user-specific data should be added
220 * to the request when opened. This means that things like authorization
221 * tokens or cookie headers should not be added.
223 const unsigned long LOAD_ANONYMOUS = 1 << 14;