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

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

Issue 2338273007: async/await: Don't trigger uncaught rejection handlers on throwaway Promises (Closed)
Patch Set: Created 4 years, 3 months 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/prologue.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/harmony-async-await.js
diff --git a/src/js/harmony-async-await.js b/src/js/harmony-async-await.js
index 4109b77fb54174366cdae648b0dae7fc0c5b02af..396ebdc750a8c865f8007592a9a7ce518ba88d9a 100644
--- a/src/js/harmony-async-await.js
+++ b/src/js/harmony-async-await.js
@@ -36,6 +36,8 @@ utils.Import(function(from) {
var promiseAwaitHandlerSymbol = utils.ImportNow("promise_await_handler_symbol");
var promiseHandledHintSymbol =
utils.ImportNow("promise_handled_hint_symbol");
+var promiseHasHandlerSymbol =
+ utils.ImportNow("promise_has_handler_symbol");
// -------------------------------------------------------------------
@@ -77,6 +79,11 @@ function AsyncFunctionAwait(generator, awaited, mark) {
// Just forwarding the exception, so no debugEvent for throwawayCapability
var throwawayCapability = NewPromiseCapability(GlobalPromise, false);
+
+ // The Promise will be thrown away and not handled, but it shouldn't trigger
+ // unhandled reject events as its work is done
+ SET_PRIVATE(throwawayCapability.promise, promiseHasHandlerSymbol, true);
+
return PerformPromiseThen(promise, onFulfilled, onRejected,
throwawayCapability);
}
« no previous file with comments | « no previous file | src/js/prologue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698