1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsIRequestObserver.idl"
8 interface nsIInputStream
;
13 [scriptable
, uuid(3b4c8a77
-76ba
-4610-b316
-678c73a3b88c
)]
14 interface nsIStreamListener
: nsIRequestObserver
17 * Called when the next chunk of data (corresponding to the request) may
18 * be read without blocking the calling thread. The onDataAvailable impl
19 * must read exactly |aCount| bytes of data before returning.
21 * @param aRequest request corresponding to the source of the data
22 * @param aInputStream input stream containing the data chunk
24 * Number of bytes that were sent in previous onDataAvailable calls
25 * for this request. In other words, the sum of all previous count
27 * @param aCount number of bytes available in the stream
29 * NOTE: The aInputStream parameter must implement readSegments.
31 * An exception thrown from onDataAvailable has the side-effect of
32 * causing the request to be canceled.
34 void onDataAvailable
(in nsIRequest aRequest
,
35 in nsIInputStream aInputStream
,
36 in unsigned long long aOffset
,
37 in unsigned long aCount
);