modules/libjar/zipwriter/public/nsIZipWriter.idl

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4 */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7 interface nsIChannel;
michael@0 8 interface nsIInputStream;
michael@0 9 interface nsIRequestObserver;
michael@0 10 interface nsIFile;
michael@0 11 interface nsIZipEntry;
michael@0 12
michael@0 13 /**
michael@0 14 * nsIZipWriter
michael@0 15 *
michael@0 16 * An interface for a zip archiver that can be used from script.
michael@0 17 *
michael@0 18 * The interface supports both a synchronous method of archiving data and a
michael@0 19 * queueing system to allow operations to be prepared then run in sequence
michael@0 20 * with notification after completion.
michael@0 21 *
michael@0 22 * Operations added to the queue do not get performed until performQueue is
michael@0 23 * called at which point they will be performed in the order that they were
michael@0 24 * added to the queue.
michael@0 25 *
michael@0 26 * Operations performed on the queue will throw any errors out to the
michael@0 27 * observer.
michael@0 28 *
michael@0 29 * An attempt to perform a synchronous operation while the background queue
michael@0 30 * is in progress will throw NS_ERROR_IN_PROGRESS.
michael@0 31 *
michael@0 32 * Entry names should use /'s as path separators and should not start with
michael@0 33 * a /.
michael@0 34 *
michael@0 35 * It is not generally necessary to add directory entries in order to add file
michael@0 36 * entries within them, however it is possible that some zip programs may
michael@0 37 * experience problems what that.
michael@0 38 */
michael@0 39 [scriptable, uuid(3ca10750-797e-4a22-bcfe-66170b5e96dd)]
michael@0 40 interface nsIZipWriter : nsISupports
michael@0 41 {
michael@0 42 /**
michael@0 43 * Some predefined compression levels
michael@0 44 */
michael@0 45 const uint32_t COMPRESSION_NONE = 0;
michael@0 46 const uint32_t COMPRESSION_FASTEST = 1;
michael@0 47 const uint32_t COMPRESSION_DEFAULT = 6;
michael@0 48 const uint32_t COMPRESSION_BEST = 9;
michael@0 49
michael@0 50 /**
michael@0 51 * Gets or sets the comment associated with the open zip file.
michael@0 52 *
michael@0 53 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 54 */
michael@0 55 attribute ACString comment;
michael@0 56
michael@0 57 /**
michael@0 58 * Indicates that operations on the background queue are being performed.
michael@0 59 */
michael@0 60 readonly attribute boolean inQueue;
michael@0 61
michael@0 62 /**
michael@0 63 * The file that the zipwriter is writing to.
michael@0 64 */
michael@0 65 readonly attribute nsIFile file;
michael@0 66
michael@0 67 /**
michael@0 68 * Opens a zip file.
michael@0 69 *
michael@0 70 * @param aFile the zip file to open
michael@0 71 * @param aIoFlags the open flags for the zip file from prio.h
michael@0 72 *
michael@0 73 * @throws NS_ERROR_ALREADY_INITIALIZED if a zip file is already open
michael@0 74 * @throws NS_ERROR_INVALID_ARG if aFile is null
michael@0 75 * @throws NS_ERROR_FILE_NOT_FOUND if aFile does not exist and flags did
michael@0 76 * not allow for creation
michael@0 77 * @throws NS_ERROR_FILE_CORRUPTED if the file does not contain zip markers
michael@0 78 * @throws <other-error> on failure to open zip file (most likely corrupt
michael@0 79 * or unsupported form)
michael@0 80 */
michael@0 81 void open(in nsIFile aFile, in int32_t aIoFlags);
michael@0 82
michael@0 83 /**
michael@0 84 * Returns a nsIZipEntry describing a specified zip entry or null if there
michael@0 85 * is no such entry in the zip file
michael@0 86 *
michael@0 87 * @param aZipEntry the path of the entry
michael@0 88 */
michael@0 89 nsIZipEntry getEntry(in AUTF8String aZipEntry);
michael@0 90
michael@0 91 /**
michael@0 92 * Checks whether the zipfile contains an entry specified by zipEntry.
michael@0 93 *
michael@0 94 * @param aZipEntry the path of the entry
michael@0 95 */
michael@0 96 boolean hasEntry(in AUTF8String aZipEntry);
michael@0 97
michael@0 98 /**
michael@0 99 * Adds a new directory entry to the zip file. If aZipEntry does not end with
michael@0 100 * "/" then it will be added.
michael@0 101 *
michael@0 102 * @param aZipEntry the path of the directory entry
michael@0 103 * @param aModTime the modification time of the entry in microseconds
michael@0 104 * @param aQueue adds the operation to the background queue. Will be
michael@0 105 * performed when processQueue is called.
michael@0 106 *
michael@0 107 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 108 * @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the
michael@0 109 * file
michael@0 110 * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
michael@0 111 */
michael@0 112 void addEntryDirectory(in AUTF8String aZipEntry, in PRTime aModTime,
michael@0 113 in boolean aQueue);
michael@0 114
michael@0 115 /**
michael@0 116 * Adds a new file or directory to the zip file. If the specified file is
michael@0 117 * a directory then this will be equivalent to a call to
michael@0 118 * addEntryDirectory(aZipEntry, aFile.lastModifiedTime, aQueue)
michael@0 119 *
michael@0 120 * @param aZipEntry the path of the file entry
michael@0 121 * @param aCompression the compression level, 0 is no compression, 9 is best
michael@0 122 * @param aFile the file to get the data and modification time from
michael@0 123 * @param aQueue adds the operation to the background queue. Will be
michael@0 124 * performed when processQueue is called.
michael@0 125 *
michael@0 126 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 127 * @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the zip
michael@0 128 * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
michael@0 129 * @throws NS_ERROR_FILE_NOT_FOUND if file does not exist
michael@0 130 */
michael@0 131 void addEntryFile(in AUTF8String aZipEntry,
michael@0 132 in int32_t aCompression, in nsIFile aFile,
michael@0 133 in boolean aQueue);
michael@0 134
michael@0 135 /**
michael@0 136 * Adds data from a channel to the zip file. If the operation is performed
michael@0 137 * on the queue then the channel will be opened asynchronously, otherwise
michael@0 138 * the channel must support being opened synchronously.
michael@0 139 *
michael@0 140 * @param aZipEntry the path of the file entry
michael@0 141 * @param aModTime the modification time of the entry in microseconds
michael@0 142 * @param aCompression the compression level, 0 is no compression, 9 is best
michael@0 143 * @param aChannel the channel to get the data from
michael@0 144 * @param aQueue adds the operation to the background queue. Will be
michael@0 145 * performed when processQueue is called.
michael@0 146 *
michael@0 147 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 148 * @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the zip
michael@0 149 * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
michael@0 150 */
michael@0 151 void addEntryChannel(in AUTF8String aZipEntry, in PRTime aModTime,
michael@0 152 in int32_t aCompression, in nsIChannel aChannel,
michael@0 153 in boolean aQueue);
michael@0 154
michael@0 155 /**
michael@0 156 * Adds data from an input stream to the zip file.
michael@0 157 *
michael@0 158 * @param aZipEntry the path of the file entry
michael@0 159 * @param aModTime the modification time of the entry in microseconds
michael@0 160 * @param aCompression the compression level, 0 is no compression, 9 is best
michael@0 161 * @param aStream the input stream to get the data from
michael@0 162 * @param aQueue adds the operation to the background queue. Will be
michael@0 163 * performed when processQueue is called.
michael@0 164 *
michael@0 165 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 166 * @throws NS_ERROR_FILE_ALREADY_EXISTS if the path already exists in the zip
michael@0 167 * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
michael@0 168 */
michael@0 169 void addEntryStream(in AUTF8String aZipEntry, in PRTime aModTime,
michael@0 170 in int32_t aCompression, in nsIInputStream aStream,
michael@0 171 in boolean aQueue);
michael@0 172
michael@0 173 /**
michael@0 174 * Removes an existing entry from the zip file.
michael@0 175 *
michael@0 176 * @param aZipEntry the path of the entry to be removed
michael@0 177 * @param aQueue adds the operation to the background queue. Will be
michael@0 178 * performed when processQueue is called.
michael@0 179 *
michael@0 180 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 181 * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
michael@0 182 * @throws NS_ERROR_FILE_NOT_FOUND if no entry with the given path exists
michael@0 183 * @throws <other-error> on failure to update the zip file
michael@0 184 */
michael@0 185 void removeEntry(in AUTF8String aZipEntry, in boolean aQueue);
michael@0 186
michael@0 187 /**
michael@0 188 * Processes all queued items until complete or some error occurs. The
michael@0 189 * observer will be notified when the first operation starts and when the
michael@0 190 * last operation completes. Any failures will be passed to the observer.
michael@0 191 * The zip writer will be busy until the queue is complete or some error
michael@0 192 * halted processing of the queue early. In the event of an early failure,
michael@0 193 * remaining items will stay in the queue and calling processQueue will
michael@0 194 * continue.
michael@0 195 *
michael@0 196 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 197 * @throws NS_ERROR_IN_PROGRESS if the queue is already in progress
michael@0 198 */
michael@0 199 void processQueue(in nsIRequestObserver aObserver, in nsISupports aContext);
michael@0 200
michael@0 201 /**
michael@0 202 * Closes the zip file.
michael@0 203 *
michael@0 204 * @throws NS_ERROR_NOT_INITIALIZED if no zip file has been opened
michael@0 205 * @throws NS_ERROR_IN_PROGRESS if another operation is currently in progress
michael@0 206 * @throws <other-error> on failure to complete the zip file
michael@0 207 */
michael@0 208 void close();
michael@0 209
michael@0 210 /**
michael@0 211 * Make all stored(uncompressed) files align to given alignment size.
michael@0 212 *
michael@0 213 * @param aAlignSize is the alignment size, valid values from 2 to 32768, and
michael@0 214 must be power of 2.
michael@0 215 *
michael@0 216 * @throws NS_ERROR_INVALID_ARG if aAlignSize is invalid
michael@0 217 * @throws <other-error> on failure to update the zip file
michael@0 218 */
michael@0 219 void alignStoredFiles(in uint16_t aAlignSize);
michael@0 220 };

mercurial