Bug 826008: Fix type tests for constraints objects r=smaug
authorRandell Jesup <rjesup@jesup.org>
Thu, 03 Jan 2013 11:58:34 -0500
changeset 126553 e1e4862d5e1d54a474ed30837966e49dc6b91d05
parent 126552 7ab62e7bf042fae28786a710cfb6dccf3b10434c
child 126554 84d3b622b3da8db3078d65e069a6cb78165e24c9
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs826008
milestone20.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 826008: Fix type tests for constraints objects r=smaug
media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp
@@ -594,17 +594,17 @@ PeerConnectionImpl::ConvertConstraints(
   const JS::Value& aConstraints, MediaConstraints* aObj, JSContext* aCx)
 {
   size_t i;
   jsval mandatory, optional;
   JSObject& constraints = aConstraints.toObject();
 
   // Mandatory constraints.
   if (JS_GetProperty(aCx, &constraints, "mandatory", &mandatory)) {
-    if (JSVAL_IS_PRIMITIVE(mandatory) && mandatory.isObject() && !JSVAL_IS_NULL(mandatory)) {
+    if (mandatory.isObject()) {
       JSObject* opts = JSVAL_TO_OBJECT(mandatory);
       JS::AutoIdArray mandatoryOpts(aCx, JS_Enumerate(aCx, opts));
 
       // Iterate over each property.
       for (i = 0; i < mandatoryOpts.length(); i++) {
         jsval option, optionName;
         if (JS_GetPropertyById(aCx, opts, mandatoryOpts[i], &option)) {
           if (JS_IdToValue(aCx, mandatoryOpts[i], &optionName)) {
@@ -617,27 +617,27 @@ PeerConnectionImpl::ConvertConstraints(
           }
         }
       }
     }
   }
 
   // Optional constraints.
   if (JS_GetProperty(aCx, &constraints, "optional", &optional)) {
-    if (JSVAL_IS_PRIMITIVE(optional) && optional.isObject() && !JSVAL_IS_NULL(optional)) {
+    if (optional.isObject()) {
       JSObject* opts = JSVAL_TO_OBJECT(optional);
       if (JS_IsArrayObject(aCx, opts)) {
         uint32_t length;
         if (!JS_GetArrayLength(aCx, opts, &length)) {
           return NS_ERROR_FAILURE;
         }
         for (i = 0; i < length; i++) {
           jsval val;
           JS_GetElement(aCx, opts, i, &val);
-          if (JSVAL_IS_PRIMITIVE(val)) {
+          if (val.isObject()) {
             // Extract name & value and store.
             // FIXME: MediaConstraints does not support optional constraints?
           }
         }
       }
     }
   }