Bug 1038465 - Pass suggested filename to application reputation query. r=paolo, a=sledru
authorMonica Chew <mmc@mozilla.com>
Tue, 15 Jul 2014 13:46:52 -0700
changeset 208053 5f975bb5e02c2d7a69ed5638a3601559cd746a9d
parent 208052 d87d4e1f2e24fe7c0d07da38d634b2e79d20c067
child 208054 e1b73deedcb4510a03615fc1e364ac912805b938
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo, sledru
bugs1038465
milestone32.0a2
Bug 1038465 - Pass suggested filename to application reputation query. r=paolo, a=sledru
testing/profiles/prefs_general.js
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/jsdownloads/src/DownloadIntegration.jsm
--- 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;
   },