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