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: 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 "nsILocalFile.idl" |
michael@0 | 7 | |
michael@0 | 8 | %{C++ |
michael@0 | 9 | #include <Carbon/Carbon.h> |
michael@0 | 10 | #include <CoreFoundation/CoreFoundation.h> |
michael@0 | 11 | %} |
michael@0 | 12 | |
michael@0 | 13 | native OSType(OSType); |
michael@0 | 14 | native FSSpec(FSSpec); |
michael@0 | 15 | native FSRef(FSRef); |
michael@0 | 16 | [ptr] native FSRefPtr(FSRef); |
michael@0 | 17 | native CFURLRef(CFURLRef); |
michael@0 | 18 | |
michael@0 | 19 | [scriptable, builtinclass, uuid(E5DE2CC9-BF06-4329-8F91-5D2D45284500)] |
michael@0 | 20 | interface nsILocalFileMac : nsILocalFile |
michael@0 | 21 | { |
michael@0 | 22 | /** |
michael@0 | 23 | * initWithCFURL |
michael@0 | 24 | * |
michael@0 | 25 | * Init this object with a CFURLRef |
michael@0 | 26 | * |
michael@0 | 27 | * NOTE: Supported only for XP_MACOSX |
michael@0 | 28 | * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand. |
michael@0 | 29 | * |
michael@0 | 30 | * @param aCFURL the CoreFoundation URL |
michael@0 | 31 | * |
michael@0 | 32 | */ |
michael@0 | 33 | [noscript] void initWithCFURL(in CFURLRef aCFURL); |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * initWithFSRef |
michael@0 | 37 | * |
michael@0 | 38 | * Init this object with an FSRef |
michael@0 | 39 | * |
michael@0 | 40 | * NOTE: Supported only for XP_MACOSX |
michael@0 | 41 | * |
michael@0 | 42 | * @param aFSRef the native FSRef |
michael@0 | 43 | * |
michael@0 | 44 | */ |
michael@0 | 45 | [noscript] void initWithFSRef([const] in FSRefPtr aFSRef); |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * getCFURL |
michael@0 | 49 | * |
michael@0 | 50 | * Returns the CFURLRef of the file object. The caller is |
michael@0 | 51 | * responsible for calling CFRelease() on it. |
michael@0 | 52 | * |
michael@0 | 53 | * NOTE: Observes the state of the followLinks attribute. |
michael@0 | 54 | * If the file object is an alias and followLinks is TRUE, returns |
michael@0 | 55 | * the target of the alias. If followLinks is FALSE, returns |
michael@0 | 56 | * the unresolved alias file. |
michael@0 | 57 | * |
michael@0 | 58 | * NOTE: Supported only for XP_MACOSX |
michael@0 | 59 | * |
michael@0 | 60 | * @return |
michael@0 | 61 | * |
michael@0 | 62 | */ |
michael@0 | 63 | [noscript] CFURLRef getCFURL(); |
michael@0 | 64 | |
michael@0 | 65 | /** |
michael@0 | 66 | * getFSRef |
michael@0 | 67 | * |
michael@0 | 68 | * Returns the FSRef of the file object. |
michael@0 | 69 | * |
michael@0 | 70 | * NOTE: Observes the state of the followLinks attribute. |
michael@0 | 71 | * If the file object is an alias and followLinks is TRUE, returns |
michael@0 | 72 | * the target of the alias. If followLinks is FALSE, returns |
michael@0 | 73 | * the unresolved alias file. |
michael@0 | 74 | * |
michael@0 | 75 | * NOTE: Supported only for XP_MACOSX |
michael@0 | 76 | * |
michael@0 | 77 | * @return |
michael@0 | 78 | * |
michael@0 | 79 | */ |
michael@0 | 80 | [noscript] FSRef getFSRef(); |
michael@0 | 81 | |
michael@0 | 82 | /** |
michael@0 | 83 | * getFSSpec |
michael@0 | 84 | * |
michael@0 | 85 | * Returns the FSSpec of the file object. |
michael@0 | 86 | * |
michael@0 | 87 | * NOTE: Observes the state of the followLinks attribute. |
michael@0 | 88 | * If the file object is an alias and followLinks is TRUE, returns |
michael@0 | 89 | * the target of the alias. If followLinks is FALSE, returns |
michael@0 | 90 | * the unresolved alias file. |
michael@0 | 91 | * |
michael@0 | 92 | * @return |
michael@0 | 93 | * |
michael@0 | 94 | */ |
michael@0 | 95 | [noscript] FSSpec getFSSpec(); |
michael@0 | 96 | |
michael@0 | 97 | /** |
michael@0 | 98 | * fileSizeWithResFork |
michael@0 | 99 | * |
michael@0 | 100 | * Returns the combined size of both the data fork and the resource |
michael@0 | 101 | * fork (if present) rather than just the size of the data fork |
michael@0 | 102 | * as returned by GetFileSize() |
michael@0 | 103 | * |
michael@0 | 104 | */ |
michael@0 | 105 | readonly attribute int64_t fileSizeWithResFork; |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | * fileType, creator |
michael@0 | 109 | * |
michael@0 | 110 | * File type and creator attributes |
michael@0 | 111 | * |
michael@0 | 112 | */ |
michael@0 | 113 | [noscript] attribute OSType fileType; |
michael@0 | 114 | [noscript] attribute OSType fileCreator; |
michael@0 | 115 | |
michael@0 | 116 | /** |
michael@0 | 117 | * launchWithDoc |
michael@0 | 118 | * |
michael@0 | 119 | * Launch the application that this file points to with a document. |
michael@0 | 120 | * |
michael@0 | 121 | * @param aDocToLoad Must not be NULL. If no document, use nsIFile::launch |
michael@0 | 122 | * @param aLaunchInBackground TRUE if the application should not come to the front. |
michael@0 | 123 | * |
michael@0 | 124 | */ |
michael@0 | 125 | void launchWithDoc(in nsIFile aDocToLoad, in boolean aLaunchInBackground); |
michael@0 | 126 | |
michael@0 | 127 | /** |
michael@0 | 128 | * openDocWithApp |
michael@0 | 129 | * |
michael@0 | 130 | * Open the document that this file points to with the given application. |
michael@0 | 131 | * |
michael@0 | 132 | * @param aAppToOpenWith The application with which to open the document. |
michael@0 | 133 | * If NULL, the creator code of the document is used |
michael@0 | 134 | * to determine the application. |
michael@0 | 135 | * @param aLaunchInBackground TRUE if the application should not come to the front. |
michael@0 | 136 | * |
michael@0 | 137 | */ |
michael@0 | 138 | void openDocWithApp(in nsIFile aAppToOpenWith, in boolean aLaunchInBackground); |
michael@0 | 139 | |
michael@0 | 140 | /** |
michael@0 | 141 | * isPackage |
michael@0 | 142 | * |
michael@0 | 143 | * returns true if a directory is determined to be a package under Mac OS 9/X |
michael@0 | 144 | * |
michael@0 | 145 | */ |
michael@0 | 146 | boolean isPackage(); |
michael@0 | 147 | |
michael@0 | 148 | /** |
michael@0 | 149 | * bundleDisplayName |
michael@0 | 150 | * |
michael@0 | 151 | * returns the display name of the application bundle (usually the human |
michael@0 | 152 | * readable name of the application) |
michael@0 | 153 | */ |
michael@0 | 154 | readonly attribute AString bundleDisplayName; |
michael@0 | 155 | |
michael@0 | 156 | /** |
michael@0 | 157 | * bundleIdentifier |
michael@0 | 158 | * |
michael@0 | 159 | * returns the identifier of the bundle |
michael@0 | 160 | */ |
michael@0 | 161 | readonly attribute AUTF8String bundleIdentifier; |
michael@0 | 162 | |
michael@0 | 163 | /** |
michael@0 | 164 | * Last modified time of a bundle's contents (as opposed to its package |
michael@0 | 165 | * directory). Our convention is to make the bundle's Info.plist file |
michael@0 | 166 | * stand in for the rest of its contents -- since this file contains the |
michael@0 | 167 | * bundle's version information and other identifiers. For non-bundles |
michael@0 | 168 | * this is the same as lastModifiedTime. |
michael@0 | 169 | */ |
michael@0 | 170 | readonly attribute int64_t bundleContentsLastModifiedTime; |
michael@0 | 171 | }; |
michael@0 | 172 | |
michael@0 | 173 | %{C++ |
michael@0 | 174 | extern "C" |
michael@0 | 175 | { |
michael@0 | 176 | NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowSymlinks, nsILocalFileMac** result); |
michael@0 | 177 | NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowSymlinks, nsILocalFileMac** result); |
michael@0 | 178 | } |
michael@0 | 179 | %} |