nsIRequest.idl 7.4 KB

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