Try to fix orange from e2c5f6be2148

--HG--
extra : rebase_source : 148d9a1eef794af433373002effd47c12cce6e1c
This commit is contained in:
Peter Van der Beken 2010-05-11 18:27:44 +02:00
parent 7caac1e81b
commit 00ea1d430a
3 changed files with 16 additions and 11 deletions

View File

@ -1578,10 +1578,12 @@ nsHTMLDocument::GetURL(nsAString& aURL)
}
nsIContent*
nsHTMLDocument::GetBody()
nsHTMLDocument::GetBody(nsresult *aResult)
{
Element* body = GetBodyElement();
*aResult = NS_OK;
if (body) {
// There is a body element, return that as the body.
return body;
@ -1599,20 +1601,24 @@ nsHTMLDocument::GetBody()
NS_LITERAL_STRING("frameset"));
}
return nodeList ? nodeList->GetNodeAt(0) : nsnull;
if (!nodeList) {
*aResult = NS_ERROR_OUT_OF_MEMORY;
return nsnull;
}
return nodeList->GetNodeAt(0);
}
NS_IMETHODIMP
nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody)
{
nsIContent *body = GetBody();
if (!body) {
*aBody = nsnull;
*aBody = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
nsresult rv;
nsIContent *body = GetBody(&rv);
return CallQueryInterface(body, aBody);
return body ? CallQueryInterface(body, aBody) : rv;
}
NS_IMETHODIMP

View File

@ -160,7 +160,7 @@ public:
nsIDOMNodeList **_retval);
virtual nsresult GetDocumentAllResult(const nsAString& aID,
nsISupports** aResult);
nsIContent *GetBody();
nsIContent *GetBody(nsresult *aResult);
already_AddRefed<nsContentList> GetElementsByName(const nsAString & aName)
{
nsString* elementNameData = new nsString(aName);

View File

@ -648,8 +648,7 @@ customMethodCalls = {
},
'nsIDOMHTMLDocument_GetBody': {
'thisType': 'nsHTMLDocument',
'code': ' nsIContent *result = self->GetBody();',
'canFail': False
'code': ' nsIContent *result = self->GetBody(&rv);'
},
'nsIDOMHTMLDocument_GetElementsByName': {
'thisType': 'nsHTMLDocument',