Chromium Code Reviews| Index: src/promise.js |
| diff --git a/src/promise.js b/src/promise.js |
| index 443a3b8c01a15d2d8cd4de98e4dfb10219fcb511..02562ed8f4b899c220f839f6982d9467aa27a7bd 100644 |
| --- a/src/promise.js |
| +++ b/src/promise.js |
| @@ -103,6 +103,8 @@ var lastMicrotaskId = 0; |
| function PromiseHandle(value, handler, deferred) { |
| try { |
| %DebugPushPromise(deferred.promise); |
| + var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(handler); |
| + if (stepping) %DebugPrepareStepInIfStepping(handler); |
| var result = handler(value); |
| if (result === deferred.promise) |
| throw MakeTypeError('promise_cyclic', [result]); |
| @@ -270,8 +272,19 @@ var lastMicrotaskId = 0; |
| this, |
| function(x) { |
| x = PromiseCoerce(constructor, x); |
| - return x === that ? onReject(MakeTypeError('promise_cyclic', [x])) : |
| - IsPromise(x) ? x.then(onResolve, onReject) : onResolve(x); |
| + if (x === that) { |
| + if (DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(onReject)) { |
|
Yang
2014/11/17 19:41:02
This conditional is used in a lot of places now. D
|
| + %DebugPrepareStepInIfStepping(onReject); |
| + } |
| + return onReject(MakeTypeError('promise_cyclic', [x])); |
| + } else if (IsPromise(x)) { |
| + return x.then(onResolve, onReject); |
| + } else { |
| + if (DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(onResolve)) { |
| + %DebugPrepareStepInIfStepping(onResolve); |
| + } |
| + return onResolve(x); |
| + } |
| }, |
| onReject, |
| PromiseChain |