Bug 826008: Fix type tests for constraints objects r=smaug

This commit is contained in:
Randell Jesup 2013-01-03 11:58:34 -05:00
parent 2bda0b1509
commit cda946d552

View File

@ -599,7 +599,7 @@ PeerConnectionImpl::ConvertConstraints(
// 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));
@ -622,7 +622,7 @@ 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;
@ -632,7 +632,7 @@ PeerConnectionImpl::ConvertConstraints(
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?
}