PageRenderTime 83ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 37ms app.codeStats 0ms

/gecko_sdk/idl/nsIRequest.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 217 lines | 24 code | 21 blank | 172 comment | 0 complexity | ec964ddac1eb9a0b385a64d79b49ffc4 MD5 | raw file
  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
  4 *
  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/
  9 *
 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.
 14 *
 15 * The Original Code is mozilla.org code.
 16 *
 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.
 21 *
 22 * Contributor(s):
 23 *
 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.
 35 *
 36 * ***** END LICENSE BLOCK ***** */
 37
 38#include "nsISupports.idl"
 39
 40interface nsILoadGroup;
 41
 42typedef unsigned long nsLoadFlags;
 43
 44/**
 45 * nsIRequest
 46 *
 47 * @status FROZEN
 48 */
 49[scriptable, uuid(ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe)]
 50interface nsIRequest : nsISupports
 51{
 52    /**
 53     * The name of the request.  Often this is the URI of the request.
 54     */
 55    readonly attribute AUTF8String name;
 56
 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).
 64     *
 65     * Requests can become pending multiple times during their lifetime.
 66     *
 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.
 71     */
 72    boolean isPending();
 73
 74    /**
 75     * The error status associated with the request.
 76     */
 77    readonly attribute nsresult status;
 78
 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.
 85     *
 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.
 89     *
 90     * Requests that use nsIStreamListener must not call onDataAvailable
 91     * anymore after cancel has been called.
 92     *
 93     * @param aStatus the reason for canceling this request.
 94     *
 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.
 99     */
100    void cancel(in nsresult aStatus);
101
102    /**
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.
107     *
108     * Calling cancel() on a suspended request must not send any
109     * notifications (such as onstopRequest) until the request is resumed.
110     *
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.
115     */
116    void suspend();
117
118    /**
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.
122     */
123    void resume();
124
125    /**
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.
129     */
130    attribute nsILoadGroup loadGroup;
131
132    /**
133     * The load flags of this request.  Bits 0-15 are reserved.
134     *
135     * When added to a load group, this request's load flags are merged with
136     * the load flags of the load group.
137     */
138    attribute nsLoadFlags loadFlags;
139
140    /**************************************************************************
141     * Listed below are the various load flags which may be or'd together.
142     */
143
144    /**
145     * No special load flags:
146     */
147    const unsigned long LOAD_NORMAL = 0;
148
149    /** 
150     * Don't deliver status notifications to the nsIProgressEventSink, or keep 
151     * this load from completing the nsILoadGroup it may belong to.
152     */
153    const unsigned long LOAD_BACKGROUND = 1 << 0; 
154
155    /**************************************************************************
156     * The following flags control the flow of data into the cache.
157     */
158
159    /**
160     * This flag prevents caching of any kind.  It does not, however, prevent
161     * cached content from being used to satisfy this request.
162     */
163    const unsigned long INHIBIT_CACHING = 1 << 7;
164
165    /**
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.
169     */
170    const unsigned long INHIBIT_PERSISTENT_CACHING = 1 << 8;
171
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.
176     */
177
178    /**
179     * Force an end-to-end download of content data from the origin server.
180     * This flag is used for a shift-reload.
181     */
182    const unsigned long LOAD_BYPASS_CACHE = 1 << 9;
183
184    /**
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.
189     */
190    const unsigned long LOAD_FROM_CACHE   = 1 << 10;
191
192    /**
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.
196     * 
197     * VALIDATE_ALWAYS forces validation of any cached content independent of
198     * its expiration time.
199     * 
200     * VALIDATE_NEVER disables validation of expired content.
201     *
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.
205     *
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.
213     */
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;
217};