Confirm launch of executables other than .exe on Windows

This commit is contained in:
wolfbeast 2017-10-06 20:12:54 +02:00 committed by Roy Tam
commit d1abf0f6d8
2 changed files with 24 additions and 15 deletions

View file

@ -42,6 +42,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DownloadUIHelper",
@ -460,8 +462,12 @@ this.DownloadsCommon = {
throw new Error("aOwnerWindow must be a dom-window object");
}
let isWindowsExe = AppConstants.platform == "win" &&
aFile.leafName.toLowerCase().endsWith(".exe");
let promiseShouldLaunch;
if (aFile.isExecutable()) {
// Don't prompt on Windows for .exe since there will be a native prompt.
if (aFile.isExecutable() && !isWindowsExe) {
// We get a prompter for the provided window here, even though anchoring
// to the most recently active window should work as well.
promiseShouldLaunch =