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

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: 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
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/es6/debug-stepin-promises.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/es6/debug-stepin-promises.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698