Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Unified Diff: src/runtime/runtime-promise.cc

Issue 2558493003: [promises] reset callbacks once the promise is resolved (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-promise.cc
diff --git a/src/runtime/runtime-promise.cc b/src/runtime/runtime-promise.cc
index 236582be02b818315104489207acb8b6ea612a48..b5cba8a6201bb629139c4bf2e576303ae08014b9 100644
--- a/src/runtime/runtime-promise.cc
+++ b/src/runtime/runtime-promise.cc
@@ -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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698