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

Unified Diff: src/js/promise.js

Issue 1780823003: Check that Promise subclasses have callable resolve/reject (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix debug tests Created 4 years, 9 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/messages.h » ('j') | test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/promise.js
diff --git a/src/js/promise.js b/src/js/promise.js
index 8cf6a36cef6cc0b422627d2b1476abdf33cbb937..cf4774c3314c0823ffb7f2e84fecc76c1dbf0fbd 100644
--- a/src/js/promise.js
+++ b/src/js/promise.js
@@ -217,8 +217,6 @@ function PromiseReject(promise, r) {
PromiseDone(promise, -1, r, promiseOnRejectSymbol)
}
-// Convenience.
-
function NewPromiseCapability(C) {
if (C === GlobalPromise) {
// Optimized case, avoid extra closure.
@@ -239,6 +237,9 @@ function NewPromiseCapability(C) {
result.reject = reject;
});
+ if (!IS_CALLABLE(result.resolve) || !IS_CALLABLE(result.reject))
+ throw MakeTypeError(kPromiseNonCallable);
+
return result;
}
« no previous file with comments | « no previous file | src/messages.h » ('j') | test/mjsunit/es6/debug-promises/throw-with-undefined-reject.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698