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 423380 54b5db87eb7e
parent 423379 342a2a4aa8a8
child 423381 3ca934cfed6a
push id34174
push userapavel@mozilla.com
push dateFri, 22 Jun 2018 21:50:06 +0000
treeherdermozilla-central@16a043079689 [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;