From 64a5f4f2b16ae86bc55d869a8ec08cd0a404cb3c Mon Sep 17 00:00:00 2001 From: Monica Chew Date: Tue, 15 Jul 2014 13:46:52 -0700 Subject: [PATCH] Bug 1038465: Pass suggested filename to application reputation query (r=paolo) --- testing/profiles/prefs_general.js | 1 + toolkit/components/downloads/ApplicationReputation.cpp | 3 +++ toolkit/components/jsdownloads/src/DownloadIntegration.jsm | 2 ++ 3 files changed, 6 insertions(+) diff --git a/testing/profiles/prefs_general.js b/testing/profiles/prefs_general.js index 5320d498fbf1..c2cc2eeaa6ce 100644 --- a/testing/profiles/prefs_general.js +++ b/testing/profiles/prefs_general.js @@ -82,6 +82,7 @@ user_pref("urlclassifier.updateinterval", 172800); // Point the url-classifier to the local testing server for fast failures user_pref("browser.safebrowsing.gethashURL", "http://%(server)s/safebrowsing-dummy/gethash"); user_pref("browser.safebrowsing.updateURL", "http://%(server)s/safebrowsing-dummy/update"); +user_pref("browser.safebrowsing.appRepURL", "http://%(server)s/safebrowsing-dummy/update"); // Point update checks to the local testing server for fast failures user_pref("extensions.update.url", "http://%(server)s/extensions-dummy/updateURL"); user_pref("extensions.update.background.url", "http://%(server)s/extensions-dummy/updateBackgroundURL"); diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index dbbd21bead6f..bf15a6609417 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -361,8 +361,11 @@ PendingLookup::IsBinaryFile() nsString fileName; nsresult rv = mQuery->GetSuggestedFileName(fileName); if (NS_FAILED(rv)) { + LOG(("No suggested filename [this = %p]", this)); return false; } + LOG(("Suggested filename: %s [this = %p]", + NS_ConvertUTF16toUTF8(fileName).get(), this)); return // Executable extensions for MS Windows, from // https://code.google.com/p/chromium/codesearch#chromium/src/chrome/common/safe_browsing/download_protection_util.cc&l=14 diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index 4b02ee7b9ddb..ccbe25220430 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -517,11 +517,13 @@ this.DownloadIntegration = { if (aDownload.source.referrer) { aReferrer: NetUtil.newURI(aDownload.source.referrer); } + let aSuggestedFileName = OS.Path.basename(aDownload.target.path); gApplicationReputationService.queryReputation({ sourceURI: NetUtil.newURI(aDownload.source.url), referrerURI: aReferrer, fileSize: aDownload.currentBytes, sha256Hash: hash, + suggestedFileName: aSuggestedFileName, signatureInfo: sigInfo, redirects: channelRedirects }, function onComplete(aShouldBlock, aRv) {