diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-08 12:06:30 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-08 12:06:30 +0100 |
commit | 44cd9f2a915a4879371c5e0b059acc3e5a2378b0 (patch) | |
tree | 8cb1a4758b16d9caae55f525b73f5fca3824b4f7 /toolkit | |
parent | f8d1830b530cd553d788b3579d41725d35c4da7f (diff) | |
parent | b62fce0dc0c77a5788c331db32b3996e4020e2a5 (diff) | |
download | UXP-44cd9f2a915a4879371c5e0b059acc3e5a2378b0.tar UXP-44cd9f2a915a4879371c5e0b059acc3e5a2378b0.tar.gz UXP-44cd9f2a915a4879371c5e0b059acc3e5a2378b0.tar.lz UXP-44cd9f2a915a4879371c5e0b059acc3e5a2378b0.tar.xz UXP-44cd9f2a915a4879371c5e0b059acc3e5a2378b0.zip |
Merge branch 'ported-upstream'
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/components/jsdownloads/src/DownloadIntegration.jsm | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 5fed9212a..1d289c24d 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -28,6 +28,8 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown", "resource://gre/modules/AsyncShutdown.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", + "resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask", "resource://gre/modules/DeferredTask.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Downloads", @@ -675,20 +677,6 @@ this.DownloadIntegration = { launchDownload: Task.async(function* (aDownload) { let file = new FileUtils.File(aDownload.target.path); -#ifndef XP_WIN - // 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 - // separately in the user interface layer, for two reasons. The first is - // 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() && - !(yield this.confirmLaunchExecutable(file.path))) { - 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. @@ -698,6 +686,21 @@ this.DownloadIntegration = { fileExtension = match[1]; } + let isWindowsExe = AppConstants.platform == "win" && + fileExtension.toLowerCase() == "exe"; + + // Ask for confirmation if the file is executable, except for .exe 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 separately in the user interface layer, for two reasons. The + // first is 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() && !isWindowsExe && + !(await this.confirmLaunchExecutable(file.path))) { + return; + } + try { // The MIME service might throw if contentType == "" and it can't find // a MIME type for the given extension, so we'll treat this case as |