summaryrefslogtreecommitdiff
path: root/toolkit/components/jsdownloads
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-04-20 15:59:23 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-04-20 15:59:23 +0200
commit879c5525d81c0e62450023f948f576c7bb04a6fd (patch)
tree1cf88c06021d4ead55d83a1b54b82e81582b4b37 /toolkit/components/jsdownloads
parent47baf0a649c07f37ef65536c0972a95e17803328 (diff)
downloaduxp-879c5525d81c0e62450023f948f576c7bb04a6fd.tar.gz
Re-implement pref-able file zone information ("Mark of the Web")
See also: https://github.com/MoonchildProductions/Pale-Moon/issues/593 https://github.com/MoonchildProductions/Pale-Moon/pull/599
Diffstat (limited to 'toolkit/components/jsdownloads')
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm32
1 files changed, 32 insertions, 0 deletions
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
index 1c30599f5a..38b89ae8e8 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -530,6 +530,37 @@ this.DownloadIntegration = {
* @return true if files should be marked
*/
_shouldSaveZoneInformation() {
+#ifdef MC_PALEMOON
+ let zonePref = 2;
+ try {
+ 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;
+ }
+#else
let key = Cc["@mozilla.org/windows-registry-key;1"]
.createInstance(Ci.nsIWindowsRegKey);
try {
@@ -545,6 +576,7 @@ this.DownloadIntegration = {
// If the key is not present, files should be marked by default.
return true;
}
+#endif
},
#endif