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