Bug 1038465 - Pass suggested filename to application reputation query. r=paolo, a=sledru
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -77,16 +77,17 @@ user_pref("geo.wifi.logging.enabled", tr
user_pref("camino.warn_when_closing", false); // Camino-only, harmless to others
// Make url-classifier updates so rare that they won't affect tests
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");
user_pref("extensions.blocklist.url", "http://%(server)s/extensions-dummy/blocklistURL");
user_pref("extensions.hotfix.url", "http://%(server)s/extensions-dummy/hotfixURL");
// Turn off extension updates so they don't bother tests
user_pref("extensions.update.enabled", false);
// Make sure opening about:addons won't hit the network
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -353,18 +353,21 @@ PendingLookup::~PendingLookup()
}
bool
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
StringEndsWith(fileName, NS_LITERAL_STRING(".apk")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".bas")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".bat")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".cab")) ||
StringEndsWith(fileName, NS_LITERAL_STRING(".cmd")) ||
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -517,16 +517,17 @@ this.DownloadIntegration = {
if (aDownload.source.referrer) {
aReferrer: NetUtil.newURI(aDownload.source.referrer);
}
gApplicationReputationService.queryReputation({
sourceURI: NetUtil.newURI(aDownload.source.url),
referrerURI: aReferrer,
fileSize: aDownload.currentBytes,
sha256Hash: hash,
+ suggestedFileName: OS.Path.basename(aDownload.target.path),
signatureInfo: sigInfo,
redirects: channelRedirects },
function onComplete(aShouldBlock, aRv) {
deferred.resolve(aShouldBlock);
});
return deferred.promise;
},