summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-02 19:05:56 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-02 19:05:56 +0200
commite92808f0ebbeab3ffb79a0b1a4d190f61fb8b43a (patch)
treee5ba54415e62d447a4238aa0000f1ef2e58cfd53 /toolkit
parent4c9914227ed9e675d65ad16e0bb899e8107a0ee5 (diff)
downloaduxp-e92808f0ebbeab3ffb79a0b1a4d190f61fb8b43a.tar.gz
Prevent suppressing executable warnings using the "don't ask me this again" checkbox.
A hidden preference matching the behavior of "browser.download.manager.alertOnEXEOpen" is kept, but is renamed in order to recover cases where the checkbox was used accidentally. While there, simplify the `confirmLaunchExecutable` function by converting from promises to async function. Since Basilisk moved this prompting to toolkit, we also clean up some unused duplicate strings from application/basilisk while we're there. This resolves #581
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/jsdownloads/src/DownloadUIHelper.jsm51
-rw-r--r--toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties1
-rw-r--r--toolkit/modules/Troubleshoot.jsm2
3 files changed, 18 insertions, 36 deletions
diff --git a/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm b/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm
index 5bd351ee97..ce165205bb 100644
--- a/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm
@@ -124,52 +124,35 @@ this.DownloadPrompter.prototype = {
/**
* Displays a warning message box that informs that the specified file is
- * executable, and asks whether the user wants to launch it. The user is
- * given the option of disabling future instances of this warning.
+ * executable, and asks whether the user wants to launch it.
*
* @param aPath
* String containing the full path to the file to be opened.
*
- * @return {Promise}
* @resolves Boolean indicating whether the launch operation can continue.
- * @rejects JavaScript exception.
*/
- confirmLaunchExecutable: function (aPath)
+ async confirmLaunchExecutable: function (aPath)
{
- const kPrefAlertOnEXEOpen = "browser.download.manager.alertOnEXEOpen";
+ const kPrefConfirmOpenExe = "browser.download.confirmOpenExecutable";
- try {
- // Always launch in case we have no prompter implementation.
- if (!this._prompter) {
- return Promise.resolve(true);
- }
-
- try {
- if (!Services.prefs.getBoolPref(kPrefAlertOnEXEOpen)) {
- return Promise.resolve(true);
- }
- } catch (ex) {
- // If the preference does not exist, continue with the prompt.
- }
-
- let leafName = OS.Path.basename(aPath);
-
- let s = DownloadUIHelper.strings;
- let checkState = { value: false };
- let shouldLaunch = this._prompter.confirmCheck(
- s.fileExecutableSecurityWarningTitle,
- s.fileExecutableSecurityWarning(leafName, leafName),
- s.fileExecutableSecurityWarningDontAsk,
- checkState);
+ // Always launch in case we have no prompter implementation.
+ if (!this._prompter) {
+ return true;
+ }
- if (shouldLaunch) {
- Services.prefs.setBoolPref(kPrefAlertOnEXEOpen, !checkState.value);
+ try {
+ if (!Services.prefs.getBoolPref(kPrefConfirmOpenExe)) {
+ return true;
}
-
- return Promise.resolve(shouldLaunch);
} catch (ex) {
- return Promise.reject(ex);
+ // If the preference does not exist, continue with the prompt.
}
+
+ let leafName = OS.Path.basename(aPath);
+
+ let s = DownloadUIHelper.strings;
+ return this._prompter.confirm(s.fileExecutableSecurityWarningTitle,
+ s.fileExecutableSecurityWarning(leafName, leafName));
},
/**
diff --git a/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties b/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties
index 3a50d17f3a..af95022f18 100644
--- a/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties
@@ -134,7 +134,6 @@ downloadsTitlePercent=#2% of #1 file - Downloads;#2% of #1 files - Downloads
fileExecutableSecurityWarning=“%S” is an executable file. Executable files may contain viruses or other malicious code that could harm your computer. Use caution when opening this file. Are you sure you want to launch “%S”?
fileExecutableSecurityWarningTitle=Open Executable File?
-fileExecutableSecurityWarningDontAsk=Don’t ask me this again
displayNameDesktop=Desktop
diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm
index a862b1db46..21e8b3c79b 100644
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -20,12 +20,12 @@ const PREFS_WHITELIST = [
"apz.",
"browser.cache.",
"browser.display.",
+ "browser.download.confirmOpenExecutable",
"browser.download.folderList",
"browser.download.hide_plugins_without_extensions",
"browser.download.importedFromSqlite",
"browser.download.lastDir.savePerSite",
"browser.download.manager.addToRecentDocs",
- "browser.download.manager.alertOnEXEOpen",
"browser.download.manager.closeWhenDone",
"browser.download.manager.displayedHistoryDays",
"browser.download.manager.quitBehavior",