You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/checklist/javascript.md
+45-8Lines changed: 45 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,9 +76,6 @@ as expression position for the exception. For syntax errors, we should report th
76
76
Note that `Error.stack` is only collected for `Error` objects, at the time the `Error` object is constructed. This may be different
77
77
than the stack trace passed to DevTools via [`JSMessageObject`](https://source.chromium.org/chromium/chromium/src/+/main:v8/src/objects/js-objects.h;l=1264-1345;drc=82dff63dbf9db05e9274e11d9128af7b9f51ceaa).
78
78
79
-
Independently from V8, DevTools offers a way to show async stack traces by stitching together stack traces collected at the
80
-
location where the callback is passed, and the actual location of the exception inside the callback.
81
-
82
79
### Affected
83
80
84
81
NLFs that can cause an exception to be thrown, or can call into another function that throws.
@@ -95,12 +92,34 @@ Repeat with the "Disable async stack traces" checkbox in the Preferences checked
95
92
Test cases for stack traces is mandatory, if there is any way the NLF can interact with throwing exceptions. For examples look
96
93
for `mjsunit` tests with `stack-trace` in their names.
97
94
98
-
For async stack traces, please look at Blink LayoutTests such as [this one](https://chromium.googlesource.com/chromium/src/+/3daa588ce613845e298cbd667fa6f5787f95d574/third\_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-await/async-callstack-async-await.html).
99
-
100
95
### Reading material
101
96
102
97
[Design doc for debugging support for tail-calls](https://docs.google.com/a/google.com/document/d/1Bk4QahtaT-XzrMlHTkm0SVol3LoKXTrC9E7INxJBHrE/edit?usp=drive\_web)
103
98
99
+
## Async stack traces
100
+
101
+
DevTools offers a way to show async stack traces by stitching together stack traces collected at the
102
+
location where the callback is passed, and the actual location of the exception inside the callback.
103
+
104
+
The canonical example of this is throwing inside a `setTimeout` callback. The async stack trace will
105
+
consist of the stack trace of the error plus a stack trace captured at the `setTimeout` call-site.
106
+
107
+
The instrumentation is based on four [`ayncTask*` methods](https://source.chromium.org/chromium/chromium/src/+/main:v8/include/v8-inspector.h;l=370-375;drc=aafd25ffbc72935b52fee731f957e5827c73a096). Namely `asyncTaskScheduled`, `asyncTaskStarted`, `asyncTaskFinished` and `asyncTaskCancelled`.
108
+
V8 has a [higher-level interface](https://source.chromium.org/chromium/chromium/src/+/main:v8/src/debug/debug-interface.h;l=351-352;drc=e6fc2038d73ef96ff47deda3146d94d25530e13b) that translates Promise events (such as `await`, `.then`, etc) to these for `asyncTask*` methods.
109
+
110
+
### Affected
111
+
112
+
NLFs touching promises or callback scheduling.
113
+
114
+
### How to test
115
+
116
+
Throw or pause inside a new language feature and check either the call stack sidebar panel in "Sources"
117
+
or use a `console.trace` and check the async stack trace in the console.
118
+
119
+
### Test cases
120
+
121
+
Test cases for async stack traces are mandatory, if there is any way the NLF interacts with callback scheduling or
122
+
Promises. For examples look in V8 `inspector` tests with `async-stack` in their name (e.g. [here](https://source.chromium.org/chromium/chromium/src/+/main:v8/test/inspector/debugger/async-stack-await.js)).
104
123
105
124
## Catch prediction
106
125
@@ -319,20 +338,38 @@ Take a heap Snapshot in DevTools' Profiler panel and inspect the result. Objects
319
338
320
339
Take a look at `test/cctest/test-heap-profiler.cc`.
321
340
341
+
## Restart frame
342
+
343
+
DevTools allows restarting of some stack frames, not just the top-level one. The feature is implemented by throwing a termination exception and unwinding the stack
344
+
until after the function we want to restart, and then re-invoking the function. This only works for certain functions, e.g. async functions can't be restarted
345
+
as that would require rolling back the underlying generator.
346
+
347
+
### Affected
348
+
349
+
NLFs that change function execution or require a function to carry state (e.g. async functions
350
+
need a generator that can't be reset).
351
+
352
+
### How to test
353
+
354
+
While paused, right click a stack frame with the NLF in the call stack view and select "Restart frame". If the NLF prevents the frame from being restarted, then
355
+
the "Restart frame" menu item must be disabled, otherwise the frame must be properly restarted.
356
+
357
+
### Test cases
358
+
359
+
Take a look in `test/inspector/debugger/restart-frame/*`.
322
360
323
361
## LiveEdit
324
362
325
363
LiveEdit is a feature that allows for script content to be replaced during its execution. While it has many limitations, the most often use case
326
-
of editing the function we are paused in and restarting said function usually works.
364
+
of editing the function we are paused in and restarting said function afterwards.
327
365
328
366
### Affected
329
367
330
368
NLFs that affect code execution
331
369
332
370
### How to test
333
371
334
-
Open DevTools and break inside the part of script affected by the NLF. In the Source panel's Call Stack view, right-click the top-most frame and select
335
-
Restart Frame.
372
+
Open DevTools and break inside the part of script affected by the NLF. Change the code inside the function with the NLF and save the script.
0 commit comments