Bug 780790: Check for NULL callbacks to getUserMedia; r=jesup
☠☠ backed out by f86c9ae8f544 ☠ ☠
authorAnant Narayanan <anant@kix.in>
Thu, 18 Oct 2012 11:52:39 -0700
changeset 110824 3dfb18a29fe247144938f6a69c23e77848f58641
parent 110823 30a31da7097f1bb8d9662b2a7bd71c2d05e283ec
child 110825 f86c9ae8f544e9ac7f22bd5279a1e73d2c35f0ae
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjesup
bugs780790
milestone19.0a1
Bug 780790: Check for NULL callbacks to getUserMedia; r=jesup
dom/media/MediaManager.cpp
dom/media/bridge/IPeerConnection.idl
--- 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;
--- a/dom/media/bridge/IPeerConnection.idl
+++ b/dom/media/bridge/IPeerConnection.idl
@@ -46,17 +46,17 @@ interface IPeerConnectionObserver : nsIS
   /* When SDP is parsed and a candidate line is found this method is called.
    * It should hook back into the media transport to notify it of ICE candidates
    * listed in the SDP PeerConnectionImpl does not parse ICE candidates, just
    * pulls them out of the SDP.
    */
   void foundIceCandidate(in string candidate);
 };
 
-[scriptable, uuid(cb3f0048-1009-11e2-b822-87ee49eface7)]
+[scriptable, uuid(f6819246-f5af-40f2-ab82-e166d5da7ba0)]
 interface IPeerConnection : nsISupports
 {
   const unsigned long kHintAudio = 0x00000001;
   const unsigned long kHintVideo = 0x00000002;
 
   const long kActionNone = -1;
   const long kActionOffer = 0;
   const long kActionAnswer = 1;
@@ -68,18 +68,18 @@ interface IPeerConnection : nsISupports
   const long kIceConnected = 3;
   const long kIceFailed = 4;
 
   /* Must be called first. Observer events will be dispatched on the thread provided */
   void initialize(in IPeerConnectionObserver observer, in nsIDOMWindow window,
                   [optional] in nsIThread thread);
 
   /* JSEP calls */
-  void createOffer(in string hints);
-  void createAnswer(in string hints, in string offer);
+  void createOffer(in nsIPropertyBag2 constraints);
+  void createAnswer(in nsIPropertyBag2 constraints, in string offer);
   void setLocalDescription(in long action, in string sdp);
   void setRemoteDescription(in long action, in string sdp);
 
   /* Adds the stream created by GetUserMedia */
   void addStream(in nsIDOMMediaStream stream);
   void removeStream(in nsIDOMMediaStream stream);
   void closeStreams();