Add preference to allow the loading of FTP subresources for corner cases

This commit is contained in:
wolfbeast 2019-07-14 22:41:01 +02:00 committed by Roy Tam
commit 797f3eae35
4 changed files with 19 additions and 0 deletions

View file

@ -98,6 +98,9 @@ nsContentSecurityManager::CheckFTPSubresourceLoad(nsIChannel* aChannel)
// We dissallow using FTP resources as a subresource everywhere.
// The only valid way to use FTP resources is loading it as
// a top level document.
if (!mozilla::net::nsIOService::BlockFTPSubresources()) {
return NS_OK;
}
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
if (!loadInfo) {

View file

@ -5448,6 +5448,9 @@ pref("layout.css.servo.enabled", true);
// URL-Bar will not be blocked when flipping this pref.
pref("security.data_uri.block_toplevel_data_uri_navigations", true);
// If true, all FTP subresource loads will be blocked.
pref("security.block_ftp_subresources", true);
// Disable Storage api in release builds.
#ifdef NIGHTLY_BUILD
pref("dom.storageManager.enabled", true);

View file

@ -166,6 +166,7 @@ uint32_t nsIOService::gDefaultSegmentSize = 4096;
uint32_t nsIOService::gDefaultSegmentCount = 24;
bool nsIOService::sBlockToplevelDataUriNavigations = false;
bool nsIOService::sBlockFTPSubresources = false;
////////////////////////////////////////////////////////////////////////////////
@ -243,6 +244,8 @@ nsIOService::Init()
Preferences::AddBoolVarCache(&sBlockToplevelDataUriNavigations,
"security.data_uri.block_toplevel_data_uri_navigations", false);
Preferences::AddBoolVarCache(&sBlockFTPSubresources,
"security.block_ftp_subresources", true);
Preferences::AddBoolVarCache(&mOfflineMirrorsConnectivity, OFFLINE_MIRRORS_CONNECTIVITY, true);
gIOService = this;
@ -1869,5 +1872,11 @@ nsIOService::BlockToplevelDataUriNavigations()
return sBlockToplevelDataUriNavigations;
}
/*static*/ bool
nsIOService::BlockFTPSubresources()
{
return sBlockFTPSubresources;
}
} // namespace net
} // namespace mozilla

View file

@ -94,6 +94,8 @@ public:
static bool BlockToplevelDataUriNavigations();
static bool BlockFTPSubresources();
// Used to trigger a recheck of the captive portal status
nsresult RecheckCaptivePortal();
private:
@ -175,6 +177,8 @@ private:
static bool sBlockToplevelDataUriNavigations;
static bool sBlockFTPSubresources;
// Time a network tearing down started.
mozilla::Atomic<PRIntervalTime> mNetTearingDownStarted;
public: