Bug 1287827 - Part 4. Remove the special-case Loop CSP setting. r=mrbkap

This commit is contained in:
Mark Banner 2016-07-27 10:51:58 +01:00
Родитель 59109f0ef2
Коммит f12f4ca9c9
2 изменённых файлов: 0 добавлений и 43 удалений

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

@ -2619,33 +2619,6 @@ nsDocument::SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages)
} }
} }
bool
nsDocument::IsLoopDocument(nsIChannel *aChannel)
{
nsCOMPtr<nsIURI> chanURI;
nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(chanURI));
NS_ENSURE_SUCCESS(rv, false);
bool isAbout = false;
bool isLoop = false;
rv = chanURI->SchemeIs("about", &isAbout);
NS_ENSURE_SUCCESS(rv, false);
if (isAbout) {
nsCOMPtr<nsIURI> loopURI;
rv = NS_NewURI(getter_AddRefs(loopURI), "about:loopconversation");
NS_ENSURE_SUCCESS(rv, false);
rv = chanURI->EqualsExceptRef(loopURI, &isLoop);
NS_ENSURE_SUCCESS(rv, false);
if (!isLoop) {
rv = NS_NewURI(getter_AddRefs(loopURI), "about:looppanel");
NS_ENSURE_SUCCESS(rv, false);
rv = chanURI->EqualsExceptRef(loopURI, &isLoop);
NS_ENSURE_SUCCESS(rv, false);
}
}
return isLoop;
}
void void
nsDocument::ApplySettingsFromCSP(bool aSpeculative) nsDocument::ApplySettingsFromCSP(bool aSpeculative)
{ {
@ -2770,9 +2743,6 @@ nsDocument::InitCSP(nsIChannel* aChannel)
principal->GetAddonId(addonId); principal->GetAddonId(addonId);
bool applyAddonCSP = !addonId.IsEmpty(); bool applyAddonCSP = !addonId.IsEmpty();
// Check if this is part of the Loop/Hello service
bool applyLoopCSP = IsLoopDocument(aChannel);
// Check if this is a signed content to apply default CSP. // Check if this is a signed content to apply default CSP.
bool applySignedContentCSP = false; bool applySignedContentCSP = false;
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo(); nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
@ -2784,7 +2754,6 @@ nsDocument::InitCSP(nsIChannel* aChannel)
if (!applyAppDefaultCSP && if (!applyAppDefaultCSP &&
!applyAppManifestCSP && !applyAppManifestCSP &&
!applyAddonCSP && !applyAddonCSP &&
!applyLoopCSP &&
!applySignedContentCSP && !applySignedContentCSP &&
cspHeaderValue.IsEmpty() && cspHeaderValue.IsEmpty() &&
cspROHeaderValue.IsEmpty()) { cspROHeaderValue.IsEmpty()) {
@ -2868,17 +2837,6 @@ nsDocument::InitCSP(nsIChannel* aChannel)
csp->AppendPolicy(signedContentCSP, false, false); csp->AppendPolicy(signedContentCSP, false, false);
} }
// ----- if the doc is part of Loop, apply the loop CSP
if (applyLoopCSP) {
nsAdoptingString loopCSP;
loopCSP = Preferences::GetString("loop.CSP");
NS_ASSERTION(loopCSP, "Missing loop.CSP preference");
// If the pref has been removed, we continue without setting a CSP
if (loopCSP) {
csp->AppendPolicy(loopCSP, false, false);
}
}
// ----- if there's a full-strength CSP header, apply it. // ----- if there's a full-strength CSP header, apply it.
if (!cspHeaderValue.IsEmpty()) { if (!cspHeaderValue.IsEmpty()) {
rv = CSP_AppendCSPFromHeader(csp, cspHeaderValue, false); rv = CSP_AppendCSPFromHeader(csp, cspHeaderValue, false);

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

@ -1659,7 +1659,6 @@ private:
void DoUnblockOnload(); void DoUnblockOnload();
nsresult CheckFrameOptions(); nsresult CheckFrameOptions();
bool IsLoopDocument(nsIChannel* aChannel);
nsresult InitCSP(nsIChannel* aChannel); nsresult InitCSP(nsIChannel* aChannel);
/** /**