diff options
6 files changed, 25 insertions, 53 deletions
diff --git a/application/basilisk/components/downloads/DownloadsCommon.jsm b/application/basilisk/components/downloads/DownloadsCommon.jsm index 90f14f2d86..69d79dbb52 100644 --- a/application/basilisk/components/downloads/DownloadsCommon.jsm +++ b/application/basilisk/components/downloads/DownloadsCommon.jsm @@ -86,8 +86,7 @@ const kDownloadsStringsRequiringFormatting = { shortTimeLeftHours: true, shortTimeLeftDays: true, statusSeparator: true, - statusSeparatorBeforeNumber: true, - fileExecutableSecurityWarning: true + statusSeparatorBeforeNumber: true }; const kDownloadsStringsRequiringPluralForm = { diff --git a/application/basilisk/locales/en-US/chrome/browser/downloads/downloads.properties b/application/basilisk/locales/en-US/chrome/browser/downloads/downloads.properties index 30885e0066..e95b723b58 100644 --- a/application/basilisk/locales/en-US/chrome/browser/downloads/downloads.properties +++ b/application/basilisk/locales/en-US/chrome/browser/downloads/downloads.properties @@ -96,10 +96,6 @@ shortTimeLeftDays=%1$Sd statusSeparator=%1$S \u2014 %2$S statusSeparatorBeforeNumber=%1$S \u2014 %2$S -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 - # LOCALIZATION NOTE (otherDownloads2): # This is displayed in an item at the bottom of the Downloads Panel when # there are more downloads than can fit in the list in the panel. Use a diff --git a/application/palemoon/components/downloads/DownloadsCommon.jsm b/application/palemoon/components/downloads/DownloadsCommon.jsm index 1565785729..bd5d55a739 100644 --- a/application/palemoon/components/downloads/DownloadsCommon.jsm +++ b/application/palemoon/components/downloads/DownloadsCommon.jsm @@ -77,7 +77,7 @@ const nsIDM = Ci.nsIDownloadManager; const kDownloadsStringBundleUrl = "chrome://browser/locale/downloads/downloads.properties"; -const kPrefBdmAlertOnExeOpen = "browser.download.manager.alertOnEXEOpen"; +const kPrefConfirmOpenExe = "browser.download.confirmOpenExecutable"; const kDownloadsStringsRequiringFormatting = { sizeWithUnits: true, @@ -530,8 +530,10 @@ this.DownloadsCommon = { if (aFile.isExecutable() && !isWindowsExe) { let showAlert = true; try { - showAlert = Services.prefs.getBoolPref(kPrefBdmAlertOnExeOpen); - } catch (ex) { } + showAlert = Services.prefs.getBoolPref(kPrefConfirmOpenExe); + } catch (ex) { + // If the preference does not exist, continue with the prompt. + } if (showAlert) { let name = aFile.leafName; @@ -539,18 +541,11 @@ this.DownloadsCommon = { DownloadsCommon.strings.fileExecutableSecurityWarning(name, name); let title = DownloadsCommon.strings.fileExecutableSecurityWarningTitle; - let dontAsk = - DownloadsCommon.strings.fileExecutableSecurityWarningDontAsk; - let checkbox = { value: false }; - let open = Services.prompt.confirmCheck(aOwnerWindow, title, message, - dontAsk, checkbox); + let open = Services.prompt.confirm(aOwnerWindow, title, message); if (!open) { return; } - - Services.prefs.setBoolPref(kPrefBdmAlertOnExeOpen, - !checkbox.value); } } 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", |