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 "nsIStreamListener.idl" michael@0: michael@0: interface nsIOutputStream; michael@0: interface nsIRequestObserver; michael@0: interface nsIEventTarget; michael@0: michael@0: /** michael@0: * As data "flows" into a stream listener tee, it is copied to the output stream michael@0: * and then forwarded to the real listener. michael@0: */ michael@0: [scriptable, uuid(62b27fc1-6e8c-4225-8ad0-b9d44252973a)] michael@0: interface nsIStreamListenerTee : nsIStreamListener michael@0: { michael@0: /** michael@0: * Initalize the tee. michael@0: * michael@0: * @param listener michael@0: * the original listener the tee will propagate onStartRequest, michael@0: * onDataAvailable and onStopRequest notifications to, exceptions from michael@0: * the listener will be propagated back to the channel michael@0: * @param sink michael@0: * the stream the data coming from the channel will be written to, michael@0: * should be blocking michael@0: * @param requestObserver michael@0: * optional parameter, listener that gets only onStartRequest and michael@0: * onStopRequest notifications; exceptions threw within this optional michael@0: * observer are also propagated to the channel, but exceptions from michael@0: * the original listener (listener parameter) are privileged michael@0: */ michael@0: void init(in nsIStreamListener listener, michael@0: in nsIOutputStream sink, michael@0: [optional] in nsIRequestObserver requestObserver); michael@0: michael@0: /** michael@0: * Initalize the tee like above, but with the extra parameter to make it michael@0: * possible to copy the output asynchronously michael@0: * @param anEventTarget michael@0: * if set, this event-target is used to copy data to the output stream, michael@0: * giving an asynchronous tee michael@0: */ michael@0: void initAsync(in nsIStreamListener listener, michael@0: in nsIEventTarget eventTarget, michael@0: in nsIOutputStream sink, michael@0: [optional] in nsIRequestObserver requestObserver); michael@0: michael@0: };