2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2002-05-03 11:49:43 +04:00
|
|
|
|
|
|
|
#include "nsIStreamListener.idl"
|
|
|
|
|
|
|
|
interface nsIOutputStream;
|
2009-11-18 19:02:28 +03:00
|
|
|
interface nsIRequestObserver;
|
2010-02-23 21:13:18 +03:00
|
|
|
interface nsIEventTarget;
|
2002-05-03 11:49:43 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* As data "flows" into a stream listener tee, it is copied to the output stream
|
|
|
|
* and then forwarded to the real listener.
|
|
|
|
*/
|
2010-02-23 21:13:18 +03:00
|
|
|
[scriptable, uuid(62b27fc1-6e8c-4225-8ad0-b9d44252973a)]
|
2002-05-03 11:49:43 +04:00
|
|
|
interface nsIStreamListenerTee : nsIStreamListener
|
|
|
|
{
|
2009-11-18 19:02:28 +03:00
|
|
|
/**
|
|
|
|
* Initalize the tee.
|
|
|
|
*
|
|
|
|
* @param listener
|
|
|
|
* the original listener the tee will propagate onStartRequest,
|
|
|
|
* onDataAvailable and onStopRequest notifications to, exceptions from
|
|
|
|
* the listener will be propagated back to the channel
|
|
|
|
* @param sink
|
|
|
|
* the stream the data coming from the channel will be written to,
|
|
|
|
* should be blocking
|
|
|
|
* @param requestObserver
|
|
|
|
* optional parameter, listener that gets only onStartRequest and
|
|
|
|
* onStopRequest notifications; exceptions threw within this optional
|
|
|
|
* observer are also propagated to the channel, but exceptions from
|
|
|
|
* the original listener (listener parameter) are privileged
|
|
|
|
*/
|
2002-05-03 11:49:43 +04:00
|
|
|
void init(in nsIStreamListener listener,
|
2009-11-18 19:02:28 +03:00
|
|
|
in nsIOutputStream sink,
|
|
|
|
[optional] in nsIRequestObserver requestObserver);
|
2010-02-23 21:13:18 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initalize the tee like above, but with the extra parameter to make it
|
|
|
|
* possible to copy the output asynchronously
|
|
|
|
* @param anEventTarget
|
|
|
|
* if set, this event-target is used to copy data to the output stream,
|
|
|
|
* giving an asynchronous tee
|
|
|
|
*/
|
|
|
|
void initAsync(in nsIStreamListener listener,
|
|
|
|
in nsIEventTarget eventTarget,
|
|
|
|
in nsIOutputStream sink,
|
|
|
|
[optional] in nsIRequestObserver requestObserver);
|
2019-05-23 01:37:14 +03:00
|
|
|
|
2002-05-03 11:49:43 +04:00
|
|
|
};
|