diff --git a/content/xslt/src/xslt/txMozillaTextOutput.cpp b/content/xslt/src/xslt/txMozillaTextOutput.cpp index 921dc3cc8932..9cb6da4ee4c8 100644 --- a/content/xslt/src/xslt/txMozillaTextOutput.cpp +++ b/content/xslt/src/xslt/txMozillaTextOutput.cpp @@ -249,7 +249,12 @@ void txMozillaTextOutput::createResultDocument(nsIDOMDocument* aSourceDocument, return; } - rootContent->SetDocument(doc, PR_FALSE, PR_TRUE); + rv = rootContent->BindToTree(doc, nsnull, nsnull, PR_TRUE); + if (NS_FAILED(rv)) { + NS_ERROR("Failed to bind root to tree"); + rootContent->UnbindFromTree(); + return rv; + } doc->SetRootContent(rootContent); diff --git a/content/xslt/src/xslt/txMozillaXMLOutput.cpp b/content/xslt/src/xslt/txMozillaXMLOutput.cpp index f942399565ee..3f8875d96cd1 100644 --- a/content/xslt/src/xslt/txMozillaXMLOutput.cpp +++ b/content/xslt/src/xslt/txMozillaXMLOutput.cpp @@ -296,12 +296,12 @@ void txMozillaXMLOutput::endElement(const nsAString& aName, const PRInt32 aNsID) // up the tree // we can't use GetParentNode to check if mCurrentNode is the // "non-added node" since that does strange things when we've called - // SetDocument manually + // BindToTree manually if (mCurrentNode == mNonAddedNode) { nsCOMPtr document = do_QueryInterface(mNonAddedParent); if (document && !mRootContent) { mRootContent = do_QueryInterface(mCurrentNode); - mRootContent->SetDocument(document, PR_FALSE, PR_TRUE); + mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); document->SetRootContent(mRootContent); } else { @@ -455,11 +455,6 @@ void txMozillaXMLOutput::startElement(const nsAString& aName, ssle->InitStyleLinkElement(nsnull, PR_FALSE); ssle->SetEnableUpdates(PR_FALSE); } - - nsCOMPtr cont = do_QueryInterface(element); - NS_ASSERTION(cont, "element doesn't implement nsIContent"); - nsCOMPtr doc = do_QueryInterface(mDocument); - cont->SetDocument(doc, PR_FALSE, PR_TRUE); } mParentNode = mCurrentNode; mCurrentNode = do_QueryInterface(element); @@ -498,7 +493,7 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction) mParentNode = wrapper; mRootContent = do_QueryInterface(wrapper); - mRootContent->SetDocument(document, PR_FALSE, PR_TRUE); + mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); document->SetRootContent(mRootContent); } @@ -509,7 +504,7 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction) else { if (document && currentElement && !mRootContent) { mRootContent = do_QueryInterface(mCurrentNode); - mRootContent->SetDocument(document, PR_FALSE, PR_TRUE); + mRootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); document->SetRootContent(mRootContent); } else { diff --git a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp index dfbf39d3a324..ddc743c8f0fe 100644 --- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp +++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp @@ -712,7 +712,7 @@ txMozillaXSLTProcessor::notifyError() return; } - rootContent->SetDocument(document, PR_FALSE, PR_TRUE); + rootContent->BindToTree(document, nsnull, nsnull, PR_TRUE); document->SetRootContent(rootContent); nsCOMPtr text;