Bug 764130 - Don't crash if NULL pointers are passed to nsIDOMRequestService methods. r=smaug
authorJustin Lebar <justin.lebar@gmail.com>
Wed, 13 Jun 2012 17:26:10 -0400
changeset 101439 cadfa20eb77eaabf3581259446e79b469f01348b
parent 101438 ee9516c7fad7f3a885f44cdbec29f7e1fbaf67a7
child 101440 32586e976b50deba4e8abd7dea93ba1321cb5057
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs764130
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 764130 - Don't crash if NULL pointers are passed to nsIDOMRequestService methods. r=smaug
dom/base/DOMRequest.cpp
--- a/dom/base/DOMRequest.cpp
+++ b/dom/base/DOMRequest.cpp
@@ -176,30 +176,33 @@ DOMRequest::UnrootResultVal()
 }
 
 NS_IMPL_ISUPPORTS1(DOMRequestService, nsIDOMRequestService)
 
 NS_IMETHODIMP
 DOMRequestService::CreateRequest(nsIDOMWindow* aWindow,
                                  nsIDOMDOMRequest** aRequest)
 {
+  NS_ENSURE_STATE(aWindow);
   NS_ADDREF(*aRequest = new DOMRequest(aWindow));
   
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMRequestService::FireSuccess(nsIDOMDOMRequest* aRequest,
                                const jsval& aResult)
 {
+  NS_ENSURE_STATE(aRequest);
   static_cast<DOMRequest*>(aRequest)->FireSuccess(aResult);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DOMRequestService::FireError(nsIDOMDOMRequest* aRequest,
                              const nsAString& aError)
 {
+  NS_ENSURE_STATE(aRequest);
   static_cast<DOMRequest*>(aRequest)->FireError(aError);
 
   return NS_OK;
 }