Bug 780790: Check for NULL callbacks in getUserMedia; r=jesup
authorAnant Narayanan <anant>
Thu, 18 Oct 2012 11:31:00 -0700
changeset 110807 a441f6e0afc90dd7890bcf06afd80b1b8c811d61
parent 110806 d692e3c39a17a478fba8d552fe38f2d6711cf572
child 110808 f0dbdf4d4768afd6d40a0c015c3a47767e8098df
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjesup
bugs780790
milestone19.0a1
Bug 780790: Check for NULL callbacks in getUserMedia; r=jesup
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -670,16 +670,18 @@ MediaManager::GetUserMedia(bool aPrivile
   nsIMediaStreamOptions* aParams,
   nsIDOMGetUserMediaSuccessCallback* aOnSuccess,
   nsIDOMGetUserMediaErrorCallback* aOnError)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
   NS_ENSURE_TRUE(aParams, NS_ERROR_NULL_POINTER);
   NS_ENSURE_TRUE(aWindow, NS_ERROR_NULL_POINTER);
+  NS_ENSURE_TRUE(aOnError, NS_ERROR_NULL_POINTER);
+  NS_ENSURE_TRUE(aOnSuccess, NS_ERROR_NULL_POINTER);
 
   nsCOMPtr<nsIDOMGetUserMediaSuccessCallback> onSuccess(aOnSuccess);
   nsCOMPtr<nsIDOMGetUserMediaErrorCallback> onError(aOnError);
 
   /* Get options */
   nsresult rv;
   bool fake, audio, video, picture;
 
@@ -859,16 +861,19 @@ MediaManager::GetUserMedia(bool aPrivile
 
 nsresult
 MediaManager::GetUserMediaDevices(nsPIDOMWindow* aWindow,
   nsIGetUserMediaDevicesSuccessCallback* aOnSuccess,
   nsIDOMGetUserMediaErrorCallback* aOnError)
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
 
+  NS_ENSURE_TRUE(aOnError, NS_ERROR_NULL_POINTER);
+  NS_ENSURE_TRUE(aOnSuccess, NS_ERROR_NULL_POINTER);
+
   nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> onSuccess(aOnSuccess);
   nsCOMPtr<nsIDOMGetUserMediaErrorCallback> onError(aOnError);
 
   nsCOMPtr<nsIRunnable> gUMDRunnable = new GetUserMediaDevicesRunnable(
     onSuccess.forget(), onError.forget()
   );
 
   nsCOMPtr<nsIThread> deviceThread;