From 6854546d37968ee805aa5f6f2a6b850b3594fbc7 Mon Sep 17 00:00:00 2001 From: "sdwilsh%shawnwilsher.com" Date: Wed, 30 Jan 2008 05:07:44 +0000 Subject: [PATCH] Bug 412204 - anti virus scanning is slow and unnecessary. r=jimm --- browser/app/profile/firefox.js | 1 + .../components/downloads/src/nsDownloadManager.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index af5636d7eab..ee369f740e6 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -232,6 +232,7 @@ pref("browser.download.manager.focusWhenStarting", false); pref("browser.download.manager.flashCount", 2); pref("browser.download.manager.addToRecentDocs", true); pref("browser.download.manager.quitBehavior", 0); +pref("browser.download.manager.scanWhenDone", true); // search engines URL pref("browser.search.searchEnginesURL", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/firefox/%VERSION%/search-engines/"); diff --git a/toolkit/components/downloads/src/nsDownloadManager.cpp b/toolkit/components/downloads/src/nsDownloadManager.cpp index 7659f83e025..1793bdfd02b 100644 --- a/toolkit/components/downloads/src/nsDownloadManager.cpp +++ b/toolkit/components/downloads/src/nsDownloadManager.cpp @@ -96,6 +96,7 @@ #define PREF_BDM_QUITBEHAVIOR "browser.download.manager.quitBehavior" #define PREF_BDM_CLOSEWHENDONE "browser.download.manager.closeWhenDone" #define PREF_BDM_ADDTORECENTDOCS "browser.download.manager.addToRecentDocs" +#define PREF_BDM_SCANWHENDONE "browser.download.manager.scanWhenDone" #define PREF_BH_DELETETEMPFILEONEXIT "browser.helperApps.deleteTempFileOnExit" static const PRInt64 gUpdateInterval = 400 * PR_USEC_PER_MSEC; @@ -2130,7 +2131,15 @@ nsDownload::OnStateChange(nsIWebProgress *aWebProgress, mLastUpdate = PR_Now(); #if defined(XP_WIN) && !defined(__MINGW32__) - (void)SetState(nsIDownloadManager::DOWNLOAD_SCANNING); + PRBool scan = PR_TRUE; + nsCOMPtr prefs(do_GetService(NS_PREFSERVICE_CONTRACTID)); + if (prefs) + (void)prefs->GetBoolPref(PREF_BDM_SCANWHENDONE, &scan); + + if (scan) + (void)SetState(nsIDownloadManager::DOWNLOAD_SCANNING); + else + (void)SetState(nsIDownloadManager::DOWNLOAD_FINISHED); #else (void)SetState(nsIDownloadManager::DOWNLOAD_FINISHED); #endif