[promises] reset callbacks once the promise is resolved

BUG=v8:5343

Review-Url: https://codereview.chromium.org/2558493003
Cr-Commit-Position: refs/heads/master@{#41537}
This commit is contained in:
gsathya 2016-12-06 11:40:10 -08:00 committed by Commit bot
parent f7f817d783
commit 733104a0c2

View File

@ -94,10 +94,13 @@ void EnqueuePromiseReactionJob(Isolate* isolate, Handle<Object> value,
isolate->EnqueueMicrotask(info);
}
void PromiseSet(Handle<JSPromise> promise, int status, Handle<Object> result) {
void PromiseSet(Isolate* isolate, Handle<JSPromise> promise, int status,
Handle<Object> result) {
promise->set_status(status);
promise->set_result(*result);
// TODO(gsathya): reset reactions?
promise->set_deferred(isolate->heap()->undefined_value());
promise->set_fulfill_reactions(isolate->heap()->undefined_value());
promise->set_reject_reactions(isolate->heap()->undefined_value());
}
void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise,
@ -112,7 +115,7 @@ void PromiseFulfill(Isolate* isolate, Handle<JSPromise> promise,
EnqueuePromiseReactionJob(isolate, value, tasks, deferred, status);
}
PromiseSet(promise, status->value(), value);
PromiseSet(isolate, promise, status->value(), value);
}
} // namespace