From cd05a3a783409c360331f1649b6b066138159844 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Fri, 20 Apr 2018 14:52:33 +0200 Subject: [PALEMOON] Reimplemented "Time Zone Information" https://github.com/MoonchildProductions/Pale-Moon/issues/593 Issue #121 --- .../jsdownloads/src/DownloadIntegration.jsm | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'toolkit/components/jsdownloads') diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 1c30599f5..38b89ae8e 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 -- cgit v1.2.3 From f5c377092c2685625d36fdcede15567800a4d52c Mon Sep 17 00:00:00 2001 From: Moonchild Date: Fri, 20 Apr 2018 13:51:38 +0000 Subject: Revert "[PALEMOON] Reimplemented selection internet zone information on downloaded files" --- .../jsdownloads/src/DownloadIntegration.jsm | 32 ---------------------- 1 file changed, 32 deletions(-) (limited to 'toolkit/components/jsdownloads') diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 38b89ae8e..1c30599f5 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -530,37 +530,6 @@ 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 { @@ -576,7 +545,6 @@ this.DownloadIntegration = { // If the key is not present, files should be marked by default. return true; } -#endif }, #endif -- cgit v1.2.3 From 877167cf267f75ac68f1a18091f7e9a00bd94303 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 20 Apr 2018 15:59:23 +0200 Subject: 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 --- .../jsdownloads/src/DownloadIntegration.jsm | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'toolkit/components/jsdownloads') diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 1c30599f5..38b89ae8e 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 -- cgit v1.2.3 From eb64fb02b6bf678b3633b09d3e6c253c9783d717 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Fri, 20 Apr 2018 16:09:04 +0200 Subject: Make the Mark of the Web preference applicable to all applications. Follow-up to #215. --- .../components/jsdownloads/src/DownloadIntegration.jsm | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'toolkit/components/jsdownloads') diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 38b89ae8e..7439d9d11 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -530,7 +530,6 @@ this.DownloadIntegration = { * @return true if files should be marked */ _shouldSaveZoneInformation() { -#ifdef MC_PALEMOON let zonePref = 2; try { zonePref = Services.prefs.getIntPref("browser.download.saveZoneInformation"); @@ -560,23 +559,6 @@ this.DownloadIntegration = { default: // Invalid pref value defaults marking files. return true; } -#else - 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; - } -#endif }, #endif -- cgit v1.2.3