Reviewers: rossberg,

Message:
https://codereview.chromium.org/182713002/ includes the test for this issue.

Description:
PromiseThen should ignore non-function parameters.

When non-function parameters are given, PromiseThen should work as if
undefined parameters were given.

BUG=347455

Please review this at https://codereview.chromium.org/180723011/

SVN Base: git://github.com/v8/v8.git@master

Affected files (+2, -2 lines):
  M src/promise.js


Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index 82aa99027a1305ac8bf6b95672cccd89504173cd..7fb17eebb44613a3b32e6476602e30358abaf151 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -148,8 +148,8 @@ function PromiseIdResolveHandler(x) { return x }
 function PromiseIdRejectHandler(r) { throw r }

 function PromiseChain(onResolve, onReject) {  // a.k.a.  flatMap
- onResolve = IS_UNDEFINED(onResolve) ? PromiseIdResolveHandler : onResolve;
-  onReject = IS_UNDEFINED(onReject) ? PromiseIdRejectHandler : onReject;
+ onResolve = typeof onResolve === 'function' ? onResolve : PromiseIdResolveHandler; + onReject = typeof onReject === 'function' ? onReject : PromiseIdRejectHandler;
   var deferred = %_CallFunction(this.constructor, PromiseDeferred);
   switch (GET_PRIVATE(this, promiseStatus)) {
     case UNDEFINED:


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to