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: 3; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsICancelable.idl"
9 interface nsIURI;
10 interface nsIRequest;
11 interface nsIStreamListener;
12 interface nsIFile;
13 interface nsIMIMEInfo;
14 interface nsIWebProgressListener2;
15 interface nsIInterfaceRequestor;
17 /**
18 * The external helper app service is used for finding and launching
19 * platform specific external applications for a given mime content type.
20 */
21 [scriptable, uuid(9e456297-ba3e-42b1-92bd-b7db014268cb)]
22 interface nsIExternalHelperAppService : nsISupports
23 {
24 /**
25 * Binds an external helper application to a stream listener. The caller
26 * should pump data into the returned stream listener. When the OnStopRequest
27 * is issued, the stream listener implementation will launch the helper app
28 * with this data.
29 * @param aMimeContentType The content type of the incoming data
30 * @param aRequest The request corresponding to the incoming data
31 * @param aWindowContext Use GetInterface to retrieve properties like the
32 * dom window or parent window...
33 * The service might need this in order to bring up dialogs.
34 * @param aForceSave True to always save this content to disk, regardless of
35 * nsIMIMEInfo and other such influences.
36 * @return A nsIStreamListener which the caller should pump the data into.
37 */
38 nsIStreamListener doContent (in ACString aMimeContentType, in nsIRequest aRequest,
39 in nsIInterfaceRequestor aWindowContext,
40 in boolean aForceSave);
42 /**
43 * Returns true if data from a URL with this extension combination
44 * is to be decoded from aEncodingType prior to saving or passing
45 * off to helper apps, false otherwise.
46 */
47 boolean applyDecodingForExtension(in AUTF8String aExtension,
48 in ACString aEncodingType);
50 };
52 /**
53 * This is a private interface shared between external app handlers and the platform specific
54 * external helper app service
55 */
56 [scriptable, uuid(6613e2e7-feab-4e3a-bb1f-b03200d544ec)]
57 interface nsPIExternalAppLauncher : nsISupports
58 {
59 /**
60 * mscott --> eventually I should move this into a new service so other
61 * consumers can add temporary files they want deleted on exit.
62 * @param aTemporaryFile A temporary file we should delete on exit.
63 */
64 void deleteTemporaryFileOnExit(in nsIFile aTemporaryFile);
65 /**
66 * Delete a temporary file created inside private browsing mode when
67 * the private browsing mode has ended.
68 */
69 void deleteTemporaryPrivateFileWhenPossible(in nsIFile aTemporaryFile);
70 };
72 /**
73 * A helper app launcher is a small object created to handle the launching
74 * of an external application.
75 *
76 * Note that cancelling the load via the nsICancelable interface will release
77 * the reference to the launcher dialog.
78 */
79 [scriptable, uuid(acf2a516-7d7f-4771-8b22-6c4a559c088e)]
80 interface nsIHelperAppLauncher : nsICancelable
81 {
82 /**
83 * The mime info object associated with the content type this helper app
84 * launcher is currently attempting to load
85 */
86 readonly attribute nsIMIMEInfo MIMEInfo;
88 /**
89 * The source uri
90 */
91 readonly attribute nsIURI source;
93 /**
94 * The suggested name for this file
95 */
96 readonly attribute AString suggestedFileName;
98 /**
99 * Saves the final destination of the file. Does not actually perform the
100 * save.
101 * NOTE: This will release the reference to the
102 * nsIHelperAppLauncherDialog.
103 */
104 void saveToDisk(in nsIFile aNewFileLocation, in boolean aRememberThisPreference);
106 /**
107 * Remembers that aApplication should be used to launch this content. Does
108 * not actually launch the application.
109 * NOTE: This will release the reference to the nsIHelperAppLauncherDialog.
110 * @param aApplication nsIFile corresponding to the location of the application to use.
111 * @param aRememberThisPreference TRUE if we should remember this choice.
112 */
113 void launchWithApplication(in nsIFile aApplication, in boolean aRememberThisPreference);
115 /**
116 * Callback invoked by nsIHelperAppLauncherDialog::promptForSaveToFileAsync
117 * after the user has chosen a file through the File Picker (or dismissed it).
118 * @param aFile The file that was chosen by the user (or null if dialog was dismissed).
119 */
120 void saveDestinationAvailable(in nsIFile aFile);
122 /**
123 * The following methods are used by the progress dialog to get or set
124 * information on the current helper app launcher download.
125 * This reference will be released when the download is finished (after the
126 * listener receives the STATE_STOP notification).
127 */
128 void setWebProgressListener(in nsIWebProgressListener2 aWebProgressListener);
130 /**
131 * The file we are saving to
132 */
133 readonly attribute nsIFile targetFile;
135 /**
136 * The executable-ness of the target file
137 */
138 readonly attribute boolean targetFileIsExecutable;
140 /**
141 * Time when the download started
142 */
143 readonly attribute PRTime timeDownloadStarted;
145 /**
146 * The download content length, or -1 if the length is not available.
147 */
148 readonly attribute int64_t contentLength;
149 };