OLD | NEW |
(Empty) | |
| 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 |
| 40 interface nsILoadGroup; |
| 41 |
| 42 typedef unsigned long nsLoadFlags; |
| 43 |
| 44 /** |
| 45 * nsIRequest |
| 46 * |
| 47 * @status FROZEN |
| 48 */ |
| 49 [scriptable, uuid(ef6bfbd2-fd46-48d8-96b7-9f8f0fd387fe)] |
| 50 interface 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 * @return TRUE if the request has yet to reach completion. |
| 59 * @return FALSE if the request has reached completion (e.g., after |
| 60 * OnStopRequest has fired). |
| 61 * Suspended requests are still considered pending. |
| 62 */ |
| 63 boolean isPending(); |
| 64 |
| 65 /** |
| 66 * The error status associated with the request. |
| 67 */ |
| 68 readonly attribute nsresult status; |
| 69 |
| 70 /** |
| 71 * Cancels the current request. This will close any open input or |
| 72 * output streams and terminate any async requests. Users should |
| 73 * normally pass NS_BINDING_ABORTED, although other errors may also |
| 74 * be passed. The error passed in will become the value of the |
| 75 * status attribute. |
| 76 * |
| 77 * @param aStatus the reason for canceling this request. |
| 78 * |
| 79 * NOTE: most nsIRequest implementations expect aStatus to be a |
| 80 * failure code; however, some implementations may allow aStatus to |
| 81 * be a success code such as NS_OK. In general, aStatus should be |
| 82 * a failure code. |
| 83 */ |
| 84 void cancel(in nsresult aStatus); |
| 85 |
| 86 /** |
| 87 * Suspends the current request. This may have the effect of closing |
| 88 * any underlying transport (in order to free up resources), although |
| 89 * any open streams remain logically opened and will continue delivering |
| 90 * data when the transport is resumed. |
| 91 * |
| 92 * NOTE: some implementations are unable to immediately suspend, and |
| 93 * may continue to deliver events already posted to an event queue. In |
| 94 * general, callers should be capable of handling events even after |
| 95 * suspending a request. |
| 96 */ |
| 97 void suspend(); |
| 98 |
| 99 /** |
| 100 * Resumes the current request. This may have the effect of re-opening |
| 101 * any underlying transport and will resume the delivery of data to |
| 102 * any open streams. |
| 103 */ |
| 104 void resume(); |
| 105 |
| 106 /** |
| 107 * The load group of this request. While pending, the request is a |
| 108 * member of the load group. It is the responsibility of the request |
| 109 * to implement this policy. |
| 110 */ |
| 111 attribute nsILoadGroup loadGroup; |
| 112 |
| 113 /** |
| 114 * The load flags of this request. Bits 0-15 are reserved. |
| 115 * |
| 116 * When added to a load group, this request's load flags are merged with |
| 117 * the load flags of the load group. |
| 118 */ |
| 119 attribute nsLoadFlags loadFlags; |
| 120 |
| 121 /************************************************************************** |
| 122 * Listed below are the various load flags which may be or'd together. |
| 123 */ |
| 124 |
| 125 /** |
| 126 * No special load flags: |
| 127 */ |
| 128 const unsigned long LOAD_NORMAL = 0; |
| 129 |
| 130 /** |
| 131 * Don't deliver status notifications to the nsIProgressEventSink, or keep |
| 132 * this load from completing the nsILoadGroup it may belong to. |
| 133 */ |
| 134 const unsigned long LOAD_BACKGROUND = 1 << 0; |
| 135 |
| 136 /************************************************************************** |
| 137 * The following flags control the flow of data into the cache. |
| 138 */ |
| 139 |
| 140 /** |
| 141 * This flag prevents caching of any kind. It does not, however, prevent |
| 142 * cached content from being used to satisfy this request. |
| 143 */ |
| 144 const unsigned long INHIBIT_CACHING = 1 << 7; |
| 145 |
| 146 /** |
| 147 * This flag prevents caching on disk (or other persistent media), which |
| 148 * may be needed to preserve privacy. For HTTPS, this flag is set auto- |
| 149 * matically. |
| 150 */ |
| 151 const unsigned long INHIBIT_PERSISTENT_CACHING = 1 << 8; |
| 152 |
| 153 /************************************************************************** |
| 154 * The following flags control what happens when the cache contains data |
| 155 * that could perhaps satisfy this request. They are listed in descending |
| 156 * order of precidence. |
| 157 */ |
| 158 |
| 159 /** |
| 160 * Force an end-to-end download of content data from the origin server. |
| 161 * This flag is used for a shift-reload. |
| 162 */ |
| 163 const unsigned long LOAD_BYPASS_CACHE = 1 << 9; |
| 164 |
| 165 /** |
| 166 * Load from the cache, bypassing protocol specific validation logic. This |
| 167 * flag is used when browsing via history. It is not recommended for normal |
| 168 * browsing as it may likely violate reasonable assumptions made by the |
| 169 * server and confuse users. |
| 170 */ |
| 171 const unsigned long LOAD_FROM_CACHE = 1 << 10; |
| 172 |
| 173 /** |
| 174 * The following flags control the frequency of cached content validation |
| 175 * when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set. By default, |
| 176 * cached content is automatically validated if necessary before reuse. |
| 177 * |
| 178 * VALIDATE_ALWAYS forces validation of any cached content independent of |
| 179 * its expiration time. |
| 180 * |
| 181 * VALIDATE_NEVER disables validation of expired content. |
| 182 * |
| 183 * VALIDATE_ONCE_PER_SESSION disables validation of expired content, |
| 184 * provided it has already been validated (at least once) since the start |
| 185 * of this session. |
| 186 * |
| 187 * NOTE TO IMPLEMENTORS: |
| 188 * These flags are intended for normal browsing, and they should therefore |
| 189 * not apply to content that must be validated before each use. Consider, |
| 190 * for example, a HTTP response with a "Cache-control: no-cache" header. |
| 191 * According to RFC2616, this response must be validated before it can |
| 192 * be taken from a cache. Breaking this requirement could result in |
| 193 * incorrect and potentially undesirable side-effects. |
| 194 */ |
| 195 const unsigned long VALIDATE_ALWAYS = 1 << 11; |
| 196 const unsigned long VALIDATE_NEVER = 1 << 12; |
| 197 const unsigned long VALIDATE_ONCE_PER_SESSION = 1 << 13; |
| 198 }; |
OLD | NEW |