From 76f54b84d00d845d2e4aaae90c15c594976f5d90 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 2 Nov 2005 07:42:57 +0000 Subject: [PATCH] Move the BindToTree call for the document element into SetRootContent. Bug 289209, r=sicking, sr=jst, a=asa --- content/xslt/src/xslt/txMozillaTextOutput.cpp | 9 ++++----- content/xslt/src/xslt/txMozillaXMLOutput.cpp | 6 +++--- content/xslt/src/xslt/txMozillaXSLTProcessor.cpp | 6 ++++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/content/xslt/src/xslt/txMozillaTextOutput.cpp b/content/xslt/src/xslt/txMozillaTextOutput.cpp index b2818304c87..ad081e691bd 100644 --- a/content/xslt/src/xslt/txMozillaTextOutput.cpp +++ b/content/xslt/src/xslt/txMozillaTextOutput.cpp @@ -249,14 +249,13 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument, return; } - rv = rootContent->BindToTree(doc, nsnull, nsnull, PR_TRUE); + // XXXbz what to do on failure here? + rv = doc->SetRootContent(rootContent); if (NS_FAILED(rv)) { - NS_ERROR("Failed to bind root to tree"); - rootContent->UnbindFromTree(); + NS_ERROR("Failed to set root content"); return; } - - doc->SetRootContent(rootContent); + mDocument->CreateElementNS(XHTML_NSURI, NS_LITERAL_STRING("head"), diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index 3f8875d96cd..a262d57993f 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -301,7 +301,7 @@ void txMozillaXMLOutput::endElement(const nsAString& aName, const PRInt32 aNsID) nsCOMPtr document = do_QueryInterface(mNonAddedParent); if (document && !mRootContent) { mRootContent = do_QueryInterface(mCurrentNode); - mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); + // XXXbz what to do on failure here? document->SetRootContent(mRootContent); } else { @@ -493,7 +493,7 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction) mParentNode = wrapper; mRootContent = do_QueryInterface(wrapper); - mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); + // XXXbz what to do on failure here? document->SetRootContent(mRootContent); } @@ -504,7 +504,7 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction) else { if (document && currentElement && !mRootContent) { mRootContent = do_QueryInterface(mCurrentNode); - mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); + // XXXbz what to do on failure here? document->SetRootContent(mRootContent); } else { diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index ddc743c8f0f..2625308a24d 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -712,8 +712,10 @@ txMozillaXSLTProcessor::notifyError() return; } - rootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); - document->SetRootContent(rootContent); + rv = document->SetRootContent(rootContent); + if (NS_FAILED(rv)) { + return; + } nsCOMPtr text; rv = errorDocument->CreateTextNode(mErrorText, getter_AddRefs(text));