netwerk/base/public/nsIStreamListenerTee.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/public/nsIStreamListenerTee.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsIStreamListener.idl"
     1.9 +
    1.10 +interface nsIOutputStream;
    1.11 +interface nsIRequestObserver;
    1.12 +interface nsIEventTarget;
    1.13 +
    1.14 +/**
    1.15 + * As data "flows" into a stream listener tee, it is copied to the output stream
    1.16 + * and then forwarded to the real listener.
    1.17 + */
    1.18 +[scriptable, uuid(62b27fc1-6e8c-4225-8ad0-b9d44252973a)]
    1.19 +interface nsIStreamListenerTee : nsIStreamListener
    1.20 +{
    1.21 +    /** 
    1.22 +     * Initalize the tee.
    1.23 +     *
    1.24 +     * @param listener
    1.25 +     *    the original listener the tee will propagate onStartRequest,
    1.26 +     *    onDataAvailable and onStopRequest notifications to, exceptions from 
    1.27 +     *    the listener will be propagated back to the channel
    1.28 +     * @param sink
    1.29 +     *    the stream the data coming from the channel will be written to,
    1.30 +     *    should be blocking
    1.31 +     * @param requestObserver
    1.32 +     *    optional parameter, listener that gets only onStartRequest and
    1.33 +     *    onStopRequest notifications; exceptions threw within this optional
    1.34 +     *    observer are also propagated to the channel, but exceptions from
    1.35 +     *    the original listener (listener parameter) are privileged 
    1.36 +     */
    1.37 +    void init(in nsIStreamListener listener,
    1.38 +              in nsIOutputStream sink,
    1.39 +              [optional] in nsIRequestObserver requestObserver);
    1.40 +
    1.41 +    /** 
    1.42 +     * Initalize the tee like above, but with the extra parameter to make it
    1.43 +     * possible to copy the output asynchronously
    1.44 +     * @param anEventTarget
    1.45 +     *    if set, this event-target is used to copy data to the output stream,
    1.46 +     *    giving an asynchronous tee
    1.47 +    */
    1.48 +    void initAsync(in nsIStreamListener listener,
    1.49 +                   in nsIEventTarget eventTarget,
    1.50 +                   in nsIOutputStream sink,
    1.51 +                   [optional] in nsIRequestObserver requestObserver);
    1.52 +    
    1.53 +};

mercurial