nsIWebBrowserStream.idl 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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) 2001, 2002
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. * Marco Pesenti Gritti <[email protected]>
  24. *
  25. * Alternatively, the contents of this file may be used under the terms of
  26. * either the GNU General Public License Version 2 or later (the "GPL"), or
  27. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. * in which case the provisions of the GPL or the LGPL are applicable instead
  29. * of those above. If you wish to allow use of your version of this file only
  30. * under the terms of either the GPL or the LGPL, and not to allow others to
  31. * use your version of this file under the terms of the MPL, indicate your
  32. * decision by deleting the provisions above and replace them with the notice
  33. * and other provisions required by the GPL or the LGPL. If you do not delete
  34. * the provisions above, a recipient may use your version of this file under
  35. * the terms of any one of the MPL, the GPL or the LGPL.
  36. *
  37. * ***** END LICENSE BLOCK ***** */
  38. #include "nsISupports.idl"
  39. interface nsIURI;
  40. /**
  41. * This interface provides a way to stream data to the web browser. This allows
  42. * loading of data from sources which can not be accessed using URIs and
  43. * nsIWebNavigation.
  44. *
  45. * @status FROZEN
  46. */
  47. [scriptable, uuid(86d02f0e-219b-4cfc-9c88-bd98d2cce0b8)]
  48. interface nsIWebBrowserStream : nsISupports
  49. {
  50. /**
  51. * Prepare to load a stream of data. When this function returns successfully,
  52. * it must be paired by a call to closeStream.
  53. *
  54. * @param aBaseURI
  55. * The base URI of the data. Must not be null. Relative
  56. * URIs will be resolved relative to this URI.
  57. * @param aContentType
  58. * ASCII string giving the content type of the data. If rendering
  59. * content of this type is not supported, this method fails.
  60. * This string may include a charset declaration, for example:
  61. * text/html;charset=ISO-8859-1
  62. *
  63. * @throw NS_ERROR_NOT_AVAILABLE
  64. * The requested content type is not supported.
  65. * @throw NS_ERROR_IN_PROGRESS
  66. * openStream was called twice without an intermediate closeStream.
  67. */
  68. void openStream(in nsIURI aBaseURI, in ACString aContentType);
  69. /**
  70. * Append data to this stream.
  71. * @param aData The data to append
  72. * @param aLen Length of the data to append.
  73. *
  74. * @note To append more than 4 GB of data, call this method multiple times.
  75. */
  76. void appendToStream([const, array, size_is(aLen)] in octet aData,
  77. in unsigned long aLen);
  78. /**
  79. * Notifies the browser that all the data has been appended. This may notify
  80. * the user that the browser is "done loading" in some form.
  81. *
  82. * @throw NS_ERROR_UNEXPECTED
  83. * This method was called without a preceding openStream.
  84. */
  85. void closeStream();
  86. };