зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1227554 - Default to NullPrincipal if doc is not available within expatdriver. r=bz
This commit is contained in:
Родитель
0677db9d9a
Коммит
bbf91a3b0c
|
@ -29,6 +29,7 @@
|
|||
#include "nsXPCOMCIDInternal.h"
|
||||
#include "nsUnicharInputStream.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsNullPrincipal.h"
|
||||
|
||||
#include "mozilla/Logging.h"
|
||||
|
||||
|
@ -789,14 +790,21 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const char16_t* aFPIStr,
|
|||
NS_ASSERTION(mSink == nsCOMPtr<nsIExpatSink>(do_QueryInterface(mOriginalSink)),
|
||||
"In nsExpatDriver::OpenInputStreamFromExternalDTD: "
|
||||
"mOriginalSink not the same object as mSink?");
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsCOMPtr<nsIPrincipal> loadingPrincipal;
|
||||
if (mOriginalSink) {
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
doc = do_QueryInterface(mOriginalSink->GetTarget());
|
||||
if (doc) {
|
||||
loadingPrincipal = doc->NodePrincipal();
|
||||
}
|
||||
}
|
||||
if (!loadingPrincipal) {
|
||||
loadingPrincipal = nsNullPrincipal::Create();
|
||||
NS_ENSURE_TRUE(loadingPrincipal, NS_ERROR_FAILURE);
|
||||
}
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
uri,
|
||||
doc,
|
||||
loadingPrincipal,
|
||||
nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS |
|
||||
nsILoadInfo::SEC_ALLOW_CHROME,
|
||||
nsIContentPolicy::TYPE_DTD);
|
||||
|
|
Загрузка…
Ссылка в новой задаче