[X2Go-Commits] [pale-moon] 12/22: Confirm launch of executables other than .exe on Windows.
git-admin at x2go.org
git-admin at x2go.org
Sat Sep 29 03:25:22 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch upstream/palemoon-master
in repository pale-moon.
commit 93403cdebbfddd404a6e0680eba52ab889ff1d65
Author: Pale Moon <git-repo at palemoon.org>
Date: Sat Jun 30 19:29:36 2018 +0200
Confirm launch of executables other than .exe on Windows.
---
browser/components/downloads/DownloadsCommon.jsm | 21 ++++++++--------
.../jsdownloads/src/DownloadIntegration.jsm | 28 ++++++++++++----------
2 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/browser/components/downloads/DownloadsCommon.jsm b/browser/components/downloads/DownloadsCommon.jsm
index b90baaf..4bcdb18 100644
--- a/browser/components/downloads/DownloadsCommon.jsm
+++ b/browser/components/downloads/DownloadsCommon.jsm
@@ -77,7 +77,6 @@ const nsIDM = Ci.nsIDownloadManager;
const kDownloadsStringBundleUrl =
"chrome://browser/locale/downloads/downloads.properties";
-const kPrefBdmScanWhenDone = "browser.download.manager.scanWhenDone";
const kPrefBdmAlertOnExeOpen = "browser.download.manager.alertOnEXEOpen";
const kDownloadsStringsRequiringFormatting = {
@@ -518,22 +517,22 @@ this.DownloadsCommon = {
if (!(aOwnerWindow instanceof Ci.nsIDOMWindow))
throw new Error("aOwnerWindow must be a dom-window object");
+#ifdef XP_WIN
+ // On Windows, the system will provide a native confirmation prompt
+ // for .exe files. Exclude this from our prompt, but prompt on other
+ // executable types.
+ let isWindowsExe = aFile.leafName.toLowerCase().endsWith(".exe");
+#else
+ let isWindowsExe = false;
+#endif
+
// Confirm opening executable files if required.
- if (aFile.isExecutable()) {
+ if (aFile.isExecutable() && !isWindowsExe) {
let showAlert = true;
try {
showAlert = Services.prefs.getBoolPref(kPrefBdmAlertOnExeOpen);
} catch (ex) { }
- // On Vista and above, we rely on native security prompting for
- // downloaded content unless it's disabled.
- if (DownloadsCommon.isWinVistaOrHigher) {
- try {
- if (Services.prefs.getBoolPref(kPrefBdmScanWhenDone)) {
- showAlert = false;
- }
- } catch (ex) { }
- }
if (showAlert) {
let name = aFile.leafName;
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
index 2ed7693..58b3bcb 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -703,7 +703,21 @@ this.DownloadIntegration = {
let deferred = Task.spawn(function DI_launchDownload_task() {
let file = new FileUtils.File(aDownload.target.path);
-#ifndef XP_WIN
+ // In case of a double extension, like ".tar.gz", we only
+ // consider the last one, because the MIME service cannot
+ // handle multiple extensions.
+ let fileExtension = null, mimeInfo = null;
+ let match = file.leafName.match(/\.([^.]+)$/);
+ if (match) {
+ fileExtension = match[1];
+ }
+
+#ifdef XP_WIN
+ let isWindowsExe = fileExtension.toLowerCase() == "exe";
+#else
+ let isWindowsExe = false;
+#endif
+
// Ask for confirmation if the file is executable, except on Windows where
// the operating system will show the prompt based on the security zone.
// We do this here, instead of letting the caller handle the prompt
@@ -711,7 +725,7 @@ this.DownloadIntegration = {
// because of its security nature, so that add-ons cannot forget to do
// this check. The second is that the system-level security prompt would
// be displayed at launch time in any case.
- if (file.isExecutable() && !this.dontOpenFileAndFolder) {
+ if (file.isExecutable() && !isWindowsExe && !this.dontOpenFileAndFolder) {
// We don't anchor the prompt to a specific window intentionally, not
// only because this is the same behavior as the system-level prompt,
// but also because the most recently active window is the right choice
@@ -722,16 +736,6 @@ this.DownloadIntegration = {
return;
}
}
-#endif
-
- // In case of a double extension, like ".tar.gz", we only
- // consider the last one, because the MIME service cannot
- // handle multiple extensions.
- let fileExtension = null, mimeInfo = null;
- let match = file.leafName.match(/\.([^.]+)$/);
- if (match) {
- fileExtension = match[1];
- }
try {
// The MIME service might throw if contentType == "" and it can't find
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pale-moon.git
More information about the x2go-commits
mailing list