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/. */
5 #include
"nsIThreadRetargetableStreamListener.idl"
7 interface nsIOutputStream
;
8 interface nsIRequestObserver
;
9 interface nsIEventTarget
;
12 * As data "flows" into a stream listener tee, it is copied to the output stream
13 * and then forwarded to the real listener.
15 [scriptable
, uuid(62b27fc1
-6e8c
-4225-8ad0
-b9d44252973a
)]
16 interface nsIStreamListenerTee
: nsIThreadRetargetableStreamListener
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
26 * the stream the data coming from the channel will be written to,
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
34 void init
(in nsIStreamListener listener
,
35 in nsIOutputStream sink
,
36 [optional] in nsIRequestObserver requestObserver
);
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
45 void initAsync
(in nsIStreamListener listener
,
46 in nsIEventTarget eventTarget
,
47 in nsIOutputStream sink
,
48 [optional] in nsIRequestObserver requestObserver
);