Fix for bug 27382 (ownerDocument of orphan text and attr nodes is null). r+sr=bz

This commit is contained in:
peterv%propagandism.org 2004-08-10 20:37:26 +00:00
Родитель e1e2c6f9fa
Коммит 6226b16caf
1 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -44,6 +44,8 @@
#include "nsContentUtils.h"
#include "nsUnicharUtils.h"
#include "nsDOMString.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
//----------------------------------------------------------------------
@ -339,18 +341,23 @@ nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
NS_IMETHODIMP
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
{
nsresult result = NS_OK;
*aOwnerDocument = nsnull;
nsresult rv = NS_OK;
if (mContent) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent, &result);
if (NS_SUCCEEDED(result)) {
result = node->GetOwnerDocument(aOwnerDocument);
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent, &rv);
if (NS_SUCCEEDED(rv)) {
rv = node->GetOwnerDocument(aOwnerDocument);
}
}
else {
*aOwnerDocument = nsnull;
nsIDocument *document = mNodeInfo->GetDocument();
if (document) {
rv = CallQueryInterface(document, aOwnerDocument);
}
}
return result;
return rv;
}
NS_IMETHODIMP