зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1844752, initialize nsNodeInfoManager::mPrincipal with the correct principal when available, r=dom-core,emilio,peterv
Differential Revision: https://phabricator.services.mozilla.com/D184219
This commit is contained in:
Родитель
3aa820e646
Коммит
de706ffb77
|
@ -2757,7 +2757,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Document)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK_WEAK_REFERENCE
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
nsresult Document::Init() {
|
||||
nsresult Document::Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
if (mCSSLoader || mStyleImageLoader || mNodeInfoManager || mScriptLoader) {
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
@ -2766,7 +2767,7 @@ nsresult Document::Init() {
|
|||
mOnloadBlocker = new OnloadBlocker();
|
||||
mStyleImageLoader = new css::ImageLoader(this);
|
||||
|
||||
mNodeInfoManager = new nsNodeInfoManager(this);
|
||||
mNodeInfoManager = new nsNodeInfoManager(this, aPrincipal);
|
||||
|
||||
// mNodeInfo keeps NodeInfoManager alive!
|
||||
mNodeInfo = mNodeInfoManager->GetDocumentNodeInfo();
|
||||
|
@ -2799,6 +2800,10 @@ nsresult Document::Init() {
|
|||
|
||||
mStyleSet = MakeUnique<ServoStyleSet>(*this);
|
||||
|
||||
if (aPrincipal) {
|
||||
SetPrincipals(aPrincipal, aPartitionedPrincipal);
|
||||
}
|
||||
|
||||
RecomputeResistFingerprinting();
|
||||
|
||||
return NS_OK;
|
||||
|
@ -12064,7 +12069,7 @@ nsresult Document::CloneDocHelper(Document* clone) const {
|
|||
clone->mIsStaticDocument = mCreatingStaticClone;
|
||||
|
||||
// Init document
|
||||
nsresult rv = clone->Init();
|
||||
nsresult rv = clone->Init(NodePrincipal(), mPartitionedPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mCreatingStaticClone) {
|
||||
|
@ -12120,7 +12125,6 @@ nsresult Document::CloneDocHelper(Document* clone) const {
|
|||
// them.
|
||||
clone->SetDocumentURI(Document::GetDocumentURI());
|
||||
clone->SetChromeXHRDocURI(mChromeXHRDocURI);
|
||||
clone->SetPrincipals(NodePrincipal(), mPartitionedPrincipal);
|
||||
clone->mActiveStoragePrincipal = mActiveStoragePrincipal;
|
||||
clone->mActiveCookiePrincipal = mActiveCookiePrincipal;
|
||||
// NOTE(emilio): Intentionally setting this to the GetDocBaseURI rather than
|
||||
|
|
|
@ -2348,7 +2348,12 @@ class Document : public nsINode,
|
|||
bool aIncludeSubdocuments,
|
||||
bool aAllowUnloadListeners = true);
|
||||
|
||||
virtual nsresult Init();
|
||||
/**
|
||||
* Pass principals if the correct ones are known when calling Init. That way
|
||||
* NodeInfoManager doesn't need to create a temporary null principal.
|
||||
*/
|
||||
virtual nsresult Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal);
|
||||
|
||||
/**
|
||||
* Notify the document that its associated ContentViewer is being destroyed.
|
||||
|
@ -5492,17 +5497,27 @@ bool IsInActiveTab(Document* aDoc);
|
|||
|
||||
// XXX These belong somewhere else
|
||||
nsresult NS_NewHTMLDocument(mozilla::dom::Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal,
|
||||
bool aLoadedAsData = false);
|
||||
|
||||
nsresult NS_NewXMLDocument(mozilla::dom::Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal,
|
||||
bool aLoadedAsData = false,
|
||||
bool aIsPlainDocument = false);
|
||||
|
||||
nsresult NS_NewSVGDocument(mozilla::dom::Document** aInstancePtrResult);
|
||||
nsresult NS_NewSVGDocument(mozilla::dom::Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal);
|
||||
|
||||
nsresult NS_NewImageDocument(mozilla::dom::Document** aInstancePtrResult);
|
||||
nsresult NS_NewImageDocument(mozilla::dom::Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal);
|
||||
|
||||
nsresult NS_NewVideoDocument(mozilla::dom::Document** aInstancePtrResult);
|
||||
nsresult NS_NewVideoDocument(mozilla::dom::Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal);
|
||||
|
||||
// Enum for requesting a particular type of document when creating a doc
|
||||
enum DocumentFlavor {
|
||||
|
|
|
@ -40,12 +40,11 @@ using mozilla::dom::NodeInfo;
|
|||
static LazyLogModule gNodeInfoManagerLeakPRLog("NodeInfoManagerLeak");
|
||||
static const uint32_t kInitialNodeInfoHashSize = 32;
|
||||
|
||||
nsNodeInfoManager::nsNodeInfoManager(mozilla::dom::Document* aDocument)
|
||||
nsNodeInfoManager::nsNodeInfoManager(mozilla::dom::Document* aDocument,
|
||||
nsIPrincipal* aPrincipal)
|
||||
: mNodeInfoHash(kInitialNodeInfoHashSize),
|
||||
mDocument(aDocument),
|
||||
mNonDocumentNodeInfos(0),
|
||||
mPrincipal(NullPrincipal::CreateWithoutOriginAttributes()),
|
||||
mDefaultPrincipal(mPrincipal),
|
||||
mTextNodeInfo(nullptr),
|
||||
mCommentNodeInfo(nullptr),
|
||||
mDocumentNodeInfo(nullptr),
|
||||
|
@ -53,6 +52,13 @@ nsNodeInfoManager::nsNodeInfoManager(mozilla::dom::Document* aDocument)
|
|||
mArena(nullptr) {
|
||||
nsLayoutStatics::AddRef();
|
||||
|
||||
if (aPrincipal) {
|
||||
mPrincipal = aPrincipal;
|
||||
} else {
|
||||
mPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
|
||||
}
|
||||
mDefaultPrincipal = mPrincipal;
|
||||
|
||||
if (gNodeInfoManagerLeakPRLog) {
|
||||
MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug,
|
||||
("NODEINFOMANAGER %p created, document=%p", this, aDocument));
|
||||
|
|
|
@ -35,7 +35,8 @@ class nsNodeInfoManager final {
|
|||
~nsNodeInfoManager();
|
||||
|
||||
public:
|
||||
explicit nsNodeInfoManager(mozilla::dom::Document* aDocument);
|
||||
explicit nsNodeInfoManager(mozilla::dom::Document* aDocument,
|
||||
nsIPrincipal* aPrincipal);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_NATIVE_CLASS(nsNodeInfoManager)
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ nsresult nsSyncLoader::LoadDocument(nsIChannel* aChannel, bool aChannelIsSync,
|
|||
|
||||
// Create document
|
||||
nsCOMPtr<Document> document;
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(document));
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(document), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Start the document load. Do this before we attach the load listener
|
||||
|
|
|
@ -145,8 +145,9 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(ImageDocument, MediaDocument,
|
|||
imgINotificationObserver,
|
||||
nsIDOMEventListener)
|
||||
|
||||
nsresult ImageDocument::Init() {
|
||||
nsresult rv = MediaDocument::Init();
|
||||
nsresult ImageDocument::Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
nsresult rv = MediaDocument::Init(aPrincipal, aPartitionedPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mShouldResize = StaticPrefs::browser_enable_automatic_image_resizing();
|
||||
|
@ -796,11 +797,13 @@ void ImageDocument::MaybeSendResultToEmbedder(nsresult aResult) {
|
|||
}
|
||||
} // namespace mozilla::dom
|
||||
|
||||
nsresult NS_NewImageDocument(mozilla::dom::Document** aResult) {
|
||||
nsresult NS_NewImageDocument(mozilla::dom::Document** aResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
auto* doc = new mozilla::dom::ImageDocument();
|
||||
NS_ADDREF(doc);
|
||||
|
||||
nsresult rv = doc->Init();
|
||||
nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(doc);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@ class ImageDocument final : public MediaDocument,
|
|||
return MediaDocumentKind::Image;
|
||||
}
|
||||
|
||||
nsresult Init() override;
|
||||
nsresult Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) override;
|
||||
|
||||
nsresult StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup, nsISupports* aContainer,
|
||||
|
|
|
@ -112,8 +112,9 @@ MediaDocument::MediaDocument()
|
|||
}
|
||||
MediaDocument::~MediaDocument() = default;
|
||||
|
||||
nsresult MediaDocument::Init() {
|
||||
nsresult rv = nsHTMLDocument::Init();
|
||||
nsresult MediaDocument::Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
nsresult rv = nsHTMLDocument::Init(aPrincipal, aPartitionedPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mIsSyntheticDocument = true;
|
||||
|
|
|
@ -29,7 +29,8 @@ class MediaDocument : public nsHTMLDocument {
|
|||
// Subclasses need to override this.
|
||||
enum MediaDocumentKind MediaDocumentKind() const override = 0;
|
||||
|
||||
virtual nsresult Init() override;
|
||||
virtual nsresult Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) override;
|
||||
|
||||
virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
||||
nsILoadGroup* aLoadGroup,
|
||||
|
|
|
@ -140,11 +140,13 @@ void VideoDocument::UpdateTitle(nsIChannel* aChannel) {
|
|||
|
||||
} // namespace mozilla::dom
|
||||
|
||||
nsresult NS_NewVideoDocument(mozilla::dom::Document** aResult) {
|
||||
nsresult NS_NewVideoDocument(mozilla::dom::Document** aResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
auto* doc = new mozilla::dom::VideoDocument();
|
||||
|
||||
NS_ADDREF(doc);
|
||||
nsresult rv = doc->Init();
|
||||
nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(doc);
|
||||
|
|
|
@ -102,10 +102,13 @@ static bool IsAsciiCompatible(const Encoding* aEncoding) {
|
|||
return aEncoding->IsAsciiCompatible() || aEncoding == ISO_2022_JP_ENCODING;
|
||||
}
|
||||
|
||||
nsresult NS_NewHTMLDocument(Document** aInstancePtrResult, bool aLoadedAsData) {
|
||||
nsresult NS_NewHTMLDocument(Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal,
|
||||
bool aLoadedAsData) {
|
||||
RefPtr<nsHTMLDocument> doc = new nsHTMLDocument();
|
||||
|
||||
nsresult rv = doc->Init();
|
||||
nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*aInstancePtrResult = nullptr;
|
||||
|
@ -138,8 +141,9 @@ JSObject* nsHTMLDocument::WrapNode(JSContext* aCx,
|
|||
return HTMLDocument_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
nsresult nsHTMLDocument::Init() {
|
||||
nsresult rv = Document::Init();
|
||||
nsresult nsHTMLDocument::Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
nsresult rv = Document::Init(aPrincipal, aPartitionedPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Now reset the compatibility mode of the CSSLoader
|
||||
|
|
|
@ -42,7 +42,8 @@ class nsHTMLDocument : public mozilla::dom::Document {
|
|||
using Document::SetDocumentURI;
|
||||
|
||||
nsHTMLDocument();
|
||||
virtual nsresult Init() override;
|
||||
virtual nsresult Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) override;
|
||||
|
||||
// Document
|
||||
virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
|
||||
|
|
|
@ -41,10 +41,12 @@ nsresult SVGDocument::Clone(dom::NodeInfo* aNodeInfo, nsINode** aResult) const {
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions
|
||||
|
||||
nsresult NS_NewSVGDocument(Document** aInstancePtrResult) {
|
||||
nsresult NS_NewSVGDocument(Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
RefPtr<SVGDocument> doc = new SVGDocument();
|
||||
|
||||
nsresult rv = doc->Init();
|
||||
nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -67,14 +67,15 @@ nsresult NS_NewDOMDocument(Document** aInstancePtrResult,
|
|||
bool isHTML = false;
|
||||
bool isXHTML = false;
|
||||
if (aFlavor == DocumentFlavorSVG) {
|
||||
rv = NS_NewSVGDocument(getter_AddRefs(d));
|
||||
rv = NS_NewSVGDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
} else if (aFlavor == DocumentFlavorHTML) {
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(d));
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
isHTML = true;
|
||||
} else if (aFlavor == DocumentFlavorXML) {
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d));
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
} else if (aFlavor == DocumentFlavorPlain) {
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d), aLoadedAsData, true);
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal,
|
||||
aLoadedAsData, true);
|
||||
} else if (aDoctype) {
|
||||
MOZ_ASSERT(aFlavor == DocumentFlavorLegacyGuess);
|
||||
nsAutoString publicId, name;
|
||||
|
@ -89,25 +90,25 @@ nsresult NS_NewDOMDocument(Document** aInstancePtrResult,
|
|||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.0//EN") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.0 Frameset//EN") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.0 Transitional//EN")) {
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(d));
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
isHTML = true;
|
||||
} else if (publicId.EqualsLiteral("-//W3C//DTD XHTML 1.0 Strict//EN") ||
|
||||
publicId.EqualsLiteral(
|
||||
"-//W3C//DTD XHTML 1.0 Transitional//EN") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD XHTML 1.0 Frameset//EN")) {
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(d));
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
isHTML = true;
|
||||
isXHTML = true;
|
||||
} else if (publicId.EqualsLiteral("-//W3C//DTD SVG 1.1//EN")) {
|
||||
rv = NS_NewSVGDocument(getter_AddRefs(d));
|
||||
rv = NS_NewSVGDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
}
|
||||
// XXX Add support for XUL documents.
|
||||
else {
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d));
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(aFlavor == DocumentFlavorLegacyGuess);
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d));
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(d), aPrincipal, aPrincipal);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -120,8 +121,6 @@ nsresult NS_NewDOMDocument(Document** aInstancePtrResult,
|
|||
}
|
||||
d->SetLoadedAsData(aLoadedAsData, /* aConsiderForMemoryReporting */ true);
|
||||
d->SetDocumentURI(aDocumentURI);
|
||||
// Must set the principal first, since SetBaseURI checks it.
|
||||
d->SetPrincipals(aPrincipal, aPrincipal);
|
||||
d->SetBaseURI(aBaseURI);
|
||||
|
||||
// We need to set the script handling object after we set the principal such
|
||||
|
@ -174,11 +173,13 @@ nsresult NS_NewDOMDocument(Document** aInstancePtrResult,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewXMLDocument(Document** aInstancePtrResult, bool aLoadedAsData,
|
||||
bool aIsPlainDocument) {
|
||||
nsresult NS_NewXMLDocument(Document** aInstancePtrResult,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal,
|
||||
bool aLoadedAsData, bool aIsPlainDocument) {
|
||||
RefPtr<XMLDocument> doc = new XMLDocument();
|
||||
|
||||
nsresult rv = doc->Init();
|
||||
nsresult rv = doc->Init(aPrincipal, aPartitionedPrincipal);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
*aInstancePtrResult = nullptr;
|
||||
|
@ -203,8 +204,9 @@ XMLDocument::XMLDocument(const char* aContentType)
|
|||
mType = eGenericXML;
|
||||
}
|
||||
|
||||
nsresult XMLDocument::Init() {
|
||||
nsresult rv = Document::Init();
|
||||
nsresult XMLDocument::Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) {
|
||||
nsresult rv = Document::Init(aPrincipal, aPartitionedPrincipal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -43,7 +43,8 @@ class XMLDocument : public Document {
|
|||
// TODO: Convert this to MOZ_CAN_RUN_SCRIPT (bug 1415230, bug 1535398)
|
||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY virtual void EndLoad() override;
|
||||
|
||||
virtual nsresult Init() override;
|
||||
virtual nsresult Init(nsIPrincipal* aPrincipal,
|
||||
nsIPrincipal* aPartitionedPrincipal) override;
|
||||
|
||||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
|
@ -61,7 +62,8 @@ class XMLDocument : public Document {
|
|||
virtual JSObject* WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
friend nsresult(::NS_NewXMLDocument)(Document**, bool, bool);
|
||||
friend nsresult(::NS_NewXMLDocument)(Document**, nsIPrincipal*, nsIPrincipal*,
|
||||
bool, bool);
|
||||
|
||||
// mChannelIsPending indicates whether we're currently asynchronously loading
|
||||
// data from mChannel. It's set to true when we first find out about the
|
||||
|
|
|
@ -123,7 +123,8 @@ nsresult txMozillaTextOutput::createResultDocument(bool aLoadedAsData) {
|
|||
*/
|
||||
|
||||
// Create the document
|
||||
nsresult rv = NS_NewXMLDocument(getter_AddRefs(mDocument), aLoadedAsData);
|
||||
nsresult rv = NS_NewXMLDocument(getter_AddRefs(mDocument), nullptr, nullptr,
|
||||
aLoadedAsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mCreatedDocument = true;
|
||||
// This should really be handled by Document::BeginLoad
|
||||
|
|
|
@ -698,12 +698,14 @@ nsresult txMozillaXMLOutput::createResultDocument(const nsAString& aName,
|
|||
|
||||
// Create the document
|
||||
if (mOutputFormat.mMethod == eHTMLOutput) {
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(mDocument), aLoadedAsData);
|
||||
rv = NS_NewHTMLDocument(getter_AddRefs(mDocument), nullptr, nullptr,
|
||||
aLoadedAsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// We should check the root name/namespace here and create the
|
||||
// appropriate document
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(mDocument), aLoadedAsData);
|
||||
rv = NS_NewXMLDocument(getter_AddRefs(mDocument), nullptr, nullptr,
|
||||
aLoadedAsData);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
// This should really be handled by Document::BeginLoad
|
||||
|
|
|
@ -972,7 +972,7 @@ void txMozillaXSLTProcessor::reportError(nsresult aResult,
|
|||
void txMozillaXSLTProcessor::notifyError() {
|
||||
nsCOMPtr<Document> document;
|
||||
{
|
||||
nsresult rv = NS_NewXMLDocument(getter_AddRefs(document));
|
||||
nsresult rv = NS_NewXMLDocument(getter_AddRefs(document), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ nsXULPrototypeDocument::nsXULPrototypeDocument()
|
|||
}
|
||||
|
||||
nsresult nsXULPrototypeDocument::Init() {
|
||||
mNodeInfoManager = new nsNodeInfoManager(nullptr);
|
||||
mNodeInfoManager = new nsNodeInfoManager(nullptr, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,8 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel,
|
|||
aCommand, aChannel, aLoadGroup, aContainer,
|
||||
[]() -> already_AddRefed<Document> {
|
||||
RefPtr<Document> doc;
|
||||
nsresult rv = NS_NewHTMLDocument(getter_AddRefs(doc));
|
||||
nsresult rv =
|
||||
NS_NewHTMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return doc.forget();
|
||||
},
|
||||
|
@ -137,7 +138,8 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel,
|
|||
aCommand, aChannel, aLoadGroup, aContainer,
|
||||
[]() -> already_AddRefed<Document> {
|
||||
RefPtr<Document> doc;
|
||||
nsresult rv = NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
nsresult rv =
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return doc.forget();
|
||||
},
|
||||
|
@ -148,7 +150,8 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel,
|
|||
aCommand, aChannel, aLoadGroup, aContainer,
|
||||
[]() -> already_AddRefed<Document> {
|
||||
RefPtr<Document> doc;
|
||||
nsresult rv = NS_NewSVGDocument(getter_AddRefs(doc));
|
||||
nsresult rv =
|
||||
NS_NewSVGDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return doc.forget();
|
||||
},
|
||||
|
@ -160,7 +163,8 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel,
|
|||
aCommand, aChannel, aLoadGroup, aContainer,
|
||||
[]() -> already_AddRefed<Document> {
|
||||
RefPtr<Document> doc;
|
||||
nsresult rv = NS_NewVideoDocument(getter_AddRefs(doc));
|
||||
nsresult rv =
|
||||
NS_NewVideoDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return doc.forget();
|
||||
},
|
||||
|
@ -172,7 +176,8 @@ nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel,
|
|||
aCommand, aChannel, aLoadGroup, aContainer,
|
||||
[]() -> already_AddRefed<Document> {
|
||||
RefPtr<Document> doc;
|
||||
nsresult rv = NS_NewImageDocument(getter_AddRefs(doc));
|
||||
nsresult rv =
|
||||
NS_NewImageDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return doc.forget();
|
||||
},
|
||||
|
@ -212,7 +217,8 @@ already_AddRefed<Document> nsContentDLF::CreateBlankDocument(
|
|||
nsIPrincipal* aPartitionedPrincipal, nsDocShell* aContainer) {
|
||||
// create a new blank HTML document
|
||||
RefPtr<Document> blankDoc;
|
||||
mozilla::Unused << NS_NewHTMLDocument(getter_AddRefs(blankDoc));
|
||||
mozilla::Unused << NS_NewHTMLDocument(getter_AddRefs(blankDoc), nullptr,
|
||||
nullptr);
|
||||
|
||||
if (!blankDoc) {
|
||||
return nullptr;
|
||||
|
|
|
@ -283,7 +283,7 @@ TEST(TestFetchPreloader, CacheNoneBeforeConsume)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -321,7 +321,7 @@ TEST(TestFetchPreloader, CacheStartBeforeConsume)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -361,7 +361,7 @@ TEST(TestFetchPreloader, CachePartOfDataBeforeConsume)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -401,7 +401,7 @@ TEST(TestFetchPreloader, CacheAllDataBeforeConsume)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -441,7 +441,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsume)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -480,7 +480,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeWithChannelError)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -519,7 +519,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeWithChannelCancel)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -562,7 +562,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeThrowFromOnStartRequest)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -602,7 +602,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeThrowFromOnDataAvailable)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -642,7 +642,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeThrowFromOnStopRequest)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -684,7 +684,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeCancelInOnStartRequest)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -727,7 +727,7 @@ TEST(TestFetchPreloader, CacheAllBeforeConsumeCancelInOnDataAvailable)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -771,7 +771,7 @@ TEST(TestFetchPreloader, CachePartlyBeforeConsumeCancelInOnDataAvailable)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -812,7 +812,7 @@ TEST(TestFetchPreloader, CachePartlyBeforeConsumeCancelInOnStartRequestAndRace)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -861,7 +861,7 @@ TEST(TestFetchPreloader, CachePartlyBeforeConsumeCancelInOnDataAvailableAndRace)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
@ -910,7 +910,7 @@ TEST(TestFetchPreloader, CachePartlyBeforeConsumeThrowFromOnStartRequestAndRace)
|
|||
RefPtr<FakeChannel> channel = new FakeChannel();
|
||||
RefPtr<FakePreloader> preloader = new FakePreloader(channel);
|
||||
RefPtr<mozilla::dom::Document> doc;
|
||||
NS_NewXMLDocument(getter_AddRefs(doc));
|
||||
NS_NewXMLDocument(getter_AddRefs(doc), nullptr, nullptr);
|
||||
|
||||
EXPECT_TRUE(NS_SUCCEEDED(
|
||||
preloader->OpenChannel(key, uri, mozilla::CORS_NONE,
|
||||
|
|
Загрузка…
Ссылка в новой задаче