Bug 667490 - EventSource should use the same nsIContentPolicy type as XHR, r=dveditz

This commit is contained in:
Olli Pettay 2011-10-31 14:48:50 +02:00
Родитель 603f7fd435
Коммит dc322a3cd5
2 изменённых файлов: 4 добавлений и 3 удалений

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

@ -112,9 +112,10 @@ interface nsIContentPolicy : nsISupports
const unsigned long TYPE_PING = 10;
/**
* Indicates an XMLHttpRequest. Also used for document.load.
* Indicates an XMLHttpRequest. Also used for document.load and for EventSource.
*/
const unsigned long TYPE_XMLHTTPREQUEST = 11;
const unsigned long TYPE_DATAREQUEST = 11; // alias
/**
* Indicates a request by a plugin.

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

@ -872,7 +872,7 @@ nsEventSource::InitChannelAndRequestEventSource()
if (csp) {
channelPolicy = do_CreateInstance("@mozilla.org/nschannelpolicy;1");
channelPolicy->SetContentSecurityPolicy(csp);
channelPolicy->SetLoadType(nsIContentPolicy::TYPE_SCRIPT);
channelPolicy->SetLoadType(nsIContentPolicy::TYPE_DATAREQUEST);
}
nsCOMPtr<nsIChannel> channel;
@ -1203,7 +1203,7 @@ nsEventSource::CheckCanRequestSrc(nsIURI* aSrc)
rv = CheckInnerWindowCorrectness();
NS_ENSURE_SUCCESS(rv, false);
PRInt16 shouldLoad = nsIContentPolicy::ACCEPT;
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_SCRIPT,
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_DATAREQUEST,
srcToTest,
mPrincipal,
doc,