Bug 1771858 - Handle interrupt in AsyncModuleExecutionFulfilled; r=jonco

In AsyncModuleExecutionFulfilled, it's possible that the call to GatherAsyncParentCompletions
will fail if we are interrupted. The current code assumes that this is only reachable as a
result of an OOM. This changes the assertion to an if statement to handle being interrupted.

Differential Revision: https://phabricator.services.mozilla.com/D147954
This commit is contained in:
Dan Minor 2022-06-02 03:25:23 +00:00
Родитель 91acfa8f3f
Коммит ff71e7aae1
2 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -2269,9 +2269,13 @@ void js::AsyncModuleExecutionFulfilled(JSContext* cx,
RootedArrayObject sortedList(cx);
if (!ModuleObject::GatherAsyncParentCompletions(cx, module, &sortedList)) {
// We have OOM'd -- all bets are off, reject the promise. Not much more we
// can do.
MOZ_ASSERT(cx->isExceptionPending());
// We have been interrupted or have OOM'd -- all bets are off, reject the
// promise. Not much more we can do.
if (!cx->isExceptionPending()) {
AsyncModuleExecutionRejected(cx, module, UndefinedHandleValue);
return;
}
RootedValue exception(cx);
if (!cx->getPendingException(&exception)) {
return;

Просмотреть файл

@ -0,0 +1,12 @@
// |jit-test| exitstatus: 6;
b = parseModule("await 10");
b.declarationInstantiation();
b.evaluation();
setInterruptCallback(function() {
c();
});
function c() {
interruptIf(true);
}
c();