зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1082924 - Add CSP type for fetch API. r=tvyas,baku
--HG-- extra : transplant_source : i%D8%5C%7C%9D%FEQL%C1G%B8%3B2%06%AA%AE%3A%09%29%7E
This commit is contained in:
Родитель
da52e5aaa0
Коммит
a4c280a3c0
|
@ -111,6 +111,7 @@ NS_CP_ContentTypeName(uint32_t contentType)
|
|||
CASE_RETURN( TYPE_CSP_REPORT );
|
||||
CASE_RETURN( TYPE_XSLT );
|
||||
CASE_RETURN( TYPE_BEACON );
|
||||
CASE_RETURN( TYPE_FETCH );
|
||||
default:
|
||||
return "<Unknown Type>";
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef unsigned long nsContentPolicyType;
|
|||
* by launching a dialog to prompt the user for something).
|
||||
*/
|
||||
|
||||
[scriptable,uuid(b6a71698-c117-441d-86b9-480cf06e3952)]
|
||||
[scriptable,uuid(8afe3e5c-f916-48fd-8075-9579d3502e1d)]
|
||||
interface nsIContentPolicy : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -150,6 +150,12 @@ interface nsIContentPolicy : nsISupports
|
|||
*/
|
||||
const nsContentPolicyType TYPE_BEACON = 19;
|
||||
|
||||
/**
|
||||
* Indicates a load initiated by the fetch() function from the Fetch
|
||||
* specification.
|
||||
*/
|
||||
const nsContentPolicyType TYPE_FETCH = 20;
|
||||
|
||||
/* 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
|
||||
|
|
|
@ -709,6 +709,7 @@ CSP_ContentTypeToDirective(nsContentPolicyType aType)
|
|||
case nsIContentPolicy::TYPE_WEBSOCKET:
|
||||
case nsIContentPolicy::TYPE_XMLHTTPREQUEST:
|
||||
case nsIContentPolicy::TYPE_BEACON:
|
||||
case nsIContentPolicy::TYPE_FETCH:
|
||||
return CSP_CONNECT_SRC;
|
||||
|
||||
case nsIContentPolicy::TYPE_OBJECT:
|
||||
|
|
|
@ -120,7 +120,8 @@ nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
|
|||
aContentType == nsIContentPolicy::TYPE_DOCUMENT ||
|
||||
aContentType == nsIContentPolicy::TYPE_SUBDOCUMENT ||
|
||||
aContentType == nsIContentPolicy::TYPE_SCRIPT ||
|
||||
aContentType == nsIContentPolicy::TYPE_XSLT) {
|
||||
aContentType == nsIContentPolicy::TYPE_XSLT ||
|
||||
aContentType == nsIContentPolicy::TYPE_FETCH) {
|
||||
*aDecision = nsIContentPolicy::REJECT_TYPE;
|
||||
}
|
||||
|
||||
|
|
|
@ -383,6 +383,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
|
|||
// purposes and to avoid the assertion and warning for the default case.
|
||||
case TYPE_CSP_REPORT:
|
||||
case TYPE_DTD:
|
||||
case TYPE_FETCH:
|
||||
case TYPE_FONT:
|
||||
case TYPE_OBJECT:
|
||||
case TYPE_SCRIPT:
|
||||
|
|
|
@ -45,10 +45,9 @@ InternalRequest::GetRequestConstructorCopy(nsIGlobalObject* aGlobal, ErrorResult
|
|||
copy->mOrigin = NS_ConvertUTF16toUTF8(location.mOrigin);
|
||||
}
|
||||
|
||||
copy->mContext = nsIContentPolicy::TYPE_FETCH;
|
||||
copy->mMode = mMode;
|
||||
copy->mCredentialsMode = mCredentialsMode;
|
||||
// FIXME(nsm): Add ContentType fetch to nsIContentPolicy and friends.
|
||||
// Then set copy's mContext to that.
|
||||
return copy.forget();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче