Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "nsIStreamListener.idl"
6
7
interface nsIOutputStream;
8
interface nsIRequestObserver;
9
interface nsIEventTarget;
10
11
/**
12
* As data "flows" into a stream listener tee, it is copied to the output stream
13
* and then forwarded to the real listener.
14
*/
15
[scriptable, uuid(62b27fc1-6e8c-4225-8ad0-b9d44252973a)]
16
interface nsIStreamListenerTee : nsIStreamListener
17
{
18
/**
19
* Initalize the tee.
20
*
21
* @param listener
22
* the original listener the tee will propagate onStartRequest,
23
* onDataAvailable and onStopRequest notifications to, exceptions from
24
* the listener will be propagated back to the channel
25
* @param sink
26
* the stream the data coming from the channel will be written to,
27
* should be blocking
28
* @param requestObserver
29
* optional parameter, listener that gets only onStartRequest and
30
* onStopRequest notifications; exceptions threw within this optional
31
* observer are also propagated to the channel, but exceptions from
32
* the original listener (listener parameter) are privileged
33
*/
34
void init(in nsIStreamListener listener,
35
in nsIOutputStream sink,
36
[optional] in nsIRequestObserver requestObserver);
37
38
/**
39
* Initalize the tee like above, but with the extra parameter to make it
40
* possible to copy the output asynchronously
41
* @param anEventTarget
42
* if set, this event-target is used to copy data to the output stream,
43
* giving an asynchronous tee
44
*/
45
void initAsync(in nsIStreamListener listener,
46
in nsIEventTarget eventTarget,
47
in nsIOutputStream sink,
48
[optional] in nsIRequestObserver requestObserver);
49
50
};