michael@0: /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIURI; michael@0: michael@0: /** michael@0: * This interface provides a way to stream data to the web browser. This allows michael@0: * loading of data from sources which can not be accessed using URIs and michael@0: * nsIWebNavigation. michael@0: */ michael@0: [scriptable, uuid(86d02f0e-219b-4cfc-9c88-bd98d2cce0b8)] michael@0: interface nsIWebBrowserStream : nsISupports michael@0: { michael@0: /** michael@0: * Prepare to load a stream of data. When this function returns successfully, michael@0: * it must be paired by a call to closeStream. michael@0: * michael@0: * @param aBaseURI michael@0: * The base URI of the data. Must not be null. Relative michael@0: * URIs will be resolved relative to this URI. michael@0: * @param aContentType michael@0: * ASCII string giving the content type of the data. If rendering michael@0: * content of this type is not supported, this method fails. michael@0: * This string may include a charset declaration, for example: michael@0: * text/html;charset=ISO-8859-1 michael@0: * michael@0: * @throw NS_ERROR_NOT_AVAILABLE michael@0: * The requested content type is not supported. michael@0: * @throw NS_ERROR_IN_PROGRESS michael@0: * openStream was called twice without an intermediate closeStream. michael@0: */ michael@0: void openStream(in nsIURI aBaseURI, in ACString aContentType); michael@0: michael@0: /** michael@0: * Append data to this stream. michael@0: * @param aData The data to append michael@0: * @param aLen Length of the data to append. michael@0: * michael@0: * @note To append more than 4 GB of data, call this method multiple times. michael@0: */ michael@0: void appendToStream([const, array, size_is(aLen)] in octet aData, michael@0: in unsigned long aLen); michael@0: michael@0: /** michael@0: * Notifies the browser that all the data has been appended. This may notify michael@0: * the user that the browser is "done loading" in some form. michael@0: * michael@0: * @throw NS_ERROR_UNEXPECTED michael@0: * This method was called without a preceding openStream. michael@0: */ michael@0: void closeStream(); michael@0: };