Bug 1312003 - Add some missing return value checks to JSAPI tests. r=arai

--HG--
extra : rebase_source : f54e7b35e1edb9384846e80d8f41f628dc9b79db
This commit is contained in:
Jan de Mooij 2016-10-28 12:09:24 +02:00
parent 1e930b3c1b
commit 865eb293ab
4 changed files with 10 additions and 10 deletions

View File

@ -23,7 +23,7 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
CHECK(buf_len1 = JS_NewArrayBuffer(cx, sizes[0]));
CHECK(tarray_len1 = JS_NewInt32ArrayWithBuffer(cx, testBuf[0], 0, -1));
JS_SetElement(cx, testArray[0], 0, MAGIC_VALUE_1);
CHECK(JS_SetElement(cx, testArray[0], 0, MAGIC_VALUE_1));
// Many-element ArrayBuffer (uses dynamic storage)
CHECK(buf_len200 = JS_NewArrayBuffer(cx, 200 * sizeof(uint32_t)));
@ -38,9 +38,9 @@ BEGIN_TEST(testArrayBuffer_bug720949_steal)
// Byte lengths should all agree
CHECK(JS_IsArrayBufferObject(obj));
CHECK_EQUAL(JS_GetArrayBufferByteLength(obj), size);
JS_GetProperty(cx, obj, "byteLength", &v);
CHECK(JS_GetProperty(cx, obj, "byteLength", &v));
CHECK(v.isInt32(size));
JS_GetProperty(cx, view, "byteLength", &v);
CHECK(JS_GetProperty(cx, view, "byteLength", &v));
CHECK(v.isInt32(size));
// Modifying the underlying data should update the value returned through the view

View File

@ -15,11 +15,11 @@ BEGIN_TEST(testException_bug860435)
CHECK(fun.isObject());
JS::RootedValue v(cx);
JS_CallFunctionValue(cx, global, fun, JS::HandleValueArray::empty(), &v);
CHECK(JS_CallFunctionValue(cx, global, fun, JS::HandleValueArray::empty(), &v));
CHECK(v.isObject());
JS::RootedObject obj(cx, &v.toObject());
JS_GetProperty(cx, obj, "stack", &v);
CHECK(JS_GetProperty(cx, obj, "stack", &v));
CHECK(v.isString());
return true;
}

View File

@ -22,7 +22,7 @@ BEGIN_TEST(testForceLexicalInitialization)
JS::RootedId id(cx, NameToId(name));
unsigned attrs = JSPROP_ENUMERATE | JSPROP_PERMANENT;
NativeDefineProperty(cx, env, id, uninitialized, nullptr, nullptr, attrs);
CHECK(NativeDefineProperty(cx, env, id, uninitialized, nullptr, nullptr, attrs));
// Verify that "foopi" is uninitialized
const JS::Value v = env->getSlot(env->lookup(cx, id)->slot());

View File

@ -174,7 +174,7 @@ TestArrayFromBuffer(JSContext* cx)
// Make sure all 3 views reflect the same buffer at the expected locations
JS::RootedValue v(cx, JS::Int32Value(39));
JS_SetElement(cx, array, 0, v);
CHECK(JS_SetElement(cx, array, 0, v));
JS::RootedValue v2(cx);
CHECK(JS_GetElement(cx, array, 0, &v2));
CHECK_SAME(v, v2);
@ -190,7 +190,7 @@ TestArrayFromBuffer(JSContext* cx)
}
v.setInt32(40);
JS_SetElement(cx, array, elts / 2, v);
CHECK(JS_SetElement(cx, array, elts / 2, v));
CHECK(JS_GetElement(cx, array, elts / 2, &v2));
CHECK_SAME(v, v2);
CHECK(JS_GetElement(cx, ofsArray, 0, &v2));
@ -205,7 +205,7 @@ TestArrayFromBuffer(JSContext* cx)
}
v.setInt32(41);
JS_SetElement(cx, array, elts - 1, v);
CHECK(JS_SetElement(cx, array, elts - 1, v));
CHECK(JS_GetElement(cx, array, elts - 1, &v2));
CHECK_SAME(v, v2);
CHECK(JS_GetElement(cx, ofsArray, elts / 2 - 1, &v2));
@ -226,7 +226,7 @@ TestArrayFromBuffer(JSContext* cx)
/* The copy should not see changes in the original */
v2.setInt32(42);
JS_SetElement(cx, array, 0, v2);
CHECK(JS_SetElement(cx, array, 0, v2));
CHECK(JS_GetElement(cx, copy, 0, &v2));
CHECK_SAME(v2, v); /* v is still the original value from 'array' */