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

Unified Diff: src/js/async-await.js

Issue 2512103002: [async-await] Don't create resolving callbacks for throwaway promises (Closed)
Patch Set: Created 4 years, 1 month 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 | src/js/promise.js » ('j') | src/js/promise.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/async-await.js
diff --git a/src/js/async-await.js b/src/js/async-await.js
index a1cac0d5cd62a6bb6850197db285460cf06681ea..dd8f5c0f7e5b8a00c3f79180cc38933dc36ca23d 100644
--- a/src/js/async-await.js
+++ b/src/js/async-await.js
@@ -90,8 +90,11 @@ function AsyncFunctionAwait(generator, awaited, outerPromise) {
return;
}
- // Just forwarding the exception, so no debugEvent for throwawayCapability
- var throwawayCapability = NewPromiseCapability(GlobalPromise, false);
+ // Just forwarding the exception, so no debugEvent for throwawayCapability.
+ // The resultCapability.promise is only ever fulfilled internally,
+ // so we don't need the closures to protect against accidentally
+ // calling them multiple times.
+ var throwawayCapability = NewPromiseCapability(GlobalPromise, false, true);
// The Promise will be thrown away and not handled, but it shouldn't trigger
// unhandled reject events as its work is done
« no previous file with comments | « no previous file | src/js/promise.js » ('j') | src/js/promise.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698