зеркало из https://github.com/mozilla/gecko-dev.git
Bug 990806, part 1 - Call js_ReportOutOfMemory when deliberately triggering an OOM for testing. r=terrence.
This commit is contained in:
Родитель
a6f8b84822
Коммит
ec203d63b9
|
@ -405,6 +405,13 @@ TryNewNurseryObject(ThreadSafeContext *cxArg, size_t thingSize, size_t nDynamicS
|
|||
}
|
||||
#endif /* JSGC_GENERATIONAL */
|
||||
|
||||
static inline bool
|
||||
PossiblyFail()
|
||||
{
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return true;
|
||||
}
|
||||
|
||||
template <AllowGC allowGC>
|
||||
static inline bool
|
||||
CheckAllocatorState(ThreadSafeContext *cx, AllocKind kind)
|
||||
|
@ -424,7 +431,10 @@ CheckAllocatorState(ThreadSafeContext *cx, AllocKind kind)
|
|||
#endif
|
||||
|
||||
// For testing out of memory conditions
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
if (!PossiblyFail()) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (allowGC) {
|
||||
#ifdef JS_GC_ZEAL
|
||||
|
|
Загрузка…
Ссылка в новой задаче