mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 594767 - importNode fails when using a document created with createHTMLDocument, r=sicking, a=blocking
--HG-- extra : rebase_source : 9436d96adf3450db23ddbde74407e440fec51846
This commit is contained in:
parent
19afee8fe2
commit
2340a6d11e
@ -1431,6 +1431,8 @@ nsDOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptObject);
|
||||
|
||||
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
|
||||
|
||||
return nsContentUtils::CreateDocument(aNamespaceURI, aQualifiedName, aDoctype,
|
||||
mDocumentURI, mBaseURI, mPrincipal,
|
||||
@ -1443,31 +1445,34 @@ nsDOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
||||
{
|
||||
*aReturn = NULL;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
nsresult rv = NS_NewHTMLDocument(getter_AddRefs(doc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLDocument> HTMLdoc = do_QueryInterface(doc);
|
||||
HTMLdoc->SetCompatibilityMode(eCompatibility_FullStandards);
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentType> doctype;
|
||||
// Indicate that there is no internal subset (not just an empty one)
|
||||
nsAutoString voidString;
|
||||
voidString.SetIsVoid(true);
|
||||
rv = NS_NewDOMDocumentType(getter_AddRefs(doctype),
|
||||
NULL, // aNodeInfoManager
|
||||
mPrincipal, // aPrincipal
|
||||
nsGkAtoms::html, // aName
|
||||
NULL, // aEntities
|
||||
NULL, // aNotations
|
||||
EmptyString(), // aPublicId
|
||||
EmptyString(), // aSystemId
|
||||
voidString); // aInternalSubset
|
||||
nsresult rv = NS_NewDOMDocumentType(getter_AddRefs(doctype),
|
||||
NULL, // aNodeInfoManager
|
||||
mPrincipal, // aPrincipal
|
||||
nsGkAtoms::html, // aName
|
||||
NULL, // aEntities
|
||||
NULL, // aNotations
|
||||
EmptyString(), // aPublicId
|
||||
EmptyString(), // aSystemId
|
||||
voidString); // aInternalSubset
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIContent> doctypeAsContent = do_QueryInterface(doctype);
|
||||
rv = doc->AppendChildTo(doctypeAsContent, false);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptObject);
|
||||
|
||||
NS_ENSURE_STATE(!mScriptObject || scriptHandlingObject);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = nsContentUtils::CreateDocument(EmptyString(), EmptyString(),
|
||||
doctype, mDocumentURI, mBaseURI,
|
||||
mPrincipal, scriptHandlingObject,
|
||||
getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(document);
|
||||
|
||||
nsCOMPtr<nsIContent> root;
|
||||
rv = doc->CreateElem(NS_LITERAL_STRING("html"), NULL, kNameSpaceID_XHTML,
|
||||
@ -1505,14 +1510,6 @@ nsDOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
||||
rv = root->AppendChildTo(body, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
|
||||
do_QueryReferent(mScriptObject);
|
||||
doc->SetScriptHandlingObject(scriptHandlingObject);
|
||||
|
||||
// created documents are immediately "complete" (ready to use)
|
||||
doc->SetReadyStateInternal(nsIDocument::READYSTATE_COMPLETE);
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(doc);
|
||||
document.forget(aReturn);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -36,6 +36,8 @@ function checkDoc(title, expectedtitle, normalizedtitle) {
|
||||
is(doc.documentElement.lastChild.childNodes.length, 0);
|
||||
((!title || title.indexOf("\f") === -1) ? is : todo_is)
|
||||
(doc.title, normalizedtitle);
|
||||
doc.body.innerHTML = "foo";
|
||||
is(doc.body.innerHTML, "foo", "innerHTML should work in HTML data documents!");
|
||||
}
|
||||
checkDoc("", "", "");
|
||||
checkDoc(null, "null", "null");
|
||||
|
@ -121,9 +121,13 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
|
||||
PRBool isHTML = PR_FALSE;
|
||||
PRBool isXHTML = PR_FALSE;
|
||||
if (aDoctype) {
|
||||
nsAutoString publicId;
|
||||
nsAutoString publicId, name;
|
||||
aDoctype->GetPublicId(publicId);
|
||||
if (publicId.EqualsLiteral("-//W3C//DTD HTML 4.01//EN") ||
|
||||
if (publicId.IsEmpty()) {
|
||||
aDoctype->GetName(name);
|
||||
}
|
||||
if (name.EqualsLiteral("html") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.01//EN") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.01 Frameset//EN") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.01 Transitional//EN") ||
|
||||
publicId.EqualsLiteral("-//W3C//DTD HTML 4.0//EN") ||
|
||||
|
Loading…
Reference in New Issue
Block a user