mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
Confirm launch of executables other than .exe on Windows.
This commit is contained in:
parent
1974d5079a
commit
eecf847006
2 changed files with 15 additions and 14 deletions
|
|
@ -77,7 +77,6 @@ const nsIDM = Ci.nsIDownloadManager;
|
||||||
const kDownloadsStringBundleUrl =
|
const kDownloadsStringBundleUrl =
|
||||||
"chrome://browser/locale/downloads/downloads.properties";
|
"chrome://browser/locale/downloads/downloads.properties";
|
||||||
|
|
||||||
const kPrefBdmScanWhenDone = "browser.download.manager.scanWhenDone";
|
|
||||||
const kPrefBdmAlertOnExeOpen = "browser.download.manager.alertOnEXEOpen";
|
const kPrefBdmAlertOnExeOpen = "browser.download.manager.alertOnEXEOpen";
|
||||||
|
|
||||||
const kDownloadsStringsRequiringFormatting = {
|
const kDownloadsStringsRequiringFormatting = {
|
||||||
|
|
@ -518,23 +517,22 @@ this.DownloadsCommon = {
|
||||||
if (!(aOwnerWindow instanceof Ci.nsIDOMWindow))
|
if (!(aOwnerWindow instanceof Ci.nsIDOMWindow))
|
||||||
throw new Error("aOwnerWindow must be a dom-window object");
|
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.
|
// Confirm opening executable files if required.
|
||||||
if (aFile.isExecutable()) {
|
if (aFile.isExecutable() && !isWindowsExe) {
|
||||||
let showAlert = true;
|
let showAlert = true;
|
||||||
try {
|
try {
|
||||||
showAlert = Services.prefs.getBoolPref(kPrefBdmAlertOnExeOpen);
|
showAlert = Services.prefs.getBoolPref(kPrefBdmAlertOnExeOpen);
|
||||||
} catch (ex) { }
|
} 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) {
|
if (showAlert) {
|
||||||
let name = aFile.leafName;
|
let name = aFile.leafName;
|
||||||
let message =
|
let message =
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,10 @@ EXTRA_COMPONENTS += [
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_JS_MODULES += [
|
EXTRA_JS_MODULES += [
|
||||||
'DownloadsCommon.jsm',
|
|
||||||
'DownloadsLogger.jsm',
|
'DownloadsLogger.jsm',
|
||||||
'DownloadsTaskbar.jsm',
|
'DownloadsTaskbar.jsm',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
EXTRA_PP_JS_MODULES += [
|
||||||
|
'DownloadsCommon.jsm',
|
||||||
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue