Bug 1363658 - Serializing doctypes should omit internal subset; r=hsivonen

Changes to match spec, Chrome, and Safari.  The spec was discussed and
is what we want -- we already expand entities from the internal subset
when parsing, so there's no need to remember their definitions.  Indeed
it seems like it would make sense to alter the parser to throw away the
internal subset entirely at the end of parsing.

MozReview-Commit-ID: LDvYAqSZkgE

--HG--
extra : rebase_source : 928722b51d931a3c1ce358b2346c5e535bfa16df
This commit is contained in:
Aryeh Gregor 2017-08-03 15:33:55 +03:00
parent 7d661d1755
commit b39b65ff8e
2 changed files with 1 additions and 14 deletions

View File

@ -366,7 +366,7 @@ nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
nsCOMPtr<nsIDOMDocumentType> docType = do_QueryInterface(aDocType);
NS_ENSURE_ARG(docType);
nsresult rv;
nsAutoString name, publicId, systemId, internalSubset;
nsAutoString name, publicId, systemId;
rv = docType->GetName(name);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
@ -374,8 +374,6 @@ nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
rv = docType->GetSystemId(systemId);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
rv = docType->GetInternalSubset(internalSubset);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
NS_ENSURE_TRUE(MaybeAddNewlineForRootNode(aStr), NS_ERROR_OUT_OF_MEMORY);
@ -421,12 +419,6 @@ nsXMLContentSerializer::AppendDoctype(nsIContent* aDocType,
NS_ENSURE_TRUE(AppendToString(quote, aStr), NS_ERROR_OUT_OF_MEMORY);
}
if (!internalSubset.IsEmpty()) {
NS_ENSURE_TRUE(AppendToString(NS_LITERAL_STRING(" ["), aStr), NS_ERROR_OUT_OF_MEMORY);
NS_ENSURE_TRUE(AppendToString(internalSubset, aStr), NS_ERROR_OUT_OF_MEMORY);
NS_ENSURE_TRUE(AppendToString(char16_t(']'), aStr), NS_ERROR_OUT_OF_MEMORY);
}
NS_ENSURE_TRUE(AppendToString(kGreaterThan, aStr), NS_ERROR_OUT_OF_MEMORY);
MaybeFlagNewlineForRootNode(aDocType);

View File

@ -1,5 +0,0 @@
[DOMParser-parseFromString-xml-internal-subset.html]
type: testharness
[Parsing and serialization of doctype internal subset]
expected: FAIL