Bug 1038756: Callsites creating a channel in /dom/xslt/ (r=peterv)

This commit is contained in:
Christoph Kerschbaumer 2014-09-21 09:39:41 -07:00
Родитель fad0c74a59
Коммит c2b798daee
2 изменённых файлов: 14 добавлений и 8 удалений

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

@ -59,16 +59,17 @@ URIUtils::ResetWithSource(nsIDocument *aNewDoc, nsIDOMNode *aSourceNode)
nsCOMPtr<nsIChannel> channel = sourceDoc->GetChannel(); nsCOMPtr<nsIChannel> channel = sourceDoc->GetChannel();
if (!channel) { if (!channel) {
// Need to synthesize one // Need to synthesize one
if (NS_FAILED(NS_NewChannel(getter_AddRefs(channel), nsresult rv = NS_NewChannel(getter_AddRefs(channel),
sourceDoc->GetDocumentURI(), sourceDoc->GetDocumentURI(),
nullptr, sourceDoc,
loadGroup))) { nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OTHER,
nullptr, // aChannelPolicy
loadGroup);
if (NS_FAILED(rv)) {
return; return;
} }
nsCOMPtr<nsILoadInfo> loadInfo =
new LoadInfo(sourcePrincipal, LoadInfo::eInheritPrincipal,
LoadInfo::eNotSandboxed);
channel->SetLoadInfo(loadInfo);
} }
aNewDoc->Reset(channel, loadGroup); aNewDoc->Reset(channel, loadGroup);
aNewDoc->SetPrincipal(sourcePrincipal); aNewDoc->SetPrincipal(sourcePrincipal);

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

@ -456,7 +456,12 @@ txCompileObserver::startLoad(nsIURI* aUri, txStylesheetCompiler* aCompiler,
nsIPrincipal* aReferrerPrincipal) nsIPrincipal* aReferrerPrincipal)
{ {
nsCOMPtr<nsIChannel> channel; nsCOMPtr<nsIChannel> channel;
nsresult rv = NS_NewChannel(getter_AddRefs(channel), aUri); nsresult rv = NS_NewChannel(getter_AddRefs(channel),
aUri,
aReferrerPrincipal,
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_STYLESHEET);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
channel->SetLoadGroup(mLoadGroup); channel->SetLoadGroup(mLoadGroup);