Tue, 06 Jan 2015 21:39:09 +0100
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: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
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 "nsIInputStream.idl" |
michael@0 | 7 | |
michael@0 | 8 | /** |
michael@0 | 9 | * nsIStringInputStream |
michael@0 | 10 | * |
michael@0 | 11 | * Provides scriptable and specialized C++-only methods for initializing a |
michael@0 | 12 | * nsIInputStream implementation with a simple character array. |
michael@0 | 13 | */ |
michael@0 | 14 | [scriptable, uuid(450cd2d4-f0fd-424d-b365-b1251f80fd53)] |
michael@0 | 15 | interface nsIStringInputStream : nsIInputStream |
michael@0 | 16 | { |
michael@0 | 17 | /** |
michael@0 | 18 | * SetData - assign data to the input stream (copied on assignment). |
michael@0 | 19 | * |
michael@0 | 20 | * @param data - stream data |
michael@0 | 21 | * @param dataLen - stream data length (-1 if length should be computed) |
michael@0 | 22 | * |
michael@0 | 23 | * NOTE: C++ code should consider using AdoptData or ShareData to avoid |
michael@0 | 24 | * making an extra copy of the stream data. |
michael@0 | 25 | * |
michael@0 | 26 | * NOTE: For JS callers, the given data must not contain null characters |
michael@0 | 27 | * (other than a null terminator) because a null character in the middle of |
michael@0 | 28 | * the data string will be seen as a terminator when the data is converted |
michael@0 | 29 | * from a JS string to a C++ character array. |
michael@0 | 30 | */ |
michael@0 | 31 | void setData(in string data, in long dataLen); |
michael@0 | 32 | |
michael@0 | 33 | /** |
michael@0 | 34 | * NOTE: the following methods are designed to give C++ code added control |
michael@0 | 35 | * over the ownership and lifetime of the stream data. Use with care :-) |
michael@0 | 36 | */ |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * AdoptData - assign data to the input stream. the input stream takes |
michael@0 | 40 | * ownership of the given data buffer and will nsMemory::Free it when |
michael@0 | 41 | * the input stream is destroyed. |
michael@0 | 42 | * |
michael@0 | 43 | * @param data - stream data |
michael@0 | 44 | * @param dataLen - stream data length (-1 if length should be computed) |
michael@0 | 45 | */ |
michael@0 | 46 | [noscript] void adoptData(in charPtr data, in long dataLen); |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * ShareData - assign data to the input stream. the input stream references |
michael@0 | 50 | * the given data buffer until the input stream is destroyed. the given |
michael@0 | 51 | * data buffer must outlive the input stream. |
michael@0 | 52 | * |
michael@0 | 53 | * @param data - stream data |
michael@0 | 54 | * @param dataLen - stream data length (-1 if length should be computed) |
michael@0 | 55 | */ |
michael@0 | 56 | [noscript] void shareData(in string data, in long dataLen); |
michael@0 | 57 | }; |