New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 632829 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

DevTools: promise with late catch handler contains incorrect async stack trace

Project Member Reported by kozyatinskiy@chromium.org, Jul 29 2016

Issue description

Repro:
var r;
var p1 = new Promise((a,b) => r = b);
// reject promise!
r();
// add catch after
p1.catch(() => { debugger });

Async call stack will points to debugger statement twice.

Good one:
var r;
var p1 = new Promise((a,b) => r = b);
// add catch before
p1.catch(() => { debugger });
// reject promise!
r();

Here we will get correct async stack that will point to r call.

 
Screenshot from 2016-07-29 12:41:07.png
28.9 KB View Download
Components: Platform>DevTools Platform>DevTools>JavaScript
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 10 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/754736d26c07454de8eace0b774a1ab13bf2c764

commit 754736d26c07454de8eace0b774a1ab13bf2c764
Author: kozyatinskiy <kozyatinskiy@chromium.org>
Date: Tue Jan 10 12:54:12 2017

[inspector] async stacks for Promise.then calls...

... which were done after the promise has been resolved.

Goal of this CL - change promise instrumentation to support better callbacks, chained after promise resolution and prepare instrumentation for adding new asyncTaskCreated instrumentation.

Instrumentation changes:
- asyncTaskScheduled(recurring) when promise is fulfilled or rejected,
- asyncTaskCancelled when promise is collected (since [1] we can be sure that promise will survive scheduled microtasks).

Minor changes:
- async task type in inspector <-> debugger API transferred by enum instead of string,
- Debug manages async task ids based on promise objects.

More details: https://docs.google.com/document/d/1u19N45f1gSF7M39mGsycJEK3IPyJgIXCBnWyiPeuJFE

[1] https://codereview.chromium.org/2581503003/

BUG= chromium:632829 , v8:5738 
R=dgozman@chromium.org,yangguo@chromium.org,gsathya@chromium.org

Review-Url: https://codereview.chromium.org/2578923002
Cr-Commit-Position: refs/heads/master@{#42178}

[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/builtins/builtins-promise.cc
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/debug/debug.cc
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/debug/debug.h
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/debug/debug.js
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/debug/interface-types.h
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/heap-symbols.h
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/inspector/v8-debugger.cc
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/inspector/v8-debugger.h
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/isolate.cc
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/isolate.h
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/js/async-await.js
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/js/macros.py
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/runtime/runtime-debug.cc
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/runtime/runtime-promise.cc
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/src/runtime/runtime.h
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-instrumentation-expected.txt
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-instrumentation.js
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-promise-late-then-expected.txt
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-promise-late-then.js
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-stack-await-expected.txt
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-stack-await.js
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-stack-for-promise-expected.txt
[add] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/debugger/async-stack-for-promise.js
[modify] https://crrev.com/754736d26c07454de8eace0b774a1ab13bf2c764/test/inspector/runtime/await-promise-expected.txt

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6fb55614fe7830920d5048d7ba8289b4df1c8f1b

commit 6fb55614fe7830920d5048d7ba8289b4df1c8f1b
Author: kozyatinskiy <kozyatinskiy@chromium.org>
Date: Fri Jan 13 20:47:30 2017

[DevTools] enabled async-callstack-promises.html and..

.. inspector-protocol/runtime/runtime-await-promise.html after related V8 roll.

BUG= chromium:632829 
TBR=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2634593002
Cr-Commit-Position: refs/heads/master@{#443658}

[modify] https://crrev.com/6fb55614fe7830920d5048d7ba8289b4df1c8f1b/third_party/WebKit/LayoutTests/TestExpectations

Status: Fixed (was: Assigned)

Sign in to add a comment