зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445140 part 1. Remove the XPCOM-ish version of NS_NewDOMDocumentType. r=mystor
MozReview-Commit-ID: 6sEFIfMgqet
This commit is contained in:
Родитель
3b452e5a1b
Коммит
633cf0f02a
|
@ -60,7 +60,7 @@ DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
|
|||
// Indicate that there is no internal subset (not just an empty one)
|
||||
RefPtr<DocumentType> docType =
|
||||
NS_NewDOMDocumentType(mOwner->NodeInfoManager(), name, aPublicId,
|
||||
aSystemId, VoidString(), aRv);
|
||||
aSystemId, VoidString());
|
||||
return docType.forget();
|
||||
}
|
||||
|
||||
|
@ -141,16 +141,13 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
|||
|
||||
NS_ENSURE_STATE(mOwner);
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentType> doctype;
|
||||
// Indicate that there is no internal subset (not just an empty one)
|
||||
nsresult rv = NS_NewDOMDocumentType(getter_AddRefs(doctype),
|
||||
mOwner->NodeInfoManager(),
|
||||
nsGkAtoms::html, // aName
|
||||
EmptyString(), // aPublicId
|
||||
EmptyString(), // aSystemId
|
||||
VoidString()); // aInternalSubset
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<DocumentType> doctype =
|
||||
NS_NewDOMDocumentType(mOwner->NodeInfoManager(),
|
||||
nsGkAtoms::html, // aName
|
||||
EmptyString(), // aPublicId
|
||||
EmptyString(), // aSystemId
|
||||
VoidString()); // aInternalSubset
|
||||
|
||||
nsCOMPtr<nsIGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptObject);
|
||||
|
@ -158,12 +155,12 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
|||
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = NS_NewDOMDocument(getter_AddRefs(document),
|
||||
EmptyString(), EmptyString(),
|
||||
doctype, mDocumentURI, mBaseURI,
|
||||
mOwner->NodePrincipal(),
|
||||
true, scriptHandlingObject,
|
||||
DocumentFlavorLegacyGuess);
|
||||
nsresult rv = NS_NewDOMDocument(getter_AddRefs(document),
|
||||
EmptyString(), EmptyString(),
|
||||
doctype, mDocumentURI, mBaseURI,
|
||||
mOwner->NodePrincipal(),
|
||||
true, scriptHandlingObject,
|
||||
DocumentFlavorLegacyGuess);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
|
||||
|
||||
|
|
|
@ -18,33 +18,14 @@
|
|||
#include "nsWrapperCacheInlines.h"
|
||||
#include "mozilla/dom/DocumentTypeBinding.h"
|
||||
|
||||
nsresult
|
||||
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||
nsNodeInfoManager *aNodeInfoManager,
|
||||
nsAtom *aName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
const nsAString& aInternalSubset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocType);
|
||||
mozilla::ErrorResult rv;
|
||||
*aDocType = NS_NewDOMDocumentType(aNodeInfoManager, aName, aPublicId,
|
||||
aSystemId, aInternalSubset, rv).take();
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::dom::DocumentType>
|
||||
NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
|
||||
nsAtom *aName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
const nsAString& aInternalSubset,
|
||||
mozilla::ErrorResult& rv)
|
||||
const nsAString& aInternalSubset)
|
||||
{
|
||||
if (!aName) {
|
||||
rv.Throw(NS_ERROR_INVALID_POINTER);
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(aName, "Must have a name");
|
||||
|
||||
already_AddRefed<mozilla::dom::NodeInfo> ni =
|
||||
aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentTypeNodeName, nullptr,
|
||||
|
|
|
@ -87,15 +87,6 @@ protected:
|
|||
|
||||
already_AddRefed<mozilla::dom::DocumentType>
|
||||
NS_NewDOMDocumentType(nsNodeInfoManager* aNodeInfoManager,
|
||||
nsAtom *aName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
const nsAString& aInternalSubset,
|
||||
mozilla::ErrorResult& rv);
|
||||
|
||||
nsresult
|
||||
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||
nsNodeInfoManager* aNodeInfoManager,
|
||||
nsAtom *aName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
|
|
|
@ -137,12 +137,6 @@ public:
|
|||
protected:
|
||||
friend class nsIDocument;
|
||||
friend class nsXULPrototypeDocument;
|
||||
friend nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** ,
|
||||
nsNodeInfoManager *,
|
||||
nsAtom *,
|
||||
const nsAString& ,
|
||||
const nsAString& ,
|
||||
const nsAString& );
|
||||
|
||||
/**
|
||||
* Sets the principal of the document this nodeinfo manager belongs to.
|
||||
|
|
|
@ -8,14 +8,12 @@
|
|||
#include "nsXMLContentSink.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsIDOMComment.h"
|
||||
#include "DocumentType.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsCRT.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
|
@ -55,6 +53,7 @@
|
|||
#include "nsTextNode.h"
|
||||
#include "mozilla/dom/CDATASection.h"
|
||||
#include "mozilla/dom/Comment.h"
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "mozilla/dom/ProcessingInstruction.h"
|
||||
|
@ -1178,28 +1177,20 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
|
|||
{
|
||||
FlushText();
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(mDocument, "Shouldn't get here from a document fragment");
|
||||
|
||||
RefPtr<nsAtom> name = NS_Atomize(aName);
|
||||
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Create a new doctype node
|
||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||
rv = NS_NewDOMDocumentType(getter_AddRefs(docType), mNodeInfoManager,
|
||||
name, aPublicId, aSystemId, aSubset);
|
||||
if (NS_FAILED(rv) || !docType) {
|
||||
return rv;
|
||||
}
|
||||
RefPtr<DocumentType> docType = NS_NewDOMDocumentType(mNodeInfoManager,
|
||||
name, aPublicId,
|
||||
aSystemId, aSubset);
|
||||
|
||||
MOZ_ASSERT(!aCatalogData, "Need to add back support for catalog style "
|
||||
"sheets");
|
||||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(docType);
|
||||
NS_ASSERTION(content, "doctype isn't content?");
|
||||
|
||||
mDocumentChildren.AppendElement(content);
|
||||
mDocumentChildren.AppendElement(docType);
|
||||
DidAddContent();
|
||||
return DidProcessATokenImpl();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "nsCharsetSource.h"
|
||||
#include "nsIRefreshURI.h"
|
||||
|
@ -28,6 +27,7 @@
|
|||
#include "nsIDocumentTransformer.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/css/Loader.h"
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ScriptLoader.h"
|
||||
#include "mozilla/Encoding.h"
|
||||
|
@ -885,8 +885,6 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, int32_t aNsID,
|
|||
qName.Assign(aName);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentType> documentType;
|
||||
|
||||
nsresult rv = nsContentUtils::CheckQName(qName);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
RefPtr<nsAtom> doctypeName = NS_Atomize(qName);
|
||||
|
@ -895,16 +893,14 @@ txMozillaXMLOutput::createResultDocument(const nsAString& aName, int32_t aNsID,
|
|||
}
|
||||
|
||||
// Indicate that there is no internal subset (not just an empty one)
|
||||
rv = NS_NewDOMDocumentType(getter_AddRefs(documentType),
|
||||
mNodeInfoManager,
|
||||
doctypeName,
|
||||
mOutputFormat.mPublicId,
|
||||
mOutputFormat.mSystemId,
|
||||
VoidString());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
RefPtr<DocumentType> documentType =
|
||||
NS_NewDOMDocumentType(mNodeInfoManager,
|
||||
doctypeName,
|
||||
mOutputFormat.mPublicId,
|
||||
mOutputFormat.mSystemId,
|
||||
VoidString());
|
||||
|
||||
nsCOMPtr<nsIContent> docType = do_QueryInterface(documentType);
|
||||
rv = mDocument->AppendChildTo(docType, true);
|
||||
rv = mDocument->AppendChildTo(documentType, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsIDOMDocumentType.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
|
@ -31,6 +30,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsEscape.h"
|
||||
#include "mozilla/dom/Comment.h"
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
|
@ -736,16 +736,13 @@ nsHtml5TreeOperation::AppendDoctypeToDocument(nsAtom* aName,
|
|||
{
|
||||
// Adapted from nsXMLContentSink
|
||||
// Create a new doctype node
|
||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||
NS_NewDOMDocumentType(getter_AddRefs(docType),
|
||||
aBuilder->GetNodeInfoManager(),
|
||||
aName,
|
||||
aPublicId,
|
||||
aSystemId,
|
||||
VoidString());
|
||||
NS_ASSERTION(docType, "Doctype creation failed.");
|
||||
nsCOMPtr<nsIContent> asContent = do_QueryInterface(docType);
|
||||
return AppendToDocument(asContent, aBuilder);
|
||||
RefPtr<dom::DocumentType> docType =
|
||||
NS_NewDOMDocumentType(aBuilder->GetNodeInfoManager(),
|
||||
aName,
|
||||
aPublicId,
|
||||
aSystemId,
|
||||
VoidString());
|
||||
return AppendToDocument(docType, aBuilder);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
|
|
Загрузка…
Ссылка в новой задаче