Bug 1545369 - Check for OOM in shell ReportUnhandledRejections function r=pbone

Add an error check in ReportUnhandledRejections function.

Differential Revision: https://phabricator.services.mozilla.com/D28471
This commit is contained in:
Jon Coppeard 2019-04-23 13:24:32 +01:00
parent e240b9f36f
commit 4a5820783c
2 changed files with 12 additions and 3 deletions

View File

@ -0,0 +1,9 @@
// |jit-test| --no-cgc; allow-oom
async function f(x) {
await await x;
};
for (let i = 0; i < 800; ++i) {
f();
}
gcparam("maxBytes", gcparam("gcBytes"));

View File

@ -10663,12 +10663,12 @@ static MOZ_MUST_USE bool ReportUnhandledRejections(JSContext* cx) {
Rooted<SetIteratorObject*> iterObj(cx,
&iter.toObject().as<SetIteratorObject>());
RootedArrayObject resultObj(
cx, &SetIteratorObject::createResult(cx)->as<ArrayObject>());
if (!resultObj) {
JSObject* obj = SetIteratorObject::createResult(cx);
if (!obj) {
return false;
}
RootedArrayObject resultObj(cx, &obj->as<ArrayObject>());
while (true) {
bool done = SetIteratorObject::next(iterObj, resultObj, cx);
if (done) {