xpcom/io/nsIScriptableInputStream.idl

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIInputStream;
michael@0 9
michael@0 10 /**
michael@0 11 * nsIScriptableInputStream provides scriptable access to an nsIInputStream
michael@0 12 * instance.
michael@0 13 */
michael@0 14 [scriptable, uuid(3fce9015-472a-4080-ac3e-cd875dbe361e)]
michael@0 15 interface nsIScriptableInputStream : nsISupports
michael@0 16 {
michael@0 17 /**
michael@0 18 * Closes the stream.
michael@0 19 */
michael@0 20 void close();
michael@0 21
michael@0 22 /**
michael@0 23 * Wrap the given nsIInputStream with this nsIScriptableInputStream.
michael@0 24 *
michael@0 25 * @param aInputStream parameter providing the stream to wrap
michael@0 26 */
michael@0 27 void init(in nsIInputStream aInputStream);
michael@0 28
michael@0 29 /**
michael@0 30 * Return the number of bytes currently available in the stream
michael@0 31 *
michael@0 32 * @return the number of bytes
michael@0 33 *
michael@0 34 * @throws NS_BASE_STREAM_CLOSED if called after the stream has been closed
michael@0 35 */
michael@0 36 unsigned long long available();
michael@0 37
michael@0 38 /**
michael@0 39 * Read data from the stream.
michael@0 40 *
michael@0 41 * WARNING: If the data contains a null byte, then this method will return
michael@0 42 * a truncated string.
michael@0 43 *
michael@0 44 * @param aCount the maximum number of bytes to read
michael@0 45 *
michael@0 46 * @return the data, which will be an empty string if the stream is at EOF.
michael@0 47 *
michael@0 48 * @throws NS_BASE_STREAM_CLOSED if called after the stream has been closed
michael@0 49 * @throws NS_ERROR_NOT_INITIALIZED if init was not called
michael@0 50 */
michael@0 51 string read(in unsigned long aCount);
michael@0 52
michael@0 53 /**
michael@0 54 * Read data from the stream, including NULL bytes.
michael@0 55 *
michael@0 56 * @param aCount the maximum number of bytes to read.
michael@0 57 *
michael@0 58 * @return the data from the stream, which will be an empty string if EOF
michael@0 59 * has been reached.
michael@0 60 *
michael@0 61 * @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream
michael@0 62 * would block the calling thread (non-blocking mode only).
michael@0 63 * @throws NS_ERROR_FAILURE if there are not enough bytes available to read
michael@0 64 * aCount amount of data.
michael@0 65 */
michael@0 66 ACString readBytes(in unsigned long aCount);
michael@0 67 };

mercurial