mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 877164, return early if nsDocument::Init fails, r=smaug
This commit is contained in:
parent
071d2f1f08
commit
304cb6502e
@ -169,20 +169,19 @@ RemoveFromAgentSheets(nsCOMArray<nsIStyleSheet> &aAgentSheets, const nsAString&
|
|||||||
nsresult
|
nsresult
|
||||||
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData)
|
NS_NewHTMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData)
|
||||||
{
|
{
|
||||||
nsHTMLDocument* doc = new nsHTMLDocument();
|
nsRefPtr<nsHTMLDocument> doc = new nsHTMLDocument();
|
||||||
NS_ENSURE_TRUE(doc, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
NS_ADDREF(doc);
|
|
||||||
nsresult rv = doc->Init();
|
nsresult rv = doc->Init();
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_RELEASE(doc);
|
*aInstancePtrResult = nullptr;
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aInstancePtrResult = doc;
|
|
||||||
doc->SetLoadedAsData(aLoadedAsData);
|
doc->SetLoadedAsData(aLoadedAsData);
|
||||||
|
doc.forget(aInstancePtrResult);
|
||||||
|
|
||||||
return rv;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||||
|
@ -173,24 +173,22 @@ NS_NewDOMDocument(nsIDOMDocument** aInstancePtrResult,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewXMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData)
|
NS_NewXMLDocument(nsIDocument** aInstancePtrResult, bool aLoadedAsData)
|
||||||
{
|
{
|
||||||
XMLDocument* doc = new XMLDocument();
|
nsRefPtr<XMLDocument> doc = new XMLDocument();
|
||||||
NS_ENSURE_TRUE(doc, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
NS_ADDREF(doc);
|
|
||||||
nsresult rv = doc->Init();
|
nsresult rv = doc->Init();
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_RELEASE(doc);
|
*aInstancePtrResult = nullptr;
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aInstancePtrResult = doc;
|
|
||||||
doc->SetLoadedAsData(aLoadedAsData);
|
doc->SetLoadedAsData(aLoadedAsData);
|
||||||
|
doc.forget(aInstancePtrResult);
|
||||||
|
|
||||||
return rv;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
Loading…
Reference in New Issue
Block a user