Bug 1208994 - ToAtom<NoGC> should not throw an exception on failure r=terrence

This commit is contained in:
Jon Coppeard 2015-09-29 10:15:42 +01:00
parent 7c10dfa088
commit a68d8c7152
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,4 @@
// |jit-test| --no-threads
load(libdir + 'oomTest.js');
oomTest(() => getBacktrace({args: oomTest[load+1], locals: true, thisprops: true}));

View File

@ -498,7 +498,12 @@ js::ToAtom(ExclusiveContext* cx, typename MaybeRooted<Value, allowGC>::HandleTyp
if (str->isAtom())
return &str->asAtom();
return AtomizeString(cx, str);
JSAtom* atom = AtomizeString(cx, str);
if (!atom && !allowGC) {
MOZ_ASSERT_IF(cx->isJSContext(), cx->asJSContext()->isThrowingOutOfMemory());
cx->recoverFromOutOfMemory();
}
return atom;
}
template JSAtom*