Bug 1470295 - Allow save-as download of FTP files on HTTP pages. r=ckerschb
authorTom Schuster <evilpies@gmail.com>
Thu, 21 Jun 2018 23:31:13 +0200
changeset 423353 54b5db87eb7e
parent 423352 342a2a4aa8a8
child 423354 3ca934cfed6a
push id104544
push userevilpies@gmail.com
push dateFri, 22 Jun 2018 15:27:18 +0000
treeherdermozilla-inbound@54b5db87eb7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersckerschb
bugs1470295
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1470295 - Allow save-as download of FTP files on HTTP pages. r=ckerschb
dom/security/nsContentSecurityManager.cpp
--- a/dom/security/nsContentSecurityManager.cpp
+++ b/dom/security/nsContentSecurityManager.cpp
@@ -171,17 +171,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;