summaryrefslogtreecommitdiffstats
path: root/toolkit/components/jsdownloads
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/jsdownloads')
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm40
1 files changed, 27 insertions, 13 deletions
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
index 1c30599f5..7439d9d11 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -530,20 +530,34 @@ this.DownloadIntegration = {
* @return true if files should be marked
*/
_shouldSaveZoneInformation() {
- let key = Cc["@mozilla.org/windows-registry-key;1"]
- .createInstance(Ci.nsIWindowsRegKey);
+ let zonePref = 2;
try {
- key.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Attachments",
- Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE);
- try {
- return key.readIntValue("SaveZoneInformation") != 1;
- } finally {
- key.close();
- }
- } catch (ex) {
- // If the key is not present, files should be marked by default.
- return true;
+ zonePref = Services.prefs.getIntPref("browser.download.saveZoneInformation");
+ } catch (ex) {}
+
+ switch (zonePref) {
+ case 0: // Never
+ return false;
+ case 1: // Always
+ return true;
+ case 2: // System-defined
+ let key = Cc["@mozilla.org/windows-registry-key;1"]
+ .createInstance(Ci.nsIWindowsRegKey);
+ try {
+ key.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
+ "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Attachments",
+ Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE);
+ try {
+ return key.readIntValue("SaveZoneInformation") != 1;
+ } finally {
+ key.close();
+ }
+ } catch (ex) {
+ // If the key is not present, files should be marked by default.
+ return true;
+ }
+ default: // Invalid pref value defaults marking files.
+ return true;
}
},
#endif