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

Unified Diff: src/promise.js

Issue 734163002: Allow stepping into Promise handlers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: addressed Created 6 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
Index: src/promise.js
diff --git a/src/promise.js b/src/promise.js
index 443a3b8c01a15d2d8cd4de98e4dfb10219fcb511..7d5be882f4c1ad161f2816ad70badeef614bcb40 100644
--- a/src/promise.js
+++ b/src/promise.js
@@ -103,6 +103,7 @@ var lastMicrotaskId = 0;
function PromiseHandle(value, handler, deferred) {
try {
%DebugPushPromise(deferred.promise);
+ DEBUG_PREPARE_STEP_IN_IF_STEPPING(handler);
var result = handler(value);
if (result === deferred.promise)
throw MakeTypeError('promise_cyclic', [result]);
@@ -270,8 +271,15 @@ 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) {
+ DEBUG_PREPARE_STEP_IN_IF_STEPPING(onReject);
+ return onReject(MakeTypeError('promise_cyclic', [x]));
+ } else if (IsPromise(x)) {
+ return x.then(onResolve, onReject);
+ } else {
+ DEBUG_PREPARE_STEP_IN_IF_STEPPING(onResolve);
+ return onResolve(x);
+ }
},
onReject,
PromiseChain

Powered by Google App Engine
This is Rietveld 408576698