Bug 965413 part 11. Use a LoadInfo as needed for loading stylesheets. r=smaug

This commit is contained in:
Boris Zbarsky 2014-07-10 02:56:38 -04:00
parent b8297ece4e
commit 5717f7fbc6

View File

@ -17,6 +17,7 @@
/* loading of CSS style sheets using the network APIs */
#include "mozilla/ArrayUtils.h"
#include "mozilla/LoadInfo.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/css/Loader.h"
@ -1560,12 +1561,17 @@ Loader::LoadSheet(SheetLoadData* aLoadData, StyleSheetState aSheetState)
rv = NS_URIChainHasFlags(aLoadData->mURI,
nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT,
&inherit);
if ((NS_SUCCEEDED(rv) && inherit) ||
(nsContentUtils::URIIsLocalFile(aLoadData->mURI) &&
NS_SUCCEEDED(aLoadData->mLoaderPrincipal->
CheckMayLoad(aLoadData->mURI, false, false)))) {
channel->SetOwner(aLoadData->mLoaderPrincipal);
}
inherit =
((NS_SUCCEEDED(rv) && inherit) ||
(nsContentUtils::URIIsLocalFile(aLoadData->mURI) &&
NS_SUCCEEDED(aLoadData->mLoaderPrincipal->
CheckMayLoad(aLoadData->mURI, false, false))));
nsCOMPtr<nsILoadInfo> loadInfo =
new LoadInfo(aLoadData->mLoaderPrincipal,
inherit ?
LoadInfo::eInheritPrincipal : LoadInfo::eDontInheritPrincipal,
LoadInfo::eNotSandboxed);
channel->SetLoadInfo(loadInfo);
}
// We don't have to hold on to the stream loader. The ownership