Bug 1452701 - Add pref to allow FTP subresources. r=ckerschb

--HG--
extra : rebase_source : 571060a866cc46ab253b0718d33dcbbd0f7e0a87
This commit is contained in:
Tom Schuster 2018-04-09 21:07:01 +02:00
Родитель 73071c84a9
Коммит b0dadb57b5
4 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -165,6 +165,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) {

Просмотреть файл

@ -5754,6 +5754,9 @@ pref("security.data_uri.unique_opaque_origin", 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);
// Enable Storage API for all platforms except Android.
#if !defined(MOZ_WIDGET_ANDROID)
pref("dom.storageManager.enabled", true);

Просмотреть файл

@ -174,6 +174,7 @@ uint32_t nsIOService::gDefaultSegmentCount = 24;
bool nsIOService::sIsDataURIUniqueOpaqueOrigin = false;
bool nsIOService::sBlockToplevelDataUriNavigations = false;
bool nsIOService::sBlockFTPSubresources = false;
////////////////////////////////////////////////////////////////////////////////
@ -247,6 +248,8 @@ nsIOService::Init()
"security.data_uri.unique_opaque_origin", false);
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;
@ -1928,6 +1931,12 @@ nsIOService::BlockToplevelDataUriNavigations()
return sBlockToplevelDataUriNavigations;
}
/*static*/ bool
nsIOService::BlockFTPSubresources()
{
return sBlockFTPSubresources;
}
NS_IMETHODIMP
nsIOService::NotImplemented()
{

Просмотреть файл

@ -95,6 +95,8 @@ public:
static bool IsDataURIUniqueOpaqueOrigin();
static bool BlockToplevelDataUriNavigations();
static bool BlockFTPSubresources();
// Used to count the total number of HTTP requests made
void IncrementRequestNumber() { mTotalRequests++; }
uint32_t GetTotalRequestNumber() { return mTotalRequests; }
@ -197,6 +199,8 @@ private:
static bool sIsDataURIUniqueOpaqueOrigin;
static bool sBlockToplevelDataUriNavigations;
static bool sBlockFTPSubresources;
uint32_t mTotalRequests;
uint32_t mCacheWon;
uint32_t mNetWon;