Bug 1055750 - Part 1 - Add content policy TYPE_IMAGESET. r=tanvi

This commit is contained in:
John Schoenick 2014-08-19 14:12:34 -07:00
Родитель 86ed08b752
Коммит 4359f2ad3c
6 изменённых файлов: 13 добавлений и 3 удалений

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

@ -112,6 +112,7 @@ NS_CP_ContentTypeName(uint32_t contentType)
CASE_RETURN( TYPE_XSLT );
CASE_RETURN( TYPE_BEACON );
CASE_RETURN( TYPE_FETCH );
CASE_RETURN( TYPE_IMAGESET );
default:
return "<Unknown Type>";
}

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

@ -24,7 +24,7 @@ typedef unsigned long nsContentPolicyType;
* by launching a dialog to prompt the user for something).
*/
[scriptable,uuid(8afe3e5c-f916-48fd-8075-9579d3502e1d)]
[scriptable,uuid(d8210e91-1970-4230-88ef-74b6fdc418cf)]
interface nsIContentPolicy : nsISupports
{
/**
@ -156,6 +156,11 @@ interface nsIContentPolicy : nsISupports
*/
const nsContentPolicyType TYPE_FETCH = 20;
/**
* Indicates a <img srcset> or <picture> request.
*/
const nsContentPolicyType TYPE_IMAGESET = 21;
/* When adding new content types, please update nsContentBlocker,
* NS_CP_ContentTypeName, nsCSPContext, all nsIContentPolicy
* implementations, and other things that are not listed here that are

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

@ -681,6 +681,7 @@ CSP_ContentTypeToDirective(nsContentPolicyType aType)
{
switch (aType) {
case nsIContentPolicy::TYPE_IMAGE:
case nsIContentPolicy::TYPE_IMAGESET:
return CSP_IMG_SRC;
case nsIContentPolicy::TYPE_SCRIPT:

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

@ -96,7 +96,8 @@ nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
aContentLocation);
}
}
} else if (aContentType == nsIContentPolicy::TYPE_IMAGE &&
} else if ((aContentType == nsIContentPolicy::TYPE_IMAGE ||
aContentType == nsIContentPolicy::TYPE_IMAGESET) &&
doc->GetDocumentURI()) {
// Check for (& disallow) recursive image-loads
bool isRecursiveLoad;

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

@ -381,6 +381,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
// Active content (or content with a low value/risk-of-blocking ratio)
// that has been explicitly evaluated; listed here for documentation
// purposes and to avoid the assertion and warning for the default case.
case TYPE_IMAGESET:
case TYPE_CSP_REPORT:
case TYPE_DTD:
case TYPE_FETCH:

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

@ -42,7 +42,7 @@ nsWebBrowserContentPolicy::ShouldLoad(uint32_t contentType,
if (!shell) {
return NS_OK;
}
nsresult rv;
bool allowed = true;
@ -60,6 +60,7 @@ nsWebBrowserContentPolicy::ShouldLoad(uint32_t contentType,
break;
#endif
case nsIContentPolicy::TYPE_IMAGE:
case nsIContentPolicy::TYPE_IMAGESET:
rv = shell->GetAllowImages(&allowed);
break;
default: