xpcom/io/nsISafeOutputStream.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: C++; tab-width: 2; 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 /**
michael@0 9 * This interface provides a mechanism to control an output stream
michael@0 10 * that takes care not to overwrite an existing target until it is known
michael@0 11 * that all writes to the destination succeeded.
michael@0 12 *
michael@0 13 * An object that supports this interface is intended to also support
michael@0 14 * nsIOutputStream.
michael@0 15 *
michael@0 16 * For example, a file output stream that supports this interface writes to
michael@0 17 * a temporary file, and moves it over the original file when |finish| is
michael@0 18 * called only if the stream can be successfully closed and all writes
michael@0 19 * succeeded. If |finish| is called but something went wrong during
michael@0 20 * writing, it will delete the temporary file and not touch the original.
michael@0 21 * If the stream is closed by calling |close| directly, or the stream
michael@0 22 * goes away, the original file will not be overwritten, and the temporary
michael@0 23 * file will be deleted.
michael@0 24 *
michael@0 25 * Currently, this interface is implemented only for file output streams.
michael@0 26 */
michael@0 27 [scriptable, uuid(5f914307-5c34-4e1f-8e32-ec749d25b27a)]
michael@0 28 interface nsISafeOutputStream : nsISupports
michael@0 29 {
michael@0 30 /**
michael@0 31 * Call this method to close the stream and cause the original target
michael@0 32 * to be overwritten. Note: if any call to |write| failed to write out
michael@0 33 * all of the data given to it, then calling this method will |close| the
michael@0 34 * stream and return failure. Further, if closing the stream fails, this
michael@0 35 * method will return failure. The original target will be overwritten only
michael@0 36 * if all calls to |write| succeeded and the stream was successfully closed.
michael@0 37 */
michael@0 38 void finish();
michael@0 39 };

mercurial