|
1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIURI; |
|
9 |
|
10 /** |
|
11 * This interface provides a way to stream data to the web browser. This allows |
|
12 * loading of data from sources which can not be accessed using URIs and |
|
13 * nsIWebNavigation. |
|
14 */ |
|
15 [scriptable, uuid(86d02f0e-219b-4cfc-9c88-bd98d2cce0b8)] |
|
16 interface nsIWebBrowserStream : nsISupports |
|
17 { |
|
18 /** |
|
19 * Prepare to load a stream of data. When this function returns successfully, |
|
20 * it must be paired by a call to closeStream. |
|
21 * |
|
22 * @param aBaseURI |
|
23 * The base URI of the data. Must not be null. Relative |
|
24 * URIs will be resolved relative to this URI. |
|
25 * @param aContentType |
|
26 * ASCII string giving the content type of the data. If rendering |
|
27 * content of this type is not supported, this method fails. |
|
28 * This string may include a charset declaration, for example: |
|
29 * text/html;charset=ISO-8859-1 |
|
30 * |
|
31 * @throw NS_ERROR_NOT_AVAILABLE |
|
32 * The requested content type is not supported. |
|
33 * @throw NS_ERROR_IN_PROGRESS |
|
34 * openStream was called twice without an intermediate closeStream. |
|
35 */ |
|
36 void openStream(in nsIURI aBaseURI, in ACString aContentType); |
|
37 |
|
38 /** |
|
39 * Append data to this stream. |
|
40 * @param aData The data to append |
|
41 * @param aLen Length of the data to append. |
|
42 * |
|
43 * @note To append more than 4 GB of data, call this method multiple times. |
|
44 */ |
|
45 void appendToStream([const, array, size_is(aLen)] in octet aData, |
|
46 in unsigned long aLen); |
|
47 |
|
48 /** |
|
49 * Notifies the browser that all the data has been appended. This may notify |
|
50 * the user that the browser is "done loading" in some form. |
|
51 * |
|
52 * @throw NS_ERROR_UNEXPECTED |
|
53 * This method was called without a preceding openStream. |
|
54 */ |
|
55 void closeStream(); |
|
56 }; |