Bug 764130 - Don't crash if NULL pointers are passed to nsIDOMRequestService methods. r=smaug

This commit is contained in:
Justin Lebar 2012-06-13 17:26:10 -04:00
parent 7c8b40b734
commit ea21e1cad1

View File

@ -181,6 +181,7 @@ NS_IMETHODIMP
DOMRequestService::CreateRequest(nsIDOMWindow* aWindow,
nsIDOMDOMRequest** aRequest)
{
NS_ENSURE_STATE(aWindow);
NS_ADDREF(*aRequest = new DOMRequest(aWindow));
return NS_OK;
@ -190,6 +191,7 @@ NS_IMETHODIMP
DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest,
const jsval& aResult)
{
NS_ENSURE_STATE(aRequest);
static_cast<DOMRequest*>(aRequest)->FireSuccess(aResult);
return NS_OK;
@ -199,6 +201,7 @@ NS_IMETHODIMP
DOMRequestService::FireError(nsIDOMDOMRequest* aRequest,
const nsAString& aError)
{
NS_ENSURE_STATE(aRequest);
static_cast<DOMRequest*>(aRequest)->FireError(aError);
return NS_OK;