Bug 1470295 - Allow save-as download of FTP files on HTTP pages. r=ckerschb, a=RyanVM
authorTom Schuster <evilpies@gmail.com>
Thu, 21 Jun 2018 23:31:13 +0200
changeset 473791 2f2e89cae162
parent 473790 42ee22b7ad56
child 473792 c7663317f3d4
push id1737
push userryanvm@gmail.com
push date2018-07-02 16:05 +0000
treeherdermozilla-release@ced0b5dc71eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb, RyanVM
bugs1470295
milestone61.0.1
Bug 1470295 - Allow save-as download of FTP files on HTTP pages. r=ckerschb, a=RyanVM
dom/security/nsContentSecurityManager.cpp
--- a/dom/security/nsContentSecurityManager.cpp
+++ b/dom/security/nsContentSecurityManager.cpp
@@ -170,17 +170,21 @@ nsContentSecurityManager::CheckFTPSubres
   }
 
   nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
   if (!loadInfo) {
     return NS_OK;
   }
 
   nsContentPolicyType type = loadInfo->GetExternalContentPolicyType();
-  if (type == nsIContentPolicy::TYPE_DOCUMENT) {
+
+  // Allow top-level FTP documents and save-as download of FTP files on
+  // HTTP pages.
+  if (type == nsIContentPolicy::TYPE_DOCUMENT ||
+      type == nsIContentPolicy::TYPE_SAVEAS_DOWNLOAD) {
     return NS_OK;
   }
 
   // Allow the system principal to load everything. This is meant to
   // temporarily fix downloads and pdf.js.
   nsIPrincipal* triggeringPrincipal = loadInfo->TriggeringPrincipal();
   if (nsContentUtils::IsSystemPrincipal(triggeringPrincipal)) {
     return NS_OK;