mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 990806, part 1 - Call js_ReportOutOfMemory when deliberately triggering an OOM for testing. r=terrence.
This commit is contained in:
parent
1f9cff4507
commit
78905a389b
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user