Bug 968520 - Add mozilla::fallible to FallibleArray calls in tests. r=froydnj
--- a/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
+++ b/xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
@@ -53,17 +53,17 @@ RunTest(JSRuntime* rt, JSContext* cx, Ar
*/
RootedValue value(cx);
const char* property = "foo";
for (size_t i = 0; i < ElementCount; ++i) {
RootedObject obj(cx, JS_NewPlainObject(cx));
ASSERT_FALSE(JS::ObjectIsTenured(obj));
value = Int32Value(i);
ASSERT_TRUE(JS_SetProperty(cx, obj, property, value));
- array->AppendElement(obj);
+ ASSERT_TRUE(array->AppendElement(obj, fallible));
}
/*
* If postbarriers are not working, we will crash here when we try to mark
* objects that have been moved to the tenured heap.
*/
JS_GC(rt);
--- a/xpcom/tests/TestTArray.cpp
+++ b/xpcom/tests/TestTArray.cpp
@@ -1006,17 +1006,17 @@ static bool test_fallible()
// Allocate a bunch of 128MB arrays. Larger allocations will fail on some
// platforms without actually hitting OOM.
//
// 36 * 128MB > 4GB, so we should definitely OOM by the 36th array.
const unsigned numArrays = 36;
FallibleTArray<char> arrays[numArrays];
for (size_t i = 0; i < numArrays; i++) {
- bool success = arrays[i].SetCapacity(128 * 1024 * 1024);
+ bool success = arrays[i].SetCapacity(128 * 1024 * 1024, fallible);
if (!success) {
// We got our OOM. Check that it didn't come too early.
if (i < 8) {
printf("test_fallible: Got OOM on iteration %d. Too early!\n", int(i));
return false;
}
return true;
}
@@ -1107,17 +1107,17 @@ static bool test_SetLengthAndRetainStora
pre fauto post; \
pre i post; \
pre iauto post; \
pre t post; \
pre tauto post; \
} while (0)
// Setup test arrays.
- FOR_EACH(;, .SetLength(N));
+ FOR_EACH(;, .SetLength(N, fallible));
for (int n = 0; n < N; ++n) {
FOR_EACH(;, [n] = n);
}
void* initial_Hdrs[] = {
static_cast<BufAccessor<FallibleTArray<int> >&>(f).GetHdr(),
static_cast<BufAccessor<AutoFallibleTArray<int, N> >&>(fauto).GetHdr(),
static_cast<BufAccessor<InfallibleTArray<int> >&>(i).GetHdr(),