зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1396798: Do not block toplevel data: navigation to image (except svgs). r=smaug
This commit is contained in:
Родитель
2f7c2e54fc
Коммит
1e7caa84a1
|
@ -46,13 +46,17 @@ nsContentSecurityManager::AllowTopLevelNavigationToDataURI(
|
|||
if (!isDataURI) {
|
||||
return true;
|
||||
}
|
||||
// Whitelist data: images as long as they are not SVGs
|
||||
nsAutoCString filePath;
|
||||
aURI->GetFilePath(filePath);
|
||||
if (StringBeginsWith(filePath, NS_LITERAL_CSTRING("image/")) &&
|
||||
!StringBeginsWith(filePath, NS_LITERAL_CSTRING("image/svg+xml"))) {
|
||||
return true;
|
||||
}
|
||||
if (!aLoadFromExternal &&
|
||||
nsContentUtils::IsSystemPrincipal(aTriggeringPrincipal)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAutoCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
NS_ConvertUTF8toUTF16 specUTF16(aURI->GetSpecOrDefault());
|
||||
if (specUTF16.Length() > 50) {
|
||||
specUTF16.Truncate(50);
|
||||
|
|
Загрузка…
Ссылка в новой задаче