summaryrefslogtreecommitdiff
path: root/deps/v8/test/inspector
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2017-09-12 11:34:59 +0200
committerAnna Henningsen <anna@addaleax.net>2017-09-13 16:15:18 +0200
commitd82e1075dbc2cec2d6598ade10c1f43805f690fd (patch)
treeccd242b9b491dfc341d1099fe11b0ef528839877 /deps/v8/test/inspector
parentb4b7ac6ae811b2b5a3082468115dfb5a5246fe3f (diff)
downloadandroid-node-v8-d82e1075dbc2cec2d6598ade10c1f43805f690fd.tar.gz
android-node-v8-d82e1075dbc2cec2d6598ade10c1f43805f690fd.tar.bz2
android-node-v8-d82e1075dbc2cec2d6598ade10c1f43805f690fd.zip
deps: update V8 to 6.1.534.36
PR-URL: https://github.com/nodejs/node/pull/14730 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector')
-rw-r--r--deps/v8/test/inspector/BUILD.gn2
-rw-r--r--deps/v8/test/inspector/OWNERS2
-rw-r--r--deps/v8/test/inspector/cpu-profiler/coverage-block-expected.txt1173
-rw-r--r--deps/v8/test/inspector/cpu-profiler/coverage-block.js289
-rw-r--r--deps/v8/test/inspector/cpu-profiler/coverage-expected.txt48
-rw-r--r--deps/v8/test/inspector/cpu-profiler/coverage.js4
-rw-r--r--deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt18
-rw-r--r--deps/v8/test/inspector/debugger/break-location-function-calls-expected.txt219
-rw-r--r--deps/v8/test/inspector/debugger/break-location-function-calls.js82
-rw-r--r--deps/v8/test/inspector/debugger/break-locations-await-expected.txt361
-rw-r--r--deps/v8/test/inspector/debugger/break-locations-await.js126
-rw-r--r--deps/v8/test/inspector/debugger/break-locations-var-init-expected.txt170
-rw-r--r--deps/v8/test/inspector/debugger/break-locations-var-init.js74
-rw-r--r--deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt505
-rw-r--r--deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js141
-rw-r--r--deps/v8/test/inspector/debugger/for-of-loops-expected.txt395
-rw-r--r--deps/v8/test/inspector/debugger/for-of-loops.js82
-rw-r--r--deps/v8/test/inspector/debugger/framework-precise-ranges-expected.txt16
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt30
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt73
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js32
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function-expected.txt434
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function.js55
-rw-r--r--deps/v8/test/inspector/debugger/not-hold-promises-expected.txt2
-rw-r--r--deps/v8/test/inspector/debugger/not-hold-promises.js36
-rw-r--r--deps/v8/test/inspector/debugger/pause-expected.txt33
-rw-r--r--deps/v8/test/inspector/debugger/pause.js17
-rw-r--r--deps/v8/test/inspector/debugger/return-break-locations-expected.txt22
-rw-r--r--deps/v8/test/inspector/debugger/schedule-step-into-async-expected.txt2
-rw-r--r--deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt2
-rw-r--r--deps/v8/test/inspector/debugger/set-skip-all-pauses-expected.txt7
-rw-r--r--deps/v8/test/inspector/debugger/set-skip-all-pauses.js31
-rw-r--r--deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js2
-rw-r--r--deps/v8/test/inspector/debugger/step-into-expected.txt197
-rw-r--r--deps/v8/test/inspector/debugger/step-into-next-script-expected.txt4
-rw-r--r--deps/v8/test/inspector/debugger/step-into.js2
-rw-r--r--deps/v8/test/inspector/debugger/step-snapshot-expected.txt8
-rw-r--r--deps/v8/test/inspector/debugger/stepping-tail-call-expected.txt80
-rw-r--r--deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt2
-rw-r--r--deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt24
-rw-r--r--deps/v8/test/inspector/debugger/wasm-imports-expected.txt4
-rw-r--r--deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt166
-rw-r--r--deps/v8/test/inspector/debugger/wasm-scope-info.js137
-rw-r--r--deps/v8/test/inspector/debugger/wasm-stack-expected.txt6
-rw-r--r--deps/v8/test/inspector/debugger/wasm-stack.js2
-rw-r--r--deps/v8/test/inspector/debugger/wasm-stepping-expected.txt48
-rw-r--r--deps/v8/test/inspector/inspector-impl.cc254
-rw-r--r--deps/v8/test/inspector/inspector-impl.h84
-rw-r--r--deps/v8/test/inspector/inspector-test.cc528
-rw-r--r--deps/v8/test/inspector/inspector.gyp2
-rw-r--r--deps/v8/test/inspector/inspector.status22
-rw-r--r--deps/v8/test/inspector/isolate-data.cc298
-rw-r--r--deps/v8/test/inspector/isolate-data.h74
-rw-r--r--deps/v8/test/inspector/protocol-test.js34
-rw-r--r--deps/v8/test/inspector/runtime/await-promise-expected.txt50
-rw-r--r--deps/v8/test/inspector/runtime/await-promise.js27
-rw-r--r--deps/v8/test/inspector/runtime/console-context-expected.txt83
-rw-r--r--deps/v8/test/inspector/runtime/console-context.js106
-rw-r--r--deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt7
-rw-r--r--deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js14
-rw-r--r--deps/v8/test/inspector/runtime/evaluate-async-expected.txt92
-rw-r--r--deps/v8/test/inspector/runtime/evaluate-async.js37
-rw-r--r--deps/v8/test/inspector/runtime/internal-properties-expected.txt10
-rw-r--r--deps/v8/test/inspector/runtime/regression-732717-expected.txt1
-rw-r--r--deps/v8/test/inspector/runtime/regression-732717.js17
-rw-r--r--deps/v8/test/inspector/runtime/regression-736302-expected.txt82
-rw-r--r--deps/v8/test/inspector/runtime/regression-736302.js40
-rw-r--r--deps/v8/test/inspector/sessions/create-session-expected.txt132
-rw-r--r--deps/v8/test/inspector/sessions/create-session.js58
-rw-r--r--deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints-expected.txt203
-rw-r--r--deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints.js191
-rw-r--r--deps/v8/test/inspector/sessions/pause-on-console-assert-expected.txt24
-rw-r--r--deps/v8/test/inspector/sessions/pause-on-console-assert.js54
-rw-r--r--deps/v8/test/inspector/sessions/runtime-command-line-api-expected.txt211
-rw-r--r--deps/v8/test/inspector/sessions/runtime-command-line-api.js76
-rw-r--r--deps/v8/test/inspector/sessions/runtime-console-api-called-expected.txt217
-rw-r--r--deps/v8/test/inspector/sessions/runtime-console-api-called.js38
-rw-r--r--deps/v8/test/inspector/sessions/runtime-evaluate-exception-expected.txt277
-rw-r--r--deps/v8/test/inspector/sessions/runtime-evaluate-exception.js59
-rw-r--r--deps/v8/test/inspector/sessions/runtime-evaluate-expected.txt25
-rw-r--r--deps/v8/test/inspector/sessions/runtime-evaluate.js25
-rw-r--r--deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt103
-rw-r--r--deps/v8/test/inspector/sessions/runtime-remote-object.js30
-rw-r--r--deps/v8/test/inspector/task-runner.cc105
-rw-r--r--deps/v8/test/inspector/task-runner.h60
85 files changed, 7343 insertions, 1572 deletions
diff --git a/deps/v8/test/inspector/BUILD.gn b/deps/v8/test/inspector/BUILD.gn
index cffcd294bd..eec613b212 100644
--- a/deps/v8/test/inspector/BUILD.gn
+++ b/deps/v8/test/inspector/BUILD.gn
@@ -8,8 +8,6 @@ v8_executable("inspector-test") {
testonly = true
sources = [
- "inspector-impl.cc",
- "inspector-impl.h",
"inspector-test.cc",
"isolate-data.cc",
"isolate-data.h",
diff --git a/deps/v8/test/inspector/OWNERS b/deps/v8/test/inspector/OWNERS
index 9edb707b78..c5325d9c97 100644
--- a/deps/v8/test/inspector/OWNERS
+++ b/deps/v8/test/inspector/OWNERS
@@ -1,2 +1,4 @@
dgozman@chromium.org
kozyatinskiy@chromium.org
+
+# COMPONENT: Platform>DevTools>JavaScript
diff --git a/deps/v8/test/inspector/cpu-profiler/coverage-block-expected.txt b/deps/v8/test/inspector/cpu-profiler/coverage-block-expected.txt
new file mode 100644
index 0000000000..4b8079a4bd
--- /dev/null
+++ b/deps/v8/test/inspector/cpu-profiler/coverage-block-expected.txt
@@ -0,0 +1,1173 @@
+Test collecting code coverage data with Profiler.collectCoverage.
+
+Running test: testPreciseCountBaseline
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName : fib
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 15
+ endOffset : 73
+ startOffset : 1
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseCountBaseline
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ ]
+ }
+}
+
+Running test: testPreciseCountCoverage
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 15
+ endOffset : 73
+ startOffset : 1
+ }
+ [1] : {
+ count : 8
+ endOffset : 41
+ startOffset : 32
+ }
+ [2] : {
+ count : 7
+ endOffset : 71
+ startOffset : 41
+ }
+ [3] : {
+ count : 0
+ endOffset : 73
+ startOffset : 71
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ [1] : {
+ count : 0
+ endOffset : 208
+ startOffset : 206
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseCountCoverage
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 38
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ ]
+ }
+}
+
+Running test: testPreciseCountCoverageIncremental
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 15
+ endOffset : 73
+ startOffset : 1
+ }
+ [1] : {
+ count : 8
+ endOffset : 41
+ startOffset : 32
+ }
+ [2] : {
+ count : 7
+ endOffset : 71
+ startOffset : 41
+ }
+ [3] : {
+ count : 0
+ endOffset : 73
+ startOffset : 71
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ [1] : {
+ count : 0
+ endOffset : 208
+ startOffset : 206
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseCountCoverageIncremental
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : string
+ value : unoptimized
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 10946
+ type : number
+ value : 10946
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : string
+ value : unoptimized
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName : fib
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 21891
+ endOffset : 73
+ startOffset : 1
+ }
+ [1] : {
+ count : 10946
+ endOffset : 41
+ startOffset : 32
+ }
+ [2] : {
+ count : 10945
+ endOffset : 71
+ startOffset : 41
+ }
+ [3] : {
+ count : 0
+ endOffset : 73
+ startOffset : 71
+ }
+ ]
+ }
+ [1] : {
+ functionName : is_optimized
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 2
+ endOffset : 175
+ startOffset : 74
+ }
+ [1] : {
+ count : 0
+ endOffset : 156
+ startOffset : 145
+ }
+ [2] : {
+ count : 0
+ endOffset : 175
+ startOffset : 173
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseCountCoverageIncremental
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 2
+ endOffset : 17
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ [2] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 7
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+
+Running test: testPreciseCoverageFail
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ error : {
+ code : -32000
+ message : Precise coverage has not been started.
+ }
+ id : <messageId>
+}
+
+Running test: testBestEffortCoverage
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ ]
+ }
+}
+
+Running test: testBestEffortCoverageWithPreciseBinaryEnabled
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 73
+ startOffset : 1
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testBestEffortCoverageWithPreciseBinaryEnabled
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 38
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 73
+ startOffset : 1
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testBestEffortCoverageWithPreciseBinaryEnabled
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 38
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+
+Running test: testBestEffortCoverageWithPreciseCountEnabled
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 73
+ startOffset : 1
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testBestEffortCoverageWithPreciseCountEnabled
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 38
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 73
+ startOffset : 1
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testBestEffortCoverageWithPreciseCountEnabled
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 38
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+
+Running test: testEnablePreciseCountCoverageAtPause
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : undefined
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 114
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : g
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 29
+ startOffset : 1
+ }
+ ]
+ }
+ [2] : {
+ functionName : f
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 4
+ endOffset : 83
+ startOffset : 30
+ }
+ ]
+ }
+ [3] : {
+ functionName : h
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 107
+ startOffset : 84
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testEnablePreciseCountCoverageAtPause
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 38
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+
+Running test: testPreciseBinaryCoverage
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 8
+ type : number
+ value : 8
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 221
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : fib
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 73
+ startOffset : 1
+ }
+ [1] : {
+ count : 1
+ endOffset : 41
+ startOffset : 32
+ }
+ [2] : {
+ count : 1
+ endOffset : 71
+ startOffset : 41
+ }
+ [3] : {
+ count : 0
+ endOffset : 73
+ startOffset : 71
+ }
+ ]
+ }
+ [2] : {
+ functionName : is_optimized
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 175
+ startOffset : 74
+ }
+ ]
+ }
+ [3] : {
+ functionName : iife
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 208
+ startOffset : 177
+ }
+ [1] : {
+ count : 0
+ endOffset : 208
+ startOffset : 206
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseBinaryCoverage
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : string
+ value : unoptimized
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 10946
+ type : number
+ value : 10946
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : string
+ value : optimized
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName : is_optimized
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 175
+ startOffset : 74
+ }
+ [1] : {
+ count : 0
+ endOffset : 175
+ startOffset : 173
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseBinaryCoverage
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 17
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ [2] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 7
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
+
+Running test: testPreciseEmptyScriptCoverageEntries
+{
+ id : <messageId>
+ result : {
+ result : [
+ ]
+ }
+}
+
+Running test: testPreciseCountCoveragePartial
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : undefined
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 238
+ startOffset : 0
+ }
+ ]
+ }
+ [1] : {
+ functionName : outer
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 224
+ startOffset : 10
+ }
+ [1] : {
+ count : 0
+ endOffset : 224
+ startOffset : 222
+ }
+ ]
+ }
+ [2] : {
+ functionName : nested_0
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 176
+ startOffset : 31
+ }
+ [1] : {
+ count : 0
+ endOffset : 176
+ startOffset : 172
+ }
+ ]
+ }
+ [3] : {
+ functionName : nested_1
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 172
+ startOffset : 64
+ }
+ [1] : {
+ count : 0
+ endOffset : 172
+ startOffset : 166
+ }
+ ]
+ }
+ [4] : {
+ functionName : nested_2
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 166
+ startOffset : 99
+ }
+ [1] : {
+ count : 0
+ endOffset : 166
+ startOffset : 158
+ }
+ ]
+ }
+ [5] : {
+ functionName : nested_3
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 158
+ startOffset : 136
+ }
+ ]
+ }
+ [6] : {
+ functionName : nested_4
+ isBlockCoverage : false
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 201
+ startOffset : 179
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseCountCoveragePartial
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ functions : [
+ [0] : {
+ functionName : nested_1
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 172
+ startOffset : 64
+ }
+ [1] : {
+ count : 0
+ endOffset : 172
+ startOffset : 166
+ }
+ ]
+ }
+ [1] : {
+ functionName : nested_2
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 0
+ endOffset : 166
+ startOffset : 99
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url : testPreciseCountCoveragePartial
+ }
+ [1] : {
+ functions : [
+ [0] : {
+ functionName :
+ isBlockCoverage : true
+ ranges : [
+ [0] : {
+ count : 1
+ endOffset : 3
+ startOffset : 0
+ }
+ ]
+ }
+ ]
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+}
diff --git a/deps/v8/test/inspector/cpu-profiler/coverage-block.js b/deps/v8/test/inspector/cpu-profiler/coverage-block.js
new file mode 100644
index 0000000000..9c6b015b6f
--- /dev/null
+++ b/deps/v8/test/inspector/cpu-profiler/coverage-block.js
@@ -0,0 +1,289 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --no-always-opt --opt --no-stress-fullcodegen --block-coverage
+
+var source =
+`
+function fib(x) {
+ if (x < 2) return 1;
+ return fib(x-1) + fib(x-2);
+}
+function is_optimized(f) {
+ return (%GetOptimizationStatus(f) & 16) ? "optimized" : "unoptimized";
+}
+(function iife() {
+ return 1;
+})();
+fib(5);
+`;
+
+var break_source =
+`
+function g() {
+ debugger;
+}
+function f(x) {
+ if (x == 0) g();
+ else f(x - 1);
+}
+function h() {
+ g();
+}
+f(3);
+`;
+
+var nested =
+`
+var f = (function outer() {
+ function nested_0() {
+ return function nested_1() {
+ return function nested_2() {
+ return function nested_3() {}
+ }
+ }
+ }
+ function nested_4() {}
+ return nested_0();
+})();
+f()()();
+`;
+
+let {session, contextGroup, Protocol} = InspectorTest.start("Test collecting code coverage data with Profiler.collectCoverage.");
+
+function ClearAndGC() {
+ return Protocol.Runtime.evaluate({ expression: "fib = g = f = h = is_optimized = null;" })
+ .then(GC);
+}
+
+function GC() {
+ return Protocol.HeapProfiler.collectGarbage();
+}
+
+function LogSorted(message) {
+ message.result.result.sort((a, b) => parseInt(a.scriptId) - parseInt(b.scriptId));
+ return InspectorTest.logMessage(message);
+}
+
+InspectorTest.runTestSuite([
+ function testPreciseCountBaseline(next)
+ {
+ Protocol.Runtime.enable()
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(GC)
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseCountCoverage(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseCountCoverageIncremental(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(() => Protocol.Runtime.evaluate({ expression: "is_optimized(fib)" }))
+ .then(message => InspectorTest.logMessage(message))
+ .then(() => Protocol.Runtime.evaluate({ expression: "fib(20)" }))
+ .then(message => InspectorTest.logMessage(message))
+ .then(() => Protocol.Runtime.evaluate({ expression: "is_optimized(fib)" }))
+ .then(message => InspectorTest.logMessage(message))
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseCoverageFail(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(InspectorTest.logMessage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testBestEffortCoverage(next)
+ {
+ Protocol.Runtime.enable()
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.getBestEffortCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.getBestEffortCoverage)
+ .then(LogSorted)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testBestEffortCoverageWithPreciseBinaryEnabled(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(Protocol.Profiler.startPreciseCoverage)
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.getBestEffortCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.getBestEffortCoverage)
+ .then(LogSorted)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testBestEffortCoverageWithPreciseCountEnabled(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.getBestEffortCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.getBestEffortCoverage)
+ .then(LogSorted)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testEnablePreciseCountCoverageAtPause(next)
+ {
+ function handleDebuggerPause() {
+ Protocol.Profiler.enable()
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(Protocol.Debugger.resume)
+ }
+ Protocol.Debugger.enable();
+ Protocol.Debugger.oncePaused().then(handleDebuggerPause);
+ Protocol.Runtime.enable()
+ .then(() => Protocol.Runtime.compileScript({ expression: break_source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(Protocol.Debugger.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseBinaryCoverage(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(Protocol.Profiler.startPreciseCoverage)
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(() => Protocol.Runtime.evaluate({ expression: "is_optimized(fib)" }))
+ .then(message => InspectorTest.logMessage(message))
+ .then(() => Protocol.Runtime.evaluate({ expression: "fib(20)" }))
+ .then(message => InspectorTest.logMessage(message))
+ .then(() => Protocol.Runtime.evaluate({ expression: "is_optimized(fib)" }))
+ .then(message => InspectorTest.logMessage(message))
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseEmptyScriptCoverageEntries(next)
+ {
+ // Enabling the debugger holds onto script objects even though its
+ // functions can be garbage collected. We would get empty ScriptCoverage
+ // entires unless we remove them.
+ Protocol.Debugger.enable()
+ .then(Protocol.Runtime.enable)
+ .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(ClearAndGC)
+ .then(Protocol.Profiler.enable)
+ .then(Protocol.Profiler.startPreciseCoverage)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(Protocol.Debugger.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+ function testPreciseCountCoveragePartial(next)
+ {
+ Protocol.Runtime.enable()
+ .then(Protocol.Profiler.enable)
+ .then(() => Protocol.Profiler.startPreciseCoverage({callCount: true}))
+ .then(() => Protocol.Runtime.compileScript({ expression: nested, sourceURL: arguments.callee.name, persistScript: true }))
+ .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId }))
+ .then(InspectorTest.logMessage)
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(() => Protocol.Runtime.evaluate({ expression: "f()" }))
+ .then(Protocol.Profiler.takePreciseCoverage)
+ .then(LogSorted)
+ .then(Protocol.Profiler.stopPreciseCoverage)
+ .then(Protocol.Profiler.disable)
+ .then(Protocol.Runtime.disable)
+ .then(ClearAndGC)
+ .then(next);
+ },
+]);
diff --git a/deps/v8/test/inspector/cpu-profiler/coverage-expected.txt b/deps/v8/test/inspector/cpu-profiler/coverage-expected.txt
index 8094e901ce..9a811b21ec 100644
--- a/deps/v8/test/inspector/cpu-profiler/coverage-expected.txt
+++ b/deps/v8/test/inspector/cpu-profiler/coverage-expected.txt
@@ -9,6 +9,7 @@ Running test: testPreciseCountBaseline
functions : [
[0] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 15
@@ -51,6 +52,7 @@ Running test: testPreciseCountCoverage
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -61,6 +63,7 @@ Running test: testPreciseCountCoverage
}
[1] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 15
@@ -71,6 +74,7 @@ Running test: testPreciseCountCoverage
}
[2] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -81,6 +85,7 @@ Running test: testPreciseCountCoverage
}
[3] : {
functionName : iife
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -97,6 +102,7 @@ Running test: testPreciseCountCoverage
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -184,6 +190,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -194,6 +201,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
}
[1] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -204,6 +212,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
}
[2] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -214,6 +223,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
}
[3] : {
functionName : iife
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -230,6 +240,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -253,6 +264,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -263,6 +275,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
}
[1] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -273,6 +286,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
}
[2] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -283,6 +297,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
}
[3] : {
functionName : iife
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -299,6 +314,7 @@ Running test: testBestEffortCoverageWithPreciseBinaryEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -334,6 +350,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -344,6 +361,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
}
[1] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -354,6 +372,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
}
[2] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -364,6 +383,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
}
[3] : {
functionName : iife
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -380,6 +400,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -403,6 +424,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -413,6 +435,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
}
[1] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -423,6 +446,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
}
[2] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -433,6 +457,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
}
[3] : {
functionName : iife
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -449,6 +474,7 @@ Running test: testBestEffortCoverageWithPreciseCountEnabled
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -482,6 +508,7 @@ Running test: testEnablePreciseCountCoverageAtPause
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -492,6 +519,7 @@ Running test: testEnablePreciseCountCoverageAtPause
}
[1] : {
functionName : g
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -502,6 +530,7 @@ Running test: testEnablePreciseCountCoverageAtPause
}
[2] : {
functionName : f
+ isBlockCoverage : false
ranges : [
[0] : {
count : 4
@@ -512,6 +541,7 @@ Running test: testEnablePreciseCountCoverageAtPause
}
[3] : {
functionName : h
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -528,6 +558,7 @@ Running test: testEnablePreciseCountCoverageAtPause
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -563,6 +594,7 @@ Running test: testPreciseBinaryCoverage
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -573,6 +605,7 @@ Running test: testPreciseBinaryCoverage
}
[1] : {
functionName : fib
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -583,6 +616,7 @@ Running test: testPreciseBinaryCoverage
}
[2] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -593,6 +627,7 @@ Running test: testPreciseBinaryCoverage
}
[3] : {
functionName : iife
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -644,6 +679,7 @@ Running test: testPreciseBinaryCoverage
functions : [
[0] : {
functionName : is_optimized
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -660,6 +696,7 @@ Running test: testPreciseBinaryCoverage
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -676,6 +713,7 @@ Running test: testPreciseBinaryCoverage
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -718,6 +756,7 @@ Running test: testPreciseCountCoveragePartial
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -728,6 +767,7 @@ Running test: testPreciseCountCoveragePartial
}
[1] : {
functionName : outer
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -738,6 +778,7 @@ Running test: testPreciseCountCoveragePartial
}
[2] : {
functionName : nested_0
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -748,6 +789,7 @@ Running test: testPreciseCountCoveragePartial
}
[3] : {
functionName : nested_1
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -758,6 +800,7 @@ Running test: testPreciseCountCoveragePartial
}
[4] : {
functionName : nested_2
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -768,6 +811,7 @@ Running test: testPreciseCountCoveragePartial
}
[5] : {
functionName : nested_3
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -778,6 +822,7 @@ Running test: testPreciseCountCoveragePartial
}
[6] : {
functionName : nested_4
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -801,6 +846,7 @@ Running test: testPreciseCountCoveragePartial
functions : [
[0] : {
functionName : nested_1
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
@@ -811,6 +857,7 @@ Running test: testPreciseCountCoveragePartial
}
[1] : {
functionName : nested_2
+ isBlockCoverage : false
ranges : [
[0] : {
count : 0
@@ -827,6 +874,7 @@ Running test: testPreciseCountCoveragePartial
functions : [
[0] : {
functionName :
+ isBlockCoverage : false
ranges : [
[0] : {
count : 1
diff --git a/deps/v8/test/inspector/cpu-profiler/coverage.js b/deps/v8/test/inspector/cpu-profiler/coverage.js
index ce4995fd1c..31a698bbc4 100644
--- a/deps/v8/test/inspector/cpu-profiler/coverage.js
+++ b/deps/v8/test/inspector/cpu-profiler/coverage.js
@@ -58,9 +58,7 @@ function ClearAndGC() {
}
function GC() {
- return Protocol.HeapProfiler.enable()
- .then(() => Protocol.HeapProfiler.collectGarbage())
- .then(() => Protocol.HeapProfiler.disable());
+ return Protocol.HeapProfiler.collectGarbage();
}
function LogSorted(message) {
diff --git a/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt b/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt
index 76756736f3..7cd36faa2c 100644
--- a/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt
+++ b/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec-expected.txt
@@ -50,7 +50,7 @@ Paused #2
- [0] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":12}
- [1] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
Paused #3
- - [0] {"functionName":"generateAsmJs","function_lineNumber":1,"function_columnNumber":24,"lineNumber":3,"columnNumber":30}
+ - [0] {"functionName":"generateAsmJs","function_lineNumber":1,"function_columnNumber":24,"lineNumber":3,"columnNumber":31}
- [1] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":12}
- [2] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
Paused #4
@@ -58,39 +58,35 @@ Paused #4
- [1] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":12}
- [2] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
Paused #5
- - [0] {"functionName":"generateAsmJs","function_lineNumber":1,"function_columnNumber":24,"lineNumber":11,"columnNumber":2}
- - [1] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":18,"columnNumber":12}
- - [2] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #6
- [0] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [1] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #7
+Paused #6
- [0] {"functionName":"redirectFun","function_lineNumber":7,"function_columnNumber":24,"lineNumber":8,"columnNumber":6}
- [1] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [2] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #8
+Paused #7
- [0] {"functionName":"callDebugger","function_lineNumber":4,"function_columnNumber":25,"lineNumber":5,"columnNumber":6}
- [1] {"functionName":"redirectFun","function_lineNumber":7,"function_columnNumber":24,"lineNumber":8,"columnNumber":6}
- [2] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [3] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #9
+Paused #8
- [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":14,"columnNumber":4}
- [1] {"functionName":"callDebugger","function_lineNumber":4,"function_columnNumber":25,"lineNumber":5,"columnNumber":6}
- [2] {"functionName":"redirectFun","function_lineNumber":7,"function_columnNumber":24,"lineNumber":8,"columnNumber":6}
- [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #10
+Paused #9
- [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":15,"columnNumber":2}
- [1] {"functionName":"callDebugger","function_lineNumber":4,"function_columnNumber":25,"lineNumber":5,"columnNumber":6}
- [2] {"functionName":"redirectFun","function_lineNumber":7,"function_columnNumber":24,"lineNumber":8,"columnNumber":6}
- [3] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [4] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #11
+Paused #10
- [0] {"functionName":"callDebugger","function_lineNumber":4,"function_columnNumber":25,"lineNumber":6,"columnNumber":4}
- [1] {"functionName":"redirectFun","function_lineNumber":7,"function_columnNumber":24,"lineNumber":8,"columnNumber":6}
- [2] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [3] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
-Paused #12
+Paused #11
- [0] {"functionName":"redirectFun","function_lineNumber":7,"function_columnNumber":24,"lineNumber":9,"columnNumber":4}
- [1] {"functionName":"testFunction","function_lineNumber":0,"function_columnNumber":21,"lineNumber":19,"columnNumber":2}
- [2] {"functionName":"","function_lineNumber":0,"function_columnNumber":0,"lineNumber":0,"columnNumber":0}
diff --git a/deps/v8/test/inspector/debugger/break-location-function-calls-expected.txt b/deps/v8/test/inspector/debugger/break-location-function-calls-expected.txt
new file mode 100644
index 0000000000..23e30a4109
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/break-location-function-calls-expected.txt
@@ -0,0 +1,219 @@
+Break locations around function calls
+
+Running test: testFunctionCallAsArgument
+Break locations in expression:
+function test() {
+|C|foo2(|C|foo1())
+}
+
+Breakpoint at:
+function test() {
+#foo2(foo1())
+}
+
+Break at:
+function test() {
+#foo2(foo1())
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at:
+function test() {
+foo2(#foo1())
+}
+
+Break at:
+function test() {
+foo2(#foo1())
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at expression line.
+function test() {
+#foo2(foo1())
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+
+Running test: testFunctionCallAsArgument
+Break locations in expression:
+function test() {
+|C|foo2(|C|foo1());
+}
+
+Breakpoint at:
+function test() {
+#foo2(foo1());
+}
+
+Break at:
+function test() {
+#foo2(foo1());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at:
+function test() {
+foo2(#foo1());
+}
+
+Break at:
+function test() {
+foo2(#foo1());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at expression line.
+function test() {
+#foo2(foo1());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+
+Running test: testFunctionCallAsArguments
+Break locations in expression:
+function test() {
+|C|foo3(|C|foo1(), |C|foo2());
+}
+
+Breakpoint at:
+function test() {
+#foo3(foo1(), foo2());
+}
+
+Break at:
+function test() {
+#foo3(foo1(), foo2());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at:
+function test() {
+foo3(#foo1(), foo2());
+}
+
+Break at:
+function test() {
+foo3(#foo1(), foo2());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at:
+function test() {
+foo3(foo1(), #foo2());
+}
+
+Break at:
+function test() {
+foo3(foo1(), #foo2());
+}
+
+Debugger.stepInto called
+function foo1() {}
+function foo2() {#}
+function foo3() {}
+
+Breakpoint at expression line.
+function test() {
+#foo3(foo1(), foo2());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+
+Running test: testFunctionCallInBinaryExpression
+Break locations in expression:
+function test() {
+|C|foo3(|C|foo1() + |C|foo2());
+}
+
+Breakpoint at:
+function test() {
+#foo3(foo1() + foo2());
+}
+
+Break at:
+function test() {
+#foo3(foo1() + foo2());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at:
+function test() {
+foo3(#foo1() + foo2());
+}
+
+Break at:
+function test() {
+foo3(#foo1() + foo2());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
+Breakpoint at:
+function test() {
+foo3(foo1() + #foo2());
+}
+
+Break at:
+function test() {
+foo3(foo1() + #foo2());
+}
+
+Debugger.stepInto called
+function foo1() {}
+function foo2() {#}
+function foo3() {}
+
+Breakpoint at expression line.
+function test() {
+#foo3(foo1() + foo2());
+}
+
+Debugger.stepInto called
+
+function foo1() {#}
+function foo2() {}
+
diff --git a/deps/v8/test/inspector/debugger/break-location-function-calls.js b/deps/v8/test/inspector/debugger/break-location-function-calls.js
new file mode 100644
index 0000000000..c32eaff2c7
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/break-location-function-calls.js
@@ -0,0 +1,82 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Break locations around function calls');
+
+contextGroup.addScript(`
+function foo1() {}
+function foo2() {}
+function foo3() {}
+//# sourceURL=test.js`);
+
+InspectorTest.logProtocolCommandCalls('Debugger.stepInto');
+session.setupScriptMap();
+InspectorTest.runAsyncTestSuite([
+ async function testFunctionCallAsArgument() {
+ await testExpression('foo2(foo1())');
+ },
+
+ async function testFunctionCallAsArgument() {
+ await testExpression('foo2(foo1());');
+ },
+
+ async function testFunctionCallAsArguments() {
+ await testExpression('foo3(foo1(), foo2());');
+ },
+
+ async function testFunctionCallInBinaryExpression() {
+ await testExpression('foo3(foo1() + foo2());');
+ },
+]);
+
+async function logPauseLocation() {
+ let {params:{callFrames}} = await Protocol.Debugger.oncePaused();
+ session.logSourceLocation(callFrames[0].location);
+}
+
+async function testExpression(expression) {
+ await Protocol.Debugger.enable();
+ let wrapper = `function test() {
+${expression}
+}
+//# sourceURL=test-function.js`;
+ Protocol.Runtime.evaluate({expression: wrapper});
+ let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed();
+ let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({
+ start: {lineNumber: 0, columnNumber : 0, scriptId}});
+ locations = locations.filter(location => location.lineNumber === 1);
+ InspectorTest.log('Break locations in expression:');
+ await session.logBreakLocations(locations);
+
+ for (let location of locations) {
+ InspectorTest.log('Breakpoint at:');
+ await session.logSourceLocation(location);
+ let {result:{breakpointId}} = await Protocol.Debugger.setBreakpoint({
+ location});
+ let evaluate = Protocol.Runtime.evaluate({
+ expression: 'test();\n//# sourceURL=expr.js'});
+ InspectorTest.log('Break at:');
+ await logPauseLocation();
+ Protocol.Debugger.stepInto();
+ await logPauseLocation();
+ await Protocol.Debugger.removeBreakpoint({breakpointId});
+ Protocol.Debugger.resume();
+ await evaluate;
+ }
+
+ InspectorTest.log('Breakpoint at expression line.')
+ let {result:{breakpointId}} = await Protocol.Debugger.setBreakpointByUrl({
+ lineNumber: 1, url: 'test-function.js'});
+ let evaluate = Protocol.Runtime.evaluate({
+ expression: 'test();\n//# sourceURL=expr.js'});
+ await logPauseLocation();
+ Protocol.Debugger.stepInto();
+ await logPauseLocation();
+ await Protocol.Debugger.removeBreakpoint({breakpointId});
+ Protocol.Debugger.resume();
+ await evaluate;
+
+ await Protocol.Debugger.disable();
+}
diff --git a/deps/v8/test/inspector/debugger/break-locations-await-expected.txt b/deps/v8/test/inspector/debugger/break-locations-await-expected.txt
new file mode 100644
index 0000000000..1bf0317b21
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/break-locations-await-expected.txt
@@ -0,0 +1,361 @@
+Tests breakable locations in await expression.
+
+Running test: testBreakLocations
+
+function testFunction() {
+ async function f1() {
+ for (let x = |_|0; x |_|< 1; ++|_|x) |_|await x;
+ |_|return await Promise.|C|resolve(2);
+ |R|}
+
+ async function f2() {
+ let r = |_|await |C|f1() + await |C|f1();
+ |_|await |C|f1();
+ |_|await |C|f1().|C|then(x => x |_|* 2|R|);
+ |_|await [1].|C|map(x => Promise.|C|resolve(x)|R|)[0];
+ |_|await Promise.|C|resolve().|C|then(x => x |_|* 2|R|);
+ let p = |_|Promise.|C|resolve(42);
+ |_|await p;
+ |_|return r;
+ |R|}
+
+ return |C|f2();|R|
+}
+
+
+Running test: testStepInto
+(anonymous) (expr.js:0:0)
+
+
+testFunction (test.js:18:9)
+(anonymous) (expr.js:0:0)
+
+ return #f2();
+}
+
+f2 (test.js:8:12)
+testFunction (test.js:18:9)
+(anonymous) (expr.js:0:0)
+ async function f2() {
+ let r = #await f1() + await f1();
+ await f1();
+
+f1 (test.js:3:17)
+f2 (test.js:8:18)
+testFunction (test.js:18:9)
+(anonymous) (expr.js:0:0)
+ async function f1() {
+ for (let x = #0; x < 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+f2 (test.js:8:18)
+testFunction (test.js:18:9)
+(anonymous) (expr.js:0:0)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:32)
+f2 (test.js:8:18)
+testFunction (test.js:18:9)
+(anonymous) (expr.js:0:0)
+ async function f1() {
+ for (let x = 0; x < 1; ++x) #await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:29)
+ async function f1() {
+ for (let x = 0; x < 1; ++#x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:4:4)
+ for (let x = 0; x < 1; ++x) await x;
+ #return await Promise.resolve(2);
+ }
+
+f1 (test.js:5:2)
+ return await Promise.resolve(2);
+ #}
+
+
+f2 (test.js:8:31)
+ async function f2() {
+ let r = await f1() + await #f1();
+ await f1();
+
+f1 (test.js:3:17)
+f2 (test.js:8:31)
+ async function f1() {
+ for (let x = #0; x < 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+f2 (test.js:8:31)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:32)
+f2 (test.js:8:31)
+ async function f1() {
+ for (let x = 0; x < 1; ++x) #await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:29)
+ async function f1() {
+ for (let x = 0; x < 1; ++#x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:4:4)
+ for (let x = 0; x < 1; ++x) await x;
+ #return await Promise.resolve(2);
+ }
+
+f1 (test.js:5:2)
+ return await Promise.resolve(2);
+ #}
+
+
+f2 (test.js:9:4)
+ let r = await f1() + await f1();
+ #await f1();
+ await f1().then(x => x * 2);
+
+f1 (test.js:3:17)
+f2 (test.js:9:10)
+ async function f1() {
+ for (let x = #0; x < 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+f2 (test.js:9:10)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:32)
+f2 (test.js:9:10)
+ async function f1() {
+ for (let x = 0; x < 1; ++x) #await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:29)
+ async function f1() {
+ for (let x = 0; x < 1; ++#x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:4:4)
+ for (let x = 0; x < 1; ++x) await x;
+ #return await Promise.resolve(2);
+ }
+
+f1 (test.js:5:2)
+ return await Promise.resolve(2);
+ #}
+
+
+f2 (test.js:10:4)
+ await f1();
+ #await f1().then(x => x * 2);
+ await [1].map(x => Promise.resolve(x))[0];
+
+f1 (test.js:3:17)
+f2 (test.js:10:10)
+ async function f1() {
+ for (let x = #0; x < 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+f2 (test.js:10:10)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:32)
+f2 (test.js:10:10)
+ async function f1() {
+ for (let x = 0; x < 1; ++x) #await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:29)
+ async function f1() {
+ for (let x = 0; x < 1; ++#x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:4:4)
+ for (let x = 0; x < 1; ++x) await x;
+ #return await Promise.resolve(2);
+ }
+
+f1 (test.js:5:2)
+ return await Promise.resolve(2);
+ #}
+
+
+f1.then.x (test.js:10:27)
+ await f1();
+ await f1().then(x => x #* 2);
+ await [1].map(x => Promise.resolve(x))[0];
+
+f1.then.x (test.js:10:30)
+ await f1();
+ await f1().then(x => x * 2#);
+ await [1].map(x => Promise.resolve(x))[0];
+
+f2 (test.js:11:4)
+ await f1().then(x => x * 2);
+ #await [1].map(x => Promise.resolve(x))[0];
+ await Promise.resolve().then(x => x * 2);
+
+map.x (test.js:11:31)
+f2 (test.js:11:14)
+ await f1().then(x => x * 2);
+ await [1].map(x => Promise.#resolve(x))[0];
+ await Promise.resolve().then(x => x * 2);
+
+map.x (test.js:11:41)
+f2 (test.js:11:14)
+ await f1().then(x => x * 2);
+ await [1].map(x => Promise.resolve(x)#)[0];
+ await Promise.resolve().then(x => x * 2);
+
+f2 (test.js:12:4)
+ await [1].map(x => Promise.resolve(x))[0];
+ #await Promise.resolve().then(x => x * 2);
+ let p = Promise.resolve(42);
+
+f2 (test.js:13:12)
+ await Promise.resolve().then(x => x * 2);
+ let p = #Promise.resolve(42);
+ await p;
+
+f2 (test.js:14:4)
+ let p = Promise.resolve(42);
+ #await p;
+ return r;
+
+f2 (test.js:15:4)
+ await p;
+ #return r;
+ }
+
+f2 (test.js:16:2)
+ return r;
+ #}
+
+
+
+Running test: testStepOver
+f2 (test.js:8:12)
+testFunction (test.js:18:9)
+(anonymous) (expr.js:0:0)
+ async function f2() {
+ let r = #await f1() + await f1();
+ await f1();
+
+f2 (test.js:8:31)
+ async function f2() {
+ let r = await f1() + await #f1();
+ await f1();
+
+f2 (test.js:9:4)
+ let r = await f1() + await f1();
+ #await f1();
+ await f1().then(x => x * 2);
+
+f2 (test.js:10:4)
+ await f1();
+ #await f1().then(x => x * 2);
+ await [1].map(x => Promise.resolve(x))[0];
+
+f2 (test.js:11:4)
+ await f1().then(x => x * 2);
+ #await [1].map(x => Promise.resolve(x))[0];
+ await Promise.resolve().then(x => x * 2);
+
+f2 (test.js:12:4)
+ await [1].map(x => Promise.resolve(x))[0];
+ #await Promise.resolve().then(x => x * 2);
+ let p = Promise.resolve(42);
+
+f2 (test.js:13:12)
+ await Promise.resolve().then(x => x * 2);
+ let p = #Promise.resolve(42);
+ await p;
+
+f2 (test.js:14:4)
+ let p = Promise.resolve(42);
+ #await p;
+ return r;
+
+f2 (test.js:15:4)
+ await p;
+ #return r;
+ }
+
+f2 (test.js:16:2)
+ return r;
+ #}
+
+
+
+Running test: testStepIntoAfterBreakpoint
+f2 (test.js:9:4)
+ let r = await f1() + await f1();
+ #await f1();
+ await f1().then(x => x * 2);
+
+f1 (test.js:3:17)
+f2 (test.js:9:10)
+ async function f1() {
+ for (let x = #0; x < 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+f2 (test.js:9:10)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:32)
+f2 (test.js:9:10)
+ async function f1() {
+ for (let x = 0; x < 1; ++x) #await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:29)
+ async function f1() {
+ for (let x = 0; x < 1; ++#x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:3:22)
+ async function f1() {
+ for (let x = 0; x #< 1; ++x) await x;
+ return await Promise.resolve(2);
+
+f1 (test.js:4:4)
+ for (let x = 0; x < 1; ++x) await x;
+ #return await Promise.resolve(2);
+ }
+
diff --git a/deps/v8/test/inspector/debugger/break-locations-await.js b/deps/v8/test/inspector/debugger/break-locations-await.js
new file mode 100644
index 0000000000..665ab83f21
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/break-locations-await.js
@@ -0,0 +1,126 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Tests breakable locations in await expression.');
+
+let source = `
+function testFunction() {
+ async function f1() {
+ for (let x = 0; x < 1; ++x) await x;
+ return await Promise.resolve(2);
+ }
+
+ async function f2() {
+ let r = await f1() + await f1();
+ await f1();
+ await f1().then(x => x * 2);
+ await [1].map(x => Promise.resolve(x))[0];
+ await Promise.resolve().then(x => x * 2);
+ let p = Promise.resolve(42);
+ await p;
+ return r;
+ }
+
+ return f2();
+}
+//# sourceURL=test.js`;
+
+contextGroup.addScript(source);
+session.setupScriptMap();
+
+InspectorTest.runAsyncTestSuite([
+ async function testBreakLocations() {
+ Protocol.Debugger.enable();
+ let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed();
+ let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({
+ start: {lineNumber: 0, columnNumber : 0, scriptId}});
+ dumpAllLocations(locations);
+ },
+
+ async function testStepInto() {
+ Protocol.Debugger.pause();
+ let fin = Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js', awaitPromise: true}).then(() => false);
+ let result;
+ while (result = await Promise.race([fin, Protocol.Debugger.oncePaused()])) {
+ let {params:{callFrames}} = result;
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ Protocol.Debugger.stepInto();
+ }
+ Protocol.Runtime.evaluate({expression: '42'});
+ await Protocol.Debugger.oncePaused();
+ await Protocol.Debugger.resume();
+ },
+
+ async function testStepOver() {
+ Protocol.Debugger.pause();
+ let fin = Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js', awaitPromise: true}).then(() => false);
+ Protocol.Debugger.stepInto();
+ await Protocol.Debugger.oncePaused();
+ Protocol.Debugger.stepInto();
+ await Protocol.Debugger.oncePaused();
+
+ let result;
+ while (result = await Promise.race([fin, Protocol.Debugger.oncePaused()])) {
+ let {params:{callFrames}} = result;
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ Protocol.Debugger.stepOver();
+ }
+ Protocol.Runtime.evaluate({expression: '42'});
+ await Protocol.Debugger.oncePaused();
+ await Protocol.Debugger.resume();
+ },
+
+ async function testStepIntoAfterBreakpoint() {
+ Protocol.Debugger.setBreakpointByUrl({lineNumber: 9, url: 'test.js'});
+ Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js'});
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ await Protocol.Debugger.resume();
+
+ async function awaitPausedAndDump() {
+ let {params:{callFrames}} = await Protocol.Debugger.oncePaused();
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ }
+ }
+]);
+
+function dumpAllLocations(locations) {
+ var lines = source.split('\n');
+ var locations = locations.sort((loc1, loc2) => {
+ if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineNumber;
+ return loc2.columnNumber - loc1.columnNumber;
+ });
+ for (var location of locations) {
+ var line = lines[location.lineNumber];
+ line = line.slice(0, location.columnNumber) + locationMark(location.type) + line.slice(location.columnNumber);
+ lines[location.lineNumber] = line;
+ }
+ lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1);
+ InspectorTest.log(lines.join('\n') + '\n');
+}
+
+function locationMark(type) {
+ if (type === 'return') return '|R|';
+ if (type === 'call') return '|C|';
+ if (type === 'debuggerStatement') return '|D|';
+ return '|_|';
+}
diff --git a/deps/v8/test/inspector/debugger/break-locations-var-init-expected.txt b/deps/v8/test/inspector/debugger/break-locations-var-init-expected.txt
new file mode 100644
index 0000000000..2242088763
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/break-locations-var-init-expected.txt
@@ -0,0 +1,170 @@
+Tests breakable locations in variable initializations.
+
+Running test: testBreakLocations
+
+Running test: testStepInto
+
+function testFunction() {
+ var obj1 = |_|{a : 1};
+ var arr1 = |_|[1];
+ var promise = |_|Promise.|C|resolve(1).|C|then(x => x |_|* 2|R|).|C|then(x => x |_|/ 2|R|);
+ |_|Promise.|C|resolve(1).|C|then(x => x |_|* 2|R|).|C|then(x => x |_|/ 2|R|);
+ |_|promise = Promise.|C|resolve(1).|C|then(x => x |_|* 2|R|).|C|then(x => x |_|/ 2|R|);
+ var a = |_|1;
+ const x = |_|(a = 20);
+ var y = |_|(a = 100);
+ var z = |_|x + (a = 1) + (a = 2) + (a = 3) + |C|f();
+ function f() {
+ for (let { x, y } = |_|{ x: 0, y: 1 }; y |_|> 0; --|_|y) { let z = |_|x + y; }
+ |R|}
+ var b = obj1.|_|a;
+ |_|(async function asyncF() {
+ let r = |_|await Promise.|C|resolve(42);
+ |_|return r;
+ |R|})|C|();
+ |_|return promise;|R|
+}
+
+(anonymous) (expr.js:0:0)
+
+
+testFunction (test.js:2:13)
+(anonymous) (expr.js:0:0)
+function testFunction() {
+ var obj1 = #{a : 1};
+ var arr1 = [1];
+
+testFunction (test.js:3:13)
+(anonymous) (expr.js:0:0)
+ var obj1 = {a : 1};
+ var arr1 = #[1];
+ var promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+
+testFunction (test.js:4:16)
+(anonymous) (expr.js:0:0)
+ var arr1 = [1];
+ var promise = #Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+
+testFunction (test.js:5:2)
+(anonymous) (expr.js:0:0)
+ var promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ #Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+
+testFunction (test.js:6:2)
+(anonymous) (expr.js:0:0)
+ Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ #promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ var a = 1;
+
+testFunction (test.js:7:10)
+(anonymous) (expr.js:0:0)
+ promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ var a = #1;
+ const x = (a = 20);
+
+testFunction (test.js:8:12)
+(anonymous) (expr.js:0:0)
+ var a = 1;
+ const x = #(a = 20);
+ var y = (a = 100);
+
+testFunction (test.js:9:10)
+(anonymous) (expr.js:0:0)
+ const x = (a = 20);
+ var y = #(a = 100);
+ var z = x + (a = 1) + (a = 2) + (a = 3) + f();
+
+testFunction (test.js:10:10)
+(anonymous) (expr.js:0:0)
+ var y = (a = 100);
+ var z = #x + (a = 1) + (a = 2) + (a = 3) + f();
+ function f() {
+
+f (test.js:12:24)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ function f() {
+ for (let { x, y } = #{ x: 0, y: 1 }; y > 0; --y) { let z = x + y; }
+ }
+
+f (test.js:12:42)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ function f() {
+ for (let { x, y } = { x: 0, y: 1 }; y #> 0; --y) { let z = x + y; }
+ }
+
+f (test.js:12:62)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ function f() {
+ for (let { x, y } = { x: 0, y: 1 }; y > 0; --y) { let z = #x + y; }
+ }
+
+f (test.js:12:49)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ function f() {
+ for (let { x, y } = { x: 0, y: 1 }; y > 0; --#y) { let z = x + y; }
+ }
+
+f (test.js:12:42)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ function f() {
+ for (let { x, y } = { x: 0, y: 1 }; y #> 0; --y) { let z = x + y; }
+ }
+
+f (test.js:13:2)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ for (let { x, y } = { x: 0, y: 1 }; y > 0; --y) { let z = x + y; }
+ #}
+ var b = obj1.a;
+
+testFunction (test.js:14:15)
+(anonymous) (expr.js:0:0)
+ }
+ var b = obj1.#a;
+ (async function asyncF() {
+
+testFunction (test.js:15:2)
+(anonymous) (expr.js:0:0)
+ var b = obj1.a;
+ #(async function asyncF() {
+ let r = await Promise.resolve(42);
+
+asyncF (test.js:16:12)
+testFunction (test.js:18:4)
+(anonymous) (expr.js:0:0)
+ (async function asyncF() {
+ let r = #await Promise.resolve(42);
+ return r;
+
+asyncF (test.js:17:4)
+ let r = await Promise.resolve(42);
+ #return r;
+ })();
+
+asyncF (test.js:18:2)
+ return r;
+ #})();
+ return promise;
+
+
+Running test: testStepIntoAfterBreakpoint
+testFunction (test.js:10:10)
+(anonymous) (expr.js:0:0)
+ var y = (a = 100);
+ var z = #x + (a = 1) + (a = 2) + (a = 3) + f();
+ function f() {
+
+f (test.js:12:24)
+testFunction (test.js:10:44)
+(anonymous) (expr.js:0:0)
+ function f() {
+ for (let { x, y } = #{ x: 0, y: 1 }; y > 0; --y) { let z = x + y; }
+ }
+
diff --git a/deps/v8/test/inspector/debugger/break-locations-var-init.js b/deps/v8/test/inspector/debugger/break-locations-var-init.js
new file mode 100644
index 0000000000..291de8f69d
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/break-locations-var-init.js
@@ -0,0 +1,74 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Tests breakable locations in variable initializations.');
+
+let source = `
+function testFunction() {
+ var obj1 = {a : 1};
+ var arr1 = [1];
+ var promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ promise = Promise.resolve(1).then(x => x * 2).then(x => x / 2);
+ var a = 1;
+ const x = (a = 20);
+ var y = (a = 100);
+ var z = x + (a = 1) + (a = 2) + (a = 3) + f();
+ function f() {
+ for (let { x, y } = { x: 0, y: 1 }; y > 0; --y) { let z = x + y; }
+ }
+ var b = obj1.a;
+ (async function asyncF() {
+ let r = await Promise.resolve(42);
+ return r;
+ })();
+ return promise;
+}
+//# sourceURL=test.js`;
+
+contextGroup.addScript(source);
+session.setupScriptMap();
+
+InspectorTest.runAsyncTestSuite([
+ async function testBreakLocations() {
+ Protocol.Debugger.enable();
+ let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed();
+ let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({
+ start: {lineNumber: 0, columnNumber : 0, scriptId}});
+ session.logBreakLocations(locations);
+ },
+
+ async function testStepInto() {
+ Protocol.Debugger.pause();
+ let fin = Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js', awaitPromise: true}).then(() => false);
+ let result;
+ while (result = await Promise.race([fin, Protocol.Debugger.oncePaused()])) {
+ let {params:{callFrames}} = result;
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ Protocol.Debugger.stepInto();
+ }
+ Protocol.Runtime.evaluate({expression: '42'});
+ await Protocol.Debugger.oncePaused();
+ await Protocol.Debugger.resume();
+ },
+
+ async function testStepIntoAfterBreakpoint() {
+ Protocol.Debugger.setBreakpointByUrl({lineNumber: 10, url: 'test.js'});
+ Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js'});
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ await Protocol.Debugger.resume();
+
+ async function awaitPausedAndDump() {
+ let {params:{callFrames}} = await Protocol.Debugger.oncePaused();
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ }
+ }
+]);
diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt
new file mode 100644
index 0000000000..e4819bd6d1
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt
@@ -0,0 +1,505 @@
+Tests evaluateOnCallFrame in module.
+
+Running test: testTotal
+foo1 (module1:7:2)
+foo2 (module2:6:9)
+(anonymous) (module3:4:0)
+local:foo1
+[
+ [0] : c1 = 12
+ [1] : g1 = 2
+]
+module
+[
+ [0] : a1 = 10
+ [1] : g1 = 1
+ [2] : b1 = 11
+ [3] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
+]
+global
+[
+ ...
+]
+Check variables in frame#0
+ let g1 = 2;
+ #debugger;
+ return a1 + b1 + c1 + g1;
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+c1 =
+{
+ description : 12
+ type : number
+ value : 12
+}
+Evaluating: ++c1
+updated c1 =
+{
+ description : 13
+ type : number
+ value : 13
+}
+Evaluating: --c1
+g1 =
+{
+ description : 2
+ type : number
+ value : 2
+}
+Evaluating: ++g1
+updated g1 =
+{
+ description : 3
+ type : number
+ value : 3
+}
+Evaluating: --g1
+a1 =
+{
+ description : 10
+ type : number
+ value : 10
+}
+Evaluating: ++a1
+updated a1 =
+{
+ description : 11
+ type : number
+ value : 11
+}
+Evaluating: --a1
+b1 =
+{
+ description : 11
+ type : number
+ value : 11
+}
+Evaluating: ++b1
+updated b1 =
+{
+ description : 12
+ type : number
+ value : 12
+}
+Evaluating: --b1
+foo1 =
+{
+ className : Function
+ description : function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
+ objectId : <objectId>
+ type : function
+}
+local:foo2
+[
+ [0] : c2 = 22
+]
+module
+[
+ [0] : a2 = 20
+ [1] : foo1 = function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
+ [2] : b2 = 21
+ [3] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
+]
+global
+[
+ ...
+]
+Check variables in frame#1
+ let c2 = 22;
+ return #foo1() + a2 + b2 + c2;
+}
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+c2 =
+{
+ description : 22
+ type : number
+ value : 22
+}
+Evaluating: ++c2
+updated c2 =
+{
+ description : 23
+ type : number
+ value : 23
+}
+Evaluating: --c2
+a2 =
+{
+ description : 20
+ type : number
+ value : 20
+}
+Evaluating: ++a2
+updated a2 =
+{
+ description : 21
+ type : number
+ value : 21
+}
+Evaluating: --a2
+foo1 =
+{
+ className : Function
+ description : function foo1() { let c1 = 12; let g1 = 2; debugger; return a1 + b1 + c1 + g1; }
+ objectId : <objectId>
+ type : function
+}
+b2 =
+{
+ description : 21
+ type : number
+ value : 21
+}
+Evaluating: ++b2
+updated b2 =
+{
+ description : 22
+ type : number
+ value : 22
+}
+Evaluating: --b2
+foo2 =
+{
+ className : Function
+ description : function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
+ objectId : <objectId>
+ type : function
+}
+module
+[
+ [0] : a3 = 30
+ [1] : foo2 = function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
+ [2] : b3 = 31
+]
+global
+[
+ ...
+]
+Check variables in frame#2
+export let b3 = 31;
+#foo2();
+
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+a3 =
+{
+ description : 30
+ type : number
+ value : 30
+}
+Evaluating: ++a3
+updated a3 =
+{
+ description : 31
+ type : number
+ value : 31
+}
+Evaluating: --a3
+foo2 =
+{
+ className : Function
+ description : function foo2() { let c2 = 22; return foo1() + a2 + b2 + c2; }
+ objectId : <objectId>
+ type : function
+}
+b3 =
+{
+ description : 31
+ type : number
+ value : 31
+}
+Evaluating: ++b3
+updated b3 =
+{
+ description : 32
+ type : number
+ value : 32
+}
+Evaluating: --b3
+
+Running test: testAnother
+(anonymous) (module4:5:13)
+bar (module4:5:24)
+(anonymous) (module4:7:0)
+local
+[
+]
+closure:bar
+[
+ [0] : a = 0
+]
+module
+[
+ [0] : a = 1
+ [1] : b = 2
+ [2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); }
+]
+global
+[
+ ...
+]
+Check variables in frame#0
+ let a = 0;
+ (() => {a; #debugger;})();
+};
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+a =
+{
+ description : 0
+ type : number
+ value : 0
+}
+Evaluating: ++a
+updated a =
+{
+ description : 1
+ type : number
+ value : 1
+}
+Evaluating: --a
+b =
+{
+ description : 2
+ type : number
+ value : 2
+}
+Evaluating: ++b
+updated b =
+{
+ description : 3
+ type : number
+ value : 3
+}
+Evaluating: --b
+bar =
+{
+ className : Function
+ description : function bar() { let a = 0; (() => {a; debugger;})(); }
+ objectId : <objectId>
+ type : function
+}
+local:bar
+[
+ [0] : a = 0
+]
+module
+[
+ [0] : a = 1
+ [1] : b = 2
+ [2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); }
+]
+global
+[
+ ...
+]
+Check variables in frame#1
+ let a = 0;
+ (() => {a; debugger;})#();
+};
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+a =
+{
+ description : 0
+ type : number
+ value : 0
+}
+Evaluating: ++a
+updated a =
+{
+ description : 1
+ type : number
+ value : 1
+}
+Evaluating: --a
+b =
+{
+ description : 2
+ type : number
+ value : 2
+}
+Evaluating: ++b
+updated b =
+{
+ description : 3
+ type : number
+ value : 3
+}
+Evaluating: --b
+bar =
+{
+ className : Function
+ description : function bar() { let a = 0; (() => {a; debugger;})(); }
+ objectId : <objectId>
+ type : function
+}
+module
+[
+ [0] : a = 1
+ [1] : b = 2
+ [2] : bar = function bar() { let a = 0; (() => {a; debugger;})(); }
+]
+global
+[
+ ...
+]
+Check variables in frame#2
+};
+#bar();
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+a =
+{
+ description : 1
+ type : number
+ value : 1
+}
+Evaluating: ++a
+updated a =
+{
+ description : 2
+ type : number
+ value : 2
+}
+Evaluating: --a
+b =
+{
+ description : 2
+ type : number
+ value : 2
+}
+Evaluating: ++b
+updated b =
+{
+ description : 3
+ type : number
+ value : 3
+}
+Evaluating: --b
+bar =
+{
+ className : Function
+ description : function bar() { let a = 0; (() => {a; debugger;})(); }
+ objectId : <objectId>
+ type : function
+}
+
+Running test: testDifferentModuleVariables
+(anonymous) (module5:5:0)
+module
+[
+ [0] : b2 = 21
+ [1] : a = 0
+ [2] : b = 0
+ [3] : c = 0
+]
+global
+[
+ ...
+]
+Check variables in frame#0
+export var c = 0;
+#debugger;
+
+
+Array =
+{
+ className : Function
+ description : function Array() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+b2 =
+{
+ description : 21
+ type : number
+ value : 21
+}
+Evaluating: ++b2
+updated b2 =
+{
+ description : 21
+ type : number
+ value : 21
+}
+Evaluating: --b2
+a =
+{
+ description : 0
+ type : number
+ value : 0
+}
+Evaluating: ++a
+updated a =
+{
+ description : 0
+ type : number
+ value : 0
+}
+Evaluating: --a
+b =
+{
+ description : 0
+ type : number
+ value : 0
+}
+Evaluating: ++b
+updated b =
+{
+ description : 1
+ type : number
+ value : 1
+}
+Evaluating: --b
+c =
+{
+ description : 0
+ type : number
+ value : 0
+}
+Evaluating: ++c
+updated c =
+{
+ description : 1
+ type : number
+ value : 1
+}
+Evaluating: --c
diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js
new file mode 100644
index 0000000000..ef9050ec48
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js
@@ -0,0 +1,141 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Tests evaluateOnCallFrame in module.');
+
+var module1 = `
+let a1 = 10;
+let g1 = 1;
+export let b1 = 11;
+export function foo1() {
+ let c1 = 12;
+ let g1 = 2;
+ debugger;
+ return a1 + b1 + c1 + g1;
+}`;
+
+var module2 = `
+import { foo1 } from 'module1';
+let a2 = 20;
+export let b2 = 21;
+export function foo2() {
+ let c2 = 22;
+ return foo1() + a2 + b2 + c2;
+}`;
+
+var module3 = `
+import { foo2 } from 'module2';
+let a3 = 30;
+export let b3 = 31;
+foo2();
+`;
+
+var module4 = `
+let a = 1;
+let b = 2;
+function bar() {
+ let a = 0;
+ (() => {a; debugger;})();
+};
+bar();`;
+
+var module5 = `
+import { b2 } from 'module2';
+export const a = 0;
+export let b = 0;
+export var c = 0;
+debugger;
+`;
+
+InspectorTest.runAsyncTestSuite([
+ async function testTotal() {
+ session.setupScriptMap();
+ Protocol.Debugger.enable();
+ contextGroup.addModule(module1, 'module1');
+ contextGroup.addModule(module2, 'module2');
+ contextGroup.addModule(module3, 'module3');
+ let {params:{callFrames}} = (await Protocol.Debugger.oncePaused());
+ session.logCallFrames(callFrames);
+ for (let i = 0; i < callFrames.length; ++i) {
+ await checkFrame(callFrames[i], i);
+ }
+ await Protocol.Debugger.resume();
+ },
+
+ async function testAnother() {
+ contextGroup.addModule(module4, 'module4');
+ let {params:{callFrames}} = (await Protocol.Debugger.oncePaused());
+ session.logCallFrames(callFrames);
+ for (let i = 0; i < callFrames.length; ++i) {
+ await checkFrame(callFrames[i], i);
+ }
+ await Protocol.Debugger.resume();
+ },
+
+ async function testDifferentModuleVariables() {
+ contextGroup.addModule(module5, 'module5');
+ let {params:{callFrames}} = (await Protocol.Debugger.oncePaused());
+ session.logCallFrames(callFrames);
+ for (let i = 0; i < callFrames.length; ++i) {
+ await checkFrame(callFrames[i], i);
+ }
+ await Protocol.Debugger.resume();
+ }
+]);
+
+async function checkFrame(frame, i) {
+ let variables = new Set();
+ variables.add('Array');
+
+ for (let scopeChain of frame.scopeChain) {
+ if (scopeChain.name) {
+ InspectorTest.log(scopeChain.type + ':' + scopeChain.name);
+ } else {
+ InspectorTest.log(scopeChain.type);
+ }
+ if (scopeChain.type === 'global') {
+ InspectorTest.log('[\n ...\n]');
+ continue;
+ }
+ let {result: {result}} = await Protocol.Runtime.getProperties({
+ objectId: scopeChain.object.objectId});
+ result.forEach(v => variables.add(v.name));
+ result = result.map(v => v.value ?
+ (v.name + ' = ' + v.value.description) : (v.name));
+ InspectorTest.logMessage(result);
+ }
+
+ InspectorTest.log(`Check variables in frame#${i}`);
+ await session.logSourceLocation(frame.location);
+ await checkVariables(frame.callFrameId, variables);
+}
+
+async function checkVariables(callFrameId, names) {
+ for (let name of names) {
+ var {result:{result}} = await Protocol.Debugger.evaluateOnCallFrame({
+ callFrameId, expression: name});
+ if (result.type === 'object' && result.subtype && result.subtype === 'error') {
+ continue;
+ }
+ InspectorTest.log(name + ' = ');
+ InspectorTest.logMessage(result);
+ if (result.type === "number") {
+ let updateExpression = '++' + name;
+ InspectorTest.log('Evaluating: ' + updateExpression);
+ await Protocol.Debugger.evaluateOnCallFrame({
+ callFrameId, expression: updateExpression});
+
+ var {result:{result}} = await Protocol.Debugger.evaluateOnCallFrame({
+ callFrameId, expression: name});
+ InspectorTest.log('updated ' + name + ' = ');
+ InspectorTest.logMessage(result);
+
+ updateExpression = '--' + name;
+ InspectorTest.log('Evaluating: ' + updateExpression);
+ await Protocol.Debugger.evaluateOnCallFrame({
+ callFrameId, expression: updateExpression});
+ }
+ }
+}
diff --git a/deps/v8/test/inspector/debugger/for-of-loops-expected.txt b/deps/v8/test/inspector/debugger/for-of-loops-expected.txt
new file mode 100644
index 0000000000..6d23c941cb
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/for-of-loops-expected.txt
@@ -0,0 +1,395 @@
+Tests breakable locations in for-of loops.
+
+Running test: testBreakLocations
+
+Running test: testStepInto
+
+function testFunction() {
+ var obj = |_|{a : 1};
+ var arr = |_|[1];
+ var all = |_|[];
+ for (var |_|k in |_|arr) { all.|C|push(k); }
+ for (var |_|k of |_|arr) { all.|C|push(k); }
+ for (var |_|k in |_|obj) { all.|C|push(k); }
+ for (let |_|k in |_|arr) { all.|C|push(k); }
+ for (let |_|k of |_|arr) { all.|C|push(k); }
+ for (let |_|k in |_|obj) { all.|C|push(k); }
+
+ var iterable = |_|{
+ [Symbol.iterator]() {
+ |_|return {
+ i: 0,
+ next() {
+ if (this.|_|i < 1) {
+ |_|return { value: this.i++, done: false };|R|
+ }
+ |_|return { value: undefined, done: true };|R|
+ }
+ };|R|
+ }
+ };
+ for (var |_|k of |_|iterable) { all.|C|push(k); }
+ |_|iterable.i = 0;
+ for (let |_|k of |_|iterable) { all.|C|push(k); }
+|R|}
+
+(anonymous) (expr.js:0:0)
+
+
+testFunction (test.js:2:12)
+(anonymous) (expr.js:0:0)
+function testFunction() {
+ var obj = #{a : 1};
+ var arr = [1];
+
+testFunction (test.js:3:12)
+(anonymous) (expr.js:0:0)
+ var obj = {a : 1};
+ var arr = #[1];
+ var all = [];
+
+testFunction (test.js:4:12)
+(anonymous) (expr.js:0:0)
+ var arr = [1];
+ var all = #[];
+ for (var k in arr) { all.push(k); }
+
+testFunction (test.js:5:16)
+(anonymous) (expr.js:0:0)
+ var all = [];
+ for (var k in #arr) { all.push(k); }
+ for (var k of arr) { all.push(k); }
+
+testFunction (test.js:5:11)
+(anonymous) (expr.js:0:0)
+ var all = [];
+ for (var #k in arr) { all.push(k); }
+ for (var k of arr) { all.push(k); }
+
+testFunction (test.js:5:27)
+(anonymous) (expr.js:0:0)
+ var all = [];
+ for (var k in arr) { all.#push(k); }
+ for (var k of arr) { all.push(k); }
+
+testFunction (test.js:5:11)
+(anonymous) (expr.js:0:0)
+ var all = [];
+ for (var #k in arr) { all.push(k); }
+ for (var k of arr) { all.push(k); }
+
+testFunction (test.js:6:16)
+(anonymous) (expr.js:0:0)
+ for (var k in arr) { all.push(k); }
+ for (var k of #arr) { all.push(k); }
+ for (var k in obj) { all.push(k); }
+
+testFunction (test.js:6:11)
+(anonymous) (expr.js:0:0)
+ for (var k in arr) { all.push(k); }
+ for (var #k of arr) { all.push(k); }
+ for (var k in obj) { all.push(k); }
+
+testFunction (test.js:6:27)
+(anonymous) (expr.js:0:0)
+ for (var k in arr) { all.push(k); }
+ for (var k of arr) { all.#push(k); }
+ for (var k in obj) { all.push(k); }
+
+testFunction (test.js:6:11)
+(anonymous) (expr.js:0:0)
+ for (var k in arr) { all.push(k); }
+ for (var #k of arr) { all.push(k); }
+ for (var k in obj) { all.push(k); }
+
+testFunction (test.js:7:16)
+(anonymous) (expr.js:0:0)
+ for (var k of arr) { all.push(k); }
+ for (var k in #obj) { all.push(k); }
+ for (let k in arr) { all.push(k); }
+
+testFunction (test.js:7:11)
+(anonymous) (expr.js:0:0)
+ for (var k of arr) { all.push(k); }
+ for (var #k in obj) { all.push(k); }
+ for (let k in arr) { all.push(k); }
+
+testFunction (test.js:7:27)
+(anonymous) (expr.js:0:0)
+ for (var k of arr) { all.push(k); }
+ for (var k in obj) { all.#push(k); }
+ for (let k in arr) { all.push(k); }
+
+testFunction (test.js:7:11)
+(anonymous) (expr.js:0:0)
+ for (var k of arr) { all.push(k); }
+ for (var #k in obj) { all.push(k); }
+ for (let k in arr) { all.push(k); }
+
+testFunction (test.js:8:16)
+(anonymous) (expr.js:0:0)
+ for (var k in obj) { all.push(k); }
+ for (let k in #arr) { all.push(k); }
+ for (let k of arr) { all.push(k); }
+
+testFunction (test.js:8:11)
+(anonymous) (expr.js:0:0)
+ for (var k in obj) { all.push(k); }
+ for (let #k in arr) { all.push(k); }
+ for (let k of arr) { all.push(k); }
+
+testFunction (test.js:8:27)
+(anonymous) (expr.js:0:0)
+ for (var k in obj) { all.push(k); }
+ for (let k in arr) { all.#push(k); }
+ for (let k of arr) { all.push(k); }
+
+testFunction (test.js:8:11)
+(anonymous) (expr.js:0:0)
+ for (var k in obj) { all.push(k); }
+ for (let #k in arr) { all.push(k); }
+ for (let k of arr) { all.push(k); }
+
+testFunction (test.js:9:16)
+(anonymous) (expr.js:0:0)
+ for (let k in arr) { all.push(k); }
+ for (let k of #arr) { all.push(k); }
+ for (let k in obj) { all.push(k); }
+
+testFunction (test.js:9:11)
+(anonymous) (expr.js:0:0)
+ for (let k in arr) { all.push(k); }
+ for (let #k of arr) { all.push(k); }
+ for (let k in obj) { all.push(k); }
+
+testFunction (test.js:9:27)
+(anonymous) (expr.js:0:0)
+ for (let k in arr) { all.push(k); }
+ for (let k of arr) { all.#push(k); }
+ for (let k in obj) { all.push(k); }
+
+testFunction (test.js:9:11)
+(anonymous) (expr.js:0:0)
+ for (let k in arr) { all.push(k); }
+ for (let #k of arr) { all.push(k); }
+ for (let k in obj) { all.push(k); }
+
+testFunction (test.js:10:16)
+(anonymous) (expr.js:0:0)
+ for (let k of arr) { all.push(k); }
+ for (let k in #obj) { all.push(k); }
+
+
+testFunction (test.js:10:11)
+(anonymous) (expr.js:0:0)
+ for (let k of arr) { all.push(k); }
+ for (let #k in obj) { all.push(k); }
+
+
+testFunction (test.js:10:27)
+(anonymous) (expr.js:0:0)
+ for (let k of arr) { all.push(k); }
+ for (let k in obj) { all.#push(k); }
+
+
+testFunction (test.js:10:11)
+(anonymous) (expr.js:0:0)
+ for (let k of arr) { all.push(k); }
+ for (let #k in obj) { all.push(k); }
+
+
+testFunction (test.js:12:17)
+(anonymous) (expr.js:0:0)
+
+ var iterable = #{
+ [Symbol.iterator]() {
+
+testFunction (test.js:25:16)
+(anonymous) (expr.js:0:0)
+ };
+ for (var k of #iterable) { all.push(k); }
+ iterable.i = 0;
+
+[Symbol.iterator] (test.js:14:6)
+testFunction (test.js:25:16)
+(anonymous) (expr.js:0:0)
+ [Symbol.iterator]() {
+ #return {
+ i: 0,
+
+[Symbol.iterator] (test.js:22:8)
+testFunction (test.js:25:16)
+(anonymous) (expr.js:0:0)
+ }
+ };#
+ }
+
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ };
+ for (var #k of iterable) { all.push(k); }
+ iterable.i = 0;
+
+next (test.js:17:19)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ next() {
+ if (this.#i < 1) {
+ return { value: this.i++, done: false };
+
+next (test.js:18:12)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ if (this.i < 1) {
+ #return { value: this.i++, done: false };
+ }
+
+next (test.js:18:52)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ if (this.i < 1) {
+ return { value: this.i++, done: false };#
+ }
+
+testFunction (test.js:25:32)
+(anonymous) (expr.js:0:0)
+ };
+ for (var k of iterable) { all.#push(k); }
+ iterable.i = 0;
+
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ };
+ for (var #k of iterable) { all.push(k); }
+ iterable.i = 0;
+
+next (test.js:17:19)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ next() {
+ if (this.#i < 1) {
+ return { value: this.i++, done: false };
+
+next (test.js:20:10)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ }
+ #return { value: undefined, done: true };
+ }
+
+next (test.js:20:50)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ }
+ return { value: undefined, done: true };#
+ }
+
+testFunction (test.js:26:2)
+(anonymous) (expr.js:0:0)
+ for (var k of iterable) { all.push(k); }
+ #iterable.i = 0;
+ for (let k of iterable) { all.push(k); }
+
+testFunction (test.js:27:16)
+(anonymous) (expr.js:0:0)
+ iterable.i = 0;
+ for (let k of #iterable) { all.push(k); }
+}
+
+[Symbol.iterator] (test.js:14:6)
+testFunction (test.js:27:16)
+(anonymous) (expr.js:0:0)
+ [Symbol.iterator]() {
+ #return {
+ i: 0,
+
+[Symbol.iterator] (test.js:22:8)
+testFunction (test.js:27:16)
+(anonymous) (expr.js:0:0)
+ }
+ };#
+ }
+
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ iterable.i = 0;
+ for (let #k of iterable) { all.push(k); }
+}
+
+next (test.js:17:19)
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ next() {
+ if (this.#i < 1) {
+ return { value: this.i++, done: false };
+
+next (test.js:18:12)
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ if (this.i < 1) {
+ #return { value: this.i++, done: false };
+ }
+
+next (test.js:18:52)
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ if (this.i < 1) {
+ return { value: this.i++, done: false };#
+ }
+
+testFunction (test.js:27:32)
+(anonymous) (expr.js:0:0)
+ iterable.i = 0;
+ for (let k of iterable) { all.#push(k); }
+}
+
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ iterable.i = 0;
+ for (let #k of iterable) { all.push(k); }
+}
+
+next (test.js:17:19)
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ next() {
+ if (this.#i < 1) {
+ return { value: this.i++, done: false };
+
+next (test.js:20:10)
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ }
+ #return { value: undefined, done: true };
+ }
+
+next (test.js:20:50)
+testFunction (test.js:27:11)
+(anonymous) (expr.js:0:0)
+ }
+ return { value: undefined, done: true };#
+ }
+
+testFunction (test.js:28:0)
+(anonymous) (expr.js:0:0)
+ for (let k of iterable) { all.push(k); }
+#}
+
+(anonymous) (expr.js:0:34)
+
+
+
+Running test: testStepIntoAfterBreakpoint
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ };
+ for (var #k of iterable) { all.push(k); }
+ iterable.i = 0;
+
+next (test.js:17:19)
+testFunction (test.js:25:11)
+(anonymous) (expr.js:0:0)
+ next() {
+ if (this.#i < 1) {
+ return { value: this.i++, done: false };
+
diff --git a/deps/v8/test/inspector/debugger/for-of-loops.js b/deps/v8/test/inspector/debugger/for-of-loops.js
new file mode 100644
index 0000000000..0fa0a26a77
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/for-of-loops.js
@@ -0,0 +1,82 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Tests breakable locations in for-of loops.');
+
+let source = `
+function testFunction() {
+ var obj = {a : 1};
+ var arr = [1];
+ var all = [];
+ for (var k in arr) { all.push(k); }
+ for (var k of arr) { all.push(k); }
+ for (var k in obj) { all.push(k); }
+ for (let k in arr) { all.push(k); }
+ for (let k of arr) { all.push(k); }
+ for (let k in obj) { all.push(k); }
+
+ var iterable = {
+ [Symbol.iterator]() {
+ return {
+ i: 0,
+ next() {
+ if (this.i < 1) {
+ return { value: this.i++, done: false };
+ }
+ return { value: undefined, done: true };
+ }
+ };
+ }
+ };
+ for (var k of iterable) { all.push(k); }
+ iterable.i = 0;
+ for (let k of iterable) { all.push(k); }
+}
+//# sourceURL=test.js`;
+
+contextGroup.addScript(source);
+session.setupScriptMap();
+
+InspectorTest.runAsyncTestSuite([
+ async function testBreakLocations() {
+ Protocol.Debugger.enable();
+ let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed();
+ let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({
+ start: {lineNumber: 0, columnNumber : 0, scriptId}});
+ session.logBreakLocations(locations);
+ },
+
+ async function testStepInto() {
+ Protocol.Debugger.pause();
+ let fin = Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js'}).then(() => false);
+ let result;
+ while (result = await Promise.race([fin, Protocol.Debugger.oncePaused()])) {
+ let {params:{callFrames}} = result;
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ Protocol.Debugger.stepInto();
+ }
+ Protocol.Runtime.evaluate({expression: '42'});
+ await Protocol.Debugger.oncePaused();
+ await Protocol.Debugger.resume();
+ },
+
+ async function testStepIntoAfterBreakpoint() {
+ Protocol.Debugger.setBreakpointByUrl({lineNumber: 25, url: 'test.js'});
+ Protocol.Runtime.evaluate({
+ expression: 'testFunction()//# sourceURL=expr.js'});
+ await awaitPausedAndDump();
+ Protocol.Debugger.stepInto();
+ await awaitPausedAndDump();
+ await Protocol.Debugger.resume();
+
+ async function awaitPausedAndDump() {
+ let {params:{callFrames}} = await Protocol.Debugger.oncePaused();
+ session.logCallFrames(callFrames);
+ session.logSourceLocation(callFrames[0].location);
+ }
+ }
+]);
diff --git a/deps/v8/test/inspector/debugger/framework-precise-ranges-expected.txt b/deps/v8/test/inspector/debugger/framework-precise-ranges-expected.txt
index c54587a7e2..0e0791d838 100644
--- a/deps/v8/test/inspector/debugger/framework-precise-ranges-expected.txt
+++ b/deps/v8/test/inspector/debugger/framework-precise-ranges-expected.txt
@@ -21,7 +21,7 @@ foo (test.js:9:2)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-foo (test.js:10:0)
+foo (test.js:9:15)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
@@ -43,7 +43,7 @@ foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-boo (test.js:13:0)
+boo (test.js:12:12)
foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
@@ -71,12 +71,12 @@ foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-boo (test.js:13:0)
+boo (test.js:12:12)
foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-foo (test.js:10:0)
+foo (test.js:9:15)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
@@ -100,12 +100,12 @@ foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-boo (test.js:13:0)
+boo (test.js:12:12)
foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-foo (test.js:10:0)
+foo (test.js:9:15)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
@@ -129,12 +129,12 @@ foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-boo (test.js:13:0)
+boo (test.js:12:12)
foo (test.js:9:9)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
-foo (test.js:10:0)
+foo (test.js:9:15)
testFunction (test.js:15:2)
(anonymous) (expr.js:0:0)
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt
index c685625de8..972a757a78 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt
@@ -43,28 +43,28 @@ function boo(){ #return Promise.resolve().then(() => 42); }
Test end is undefined
-function foo(){ #return Promise.#resolve(); #}
-function boo(){ #return Promise.#resolve().#then(() => #42#); #}
+function foo(){ #return Promise.#resolve();# }
+function boo(){ #return Promise.#resolve().#then(() => #42#);# }
#
Test end.lineNumber > scripts.lineCount()
-function foo(){ #return Promise.#resolve(); #}
-function boo(){ #return Promise.#resolve().#then(() => #42#); #}
+function foo(){ #return Promise.#resolve();# }
+function boo(){ #return Promise.#resolve().#then(() => #42#);# }
#
Test one string
-function foo(){ #return Promise.#resolve(); #}
+function foo(){ #return Promise.#resolve();# }
function boo(){ return Promise.resolve().then(() => 42); }
Test end.columnNumber > end.line.length(), should be the same as previous.
-function foo(){ #return Promise.#resolve(); #}
+function foo(){ #return Promise.#resolve();# }
function boo(){ return Promise.resolve().then(() => 42); }
Running test: getPossibleBreakpointsInArrow
-function foo() { #return Promise.#resolve().#then(() => #239#).#then(() => #42#).#then(() => #() => #42#) #}
+function foo() { #return Promise.#resolve().#then(() => #239#).#then(() => #42#).#then(() => #() => #42#)# #}
Running test: arrowFunctionFirstLine
function foo1() { #Promise.#resolve().#then(() => #42#) #}
@@ -191,22 +191,22 @@ function boo(){ #return Promise.resolve().then(() => 42); }
Test end is undefined
-function foo(){ #return Promise.#resolve(); #}
-function boo(){ #return Promise.#resolve().#then(() => #42#); #}
+function foo(){ #return Promise.#resolve();# }
+function boo(){ #return Promise.#resolve().#then(() => #42#);# }
#
Test end.lineNumber > scripts.lineCount()
-function foo(){ #return Promise.#resolve(); #}
-function boo(){ #return Promise.#resolve().#then(() => #42#); #}
+function foo(){ #return Promise.#resolve();# }
+function boo(){ #return Promise.#resolve().#then(() => #42#);# }
#
Test one string
-function foo(){ #return Promise.#resolve(); #}
+function foo(){ #return Promise.#resolve();# }
function boo(){ return Promise.resolve().then(() => 42); }
Test end.columnNumber > end.line.length(), should be the same as previous.
-function foo(){ #return Promise.#resolve(); #}
+function foo(){ #return Promise.#resolve();# }
function boo(){ return Promise.resolve().then(() => 42); }
@@ -254,14 +254,14 @@ function foo6() { Promise.resolve().then(() => 42^) }
Running test: arrowFunctionReturn
#() => #239#
-function foo() { function boo() { #return 239 #} #}#
+function foo() { function boo() { #return 239# } #}#
#() => { #239 #}#
function foo() { #239 #}#
#() => #23#9#
-#() => { #return 239 #}
+#() => { #return 239# #}
Running test: argumentsAsCalls
function foo(){#}
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt
index d83a4aa137..7ea0920182 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master-expected.txt
@@ -19,8 +19,8 @@ function testProcedure() {
|R|}
function returnTrue() {
- |_|return true;
-|R|}
+ |_|return true;|R|
+}
function testIf() {
var a;
@@ -56,49 +56,49 @@ function testNested() {
function nested3() {
|R|}
|C|nested3();
- |_|return;
- |R|}
- |_|return |C|nested2();
- |R|}
+ |_|return;|R|
+ }
+ return |C|nested2();|R|
+ }
|C|nested1();
|R|}
function return42() {
- |_|return 42;
-|R|}
+ |_|return 42;|R|
+}
function returnCall() {
- |_|return |C|return42();
-|R|}
+ |_|return |C|return42();|R|
+}
function testCallAtReturn() {
- |_|return |C|returnCall();
-|R|}
+ |_|return |C|returnCall();|R|
+}
function returnObject() {
- |_|return ({ foo: () => |_|42|R| });
-|R|}
+ |_|return ({ foo: () => |_|42|R| });|R|
+}
function testWith() {
|_|with (|C|returnObject()) {
|C|foo();
}
|_|with({}) {
- |_|return;
+ |_|return;|R|
}
-|R|}
+}
function testForLoop() {
for (var i = |_|0; i |_|< 1; ++|_|i) {}
- for (var i = |_|0; i |_|< 1; ++|_|i) |_|i;
+ for (var i = |_|0; i |_|< 1; ++|_|i) i;
for (var i = |_|0; i |_|< 0; ++|_|i) {}
|R|}
function testForOfLoop() {
- for (var k |C|of []) {}
- for (var k |C|of |_|[1]) |_|k;
+ for (var |_|k of |_|[]) {}
+ for (var |_|k of |_|[1]) |_|k;
var a = |_|[];
- for (var k |C|of |_|a) {}
+ for (var |_|k of |_|a) {}
|R|}
function testForInLoop() {
@@ -139,15 +139,15 @@ function testChainedWithNative() {
|R|}
function testPromiseThen() {
- |_|return Promise.|C|resolve().|C|then(v => v |_|* 2|R|).|C|then(v => v |_|* 2|R|);
-|R|}
+ |_|return Promise.|C|resolve().|C|then(v => v |_|* 2|R|).|C|then(v => v |_|* 2|R|);|R|
+}
function testSwitch() {
for (var i = |_|0; i |_|< 3; ++|_|i) {
|_|switch(i) {
case 0: |_|continue;
case 1: |C|return42(); |_|break;
- default: |_|return;
+ default: |_|return;|R|
}
}
|R|}
@@ -161,13 +161,13 @@ function* idMaker() {
function testGenerator() {
var gen = |C|idMaker();
|C|return42();
- |_|gen.|C|next().value;
+ gen.|C|next().value;
|D|debugger;
- |_|gen.|C|next().value;
+ gen.|C|next().value;
|C|return42();
- |_|gen.|C|next().value;
+ gen.|C|next().value;
|C|return42();
- |_|gen.|C|next().value;
+ gen.|C|next().value;
|R|}
function throwException() {
@@ -178,7 +178,7 @@ function testCaughtException() {
try {
|C|throwException()
} catch (e) {
- |_|return;
+ |_|return;|R|
}
|R|}
@@ -227,11 +227,11 @@ async function testPromiseAsyncWithCode() {
var resolveNested;
var p = |C|new Promise(resolve => resolveNested |_|= resolve|R|);
|C|setTimeout(resolveNested, 0);
- |_|await |_|p;
+ |_|await p;
|R|}
|C|setTimeout(returnCall, 0);
- |_|await |C|foo();
- |_|await |C|foo();
+ await |C|foo();
+ await |C|foo();
|C|nextTest();
|R|}
|C|main();
@@ -239,8 +239,8 @@ async function testPromiseAsyncWithCode() {
|R|}
function returnFunction() {
- |_|return returnObject;
-|R|}
+ |_|return returnObject;|R|
+}
async function testPromiseComplex() {
var nextTest;
@@ -252,7 +252,7 @@ async function testPromiseComplex() {
|R|}
var x = |_|1;
var y = |_|2;
- |C|returnFunction(|C|emptyFunction(), x++, --y, x => 2 |_|* x|R|, |C|returnCall())|C|().a = |_|await |C|foo((a => 2 |_|*a|R|)|C|(5));
+ |C|returnFunction(|C|emptyFunction(), x++, --y, x => 2 |_|* x|R|, |C|returnCall())|C|().a = await |C|foo((a => 2 |_|*a|R|)|C|(5));
|C|nextTest();
|R|}
|C|main();
@@ -264,7 +264,8 @@ function twiceDefined() {
}
function twiceDefined() {
- |_|return a + b;
-|R|}
+ |_|return a + b;|R|
+}
+
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js
index 07f90e7a25..b10c906ddb 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js
@@ -2,42 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --turbo
+// Flags: --no-stress-fullcodegen
let {session, contextGroup, Protocol} = InspectorTest.start('Checks Debugger.getPossibleBreakpoints');
var source = utils.read('test/inspector/debugger/resources/break-locations.js');
contextGroup.addScript(source);
+session.setupScriptMap();
Protocol.Debugger.onceScriptParsed()
.then(message => Protocol.Debugger.getPossibleBreakpoints({ start: { lineNumber: 0, columnNumber : 0, scriptId: message.params.scriptId }}))
- .then(dumpAllLocations)
+ .then(message => session.logBreakLocations(message.result.locations))
.then(InspectorTest.completeTest);
Protocol.Debugger.enable();
-
-function dumpAllLocations(message) {
- if (message.error) {
- InspectorTest.logMessage(message);
- return;
- }
- var lines = source.split('\n');
- var locations = message.result.locations.sort((loc1, loc2) => {
- if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineNumber;
- return loc2.columnNumber - loc1.columnNumber;
- });
- for (var location of locations) {
- var line = lines[location.lineNumber];
- line = line.slice(0, location.columnNumber) + locationMark(location.type) + line.slice(location.columnNumber);
- lines[location.lineNumber] = line;
- }
- lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1);
- InspectorTest.log(lines.join('\n'));
- return message;
-}
-
-function locationMark(type) {
- if (type === 'return') return '|R|';
- if (type === 'call') return '|C|';
- if (type === 'debuggerStatement') return '|D|';
- return '|_|';
-}
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function-expected.txt
index 81a3fc1093..0225fc3c47 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function-expected.txt
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function-expected.txt
@@ -3,37 +3,37 @@ Checks Debugger.getPossibleBreakpoints with ignoreNestedFunctions
Running test: testWholeFunction
function test() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
function nested1() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
- #}
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
+ |R|}
function nested2() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
- #}
- #nested1();
- #nested2();
-#}
-//# sourceURL=test.js
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
+ |R|}
+ |C|nested1();
+ |C|nested2();
+|R|}
+
Running test: testWholeFunctionWithoutNested
function test() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
function nested1() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
- #}
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
+ |R|}
function nested2() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
- #}
- #nested1();
- #nested2();
-#}
-//# sourceURL=test.js
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
+ |R|}
+ |C|nested1();
+ |C|nested2();
+|R|}
+
Running test: testPartOfFunctionWithoutNested
function test() {
- #Array.#from([1,2]).map(() => 1).filter(() => true);
+ |_|Array.|C|from([1,2]).map(() => 1).filter(() => true);
function nested1() {
Array.from([1,2]).map(() => 1).filter(() => true);
}
@@ -43,455 +43,135 @@ function test() {
nested1();
nested2();
}
-//# sourceURL=test.js
+
Running test: testNestedFunction
function test() {
Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
- #}
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
+ |R|}
function nested2() {
- #Array.#from([1,2]).#map(() => #1#).#filter(() => #true#);
- #}
- #nested1();
- #nested2();
-#}
-//# sourceURL=test.js
-Run test() to check breakpoints..
-test (test.js:9:2)
+ |_|Array.|C|from([1,2]).|C|map(() => |_|1|R|).|C|filter(() => |_|true|R|);
+ |R|}
+ |C|nested1();
+ |C|nested2();
+|R|}
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
+Run test() to check breakpoints..
}
- ^nested1();
+ #nested1();
nested2();
-}
-//# sourceURL=test.js
-
-nested1 (test.js:4:4)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- ^Array.from([1,2]).map(() => 1).filter(() => true);
+ #Array.from([1,2]).map(() => 1).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-nested1 (test.js:4:10)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.^from([1,2]).map(() => 1).filter(() => true);
+ Array.#from([1,2]).map(() => 1).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-nested1 (test.js:4:22)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).^map(() => 1).filter(() => true);
+ Array.from([1,2]).#map(() => 1).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map (test.js:4:32)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => ^1).filter(() => true);
+ Array.from([1,2]).map(() => #1).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map (test.js:4:33)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1^).filter(() => true);
+ Array.from([1,2]).map(() => 1#).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map (test.js:4:32)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => ^1).filter(() => true);
+ Array.from([1,2]).map(() => #1).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map (test.js:4:33)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1^).filter(() => true);
+ Array.from([1,2]).map(() => 1#).filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-nested1 (test.js:4:35)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1).^filter(() => true);
+ Array.from([1,2]).map(() => 1).#filter(() => true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map.filter (test.js:4:48)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => ^true);
+ Array.from([1,2]).map(() => 1).filter(() => #true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map.filter (test.js:4:52)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true^);
+ Array.from([1,2]).map(() => 1).filter(() => true#);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map.filter (test.js:4:48)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => ^true);
+ Array.from([1,2]).map(() => 1).filter(() => #true);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-Array.from.map.filter (test.js:4:52)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true^);
+ Array.from([1,2]).map(() => 1).filter(() => true#);
}
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-nested1 (test.js:5:2)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
Array.from([1,2]).map(() => 1).filter(() => true);
- ^}
+ #}
function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-test (test.js:10:2)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
nested1();
- ^nested2();
+ #nested2();
}
-//# sourceURL=test.js
-nested2 (test.js:7:4)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- ^Array.from([1,2]).map(() => 1).filter(() => true);
+ #Array.from([1,2]).map(() => 1).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-nested2 (test.js:7:10)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.^from([1,2]).map(() => 1).filter(() => true);
+ Array.#from([1,2]).map(() => 1).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-nested2 (test.js:7:22)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).^map(() => 1).filter(() => true);
+ Array.from([1,2]).#map(() => 1).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map (test.js:7:32)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => ^1).filter(() => true);
+ Array.from([1,2]).map(() => #1).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map (test.js:7:33)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1^).filter(() => true);
+ Array.from([1,2]).map(() => 1#).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map (test.js:7:32)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => ^1).filter(() => true);
+ Array.from([1,2]).map(() => #1).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map (test.js:7:33)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1^).filter(() => true);
+ Array.from([1,2]).map(() => 1#).filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-nested2 (test.js:7:35)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1).^filter(() => true);
+ Array.from([1,2]).map(() => 1).#filter(() => true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map.filter (test.js:7:48)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => ^true);
+ Array.from([1,2]).map(() => 1).filter(() => #true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map.filter (test.js:7:52)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true^);
+ Array.from([1,2]).map(() => 1).filter(() => true#);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map.filter (test.js:7:48)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => ^true);
+ Array.from([1,2]).map(() => 1).filter(() => #true);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-Array.from.map.filter (test.js:7:52)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true^);
+ Array.from([1,2]).map(() => 1).filter(() => true#);
}
- nested1();
- nested2();
-}
-//# sourceURL=test.js
-nested2 (test.js:8:2)
-
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
Array.from([1,2]).map(() => 1).filter(() => true);
- }
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- ^}
+ #}
nested1();
- nested2();
-}
-//# sourceURL=test.js
-
-test (test.js:11:0)
-function test() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- function nested1() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- function nested2() {
- Array.from([1,2]).map(() => 1).filter(() => true);
- }
- nested1();
nested2();
-^}
-//# sourceURL=test.js
+#}
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function.js
index 27c65fe290..2a20bca6f2 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function.js
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-restrict-to-function.js
@@ -26,31 +26,34 @@ Protocol.Debugger.onceScriptParsed().then(message => {
}).then(() => InspectorTest.runTestSuite(tests));
session.setupScriptMap();
-Protocol.Debugger.onPaused(dumpBreakLocationInSourceAndResume);
+Protocol.Debugger.onPaused(message => {
+ session.logSourceLocation(message.params.callFrames[0].location);
+ Protocol.Debugger.resume();
+});
Protocol.Debugger.enable();
var tests = [
function testWholeFunction(next) {
Protocol.Debugger.getPossibleBreakpoints({ start: location(1, 18), ignoreNestedFunctions: false })
- .then(dumpAllLocations)
+ .then(message => session.logBreakLocations(message.result.locations))
.then(next);
},
function testWholeFunctionWithoutNested(next) {
Protocol.Debugger.getPossibleBreakpoints({ start: location(1, 18), ignoreNestedFunctions: true })
- .then(dumpAllLocations)
+ .then(message => session.logBreakLocations(message.result.locations))
.then(next);
},
function testPartOfFunctionWithoutNested(next) {
Protocol.Debugger.getPossibleBreakpoints({ start: location(1, 18), end: location(2, 18), ignoreNestedFunctions: true })
- .then(dumpAllLocations)
+ .then(message => session.logBreakLocations(message.result.locations))
.then(next);
},
function testNestedFunction(next) {
Protocol.Debugger.getPossibleBreakpoints({ start: location(4, 0), ignoreNestedFunctions: true })
- .then(dumpAllLocations)
+ .then(message => session.logBreakLocations(message.result.locations))
.then(setAllBreakpoints)
.then(() => InspectorTest.log('Run test() to check breakpoints..'))
.then(() => Protocol.Runtime.evaluate({ expression: 'test()' }))
@@ -62,9 +65,9 @@ function location(lineNumber, columnNumber) {
return { lineNumber: lineNumber, columnNumber: columnNumber, scriptId: scriptId };
}
-function setAllBreakpoints(message) {
+function setAllBreakpoints(locations) {
var promises = [];
- for (var location of message.result.locations)
+ for (var location of locations)
promises.push(Protocol.Debugger.setBreakpoint({ location: location }).then(checkBreakpoint));
return Promise.all(promises);
}
@@ -80,41 +83,3 @@ function checkBreakpoint(message) {
InspectorTest.log('FAIL: possible breakpoint was resolved in another location');
}
}
-
-function dumpAllLocations(message) {
- if (message.error) {
- InspectorTest.logMessage(message);
- return;
- }
-
- var sourceLines = source.split('\n')
- var lineOffsets = Array(sourceLines.length).fill(0);
- for (var location of message.result.locations) {
- var lineNumber = location.lineNumber;
- var columnNumber = location.columnNumber;
- var line = sourceLines[lineNumber] || '';
- var offset = lineOffsets[lineNumber];
- line = line.slice(0, columnNumber + offset) + '#' + line.slice(columnNumber + offset);
- ++lineOffsets[lineNumber];
- sourceLines[lineNumber] = line;
- }
- InspectorTest.log(sourceLines.join('\n'));
- return message;
-}
-
-function dumpBreakLocationInSourceAndResume(message) {
- session.logCallFrames([ message.params.callFrames[0] ]);
-
- var location = message.params.callFrames[0].location;
- var sourceLines = source.split('\n')
-
- var lineNumber = location.lineNumber
- var columnNumber = location.columnNumber;
-
- var line = sourceLines[lineNumber];
- line = line.slice(0, columnNumber) + '^' + line.slice(columnNumber);
- sourceLines[lineNumber] = line;
- InspectorTest.log(sourceLines.join('\n'));
- InspectorTest.log('');
- Protocol.Debugger.resume();
-}
diff --git a/deps/v8/test/inspector/debugger/not-hold-promises-expected.txt b/deps/v8/test/inspector/debugger/not-hold-promises-expected.txt
new file mode 100644
index 0000000000..93929b1dfe
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/not-hold-promises-expected.txt
@@ -0,0 +1,2 @@
+Tests that we don't hold promises.
+SUCCESS
diff --git a/deps/v8/test/inspector/debugger/not-hold-promises.js b/deps/v8/test/inspector/debugger/not-hold-promises.js
new file mode 100644
index 0000000000..815b618bfe
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/not-hold-promises.js
@@ -0,0 +1,36 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Tests that we don\'t hold promises.');
+
+(async function test() {
+ Protocol.Runtime.enable();
+ Protocol.Debugger.enable();
+ Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128});
+ Protocol.HeapProfiler.enable();
+ // Force inspector internal scripts compilation.
+ await Protocol.Runtime.evaluate({expression: ''});
+ let snapshot = '';
+ Protocol.HeapProfiler.onAddHeapSnapshotChunk(msg => snapshot += msg.params.chunk);
+ await Protocol.HeapProfiler.collectGarbage();
+ await Protocol.HeapProfiler.takeHeapSnapshot();
+ let initial_node_count = JSON.parse(snapshot).snapshot.node_count;
+
+ await Protocol.Runtime.evaluate({
+ expression: `for (let i = 0; i < ${initial_node_count / 4}; ++i) Promise.resolve()`});
+ snapshot = '';
+ Protocol.HeapProfiler.onAddHeapSnapshotChunk(msg => snapshot += msg.params.chunk);
+ await Protocol.HeapProfiler.collectGarbage();
+ await Protocol.HeapProfiler.takeHeapSnapshot();
+ let without_storing_node_count = JSON.parse(snapshot).snapshot.node_count;
+ let diff_without_storing = (without_storing_node_count - initial_node_count);
+
+ if (diff_without_storing < initial_node_count / 4) {
+ InspectorTest.log('SUCCESS');
+ } else {
+ InspectorTest.log('FAILED: looks like all promises were not collected.');
+ }
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/debugger/pause-expected.txt b/deps/v8/test/inspector/debugger/pause-expected.txt
index a51bc8d0bc..2489191e48 100644
--- a/deps/v8/test/inspector/debugger/pause-expected.txt
+++ b/deps/v8/test/inspector/debugger/pause-expected.txt
@@ -34,6 +34,39 @@ paused at:
#var a = 42;
+Running test: testResumeAnotherGroup
+paused at:
+#var a = 42;
+
+{
+ error : {
+ code : -32000
+ message : Can only perform operation while paused.
+ }
+ id : <messageId>
+}
+{
+ error : {
+ code : -32000
+ message : Can only perform operation while paused.
+ }
+ id : <messageId>
+}
+{
+ error : {
+ code : -32000
+ message : Can only perform operation while paused.
+ }
+ id : <messageId>
+}
+{
+ error : {
+ code : -32000
+ message : Can only perform operation while paused.
+ }
+ id : <messageId>
+}
+
Running test: testDisableBreaksShouldCancelPause
paused at:
#debugger
diff --git a/deps/v8/test/inspector/debugger/pause.js b/deps/v8/test/inspector/debugger/pause.js
index 33ebeb830c..fdef6669f8 100644
--- a/deps/v8/test/inspector/debugger/pause.js
+++ b/deps/v8/test/inspector/debugger/pause.js
@@ -82,6 +82,23 @@ InspectorTest.runAsyncTestSuite([
await Protocol1.Debugger.resume();
},
+ async function testResumeAnotherGroup() {
+ let contextGroup2 = new InspectorTest.ContextGroup();
+ let session2 = contextGroup2.connect();
+ session2.setupScriptMap();
+ let Protocol2 = session2.Protocol;
+ Protocol2.Debugger.enable();
+ Protocol1.Debugger.pause();
+ Protocol1.Runtime.evaluate({expression: 'var a = 42;'});
+ await waitPauseAndDumpLocation(session1);
+ InspectorTest.logMessage(await Protocol2.Debugger.resume());
+ InspectorTest.logMessage(await Protocol2.Debugger.stepOver());
+ InspectorTest.logMessage(await Protocol2.Debugger.stepInto());
+ InspectorTest.logMessage(await Protocol2.Debugger.stepOut());
+ await Protocol1.Debugger.resume();
+ await Protocol2.Debugger.disable();
+ },
+
async function testDisableBreaksShouldCancelPause() {
await Protocol1.Debugger.pause();
await Protocol1.Debugger.setBreakpointsActive({active: false});
diff --git a/deps/v8/test/inspector/debugger/return-break-locations-expected.txt b/deps/v8/test/inspector/debugger/return-break-locations-expected.txt
index fa0368e1cc..688faf89c3 100644
--- a/deps/v8/test/inspector/debugger/return-break-locations-expected.txt
+++ b/deps/v8/test/inspector/debugger/return-break-locations-expected.txt
@@ -3,8 +3,26 @@ Return break locations within function
Running test: testTailCall
[
[0] : {
- columnNumber : 0
- lineNumber : 6
+ columnNumber : 20
+ lineNumber : 2
+ scriptId : <scriptId>
+ type : return
+ }
+ [1] : {
+ columnNumber : 24
+ lineNumber : 3
+ scriptId : <scriptId>
+ type : return
+ }
+ [2] : {
+ columnNumber : 29
+ lineNumber : 4
+ scriptId : <scriptId>
+ type : return
+ }
+ [3] : {
+ columnNumber : 59
+ lineNumber : 5
scriptId : <scriptId>
type : return
}
diff --git a/deps/v8/test/inspector/debugger/schedule-step-into-async-expected.txt b/deps/v8/test/inspector/debugger/schedule-step-into-async-expected.txt
index 7808101635..be3cad1bea 100644
--- a/deps/v8/test/inspector/debugger/schedule-step-into-async-expected.txt
+++ b/deps/v8/test/inspector/debugger/schedule-step-into-async-expected.txt
@@ -56,7 +56,7 @@ paused at:
paused at:
debugger;
- #p.then(v => v * 2);
+ p.#then(v => v * 2);
resolveCallback();
{
diff --git a/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt b/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt
index bb3055a62d..cd1f11e50f 100644
--- a/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt
+++ b/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt
@@ -19,7 +19,7 @@ qwe:4
baz:3
(...):1
Paused in
-qwe:5
+qwe:4
baz:3
(...):1
Paused in
diff --git a/deps/v8/test/inspector/debugger/set-skip-all-pauses-expected.txt b/deps/v8/test/inspector/debugger/set-skip-all-pauses-expected.txt
new file mode 100644
index 0000000000..1ef5fec1ea
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/set-skip-all-pauses-expected.txt
@@ -0,0 +1,7 @@
+Tests that Debugger.setSkipAllPauses skips breaks and does not block resumed notifications
+paused at:
+#debugger;
+
+paused at:
+#debugger
+
diff --git a/deps/v8/test/inspector/debugger/set-skip-all-pauses.js b/deps/v8/test/inspector/debugger/set-skip-all-pauses.js
new file mode 100644
index 0000000000..c3614872f1
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/set-skip-all-pauses.js
@@ -0,0 +1,31 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} = InspectorTest.start('Tests that Debugger.setSkipAllPauses skips breaks and does not block resumed notifications');
+session.setupScriptMap();
+
+(async function test() {
+ await Protocol.Debugger.enable();
+ Protocol.Runtime.evaluate({expression: 'debugger;'});
+ await waitForPause();
+ await Protocol.Debugger.resume();
+
+ await Protocol.Debugger.setSkipAllPauses({skip: true});
+ await Protocol.Runtime.evaluate({expression: 'debugger'});
+
+ await Protocol.Debugger.setSkipAllPauses({skip: false});
+ Protocol.Runtime.evaluate({expression: 'debugger'});
+ await waitForPause();
+ Protocol.Debugger.setSkipAllPauses({skip: true});
+ Protocol.Debugger.resume();
+ await Protocol.Debugger.onceResumed();
+
+ InspectorTest.completeTest();
+})();
+
+async function waitForPause() {
+ var message = await Protocol.Debugger.oncePaused();
+ InspectorTest.log('paused at:');
+ session.logSourceLocation(message.params.callFrames[0].location);
+}
diff --git a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js
index 34e3a25981..e28dff7de3 100644
--- a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js
+++ b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --ignition --turbo
+// Flags: --no-stress-fullcodegen
let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation');
contextGroup.addScript(`
diff --git a/deps/v8/test/inspector/debugger/step-into-expected.txt b/deps/v8/test/inspector/debugger/step-into-expected.txt
index 8be36948b2..30ba7e7329 100644
--- a/deps/v8/test/inspector/debugger/step-into-expected.txt
+++ b/deps/v8/test/inspector/debugger/step-into-expected.txt
@@ -78,9 +78,9 @@ function returnTrue() {
}
break at:
- return true;
-#}
-
+function returnTrue() {
+ return true;#
+}
break at:
if (returnTrue()) {
@@ -155,7 +155,7 @@ break at:
break at:
}
- #return nested2();
+ return #nested2();
}
break at:
@@ -174,14 +174,14 @@ break at:
}
break at:
- return;
- #}
- return nested2();
+ nested3();
+ return;#
+ }
break at:
- return nested2();
- #}
- nested1();
+ }
+ return nested2();#
+ }
break at:
nested1();
@@ -206,19 +206,19 @@ function return42() {
}
break at:
- return 42;
-#}
-
+function return42() {
+ return 42;#
+}
break at:
- return return42();
-#}
-
+function returnCall() {
+ return return42();#
+}
break at:
- return returnCall();
-#}
-
+function testCallAtReturn() {
+ return returnCall();#
+}
Running test: testWith
@@ -233,9 +233,9 @@ function returnObject() {
}
break at:
- return ({ foo: () => 42 });
-#}
-
+function returnObject() {
+ return ({ foo: () => 42 });#
+}
break at:
with (returnObject()) {
@@ -263,9 +263,9 @@ break at:
}
break at:
+ with({}) {
+ return;#
}
-#}
-
Running test: testForLoop
@@ -301,11 +301,6 @@ break at:
break at:
for (var i = 0; i < 1; ++i) {}
- for (var i = 0; i < 1; ++i) #i;
- for (var i = 0; i < 0; ++i) {}
-
-break at:
- for (var i = 0; i < 1; ++i) {}
for (var i = 0; i < 1; ++#i) i;
for (var i = 0; i < 0; ++i) {}
@@ -338,7 +333,7 @@ function testForOfLoop() {
break at:
function testForOfLoop() {
- for (var k #of []) {}
+ for (var #k of []) {}
for (var k of [1]) k;
break at:
@@ -348,7 +343,7 @@ break at:
break at:
for (var k of []) {}
- for (var k #of [1]) k;
+ for (var #k of [1]) k;
var a = [];
break at:
@@ -358,7 +353,7 @@ break at:
break at:
for (var k of []) {}
- for (var k #of [1]) k;
+ for (var #k of [1]) k;
var a = [];
break at:
@@ -373,7 +368,7 @@ break at:
break at:
var a = [];
- for (var k #of a) {}
+ for (var #k of a) {}
}
break at:
@@ -493,9 +488,9 @@ function return42() {
}
break at:
- return 42;
-#}
-
+function return42() {
+ return 42;#
+}
break at:
getterFoo();
@@ -545,9 +540,9 @@ function return42() {
}
break at:
- return 42;
-#}
-
+function return42() {
+ return 42;#
+}
break at:
obj.foo().boo()();
@@ -594,9 +589,9 @@ function testPromiseThen() {
}
break at:
- return Promise.resolve().then(v => v * 2).then(v => v * 2);
-#}
-
+function testPromiseThen() {
+ return Promise.resolve().then(v => v * 2).then(v => v * 2);#
+}
Running test: testSwitch
@@ -646,9 +641,9 @@ function return42() {
}
break at:
- return 42;
-#}
-
+function return42() {
+ return 42;#
+}
break at:
case 0: continue;
@@ -676,9 +671,9 @@ break at:
}
break at:
- }
-#}
-
+ case 1: return42(); break;
+ default: return;#
+ }
Running test: testGenerator
@@ -699,7 +694,7 @@ break at:
break at:
debugger;
- #gen.next().value;
+ gen.#next().value;
return42();
break at:
@@ -740,9 +735,9 @@ break at:
}
break at:
+ } catch (e) {
+ return;#
}
-#}
-
Running test: testClasses
@@ -804,31 +799,6 @@ async function testAsyncAwait() {
await awaitBoo();
break at:
-async function testAsyncAwait() {
- await #asyncFoo();
- await awaitBoo();
-
-break at:
-async function asyncFoo() {
- #await Promise.resolve().then(v => v * 2);
- return42();
-
-break at:
-async function asyncFoo() {
- await Promise.resolve().#then(v => v * 2);
- return42();
-
-break at:
-async function asyncFoo() {
- await Promise.#resolve().then(v => v * 2);
- return42();
-
-break at:
-async function asyncFoo() {
- await Promise.resolve().#then(v => v * 2);
- return42();
-
-break at:
async function asyncFoo() {
#await Promise.resolve().then(v => v * 2);
return42();
@@ -839,18 +809,8 @@ function return42() {
}
break at:
- return 42;
-#}
-
-
-break at:
-async function asyncBoo() {
- #await Promise.resolve();
-}
-
-break at:
-async function asyncBoo() {
- await Promise.#resolve();
+function return42() {
+ return 42;#
}
break at:
@@ -887,11 +847,6 @@ break at:
break at:
setTimeout(returnCall, 0);
- #await foo();
- await foo();
-
-break at:
- setTimeout(returnCall, 0);
await #foo();
await foo();
@@ -921,16 +876,6 @@ break at:
}
break at:
- setTimeout(resolveNested, 0);
- await #p;
- }
-
-break at:
- setTimeout(resolveNested, 0);
- #await p;
- }
-
-break at:
var resolveNested;
var p = #new Promise(resolve => resolveNested = resolve);
setTimeout(resolveNested, 0);
@@ -955,16 +900,6 @@ break at:
#await p;
}
-break at:
- setTimeout(resolveNested, 0);
- await #p;
- }
-
-break at:
- setTimeout(resolveNested, 0);
- #await p;
- }
-
Running test: testPromiseComplex
break at:
@@ -1023,14 +958,14 @@ function return42() {
}
break at:
- return 42;
-#}
-
+function return42() {
+ return 42;#
+}
break at:
- return return42();
-#}
-
+function returnCall() {
+ return return42();#
+}
break at:
var y = 2;
@@ -1043,9 +978,9 @@ function returnFunction() {
}
break at:
- return returnObject;
-#}
-
+function returnFunction() {
+ return returnObject;#
+}
break at:
var y = 2;
@@ -1058,13 +993,13 @@ function returnObject() {
}
break at:
- return ({ foo: () => 42 });
-#}
-
+function returnObject() {
+ return ({ foo: () => 42 });#
+}
break at:
var y = 2;
- returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = await #foo((a => 2 *a)(5));
+ returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = await foo((a => 2 *a)#(5));
nextTest();
break at:
@@ -1087,13 +1022,3 @@ break at:
#await Promise.resolve();
return 42;
-break at:
- async function foo() {
- await Promise.#resolve();
- return 42;
-
-break at:
- async function foo() {
- #await Promise.resolve();
- return 42;
-
diff --git a/deps/v8/test/inspector/debugger/step-into-next-script-expected.txt b/deps/v8/test/inspector/debugger/step-into-next-script-expected.txt
index 12fabcee2a..5fbd13ee99 100644
--- a/deps/v8/test/inspector/debugger/step-into-next-script-expected.txt
+++ b/deps/v8/test/inspector/debugger/step-into-next-script-expected.txt
@@ -30,7 +30,7 @@ test (foo.js:13:0)
foo (timeout2.js:2:2)
-foo (timeout2.js:3:0)
+foo (timeout2.js:2:12)
(anonymous) (timeout3.js:0:8)
@@ -63,7 +63,7 @@ test (foo.js:13:0)
foo (timeout2.js:2:2)
-foo (timeout2.js:3:0)
+foo (timeout2.js:2:12)
(anonymous) (timeout3.js:0:8)
diff --git a/deps/v8/test/inspector/debugger/step-into.js b/deps/v8/test/inspector/debugger/step-into.js
index b0b83b3d59..f2d226d588 100644
--- a/deps/v8/test/inspector/debugger/step-into.js
+++ b/deps/v8/test/inspector/debugger/step-into.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --turbo
+// Flags: --no-stress-fullcodegen
let {session, contextGroup, Protocol} = InspectorTest.start('Checks possible break locations.');
diff --git a/deps/v8/test/inspector/debugger/step-snapshot-expected.txt b/deps/v8/test/inspector/debugger/step-snapshot-expected.txt
index 7853ed7370..911ca717c8 100644
--- a/deps/v8/test/inspector/debugger/step-snapshot-expected.txt
+++ b/deps/v8/test/inspector/debugger/step-snapshot-expected.txt
@@ -19,12 +19,12 @@ paused
}
paused
- return x * 2;
- #}
- debugger;
+ function f(x) {
+ return x * 2;#
+ }
paused
-function c(f, ...args) { return f(...args); #}
+function c(f, ...args) { return f(...args);# }
paused
c(f, 2);
diff --git a/deps/v8/test/inspector/debugger/stepping-tail-call-expected.txt b/deps/v8/test/inspector/debugger/stepping-tail-call-expected.txt
index 5755c8b8d4..95b21b49b6 100644
--- a/deps/v8/test/inspector/debugger/stepping-tail-call-expected.txt
+++ b/deps/v8/test/inspector/debugger/stepping-tail-call-expected.txt
@@ -31,38 +31,38 @@ f (:3:22)
}
Debugger.stepOver called
-f (:4:0)
+f (:3:27)
f (:3:22)
f (:3:22)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOver called
-f (:4:0)
+f (:3:27)
f (:3:22)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOver called
-f (:4:0)
+f (:3:27)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOver called
-f (:4:0)
+f (:3:27)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOver called
(anonymous) (:5:5)
@@ -83,28 +83,28 @@ function f(x) {
if (x-- > 0) return f(x);
Debugger.stepOut called
-f (:4:0)
+f (:3:27)
f (:3:22)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOut called
-f (:4:0)
+f (:3:27)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOut called
-f (:4:0)
+f (:3:27)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOut called
(anonymous) (:5:5)
@@ -145,28 +145,28 @@ f (:3:22)
}
Debugger.stepOut called
-f (:4:0)
+f (:3:27)
f (:3:22)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOut called
-f (:4:0)
+f (:3:27)
f (:3:22)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOut called
-f (:4:0)
+f (:3:27)
(anonymous) (:5:0)
- if (x-- > 0) return f(x);
-#}
-f(5);
+ if (x == 2) debugger;
+ if (x-- > 0) return f(x);#
+}
Debugger.stepOut called
(anonymous) (:5:5)
diff --git a/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt
index 7e23082c4b..4c7af7e37c 100644
--- a/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt
+++ b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt
@@ -47,7 +47,7 @@ testFunction: 3:4
action: stepOver
action: stepInto
-foo: 10:0
+foo: 9:15
blackboxedBoo: 3:12
notBlackboxedFoo: 3:12
blackboxedFoo: 10:12
diff --git a/deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt b/deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt
index f529c7ee24..a59bc3281c 100644
--- a/deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt
+++ b/deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt
@@ -9,11 +9,11 @@ Running test: testScopesPaused
configurable : true
enumerable : true
isOwn : true
- name : a
+ name : b
value : {
- description : 420
+ description : 42
type : number
- value : 420
+ value : 42
}
writable : true
}
@@ -21,11 +21,11 @@ Running test: testScopesPaused
configurable : true
enumerable : true
isOwn : true
- name : b
+ name : a
value : {
- description : 42
+ description : 420
type : number
- value : 42
+ value : 420
}
writable : true
}
@@ -42,11 +42,9 @@ Running test: testScopesNonPaused
configurable : true
enumerable : true
isOwn : true
- name : a
+ name : b
value : {
- description : 430
- type : number
- value : 430
+ type : undefined
}
writable : true
}
@@ -54,9 +52,11 @@ Running test: testScopesNonPaused
configurable : true
enumerable : true
isOwn : true
- name : b
+ name : a
value : {
- type : undefined
+ description : 430
+ type : number
+ value : 430
}
writable : true
}
diff --git a/deps/v8/test/inspector/debugger/wasm-imports-expected.txt b/deps/v8/test/inspector/debugger/wasm-imports-expected.txt
index a98b9d29b4..073c8af942 100644
--- a/deps/v8/test/inspector/debugger/wasm-imports-expected.txt
+++ b/deps/v8/test/inspector/debugger/wasm-imports-expected.txt
@@ -18,8 +18,8 @@ end
Getting current stack trace via "new Error().stack".
Error
at v8://test/getStack:1:1
- at func (<WASM>[0]+1)
- at main (<WASM>[1]+1)
+ at func (wasm-function[0]:1)
+ at main (wasm-function[1]:1)
at v8://test/runWasm:1:22
exports.main returned.
Finished.
diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt
new file mode 100644
index 0000000000..7701468937
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/wasm-scope-info-expected.txt
@@ -0,0 +1,166 @@
+Test retrieving scope information when pausing in wasm functions
+Installing code and global variable.
+Calling instantiate function.
+Waiting for wasm script to be parsed.
+Got wasm script!
+Setting breakpoint on line 2 (first instruction)
+{
+ columnNumber : 2
+ lineNumber : 2
+ scriptId : <scriptId>
+}
+Paused:
+(local i32 f64)
+ #i32.const 11
+ set_local 0
+
+at func (2:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 4 (number), "local#1": 0 (number), "unicodeā˜¼f64": 0 (number)
+ stack:
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ i32.const 11
+ #set_local 0
+ i32.const 47
+
+at func (3:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 4 (number), "local#1": 0 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 11 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ set_local 0
+ #i32.const 47
+ set_local 1
+
+at func (4:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 0 (number), "unicodeā˜¼f64": 0 (number)
+ stack:
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ i32.const 47
+ #set_local 1
+ i32.const 1
+
+at func (5:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 0 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 47 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ set_local 1
+ #i32.const 1
+ f64.convert_u/i32
+
+at func (6:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0 (number)
+ stack:
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ i32.const 1
+ #f64.convert_u/i32
+ i32.const 7
+
+at func (7:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 1 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ f64.convert_u/i32
+ #i32.const 7
+ f64.convert_u/i32
+
+at func (8:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 1 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ i32.const 7
+ #f64.convert_u/i32
+ f64.div
+
+at func (9:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 1 (number), "1": 7 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ f64.convert_u/i32
+ #f64.div
+ set_local 2
+
+at func (10:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 1 (number), "1": 7 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ f64.div
+ #set_local 2
+end
+
+at func (11:2):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0 (number)
+ stack: "0": 0.14285714285714285 (number)
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+Paused:
+ set_local 2
+#end
+
+
+at func (12:0):
+ - scope (global):
+ -- skipped
+ - scope (local):
+ locals: "i32Arg": 11 (number), "local#1": 47 (number), "unicodeā˜¼f64": 0.14285714285714285 (number)
+ stack:
+at (anonymous) (0:17):
+ - scope (global):
+ -- skipped
+exports.main returned. Test finished.
diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info.js b/deps/v8/test/inspector/debugger/wasm-scope-info.js
new file mode 100644
index 0000000000..9a20d6a733
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/wasm-scope-info.js
@@ -0,0 +1,137 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} = InspectorTest.start(
+ 'Test retrieving scope information when pausing in wasm functions');
+session.setupScriptMap();
+Protocol.Debugger.enable();
+
+let evaluate = code => Protocol.Runtime.evaluate({expression: code});
+
+(async function test() {
+ let scriptId = await instantiateWasm();
+ await setBreakpoint(scriptId);
+ printPauseLocationsAndContinue();
+ await evaluate('instance.exports.main(4)');
+ InspectorTest.log('exports.main returned. Test finished.');
+ InspectorTest.completeTest();
+})();
+
+async function printPauseLocationsAndContinue() {
+ while (true) {
+ let msg = await Protocol.Debugger.oncePaused();
+ let loc = msg.params.callFrames[0].location;
+ InspectorTest.log('Paused:');
+ await session.logSourceLocation(loc);
+ await dumpScopeChainsOnPause(msg);
+ Protocol.Debugger.stepOver();
+ }
+}
+
+async function instantiateWasm() {
+ utils.load('test/mjsunit/wasm/wasm-constants.js');
+ utils.load('test/mjsunit/wasm/wasm-module-builder.js');
+
+ var builder = new WasmModuleBuilder();
+
+ builder.addFunction('func', kSig_v_i)
+ .addLocals(
+ {i32_count: 1, f64_count: 1}, ['i32Arg', undefined, 'unicodeā˜¼f64'])
+ .addBody([
+ // Set param 0 to 11.
+ kExprI32Const, 11, kExprSetLocal, 0,
+ // Set local 1 to 47.
+ kExprI32Const, 47, kExprSetLocal, 1,
+ // Set local 2 to 1/7.
+ kExprI32Const, 1, kExprF64UConvertI32, kExprI32Const, 7,
+ kExprF64UConvertI32, kExprF64Div, kExprSetLocal, 2
+ ])
+ .exportAs('main');
+
+ var module_bytes = builder.toArray();
+
+ function instantiate(bytes) {
+ var buffer = new ArrayBuffer(bytes.length);
+ var view = new Uint8Array(buffer);
+ for (var i = 0; i < bytes.length; ++i) {
+ view[i] = bytes[i] | 0;
+ }
+
+ var module = new WebAssembly.Module(buffer);
+ // Set global variable.
+ instance = new WebAssembly.Instance(module);
+ }
+
+ InspectorTest.log('Installing code and global variable.');
+ await evaluate('var instance;\n' + instantiate.toString());
+ InspectorTest.log('Calling instantiate function.');
+ evaluate('instantiate(' + JSON.stringify(module_bytes) + ')');
+ return waitForWasmScript();
+}
+
+async function setBreakpoint(scriptId) {
+ InspectorTest.log('Setting breakpoint on line 2 (first instruction)');
+ let breakpoint = await Protocol.Debugger.setBreakpoint(
+ {'location': {'scriptId': scriptId, 'lineNumber': 2}});
+ printFailure(breakpoint);
+ InspectorTest.logMessage(breakpoint.result.actualLocation);
+}
+
+function printFailure(message) {
+ if (!message.result) {
+ InspectorTest.logMessage(message);
+ }
+ return message;
+}
+
+async function waitForWasmScript() {
+ InspectorTest.log('Waiting for wasm script to be parsed.');
+ while (true) {
+ let script_msg = await Protocol.Debugger.onceScriptParsed();
+ let url = script_msg.params.url;
+ if (!url.startsWith('wasm://')) {
+ continue;
+ }
+ InspectorTest.log('Got wasm script!');
+ return script_msg.params.scriptId;
+ }
+}
+
+async function getValueString(value) {
+ if (value.type == 'object') {
+ var msg = await Protocol.Runtime.getProperties({objectId: value.objectId});
+ printFailure(msg);
+ let printProperty = elem => '"' + elem.name + '"' +
+ ': ' + elem.value.description + ' (' + elem.value.type + ')';
+ return msg.result.result.map(printProperty).join(', ');
+ }
+ return JSON.stringify(value.value) + ' (' + value.type + ')';
+}
+
+async function dumpProperties(message) {
+ printFailure(message);
+ for (var value of message.result.result) {
+ var value_str = await getValueString(value.value);
+ InspectorTest.log(' ' + value.name + ': ' + value_str);
+ }
+}
+
+async function dumpScopeChainsOnPause(message) {
+ for (var frame of message.params.callFrames) {
+ var functionName = frame.functionName || '(anonymous)';
+ var lineNumber = frame.location ? frame.location.lineNumber : frame.lineNumber;
+ var columnNumber = frame.location ? frame.location.columnNumber : frame.columnNumber;
+ InspectorTest.log(`at ${functionName} (${lineNumber}:${columnNumber}):`);
+ for (var scope of frame.scopeChain) {
+ InspectorTest.logObject(' - scope (' + scope.type + '):');
+ if (scope.type == 'global') {
+ InspectorTest.logObject(' -- skipped');
+ } else {
+ var properties = await Protocol.Runtime.getProperties(
+ {'objectId': scope.object.objectId});
+ await dumpProperties(properties);
+ }
+ }
+ }
+}
diff --git a/deps/v8/test/inspector/debugger/wasm-stack-expected.txt b/deps/v8/test/inspector/debugger/wasm-stack-expected.txt
index c3226f5631..bba3009f3e 100644
--- a/deps/v8/test/inspector/debugger/wasm-stack-expected.txt
+++ b/deps/v8/test/inspector/debugger/wasm-stack-expected.txt
@@ -1,5 +1,5 @@
Tests call stack in wasm scripts
-Running testFunction with generated WASM bytes...
+Running testFunction with generated wasm bytes...
Paused on 'debugger;'
Number of frames: 5
- [0] {"functionName":"call_debugger","function_lineNumber":1,"function_columnNumber":24,"lineNumber":2,"columnNumber":4}
@@ -12,8 +12,8 @@ Result of evaluate (string):
Error: this is your stack trace:
-- skipped --
at call_debugger (<anonymous>:3:5)
- at call_func (<WASM>[1]+1)
- at main (<WASM>[2]+3)
+ at call_func (wasm-function[1]:1)
+ at main (wasm-function[2]:3)
at testFunction (<anonymous>:15:20)
at <anonymous>:1:1
Finished!
diff --git a/deps/v8/test/inspector/debugger/wasm-stack.js b/deps/v8/test/inspector/debugger/wasm-stack.js
index 2603c31784..0234dabe79 100644
--- a/deps/v8/test/inspector/debugger/wasm-stack.js
+++ b/deps/v8/test/inspector/debugger/wasm-stack.js
@@ -46,7 +46,7 @@ contextGroup.addScript(testFunction.toString());
Protocol.Debugger.enable();
Protocol.Debugger.onPaused(handleDebuggerPaused);
-InspectorTest.log('Running testFunction with generated WASM bytes...');
+InspectorTest.log('Running testFunction with generated wasm bytes...');
Protocol.Runtime.evaluate(
{'expression': 'testFunction(' + JSON.stringify(module_bytes) + ')'});
diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt
index 793552f7f5..7af75aa575 100644
--- a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt
+++ b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt
@@ -37,7 +37,7 @@ at wasm_B (7:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 4 (number)
+ locals: {"arg#0":4} (Object)
stack: {"0":3} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -48,7 +48,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 3 (number)
+ locals: {"arg#0":3} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -64,7 +64,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 3 (number)
+ locals: {"arg#0":3} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -80,7 +80,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 3 (number)
+ locals: {"arg#0":3} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -91,7 +91,7 @@ at wasm_B (9:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 3 (number)
+ locals: {"arg#0":3} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -102,7 +102,7 @@ at wasm_B (7:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 3 (number)
+ locals: {"arg#0":3} (Object)
stack: {"0":2} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -113,7 +113,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 2 (number)
+ locals: {"arg#0":2} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -124,7 +124,7 @@ at wasm_B (9:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 2 (number)
+ locals: {"arg#0":2} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -135,7 +135,7 @@ at wasm_B (7:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 2 (number)
+ locals: {"arg#0":2} (Object)
stack: {"0":1} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -146,7 +146,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -162,7 +162,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -173,7 +173,7 @@ at wasm_B (9:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -184,7 +184,7 @@ at wasm_B (1:2):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -195,7 +195,7 @@ at wasm_B (2:4):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -206,7 +206,7 @@ at wasm_B (3:4):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {"0":1} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -217,7 +217,7 @@ at wasm_B (4:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -228,7 +228,7 @@ at wasm_B (5:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {"0":1} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -239,7 +239,7 @@ at wasm_B (6:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {"0":1,"1":1} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -250,7 +250,7 @@ at wasm_B (7:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 1 (number)
+ locals: {"arg#0":1} (Object)
stack: {"0":0} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -261,7 +261,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 0 (number)
+ locals: {"arg#0":0} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -277,7 +277,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 0 (number)
+ locals: {"arg#0":0} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -293,7 +293,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 0 (number)
+ locals: {"arg#0":0} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -309,7 +309,7 @@ at wasm_B (8:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 0 (number)
+ locals: {"arg#0":0} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
@@ -320,7 +320,7 @@ at wasm_B (9:6):
- scope (global):
-- skipped
- scope (local):
- param#0: 0 (number)
+ locals: {"arg#0":0} (Object)
stack: {} (Object)
at (anonymous) (0:17):
- scope (global):
diff --git a/deps/v8/test/inspector/inspector-impl.cc b/deps/v8/test/inspector/inspector-impl.cc
deleted file mode 100644
index 664fdf8366..0000000000
--- a/deps/v8/test/inspector/inspector-impl.cc
+++ /dev/null
@@ -1,254 +0,0 @@
-// Copyright 2016 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "test/inspector/inspector-impl.h"
-
-#include "include/v8.h"
-
-#include "src/vector.h"
-#include "test/inspector/isolate-data.h"
-#include "test/inspector/task-runner.h"
-
-namespace {
-
-class ChannelImpl final : public v8_inspector::V8Inspector::Channel {
- public:
- ChannelImpl(InspectorClientImpl::FrontendChannel* frontend_channel,
- int session_id)
- : frontend_channel_(frontend_channel), session_id_(session_id) {}
- virtual ~ChannelImpl() = default;
-
- private:
- void sendResponse(
- int callId,
- std::unique_ptr<v8_inspector::StringBuffer> message) override {
- frontend_channel_->SendMessageToFrontend(session_id_, message->string());
- }
- void sendNotification(
- std::unique_ptr<v8_inspector::StringBuffer> message) override {
- frontend_channel_->SendMessageToFrontend(session_id_, message->string());
- }
- void flushProtocolNotifications() override {}
-
- InspectorClientImpl::FrontendChannel* frontend_channel_;
- int session_id_;
- DISALLOW_COPY_AND_ASSIGN(ChannelImpl);
-};
-
-v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
- v8::internal::Vector<uint16_t> buffer =
- v8::internal::Vector<uint16_t>::New(str->Length());
- str->Write(buffer.start(), 0, str->Length());
- return buffer;
-}
-
-void MessageHandler(v8::Local<v8::Message> message,
- v8::Local<v8::Value> exception) {
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::Local<v8::Context> context = isolate->GetEnteredContext();
- if (context.IsEmpty()) return;
- v8_inspector::V8Inspector* inspector =
- IsolateData::FromContext(context)->inspector()->inspector();
-
- v8::Local<v8::StackTrace> stack = message->GetStackTrace();
- int script_id =
- static_cast<int>(message->GetScriptOrigin().ScriptID()->Value());
- if (!stack.IsEmpty() && stack->GetFrameCount() > 0) {
- int top_script_id = stack->GetFrame(0)->GetScriptId();
- if (top_script_id == script_id) script_id = 0;
- }
- int line_number = message->GetLineNumber(context).FromMaybe(0);
- int column_number = 0;
- if (message->GetStartColumn(context).IsJust())
- column_number = message->GetStartColumn(context).FromJust() + 1;
-
- v8_inspector::StringView detailed_message;
- v8::internal::Vector<uint16_t> message_text_string = ToVector(message->Get());
- v8_inspector::StringView message_text(message_text_string.start(),
- message_text_string.length());
- v8::internal::Vector<uint16_t> url_string;
- if (message->GetScriptOrigin().ResourceName()->IsString()) {
- url_string =
- ToVector(message->GetScriptOrigin().ResourceName().As<v8::String>());
- }
- v8_inspector::StringView url(url_string.start(), url_string.length());
-
- inspector->exceptionThrown(context, message_text, exception, detailed_message,
- url, line_number, column_number,
- inspector->createStackTrace(stack), script_id);
-}
-
-v8::Local<v8::String> ToString(v8::Isolate* isolate,
- const v8_inspector::StringView& string) {
- if (string.is8Bit())
- return v8::String::NewFromOneByte(isolate, string.characters8(),
- v8::NewStringType::kNormal,
- static_cast<int>(string.length()))
- .ToLocalChecked();
- else
- return v8::String::NewFromTwoByte(isolate, string.characters16(),
- v8::NewStringType::kNormal,
- static_cast<int>(string.length()))
- .ToLocalChecked();
-}
-
-void Print(v8::Isolate* isolate, const v8_inspector::StringView& string) {
- v8::Local<v8::String> v8_string = ToString(isolate, string);
- v8::String::Utf8Value utf8_string(v8_string);
- fwrite(*utf8_string, sizeof(**utf8_string), utf8_string.length(), stdout);
-}
-} // namespace
-
-InspectorClientImpl::InspectorClientImpl(v8::Isolate* isolate,
- TaskRunner* task_runner,
- FrontendChannel* frontend_channel)
- : task_runner_(task_runner),
- isolate_(isolate),
- frontend_channel_(frontend_channel) {
- isolate_->AddMessageListener(MessageHandler);
- inspector_ = v8_inspector::V8Inspector::create(isolate_, this);
-}
-
-InspectorClientImpl::~InspectorClientImpl() {}
-
-int InspectorClientImpl::ConnectSession(int context_group_id,
- const v8_inspector::StringView& state) {
- int session_id = ++last_session_id_;
- channels_[session_id].reset(new ChannelImpl(frontend_channel_, session_id));
- sessions_[session_id] =
- inspector_->connect(context_group_id, channels_[session_id].get(), state);
- context_group_by_session_[sessions_[session_id].get()] = context_group_id;
- return session_id;
-}
-
-std::unique_ptr<v8_inspector::StringBuffer>
-InspectorClientImpl::DisconnectSession(int session_id) {
- auto it = sessions_.find(session_id);
- CHECK(it != sessions_.end());
- context_group_by_session_.erase(it->second.get());
- std::unique_ptr<v8_inspector::StringBuffer> result = it->second->stateJSON();
- sessions_.erase(it);
- channels_.erase(session_id);
- return result;
-}
-
-void InspectorClientImpl::SendMessage(int session_id,
- const v8_inspector::StringView& message) {
- auto it = sessions_.find(session_id);
- if (it != sessions_.end()) it->second->dispatchProtocolMessage(message);
-}
-
-void InspectorClientImpl::BreakProgram(
- int context_group_id, const v8_inspector::StringView& reason,
- const v8_inspector::StringView& details) {
- for (int session_id : GetSessionIds(context_group_id)) {
- auto it = sessions_.find(session_id);
- if (it != sessions_.end()) it->second->breakProgram(reason, details);
- }
-}
-
-void InspectorClientImpl::SchedulePauseOnNextStatement(
- int context_group_id, const v8_inspector::StringView& reason,
- const v8_inspector::StringView& details) {
- for (int session_id : GetSessionIds(context_group_id)) {
- auto it = sessions_.find(session_id);
- if (it != sessions_.end())
- it->second->schedulePauseOnNextStatement(reason, details);
- }
-}
-
-void InspectorClientImpl::CancelPauseOnNextStatement(int context_group_id) {
- for (int session_id : GetSessionIds(context_group_id)) {
- auto it = sessions_.find(session_id);
- if (it != sessions_.end()) it->second->cancelPauseOnNextStatement();
- }
-}
-
-void InspectorClientImpl::ContextCreated(v8::Local<v8::Context> context,
- int context_group_id) {
- v8_inspector::V8ContextInfo info(context, context_group_id,
- v8_inspector::StringView());
- info.hasMemoryOnConsole = true;
- inspector_->contextCreated(info);
-}
-
-void InspectorClientImpl::ContextDestroyed(v8::Local<v8::Context> context) {
- inspector_->contextDestroyed(context);
-}
-
-std::vector<int> InspectorClientImpl::GetSessionIds(int context_group_id) {
- std::vector<int> result;
- for (auto& it : sessions_) {
- if (context_group_by_session_[it.second.get()] == context_group_id)
- result.push_back(it.first);
- }
- return result;
-}
-
-bool InspectorClientImpl::formatAccessorsAsProperties(
- v8::Local<v8::Value> object) {
- v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
- v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
- isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting",
- v8::NewStringType::kNormal)
- .ToLocalChecked());
- CHECK(object->IsObject());
- return object.As<v8::Object>()
- ->HasPrivate(context, shouldFormatAccessorsPrivate)
- .FromMaybe(false);
-}
-
-v8::Local<v8::Context> InspectorClientImpl::ensureDefaultContextInGroup(
- int context_group_id) {
- CHECK(isolate_);
- return task_runner_->data()->GetContext(context_group_id);
-}
-
-void InspectorClientImpl::SetCurrentTimeMSForTest(double time) {
- current_time_ = time;
- current_time_set_for_test_ = true;
-}
-
-double InspectorClientImpl::currentTimeMS() {
- if (current_time_set_for_test_) return current_time_;
- return v8::base::OS::TimeCurrentMillis();
-}
-
-void InspectorClientImpl::SetMemoryInfoForTest(
- v8::Local<v8::Value> memory_info) {
- memory_info_.Reset(isolate_, memory_info);
-}
-
-void InspectorClientImpl::SetLogConsoleApiMessageCalls(bool log) {
- log_console_api_message_calls_ = log;
-}
-
-v8::MaybeLocal<v8::Value> InspectorClientImpl::memoryInfo(
- v8::Isolate* isolate, v8::Local<v8::Context>) {
- if (memory_info_.IsEmpty()) return v8::MaybeLocal<v8::Value>();
- return memory_info_.Get(isolate);
-}
-
-void InspectorClientImpl::runMessageLoopOnPause(int) {
- task_runner_->RunMessageLoop(true);
-}
-
-void InspectorClientImpl::quitMessageLoopOnPause() {
- task_runner_->QuitMessageLoop();
-}
-
-void InspectorClientImpl::consoleAPIMessage(
- int contextGroupId, v8::Isolate::MessageErrorLevel level,
- const v8_inspector::StringView& message,
- const v8_inspector::StringView& url, unsigned lineNumber,
- unsigned columnNumber, v8_inspector::V8StackTrace* stack) {
- if (!log_console_api_message_calls_) return;
- Print(isolate_, message);
- fprintf(stdout, " (");
- Print(isolate_, url);
- fprintf(stdout, ":%d:%d)", lineNumber, columnNumber);
- Print(isolate_, stack->toString()->string());
- fprintf(stdout, "\n");
-}
diff --git a/deps/v8/test/inspector/inspector-impl.h b/deps/v8/test/inspector/inspector-impl.h
deleted file mode 100644
index edbec72cfb..0000000000
--- a/deps/v8/test/inspector/inspector-impl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
-#define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
-
-#include <map>
-#include <vector>
-
-#include "include/v8-inspector.h"
-#include "include/v8.h"
-#include "src/base/macros.h"
-#include "src/base/platform/platform.h"
-
-class TaskRunner;
-
-class InspectorClientImpl : public v8_inspector::V8InspectorClient {
- public:
- class FrontendChannel {
- public:
- virtual ~FrontendChannel() = default;
- virtual void SendMessageToFrontend(
- int session_id, const v8_inspector::StringView& message) = 0;
- };
-
- InspectorClientImpl(v8::Isolate* isolate, TaskRunner* task_runner,
- FrontendChannel* frontend_channel);
- virtual ~InspectorClientImpl();
-
- v8_inspector::V8Inspector* inspector() const { return inspector_.get(); }
- int ConnectSession(int context_group_id,
- const v8_inspector::StringView& state);
- std::unique_ptr<v8_inspector::StringBuffer> DisconnectSession(int session_id);
- void SendMessage(int session_id, const v8_inspector::StringView& message);
- void BreakProgram(int context_group_id,
- const v8_inspector::StringView& reason,
- const v8_inspector::StringView& details);
- void SchedulePauseOnNextStatement(int context_group_id,
- const v8_inspector::StringView& reason,
- const v8_inspector::StringView& details);
- void CancelPauseOnNextStatement(int context_group_id);
- void SetCurrentTimeMSForTest(double time);
- void SetMemoryInfoForTest(v8::Local<v8::Value> memory_info);
- void SetLogConsoleApiMessageCalls(bool log);
- void ContextCreated(v8::Local<v8::Context> context, int context_group_id);
- void ContextDestroyed(v8::Local<v8::Context> context);
-
- private:
- // V8InspectorClient implementation.
- bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
- v8::Local<v8::Context> ensureDefaultContextInGroup(
- int context_group_id) override;
- double currentTimeMS() override;
- v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate* isolate,
- v8::Local<v8::Context>) override;
- void runMessageLoopOnPause(int context_group_id) override;
- void quitMessageLoopOnPause() override;
- void consoleAPIMessage(int contextGroupId,
- v8::Isolate::MessageErrorLevel level,
- const v8_inspector::StringView& message,
- const v8_inspector::StringView& url,
- unsigned lineNumber, unsigned columnNumber,
- v8_inspector::V8StackTrace*) override;
-
- std::vector<int> GetSessionIds(int context_group_id);
-
- std::unique_ptr<v8_inspector::V8Inspector> inspector_;
- int last_session_id_ = 0;
- std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_;
- std::map<v8_inspector::V8InspectorSession*, int> context_group_by_session_;
- std::map<int, std::unique_ptr<v8_inspector::V8Inspector::Channel>> channels_;
- TaskRunner* task_runner_;
- v8::Isolate* isolate_;
- v8::Global<v8::Value> memory_info_;
- FrontendChannel* frontend_channel_;
- bool current_time_set_for_test_ = false;
- double current_time_ = 0.0;
- bool log_console_api_message_calls_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl);
-};
-
-#endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_
diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc
index 0395cc3483..930d6c9477 100644
--- a/deps/v8/test/inspector/inspector-test.cc
+++ b/deps/v8/test/inspector/inspector-test.cc
@@ -13,11 +13,10 @@
#include "src/base/platform/platform.h"
#include "src/flags.h"
-#include "src/inspector/test-interface.h"
#include "src/utils.h"
#include "src/vector.h"
-#include "test/inspector/inspector-impl.h"
+#include "test/inspector/isolate-data.h"
#include "test/inspector/task-runner.h"
namespace {
@@ -51,6 +50,20 @@ v8::Local<v8::String> ToV8String(v8::Isolate* isolate, const char* str) {
.ToLocalChecked();
}
+v8::Local<v8::String> ToV8String(v8::Isolate* isolate, const char* str,
+ int length) {
+ return v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kNormal,
+ length)
+ .ToLocalChecked();
+}
+
+v8::Local<v8::String> ToV8String(v8::Isolate* isolate,
+ const v8::internal::Vector<uint16_t>& buffer) {
+ return v8::String::NewFromTwoByte(isolate, buffer.start(),
+ v8::NewStringType::kNormal, buffer.length())
+ .ToLocalChecked();
+}
+
v8::internal::Vector<uint16_t> ToVector(
const v8_inspector::StringView& string) {
v8::internal::Vector<uint16_t> buffer =
@@ -64,182 +77,193 @@ v8::internal::Vector<uint16_t> ToVector(
return buffer;
}
-class CreateContextGroupTask : public TaskRunner::Task {
- public:
- CreateContextGroupTask(v8::base::Semaphore* ready_semaphore,
- int* context_group_id)
- : ready_semaphore_(ready_semaphore),
- context_group_id_(context_group_id) {}
- virtual ~CreateContextGroupTask() = default;
- bool is_inspector_task() final { return true; }
-
- private:
- void Run() override {
- *context_group_id_ = data()->CreateContextGroup();
- if (ready_semaphore_) ready_semaphore_->Signal();
- }
-
- v8::base::Semaphore* ready_semaphore_;
- int* context_group_id_;
-};
-
-class ConnectSessionTask : public TaskRunner::Task {
+class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
public:
- ConnectSessionTask(v8::base::Semaphore* ready_semaphore, int context_group_id,
- const v8::internal::Vector<uint16_t>& state,
- int* session_id)
- : ready_semaphore_(ready_semaphore),
+ FrontendChannelImpl(TaskRunner* task_runner, int context_group_id,
+ v8::Isolate* isolate, v8::Local<v8::Function> function)
+ : task_runner_(task_runner),
context_group_id_(context_group_id),
- state_(state),
- session_id_(session_id) {}
- virtual ~ConnectSessionTask() = default;
- bool is_inspector_task() final { return true; }
+ function_(isolate, function) {}
+ virtual ~FrontendChannelImpl() = default;
+
+ void set_session_id(int session_id) { session_id_ = session_id; }
private:
- void Run() override {
- v8_inspector::StringView state(state_.start(), state_.length());
- *session_id_ =
- data()->inspector()->ConnectSession(context_group_id_, state);
- if (ready_semaphore_) ready_semaphore_->Signal();
- }
+ void sendResponse(
+ int callId,
+ std::unique_ptr<v8_inspector::StringBuffer> message) override {
+ task_runner_->Append(
+ new SendMessageTask(this, ToVector(message->string())));
+ }
+ void sendNotification(
+ std::unique_ptr<v8_inspector::StringBuffer> message) override {
+ task_runner_->Append(
+ new SendMessageTask(this, ToVector(message->string())));
+ }
+ void flushProtocolNotifications() override {}
+
+ class SendMessageTask : public TaskRunner::Task {
+ public:
+ SendMessageTask(FrontendChannelImpl* channel,
+ const v8::internal::Vector<uint16_t>& message)
+ : channel_(channel), message_(message) {}
+ virtual ~SendMessageTask() {}
+ bool is_priority_task() final { return false; }
+
+ private:
+ void Run(IsolateData* data) override {
+ v8::MicrotasksScope microtasks_scope(data->isolate(),
+ v8::MicrotasksScope::kRunMicrotasks);
+ v8::HandleScope handle_scope(data->isolate());
+ v8::Local<v8::Context> context =
+ data->GetContext(channel_->context_group_id_);
+ v8::Context::Scope context_scope(context);
+ v8::Local<v8::Value> message = ToV8String(data->isolate(), message_);
+ v8::MaybeLocal<v8::Value> result;
+ result = channel_->function_.Get(data->isolate())
+ ->Call(context, context->Global(), 1, &message);
+ }
+ FrontendChannelImpl* channel_;
+ v8::internal::Vector<uint16_t> message_;
+ };
- v8::base::Semaphore* ready_semaphore_;
+ TaskRunner* task_runner_;
int context_group_id_;
- const v8::internal::Vector<uint16_t>& state_;
- int* session_id_;
+ v8::Global<v8::Function> function_;
+ int session_id_;
+ DISALLOW_COPY_AND_ASSIGN(FrontendChannelImpl);
};
-class DisconnectSessionTask : public TaskRunner::Task {
- public:
- DisconnectSessionTask(v8::base::Semaphore* ready_semaphore, int session_id,
- v8::internal::Vector<uint16_t>* state)
- : ready_semaphore_(ready_semaphore),
- session_id_(session_id),
- state_(state) {}
- virtual ~DisconnectSessionTask() = default;
- bool is_inspector_task() final { return true; }
+template <typename T>
+void RunSyncTask(TaskRunner* task_runner, T callback) {
+ class SyncTask : public TaskRunner::Task {
+ public:
+ SyncTask(v8::base::Semaphore* ready_semaphore, T callback)
+ : ready_semaphore_(ready_semaphore), callback_(callback) {}
+ virtual ~SyncTask() = default;
+ bool is_priority_task() final { return true; }
+
+ private:
+ void Run(IsolateData* data) override {
+ callback_(data);
+ if (ready_semaphore_) ready_semaphore_->Signal();
+ }
- private:
- void Run() override {
- std::unique_ptr<v8_inspector::StringBuffer> state =
- data()->inspector()->DisconnectSession(session_id_);
- *state_ = ToVector(state->string());
- if (ready_semaphore_) ready_semaphore_->Signal();
- }
+ v8::base::Semaphore* ready_semaphore_;
+ T callback_;
+ };
- v8::base::Semaphore* ready_semaphore_;
- int session_id_;
- v8::internal::Vector<uint16_t>* state_;
-};
+ v8::base::Semaphore ready_semaphore(0);
+ task_runner->Append(new SyncTask(&ready_semaphore, callback));
+ ready_semaphore.Wait();
+}
class SendMessageToBackendTask : public TaskRunner::Task {
public:
- explicit SendMessageToBackendTask(
- int session_id, const v8::internal::Vector<uint16_t>& message)
+ SendMessageToBackendTask(int session_id,
+ const v8::internal::Vector<uint16_t>& message)
: session_id_(session_id), message_(message) {}
- bool is_inspector_task() final { return true; }
+ bool is_priority_task() final { return true; }
private:
- void Run() override {
+ void Run(IsolateData* data) override {
v8_inspector::StringView message_view(message_.start(), message_.length());
- data()->inspector()->SendMessage(session_id_, message_view);
+ data->SendMessage(session_id_, message_view);
}
int session_id_;
v8::internal::Vector<uint16_t> message_;
};
-class SchedulePauseOnNextStatementTask : public TaskRunner::Task {
- public:
- SchedulePauseOnNextStatementTask(
- v8::base::Semaphore* ready_semaphore, int context_group_id,
- const v8::internal::Vector<uint16_t>& reason,
- const v8::internal::Vector<uint16_t>& details)
- : ready_semaphore_(ready_semaphore),
- context_group_id_(context_group_id),
- reason_(reason),
- details_(details) {}
- virtual ~SchedulePauseOnNextStatementTask() = default;
- bool is_inspector_task() final { return true; }
+void RunAsyncTask(TaskRunner* task_runner, const char* task_name,
+ TaskRunner::Task* task) {
+ class AsyncTask : public TaskRunner::Task {
+ public:
+ explicit AsyncTask(TaskRunner::Task* inner) : inner_(inner) {}
+ virtual ~AsyncTask() = default;
+ bool is_priority_task() override { return inner_->is_priority_task(); }
+ void Run(IsolateData* data) override {
+ data->AsyncTaskStarted(inner_.get());
+ inner_->Run(data);
+ data->AsyncTaskFinished(inner_.get());
+ }
- private:
- void Run() override {
- v8_inspector::StringView reason(reason_.start(), reason_.length());
- v8_inspector::StringView details(details_.start(), details_.length());
- data()->inspector()->SchedulePauseOnNextStatement(context_group_id_, reason,
- details);
- if (ready_semaphore_) ready_semaphore_->Signal();
- }
+ private:
+ std::unique_ptr<TaskRunner::Task> inner_;
+ DISALLOW_COPY_AND_ASSIGN(AsyncTask);
+ };
- v8::base::Semaphore* ready_semaphore_;
- int context_group_id_;
- const v8::internal::Vector<uint16_t>& reason_;
- const v8::internal::Vector<uint16_t>& details_;
-};
+ task_runner->data()->AsyncTaskScheduled(
+ v8_inspector::StringView(reinterpret_cast<const uint8_t*>(task_name),
+ strlen(task_name)),
+ task, false);
+ task_runner->Append(new AsyncTask(task));
+}
-class CancelPauseOnNextStatementTask : public TaskRunner::Task {
+class ExecuteStringTask : public TaskRunner::Task {
public:
- CancelPauseOnNextStatementTask(v8::base::Semaphore* ready_semaphore,
- int context_group_id)
- : ready_semaphore_(ready_semaphore),
+ ExecuteStringTask(int context_group_id,
+ const v8::internal::Vector<uint16_t>& expression,
+ v8::Local<v8::String> name,
+ v8::Local<v8::Integer> line_offset,
+ v8::Local<v8::Integer> column_offset,
+ v8::Local<v8::Boolean> is_module)
+ : expression_(expression),
+ name_(ToVector(name)),
+ line_offset_(line_offset.As<v8::Int32>()->Value()),
+ column_offset_(column_offset.As<v8::Int32>()->Value()),
+ is_module_(is_module->Value()),
context_group_id_(context_group_id) {}
- virtual ~CancelPauseOnNextStatementTask() = default;
- bool is_inspector_task() final { return true; }
-
- private:
- void Run() override {
- data()->inspector()->CancelPauseOnNextStatement(context_group_id_);
- if (ready_semaphore_) ready_semaphore_->Signal();
- }
-
- v8::base::Semaphore* ready_semaphore_;
- int context_group_id_;
-};
-
-class SendMessageToFrontendTask : public TaskRunner::Task {
- public:
- SendMessageToFrontendTask(int context_group_id, int session_id,
- const v8::internal::Vector<uint16_t>& message)
- : context_group_id_(context_group_id),
- session_id_(session_id),
- message_(message) {}
- virtual ~SendMessageToFrontendTask() {}
-
- bool is_inspector_task() final { return false; }
-
- static void Register(int session_id, v8::Isolate* isolate,
- v8::Local<v8::Function> dispatcher) {
- dispatchers_[session_id].Reset(isolate, dispatcher);
- }
-
- static void Unregister(int session_id) { dispatchers_.erase(session_id); }
-
- private:
- void Run() override {
- v8::MicrotasksScope microtasks_scope(isolate(),
+ ExecuteStringTask(const v8::internal::Vector<const char>& expression,
+ int context_group_id)
+ : expression_utf8_(expression), context_group_id_(context_group_id) {}
+ bool is_priority_task() override { return false; }
+ void Run(IsolateData* data) override {
+ v8::MicrotasksScope microtasks_scope(data->isolate(),
v8::MicrotasksScope::kRunMicrotasks);
- v8::HandleScope handle_scope(isolate());
- v8::Local<v8::Context> context = data()->GetContext(context_group_id_);
+ v8::HandleScope handle_scope(data->isolate());
+ v8::Local<v8::Context> context = data->GetContext(context_group_id_);
v8::Context::Scope context_scope(context);
+ v8::ScriptOrigin origin(
+ ToV8String(data->isolate(), name_),
+ v8::Integer::New(data->isolate(), line_offset_),
+ v8::Integer::New(data->isolate(), column_offset_),
+ /* resource_is_shared_cross_origin */ v8::Local<v8::Boolean>(),
+ /* script_id */ v8::Local<v8::Integer>(),
+ /* source_map_url */ v8::Local<v8::Value>(),
+ /* resource_is_opaque */ v8::Local<v8::Boolean>(),
+ /* is_wasm */ v8::Local<v8::Boolean>(),
+ v8::Boolean::New(data->isolate(), is_module_));
+ v8::Local<v8::String> source;
+ if (expression_.length())
+ source = ToV8String(data->isolate(), expression_);
+ else
+ source = ToV8String(data->isolate(), expression_utf8_.start(),
+ expression_utf8_.length());
- if (dispatchers_.find(session_id_) == dispatchers_.end()) return;
- v8::Local<v8::Function> function = dispatchers_[session_id_].Get(isolate());
- v8::Local<v8::Value> message =
- v8::String::NewFromTwoByte(isolate(), message_.start(),
- v8::NewStringType::kNormal,
- static_cast<int>(message_.size()))
- .ToLocalChecked();
- v8::MaybeLocal<v8::Value> result;
- result = function->Call(context, context->Global(), 1, &message);
+ v8::ScriptCompiler::Source scriptSource(source, origin);
+ if (!is_module_) {
+ v8::Local<v8::Script> script;
+ if (!v8::ScriptCompiler::Compile(context, &scriptSource).ToLocal(&script))
+ return;
+ v8::MaybeLocal<v8::Value> result;
+ result = script->Run(context);
+ } else {
+ data->RegisterModule(context, name_, &scriptSource);
+ }
}
- static std::map<int, v8::Global<v8::Function>> dispatchers_;
+ private:
+ v8::internal::Vector<uint16_t> expression_;
+ v8::internal::Vector<const char> expression_utf8_;
+ v8::internal::Vector<uint16_t> name_;
+ int32_t line_offset_ = 0;
+ int32_t column_offset_ = 0;
+ bool is_module_ = false;
int context_group_id_;
- int session_id_;
- v8::internal::Vector<uint16_t> message_;
-};
-std::map<int, v8::Global<v8::Function>> SendMessageToFrontendTask::dispatchers_;
+ DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask);
+};
class UtilsExtension : public IsolateData::SetupGlobalTask {
public:
@@ -348,10 +372,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
std::string filename(*str, str.length());
*chars = v8::internal::ReadFile(filename.c_str(), &exists);
if (!exists) {
- isolate->ThrowException(
- v8::String::NewFromUtf8(isolate, "Error reading file",
- v8::NewStringType::kNormal)
- .ToLocalChecked());
+ isolate->ThrowException(ToV8String(isolate, "Error reading file"));
return false;
}
return true;
@@ -364,12 +385,8 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
}
v8::internal::Vector<const char> chars;
v8::Isolate* isolate = args.GetIsolate();
- if (ReadFile(isolate, args[0], &chars)) {
- args.GetReturnValue().Set(
- v8::String::NewFromUtf8(isolate, chars.start(),
- v8::NewStringType::kNormal, chars.length())
- .ToLocalChecked());
- }
+ if (ReadFile(isolate, args[0], &chars))
+ args.GetReturnValue().Set(ToV8String(isolate, chars.start()));
}
static void Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
@@ -383,7 +400,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
IsolateData* data = IsolateData::FromContext(context);
int context_group_id = data->GetContextGroupId(context);
if (ReadFile(isolate, args[0], &chars)) {
- ExecuteStringTask(chars, context_group_id).RunOnIsolate(data);
+ ExecuteStringTask(chars, context_group_id).Run(data);
}
}
@@ -400,10 +417,9 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
}
backend_runner_->Append(new ExecuteStringTask(
- nullptr, args[0].As<v8::Int32>()->Value(), nullptr,
- ToVector(args[1].As<v8::String>()), args[2].As<v8::String>(),
- args[3].As<v8::Int32>(), args[4].As<v8::Int32>(),
- args[5].As<v8::Boolean>()));
+ args[0].As<v8::Int32>()->Value(), ToVector(args[1].As<v8::String>()),
+ args[2].As<v8::String>(), args[3].As<v8::Int32>(),
+ args[4].As<v8::Int32>(), args[5].As<v8::Boolean>()));
}
static void SetCurrentTimeMSForTest(
@@ -412,7 +428,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: setCurrentTimeMSForTest(time).");
Exit();
}
- backend_runner_->data()->inspector()->SetCurrentTimeMSForTest(
+ backend_runner_->data()->SetCurrentTimeMS(
args[0].As<v8::Number>()->Value());
}
@@ -422,7 +438,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: setMemoryInfoForTest(value).");
Exit();
}
- backend_runner_->data()->inspector()->SetMemoryInfoForTest(args[0]);
+ backend_runner_->data()->SetMemoryInfo(args[0]);
}
static void SchedulePauseOnNextStatement(
@@ -436,10 +452,14 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
}
v8::internal::Vector<uint16_t> reason = ToVector(args[1].As<v8::String>());
v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>());
- v8::base::Semaphore ready_semaphore(0);
- backend_runner_->Append(new SchedulePauseOnNextStatementTask(
- &ready_semaphore, args[0].As<v8::Int32>()->Value(), reason, details));
- ready_semaphore.Wait();
+ int context_group_id = args[0].As<v8::Int32>()->Value();
+ RunSyncTask(backend_runner_, [&context_group_id, &reason,
+ &details](IsolateData* data) {
+ data->SchedulePauseOnNextStatement(
+ context_group_id,
+ v8_inspector::StringView(reason.start(), reason.length()),
+ v8_inspector::StringView(details.start(), details.length()));
+ });
}
static void CancelPauseOnNextStatement(
@@ -449,10 +469,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
"Internal error: cancelPauseOnNextStatement(context_group_id).");
Exit();
}
- v8::base::Semaphore ready_semaphore(0);
- backend_runner_->Append(new CancelPauseOnNextStatementTask(
- &ready_semaphore, args[0].As<v8::Int32>()->Value()));
- ready_semaphore.Wait();
+ int context_group_id = args[0].As<v8::Int32>()->Value();
+ RunSyncTask(backend_runner_, [&context_group_id](IsolateData* data) {
+ data->CancelPauseOnNextStatement(context_group_id);
+ });
}
static void SetLogConsoleApiMessageCalls(
@@ -461,7 +481,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: setLogConsoleApiMessageCalls(bool).");
Exit();
}
- backend_runner_->data()->inspector()->SetLogConsoleApiMessageCalls(
+ backend_runner_->data()->SetLogConsoleApiMessageCalls(
args[0].As<v8::Boolean>()->Value());
}
@@ -471,11 +491,10 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: createContextGroup().");
Exit();
}
- v8::base::Semaphore ready_semaphore(0);
int context_group_id = 0;
- backend_runner_->Append(
- new CreateContextGroupTask(&ready_semaphore, &context_group_id));
- ready_semaphore.Wait();
+ RunSyncTask(backend_runner_, [&context_group_id](IsolateData* data) {
+ context_group_id = data->CreateContextGroup();
+ });
args.GetReturnValue().Set(
v8::Int32::New(args.GetIsolate(), context_group_id));
}
@@ -488,15 +507,24 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
"dispatch).");
Exit();
}
+ v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+ FrontendChannelImpl* channel = new FrontendChannelImpl(
+ IsolateData::FromContext(context)->task_runner(),
+ IsolateData::FromContext(context)->GetContextGroupId(context),
+ args.GetIsolate(), args[2].As<v8::Function>());
+
v8::internal::Vector<uint16_t> state = ToVector(args[1].As<v8::String>());
- v8::base::Semaphore ready_semaphore(0);
+ int context_group_id = args[0].As<v8::Int32>()->Value();
int session_id = 0;
- backend_runner_->Append(new ConnectSessionTask(
- &ready_semaphore, args[0].As<v8::Int32>()->Value(), state,
- &session_id));
- ready_semaphore.Wait();
- SendMessageToFrontendTask::Register(session_id, args.GetIsolate(),
- args[2].As<v8::Function>());
+ RunSyncTask(backend_runner_, [&context_group_id, &session_id, &channel,
+ &state](IsolateData* data) {
+ session_id = data->ConnectSession(
+ context_group_id,
+ v8_inspector::StringView(state.start(), state.length()), channel);
+ channel->set_session_id(session_id);
+ });
+
+ channels_[session_id].reset(channel);
args.GetReturnValue().Set(v8::Int32::New(args.GetIsolate(), session_id));
}
@@ -507,17 +535,12 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
Exit();
}
int session_id = args[0].As<v8::Int32>()->Value();
- SendMessageToFrontendTask::Unregister(session_id);
- v8::base::Semaphore ready_semaphore(0);
v8::internal::Vector<uint16_t> state;
- backend_runner_->Append(
- new DisconnectSessionTask(&ready_semaphore, session_id, &state));
- ready_semaphore.Wait();
- args.GetReturnValue().Set(
- v8::String::NewFromTwoByte(args.GetIsolate(), state.start(),
- v8::NewStringType::kNormal,
- static_cast<int>(state.size()))
- .ToLocalChecked());
+ RunSyncTask(backend_runner_, [&session_id, &state](IsolateData* data) {
+ state = ToVector(data->DisconnectSession(session_id)->string());
+ });
+ channels_.erase(session_id);
+ args.GetReturnValue().Set(ToV8String(args.GetIsolate(), state));
}
static void SendMessageToBackend(
@@ -530,30 +553,30 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
backend_runner_->Append(new SendMessageToBackendTask(
args[0].As<v8::Int32>()->Value(), ToVector(args[1].As<v8::String>())));
}
+
+ static std::map<int, std::unique_ptr<FrontendChannelImpl>> channels_;
};
TaskRunner* UtilsExtension::backend_runner_ = nullptr;
+std::map<int, std::unique_ptr<FrontendChannelImpl>> UtilsExtension::channels_;
-class SetTimeoutTask : public AsyncTask {
+class SetTimeoutTask : public TaskRunner::Task {
public:
- SetTimeoutTask(IsolateData* data, int context_group_id, const char* task_name,
+ SetTimeoutTask(int context_group_id, v8::Isolate* isolate,
v8::Local<v8::Function> function)
- : AsyncTask(data, task_name),
- function_(data->isolate(), function),
- context_group_id_(context_group_id) {}
+ : function_(isolate, function), context_group_id_(context_group_id) {}
virtual ~SetTimeoutTask() {}
-
- bool is_inspector_task() final { return false; }
+ bool is_priority_task() final { return false; }
private:
- void AsyncRun() override {
- v8::MicrotasksScope microtasks_scope(isolate(),
+ void Run(IsolateData* data) override {
+ v8::MicrotasksScope microtasks_scope(data->isolate(),
v8::MicrotasksScope::kRunMicrotasks);
- v8::HandleScope handle_scope(isolate());
- v8::Local<v8::Context> context = data()->GetContext(context_group_id_);
+ v8::HandleScope handle_scope(data->isolate());
+ v8::Local<v8::Context> context = data->GetContext(context_group_id_);
v8::Context::Scope context_scope(context);
- v8::Local<v8::Function> function = function_.Get(isolate());
+ v8::Local<v8::Function> function = function_.Get(data->isolate());
v8::MaybeLocal<v8::Value> result;
result = function->Call(context, context->Global(), 0, nullptr);
}
@@ -585,18 +608,18 @@ class SetTimeoutExtension : public IsolateData::SetupGlobalTask {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
int context_group_id = data->GetContextGroupId(context);
- std::unique_ptr<TaskRunner::Task> task;
if (args[0]->IsFunction()) {
- task.reset(new SetTimeoutTask(data, context_group_id, "setTimeout",
- v8::Local<v8::Function>::Cast(args[0])));
+ RunAsyncTask(data->task_runner(), "setTimeout",
+ new SetTimeoutTask(context_group_id, isolate,
+ v8::Local<v8::Function>::Cast(args[0])));
} else {
- task.reset(new ExecuteStringTask(
- data, context_group_id, "setTimeout",
- ToVector(args[0].As<v8::String>()), v8::String::Empty(isolate),
- v8::Integer::New(isolate, 0), v8::Integer::New(isolate, 0),
- v8::Boolean::New(isolate, false)));
+ RunAsyncTask(
+ data->task_runner(), "setTimeout",
+ new ExecuteStringTask(
+ context_group_id, ToVector(args[0].As<v8::String>()),
+ v8::String::Empty(isolate), v8::Integer::New(isolate, 0),
+ v8::Integer::New(isolate, 0), v8::Boolean::New(isolate, false)));
}
- data->task_runner()->Append(task.release());
}
};
@@ -619,9 +642,9 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
inspector->Set(ToV8String(isolate, "fireContextDestroyed"),
v8::FunctionTemplate::New(
isolate, &InspectorExtension::FireContextDestroyed));
- inspector->Set(
- ToV8String(isolate, "freeContext"),
- v8::FunctionTemplate::New(isolate, &InspectorExtension::FreeContext));
+ inspector->Set(ToV8String(isolate, "addInspectedObject"),
+ v8::FunctionTemplate::New(
+ isolate, &InspectorExtension::AddInspectedObject));
inspector->Set(ToV8String(isolate, "setMaxAsyncTaskStacks"),
v8::FunctionTemplate::New(
isolate, &InspectorExtension::SetMaxAsyncTaskStacks));
@@ -650,21 +673,26 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
- data->inspector()->ContextCreated(context,
- data->GetContextGroupId(context));
+ data->FireContextCreated(context, data->GetContextGroupId(context));
}
static void FireContextDestroyed(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
- data->inspector()->ContextDestroyed(context);
+ data->FireContextDestroyed(context);
}
- static void FreeContext(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ static void AddInspectedObject(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() != 2 || !args[0]->IsInt32()) {
+ fprintf(stderr,
+ "Internal error: addInspectedObject(session_id, object).");
+ Exit();
+ }
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
- data->FreeContext(context);
+ data->AddInspectedObject(args[0].As<v8::Int32>()->Value(), args[1]);
}
static void SetMaxAsyncTaskStacks(
@@ -673,11 +701,8 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: setMaxAsyncTaskStacks(max).");
Exit();
}
- v8_inspector::SetMaxAsyncTaskStacksForTest(
- IsolateData::FromContext(args.GetIsolate()->GetCurrentContext())
- ->inspector()
- ->inspector(),
- args[0].As<v8::Int32>()->Value());
+ IsolateData::FromContext(args.GetIsolate()->GetCurrentContext())
+ ->SetMaxAsyncTaskStacksForTest(args[0].As<v8::Int32>()->Value());
}
static void DumpAsyncTaskStacksStateForTest(
@@ -686,10 +711,8 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: dumpAsyncTaskStacksStateForTest().");
Exit();
}
- v8_inspector::DumpAsyncTaskStacksStateForTest(
- IsolateData::FromContext(args.GetIsolate()->GetCurrentContext())
- ->inspector()
- ->inspector());
+ IsolateData::FromContext(args.GetIsolate()->GetCurrentContext())
+ ->DumpAsyncTaskStacksStateForTest();
}
static void BreakProgram(const v8::FunctionCallbackInfo<v8::Value>& args) {
@@ -703,8 +726,8 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
v8_inspector::StringView reason_view(reason.start(), reason.length());
v8::internal::Vector<uint16_t> details = ToVector(args[1].As<v8::String>());
v8_inspector::StringView details_view(details.start(), details.length());
- data->inspector()->BreakProgram(data->GetContextGroupId(context),
- reason_view, details_view);
+ data->BreakProgram(data->GetContextGroupId(context), reason_view,
+ details_view);
}
static void CreateObjectWithStrictCheck(
@@ -736,12 +759,12 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
int context_group_id = data->GetContextGroupId(context);
- data->inspector()->SchedulePauseOnNextStatement(context_group_id,
- reason_view, details_view);
+ data->SchedulePauseOnNextStatement(context_group_id, reason_view,
+ details_view);
v8::MaybeLocal<v8::Value> result;
result = args[0].As<v8::Function>()->Call(context, context->Global(), 0,
nullptr);
- data->inspector()->CancelPauseOnNextStatement(context_group_id);
+ data->CancelPauseOnNextStatement(context_group_id);
}
static void AllowAccessorFormatting(
@@ -753,9 +776,7 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
v8::Local<v8::Object> object = args[0].As<v8::Object>();
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
- isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting",
- v8::NewStringType::kNormal)
- .ToLocalChecked());
+ isolate, ToV8String(isolate, "allowAccessorFormatting"));
object
->SetPrivate(isolate->GetCurrentContext(), shouldFormatAccessorsPrivate,
v8::Null(isolate))
@@ -763,24 +784,6 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
}
};
-class FrontendChannelImpl : public InspectorClientImpl::FrontendChannel {
- public:
- FrontendChannelImpl(TaskRunner* frontend_task_runner, int context_group_id)
- : frontend_task_runner_(frontend_task_runner),
- context_group_id_(context_group_id) {}
- virtual ~FrontendChannelImpl() {}
-
- void SendMessageToFrontend(int session_id,
- const v8_inspector::StringView& message) final {
- frontend_task_runner_->Append(new SendMessageToFrontendTask(
- context_group_id_, session_id, ToVector(message)));
- }
-
- private:
- TaskRunner* frontend_task_runner_;
- int context_group_id_;
-};
-
} // namespace
int main(int argc, char* argv[]) {
@@ -806,22 +809,21 @@ int main(int argc, char* argv[]) {
IsolateData::SetupGlobalTasks frontend_extensions;
frontend_extensions.emplace_back(new UtilsExtension());
TaskRunner frontend_runner(std::move(frontend_extensions), true,
- &ready_semaphore, nullptr, nullptr);
+ &ready_semaphore, nullptr, false);
ready_semaphore.Wait();
int frontend_context_group_id = 0;
- frontend_runner.Append(
- new CreateContextGroupTask(&ready_semaphore, &frontend_context_group_id));
- ready_semaphore.Wait();
+ RunSyncTask(&frontend_runner,
+ [&frontend_context_group_id](IsolateData* data) {
+ frontend_context_group_id = data->CreateContextGroup();
+ });
IsolateData::SetupGlobalTasks backend_extensions;
backend_extensions.emplace_back(new SetTimeoutExtension());
backend_extensions.emplace_back(new InspectorExtension());
- FrontendChannelImpl frontend_channel(&frontend_runner,
- frontend_context_group_id);
- TaskRunner backend_runner(
- std::move(backend_extensions), false, &ready_semaphore,
- startup_data.data ? &startup_data : nullptr, &frontend_channel);
+ TaskRunner backend_runner(std::move(backend_extensions), false,
+ &ready_semaphore,
+ startup_data.data ? &startup_data : nullptr, true);
ready_semaphore.Wait();
UtilsExtension::set_backend_task_runner(&backend_runner);
diff --git a/deps/v8/test/inspector/inspector.gyp b/deps/v8/test/inspector/inspector.gyp
index 26f44d4812..b465f9e552 100644
--- a/deps/v8/test/inspector/inspector.gyp
+++ b/deps/v8/test/inspector/inspector.gyp
@@ -20,8 +20,6 @@
'../..',
],
'sources': [
- 'inspector-impl.cc',
- 'inspector-impl.h',
'inspector-test.cc',
'isolate-data.cc',
'isolate-data.h',
diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status
index 5eb0a30ec6..78343f7dcc 100644
--- a/deps/v8/test/inspector/inspector.status
+++ b/deps/v8/test/inspector/inspector.status
@@ -13,6 +13,7 @@
'debugger/scope-skip-variables-with-empty-name': [PASS, FAIL],
'debugger/update-call-frame-scopes': [PASS, FAIL],
'debugger/side-effect-free-debug-evaluate': [PASS, FAIL],
+ 'debugger/evaluate-on-call-frame-in-module': [PASS, FAIL],
# Issue 6170. Crash.
'cpu-profiler/console-profile': [SKIP],
'cpu-profiler/console-profile-end-parameterless-crash': [SKIP],
@@ -21,14 +22,23 @@
}], # variant != default
##############################################################################
-['variant == noturbofan', {
- # Crashes due to missing source position in ToBooleanICStub?
- 'runtime/command-line-api': [SKIP],
-}], # variant == noturbofan
-
-##############################################################################
['variant == wasm_traps', {
'*': [SKIP],
}], # variant == wasm_traps
+##############################################################################
+['variant == fullcode', {
+ # fullcode doesn't generate precise return positions
+ 'debugger/return-break-locations': [SKIP],
+ 'debugger/for-of-loops': [SKIP],
+ 'debugger/break-locations-var-init': [SKIP],
+ 'debugger/framework-precise-ranges': [SKIP],
+ 'debugger/step-snapshot': [SKIP],
+ 'debugger/step-into-next-script': [SKIP],
+ 'debugger/asm-js-breakpoint-before-exec': [SKIP],
+ 'debugger/break-locations-await': [SKIP],
+ 'debugger/get-possible-breakpoints': [SKIP],
+ 'debugger/stepping-with-blackboxed-ranges': [SKIP],
+}], # variant == fullcode
+
]
diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc
index b1e85ede80..74c367a5e9 100644
--- a/deps/v8/test/inspector/isolate-data.cc
+++ b/deps/v8/test/inspector/isolate-data.cc
@@ -4,7 +4,7 @@
#include "test/inspector/isolate-data.h"
-#include "test/inspector/inspector-impl.h"
+#include "src/inspector/test-interface.h"
#include "test/inspector/task-runner.h"
namespace {
@@ -19,12 +19,44 @@ v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
return buffer;
}
+v8::Local<v8::String> ToString(v8::Isolate* isolate,
+ const v8_inspector::StringView& string) {
+ if (string.is8Bit())
+ return v8::String::NewFromOneByte(isolate, string.characters8(),
+ v8::NewStringType::kNormal,
+ static_cast<int>(string.length()))
+ .ToLocalChecked();
+ else
+ return v8::String::NewFromTwoByte(isolate, string.characters16(),
+ v8::NewStringType::kNormal,
+ static_cast<int>(string.length()))
+ .ToLocalChecked();
+}
+
+void Print(v8::Isolate* isolate, const v8_inspector::StringView& string) {
+ v8::Local<v8::String> v8_string = ToString(isolate, string);
+ v8::String::Utf8Value utf8_string(v8_string);
+ fwrite(*utf8_string, sizeof(**utf8_string), utf8_string.length(), stdout);
+}
+
+class Inspectable : public v8_inspector::V8InspectorSession::Inspectable {
+ public:
+ Inspectable(v8::Isolate* isolate, v8::Local<v8::Value> object)
+ : object_(isolate, object) {}
+ ~Inspectable() override {}
+ v8::Local<v8::Value> get(v8::Local<v8::Context> context) override {
+ return object_.Get(context->GetIsolate());
+ }
+
+ private:
+ v8::Global<v8::Value> object_;
+};
+
} // namespace
IsolateData::IsolateData(TaskRunner* task_runner,
IsolateData::SetupGlobalTasks setup_global_tasks,
- v8::StartupData* startup_data,
- InspectorClientImpl::FrontendChannel* channel)
+ v8::StartupData* startup_data, bool with_inspector)
: task_runner_(task_runner),
setup_global_tasks_(std::move(setup_global_tasks)) {
v8::Isolate::CreateParams params;
@@ -33,8 +65,11 @@ IsolateData::IsolateData(TaskRunner* task_runner,
params.snapshot_blob = startup_data;
isolate_ = v8::Isolate::New(params);
isolate_->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped);
- if (channel)
- inspector_.reset(new InspectorClientImpl(isolate_, task_runner, channel));
+ if (with_inspector) {
+ isolate_->AddMessageListener(&IsolateData::MessageHandler);
+ isolate_->SetPromiseRejectCallback(&IsolateData::PromiseRejectHandler);
+ inspector_ = v8_inspector::V8Inspector::create(isolate_, this);
+ }
}
IsolateData* IsolateData::FromContext(v8::Local<v8::Context> context) {
@@ -58,7 +93,7 @@ int IsolateData::CreateContextGroup() {
context->SetAlignedPointerInEmbedderData(
kContextGroupIdIndex, reinterpret_cast<void*>(context_group_id * 2));
contexts_[context_group_id].Reset(isolate_, context);
- if (inspector_) inspector_->ContextCreated(context, context_group_id);
+ if (inspector_) FireContextCreated(context, context_group_id);
return context_group_id;
}
@@ -79,13 +114,16 @@ void IsolateData::RegisterModule(v8::Local<v8::Context> context,
v8::Local<v8::Module> module;
if (!v8::ScriptCompiler::CompileModule(isolate(), source).ToLocal(&module))
return;
- if (!module->Instantiate(context, &IsolateData::ModuleResolveCallback))
+ if (!module->InstantiateModule(context, &IsolateData::ModuleResolveCallback)
+ .FromMaybe(false)) {
return;
+ }
v8::Local<v8::Value> result;
if (!module->Evaluate(context).ToLocal(&result)) return;
modules_[name] = v8::Global<v8::Module>(isolate_, module);
}
+// static
v8::MaybeLocal<v8::Module> IsolateData::ModuleResolveCallback(
v8::Local<v8::Context> context, v8::Local<v8::String> specifier,
v8::Local<v8::Module> referrer) {
@@ -94,9 +132,245 @@ v8::MaybeLocal<v8::Module> IsolateData::ModuleResolveCallback(
return data->modules_[ToVector(specifier)].Get(data->isolate_);
}
-void IsolateData::FreeContext(v8::Local<v8::Context> context) {
- int context_group_id = GetContextGroupId(context);
- auto it = contexts_.find(context_group_id);
- if (it == contexts_.end()) return;
- contexts_.erase(it);
+int IsolateData::ConnectSession(int context_group_id,
+ const v8_inspector::StringView& state,
+ v8_inspector::V8Inspector::Channel* channel) {
+ int session_id = ++last_session_id_;
+ sessions_[session_id] = inspector_->connect(context_group_id, channel, state);
+ context_group_by_session_[sessions_[session_id].get()] = context_group_id;
+ return session_id;
+}
+
+std::unique_ptr<v8_inspector::StringBuffer> IsolateData::DisconnectSession(
+ int session_id) {
+ auto it = sessions_.find(session_id);
+ CHECK(it != sessions_.end());
+ context_group_by_session_.erase(it->second.get());
+ std::unique_ptr<v8_inspector::StringBuffer> result = it->second->stateJSON();
+ sessions_.erase(it);
+ return result;
+}
+
+void IsolateData::SendMessage(int session_id,
+ const v8_inspector::StringView& message) {
+ auto it = sessions_.find(session_id);
+ if (it != sessions_.end()) it->second->dispatchProtocolMessage(message);
+}
+
+void IsolateData::BreakProgram(int context_group_id,
+ const v8_inspector::StringView& reason,
+ const v8_inspector::StringView& details) {
+ for (int session_id : GetSessionIds(context_group_id)) {
+ auto it = sessions_.find(session_id);
+ if (it != sessions_.end()) it->second->breakProgram(reason, details);
+ }
+}
+
+void IsolateData::SchedulePauseOnNextStatement(
+ int context_group_id, const v8_inspector::StringView& reason,
+ const v8_inspector::StringView& details) {
+ for (int session_id : GetSessionIds(context_group_id)) {
+ auto it = sessions_.find(session_id);
+ if (it != sessions_.end())
+ it->second->schedulePauseOnNextStatement(reason, details);
+ }
+}
+
+void IsolateData::CancelPauseOnNextStatement(int context_group_id) {
+ for (int session_id : GetSessionIds(context_group_id)) {
+ auto it = sessions_.find(session_id);
+ if (it != sessions_.end()) it->second->cancelPauseOnNextStatement();
+ }
+}
+
+void IsolateData::AsyncTaskScheduled(const v8_inspector::StringView& name,
+ void* task, bool recurring) {
+ inspector_->asyncTaskScheduled(name, task, recurring);
+}
+
+void IsolateData::AsyncTaskStarted(void* task) {
+ inspector_->asyncTaskStarted(task);
+}
+
+void IsolateData::AsyncTaskFinished(void* task) {
+ inspector_->asyncTaskFinished(task);
+}
+
+void IsolateData::AddInspectedObject(int session_id,
+ v8::Local<v8::Value> object) {
+ auto it = sessions_.find(session_id);
+ if (it == sessions_.end()) return;
+ std::unique_ptr<Inspectable> inspectable(new Inspectable(isolate_, object));
+ it->second->addInspectedObject(std::move(inspectable));
+}
+
+void IsolateData::SetMaxAsyncTaskStacksForTest(int limit) {
+ v8_inspector::SetMaxAsyncTaskStacksForTest(inspector_.get(), limit);
+}
+
+void IsolateData::DumpAsyncTaskStacksStateForTest() {
+ v8_inspector::DumpAsyncTaskStacksStateForTest(inspector_.get());
+}
+
+// static
+int IsolateData::HandleMessage(v8::Local<v8::Message> message,
+ v8::Local<v8::Value> exception) {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::Local<v8::Context> context = isolate->GetEnteredContext();
+ if (context.IsEmpty()) return 0;
+ v8_inspector::V8Inspector* inspector =
+ IsolateData::FromContext(context)->inspector_.get();
+
+ v8::Local<v8::StackTrace> stack = message->GetStackTrace();
+ int script_id =
+ static_cast<int>(message->GetScriptOrigin().ScriptID()->Value());
+ if (!stack.IsEmpty() && stack->GetFrameCount() > 0) {
+ int top_script_id = stack->GetFrame(0)->GetScriptId();
+ if (top_script_id == script_id) script_id = 0;
+ }
+ int line_number = message->GetLineNumber(context).FromMaybe(0);
+ int column_number = 0;
+ if (message->GetStartColumn(context).IsJust())
+ column_number = message->GetStartColumn(context).FromJust() + 1;
+
+ v8_inspector::StringView detailed_message;
+ v8::internal::Vector<uint16_t> message_text_string = ToVector(message->Get());
+ v8_inspector::StringView message_text(message_text_string.start(),
+ message_text_string.length());
+ v8::internal::Vector<uint16_t> url_string;
+ if (message->GetScriptOrigin().ResourceName()->IsString()) {
+ url_string =
+ ToVector(message->GetScriptOrigin().ResourceName().As<v8::String>());
+ }
+ v8_inspector::StringView url(url_string.start(), url_string.length());
+
+ return inspector->exceptionThrown(
+ context, message_text, exception, detailed_message, url, line_number,
+ column_number, inspector->createStackTrace(stack), script_id);
+}
+
+// static
+void IsolateData::MessageHandler(v8::Local<v8::Message> message,
+ v8::Local<v8::Value> exception) {
+ HandleMessage(message, exception);
+}
+
+// static
+void IsolateData::PromiseRejectHandler(v8::PromiseRejectMessage data) {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::Local<v8::Context> context = isolate->GetEnteredContext();
+ if (context.IsEmpty()) return;
+ v8::Local<v8::Promise> promise = data.GetPromise();
+ v8::Local<v8::Private> id_private = v8::Private::ForApi(
+ isolate,
+ v8::String::NewFromUtf8(isolate, "id", v8::NewStringType::kNormal)
+ .ToLocalChecked());
+
+ if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) {
+ v8::Local<v8::Value> id;
+ if (!promise->GetPrivate(context, id_private).ToLocal(&id)) return;
+ if (!id->IsInt32()) return;
+ v8_inspector::V8Inspector* inspector =
+ IsolateData::FromContext(context)->inspector_.get();
+ const char* reason_str = "Handler added to rejected promise";
+ inspector->exceptionRevoked(
+ context, id.As<v8::Int32>()->Value(),
+ v8_inspector::StringView(reinterpret_cast<const uint8_t*>(reason_str),
+ strlen(reason_str)));
+ return;
+ }
+
+ v8::Local<v8::Value> exception = data.GetValue();
+ int exception_id = HandleMessage(
+ v8::Exception::CreateMessage(isolate, exception), exception);
+ if (exception_id) {
+ promise
+ ->SetPrivate(isolate->GetCurrentContext(), id_private,
+ v8::Int32::New(isolate, exception_id))
+ .ToChecked();
+ }
+}
+
+void IsolateData::FireContextCreated(v8::Local<v8::Context> context,
+ int context_group_id) {
+ v8_inspector::V8ContextInfo info(context, context_group_id,
+ v8_inspector::StringView());
+ info.hasMemoryOnConsole = true;
+ inspector_->contextCreated(info);
+}
+
+void IsolateData::FireContextDestroyed(v8::Local<v8::Context> context) {
+ inspector_->contextDestroyed(context);
+}
+
+std::vector<int> IsolateData::GetSessionIds(int context_group_id) {
+ std::vector<int> result;
+ for (auto& it : sessions_) {
+ if (context_group_by_session_[it.second.get()] == context_group_id)
+ result.push_back(it.first);
+ }
+ return result;
+}
+
+bool IsolateData::formatAccessorsAsProperties(v8::Local<v8::Value> object) {
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
+ v8::Local<v8::Private> shouldFormatAccessorsPrivate = v8::Private::ForApi(
+ isolate, v8::String::NewFromUtf8(isolate, "allowAccessorFormatting",
+ v8::NewStringType::kNormal)
+ .ToLocalChecked());
+ CHECK(object->IsObject());
+ return object.As<v8::Object>()
+ ->HasPrivate(context, shouldFormatAccessorsPrivate)
+ .FromMaybe(false);
+}
+
+v8::Local<v8::Context> IsolateData::ensureDefaultContextInGroup(
+ int context_group_id) {
+ return GetContext(context_group_id);
+}
+
+void IsolateData::SetCurrentTimeMS(double time) {
+ current_time_ = time;
+ current_time_set_ = true;
+}
+
+double IsolateData::currentTimeMS() {
+ if (current_time_set_) return current_time_;
+ return v8::base::OS::TimeCurrentMillis();
+}
+
+void IsolateData::SetMemoryInfo(v8::Local<v8::Value> memory_info) {
+ memory_info_.Reset(isolate_, memory_info);
+}
+
+void IsolateData::SetLogConsoleApiMessageCalls(bool log) {
+ log_console_api_message_calls_ = log;
+}
+
+v8::MaybeLocal<v8::Value> IsolateData::memoryInfo(v8::Isolate* isolate,
+ v8::Local<v8::Context>) {
+ if (memory_info_.IsEmpty()) return v8::MaybeLocal<v8::Value>();
+ return memory_info_.Get(isolate);
+}
+
+void IsolateData::runMessageLoopOnPause(int) {
+ task_runner_->RunMessageLoop(true);
+}
+
+void IsolateData::quitMessageLoopOnPause() { task_runner_->QuitMessageLoop(); }
+
+void IsolateData::consoleAPIMessage(int contextGroupId,
+ v8::Isolate::MessageErrorLevel level,
+ const v8_inspector::StringView& message,
+ const v8_inspector::StringView& url,
+ unsigned lineNumber, unsigned columnNumber,
+ v8_inspector::V8StackTrace* stack) {
+ if (!log_console_api_message_calls_) return;
+ Print(isolate_, message);
+ fprintf(stdout, " (");
+ Print(isolate_, url);
+ fprintf(stdout, ":%d:%d)", lineNumber, columnNumber);
+ Print(isolate_, stack->toString()->string());
+ fprintf(stdout, "\n");
}
diff --git a/deps/v8/test/inspector/isolate-data.h b/deps/v8/test/inspector/isolate-data.h
index 52a3fb3206..a94316ff9b 100644
--- a/deps/v8/test/inspector/isolate-data.h
+++ b/deps/v8/test/inspector/isolate-data.h
@@ -10,12 +10,13 @@
#include "include/v8-inspector.h"
#include "include/v8-platform.h"
#include "include/v8.h"
+#include "src/base/macros.h"
+#include "src/base/platform/platform.h"
#include "src/vector.h"
-#include "test/inspector/inspector-impl.h"
class TaskRunner;
-class IsolateData {
+class IsolateData : public v8_inspector::V8InspectorClient {
public:
class SetupGlobalTask {
public:
@@ -26,20 +27,47 @@ class IsolateData {
using SetupGlobalTasks = std::vector<std::unique_ptr<SetupGlobalTask>>;
IsolateData(TaskRunner* task_runner, SetupGlobalTasks setup_global_tasks,
- v8::StartupData* startup_data,
- InspectorClientImpl::FrontendChannel* channel);
+ v8::StartupData* startup_data, bool with_inspector);
static IsolateData* FromContext(v8::Local<v8::Context> context);
v8::Isolate* isolate() const { return isolate_; }
- InspectorClientImpl* inspector() const { return inspector_.get(); }
TaskRunner* task_runner() const { return task_runner_; }
+
+ // Setting things up.
int CreateContextGroup();
v8::Local<v8::Context> GetContext(int context_group_id);
int GetContextGroupId(v8::Local<v8::Context> context);
void RegisterModule(v8::Local<v8::Context> context,
v8::internal::Vector<uint16_t> name,
v8::ScriptCompiler::Source* source);
- void FreeContext(v8::Local<v8::Context> context);
+
+ // Working with V8Inspector api.
+ int ConnectSession(int context_group_id,
+ const v8_inspector::StringView& state,
+ v8_inspector::V8Inspector::Channel* channel);
+ std::unique_ptr<v8_inspector::StringBuffer> DisconnectSession(int session_id);
+ void SendMessage(int session_id, const v8_inspector::StringView& message);
+ void BreakProgram(int context_group_id,
+ const v8_inspector::StringView& reason,
+ const v8_inspector::StringView& details);
+ void SchedulePauseOnNextStatement(int context_group_id,
+ const v8_inspector::StringView& reason,
+ const v8_inspector::StringView& details);
+ void CancelPauseOnNextStatement(int context_group_id);
+ void AsyncTaskScheduled(const v8_inspector::StringView& name, void* task,
+ bool recurring);
+ void AsyncTaskStarted(void* task);
+ void AsyncTaskFinished(void* task);
+ void AddInspectedObject(int session_id, v8::Local<v8::Value> object);
+
+ // Test utilities.
+ void SetCurrentTimeMS(double time);
+ void SetMemoryInfo(v8::Local<v8::Value> memory_info);
+ void SetLogConsoleApiMessageCalls(bool log);
+ void SetMaxAsyncTaskStacksForTest(int limit);
+ void DumpAsyncTaskStacksStateForTest();
+ void FireContextCreated(v8::Local<v8::Context> context, int context_group_id);
+ void FireContextDestroyed(v8::Local<v8::Context> context);
private:
struct VectorCompare {
@@ -54,15 +82,47 @@ class IsolateData {
static v8::MaybeLocal<v8::Module> ModuleResolveCallback(
v8::Local<v8::Context> context, v8::Local<v8::String> specifier,
v8::Local<v8::Module> referrer);
+ static void MessageHandler(v8::Local<v8::Message> message,
+ v8::Local<v8::Value> exception);
+ static void PromiseRejectHandler(v8::PromiseRejectMessage data);
+ static int HandleMessage(v8::Local<v8::Message> message,
+ v8::Local<v8::Value> exception);
+ std::vector<int> GetSessionIds(int context_group_id);
+
+ // V8InspectorClient implementation.
+ bool formatAccessorsAsProperties(v8::Local<v8::Value>) override;
+ v8::Local<v8::Context> ensureDefaultContextInGroup(
+ int context_group_id) override;
+ double currentTimeMS() override;
+ v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate* isolate,
+ v8::Local<v8::Context>) override;
+ void runMessageLoopOnPause(int context_group_id) override;
+ void quitMessageLoopOnPause() override;
+ void consoleAPIMessage(int contextGroupId,
+ v8::Isolate::MessageErrorLevel level,
+ const v8_inspector::StringView& message,
+ const v8_inspector::StringView& url,
+ unsigned lineNumber, unsigned columnNumber,
+ v8_inspector::V8StackTrace*) override;
TaskRunner* task_runner_;
SetupGlobalTasks setup_global_tasks_;
v8::Isolate* isolate_;
- std::unique_ptr<InspectorClientImpl> inspector_;
+ std::unique_ptr<v8_inspector::V8Inspector> inspector_;
int last_context_group_id_ = 0;
std::map<int, v8::Global<v8::Context>> contexts_;
std::map<v8::internal::Vector<uint16_t>, v8::Global<v8::Module>,
VectorCompare>
modules_;
+ int last_session_id_ = 0;
+ std::map<int, std::unique_ptr<v8_inspector::V8InspectorSession>> sessions_;
+ std::map<v8_inspector::V8InspectorSession*, int> context_group_by_session_;
+ v8::Global<v8::Value> memory_info_;
+ bool current_time_set_ = false;
+ double current_time_ = 0.0;
+ bool log_console_api_message_calls_ = false;
+
+ DISALLOW_COPY_AND_ASSIGN(IsolateData);
};
+
#endif // V8_TEST_INSPECTOR_PROTOCOL_ISOLATE_DATA_H_
diff --git a/deps/v8/test/inspector/protocol-test.js b/deps/v8/test/inspector/protocol-test.js
index a99a9f536d..fc2bc50a59 100644
--- a/deps/v8/test/inspector/protocol-test.js
+++ b/deps/v8/test/inspector/protocol-test.js
@@ -186,6 +186,10 @@ InspectorTest.Session = class {
this.id = utils.connectSession(this.contextGroup.id, state, this._dispatchMessage.bind(this));
}
+ async addInspectedObject(serializable) {
+ return this.Protocol.Runtime.evaluate({expression: `inspector.addInspectedObject(${this.id}, ${JSON.stringify(serializable)})`});
+ }
+
sendRawCommand(requestId, command, handler) {
if (InspectorTest._dumpInspectorProtocolMessages)
utils.print("frontend: " + command);
@@ -239,6 +243,36 @@ InspectorTest.Session = class {
return this.logSourceLocation(locations[0]).then(() => this.logSourceLocations(locations.splice(1)));
}
+ async logBreakLocations(inputLocations) {
+ let locations = inputLocations.slice();
+ let scriptId = locations[0].scriptId;
+ let script = this._scriptMap.get(scriptId);
+ if (!script.scriptSource) {
+ let message = await this.Protocol.Debugger.getScriptSource({scriptId});
+ script.scriptSource = message.result.scriptSource;
+ }
+ let lines = script.scriptSource.split('\n');
+ locations = locations.sort((loc1, loc2) => {
+ if (loc2.lineNumber !== loc1.lineNumber) return loc2.lineNumber - loc1.lineNumber;
+ return loc2.columnNumber - loc1.columnNumber;
+ });
+ for (let location of locations) {
+ let line = lines[location.lineNumber];
+ line = line.slice(0, location.columnNumber) + locationMark(location.type) + line.slice(location.columnNumber);
+ lines[location.lineNumber] = line;
+ }
+ lines = lines.filter(line => line.indexOf('//# sourceURL=') === -1);
+ InspectorTest.log(lines.join('\n') + '\n');
+ return inputLocations;
+
+ function locationMark(type) {
+ if (type === 'return') return '|R|';
+ if (type === 'call') return '|C|';
+ if (type === 'debuggerStatement') return '|D|';
+ return '|_|';
+ }
+ }
+
logAsyncStackTrace(asyncStackTrace) {
while (asyncStackTrace) {
if (asyncStackTrace.promiseCreationFrame) {
diff --git a/deps/v8/test/inspector/runtime/await-promise-expected.txt b/deps/v8/test/inspector/runtime/await-promise-expected.txt
index ae37bd6708..3e23a71a38 100644
--- a/deps/v8/test/inspector/runtime/await-promise-expected.txt
+++ b/deps/v8/test/inspector/runtime/await-promise-expected.txt
@@ -99,6 +99,56 @@ Running test: testRejectedPromiseWithStack
}
}
+Running test: testRejectedPromiseWithError
+{
+ id : <messageId>
+ result : {
+ exceptionDetails : {
+ columnNumber : 0
+ exception : {
+ className : Error
+ description : Error: MyError at rejectPromiseWithAnError (test.js:25:20) at <anonymous>:1:1
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ exceptionId : <exceptionId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ ]
+ parent : {
+ callFrames : [
+ [0] : {
+ columnNumber : 4
+ functionName : rejectPromiseWithAnError
+ lineNumber : 24
+ scriptId : <scriptId>
+ url : test.js
+ }
+ [1] : {
+ columnNumber : 0
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ description : Promise.reject
+ }
+ }
+ text : Uncaught (in promise) Error: MyError
+ }
+ result : {
+ className : Error
+ description : Error: MyError at rejectPromiseWithAnError (test.js:25:20) at <anonymous>:1:1
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ }
+}
+
Running test: testPendingPromise
{
id : <messageId>
diff --git a/deps/v8/test/inspector/runtime/await-promise.js b/deps/v8/test/inspector/runtime/await-promise.js
index 042a1332bf..cf7d53d083 100644
--- a/deps/v8/test/inspector/runtime/await-promise.js
+++ b/deps/v8/test/inspector/runtime/await-promise.js
@@ -28,6 +28,18 @@ function rejectPromise()
rejectCallback = undefined;
}
+function rejectPromiseWithAnError()
+{
+ rejectCallback(new Error('MyError'));
+ resolveCallback = undefined;
+ rejectCallback = undefined;
+}
+
+function throwError()
+{
+ throw new Error('MyError');
+}
+
//# sourceURL=test.js`);
Protocol.Debugger.enable()
@@ -68,6 +80,21 @@ function testSuite()
}
},
+ function testRejectedPromiseWithError(next)
+ {
+ Protocol.Runtime.evaluate({ expression: "createPromise()"})
+ .then(result => scheduleRejectAndAwaitPromise(result))
+ .then(result => InspectorTest.logMessage(result))
+ .then(() => next());
+
+ function scheduleRejectAndAwaitPromise(result)
+ {
+ var promise = Protocol.Runtime.awaitPromise({ promiseObjectId: result.result.result.objectId });
+ Protocol.Runtime.evaluate({ expression: "rejectPromiseWithAnError()" });
+ return promise;
+ }
+ },
+
function testPendingPromise(next)
{
Protocol.Runtime.evaluate({ expression: "createPromise()"})
diff --git a/deps/v8/test/inspector/runtime/console-context-expected.txt b/deps/v8/test/inspector/runtime/console-context-expected.txt
new file mode 100644
index 0000000000..941f9c34da
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/console-context-expected.txt
@@ -0,0 +1,83 @@
+Tests console.context
+
+Running test: testConsoleContextMethod
+console.context description:
+{
+ className : Function
+ description : function context() { [native code] }
+ objectId : <objectId>
+ type : function
+}
+console.context() methods:
+[
+ [0] : debug
+ [1] : error
+ [2] : info
+ [3] : log
+ [4] : warn
+ [5] : dir
+ [6] : dirXml
+ [7] : table
+ [8] : trace
+ [9] : group
+ [10] : groupCollapsed
+ [11] : groupEnd
+ [12] : clear
+ [13] : count
+ [14] : assert
+ [15] : markTimeline
+ [16] : profile
+ [17] : profileEnd
+ [18] : timeline
+ [19] : timelineEnd
+ [20] : time
+ [21] : timeEnd
+ [22] : timeStamp
+]
+
+Running test: testDefaultConsoleContext
+undefined
+undefined
+undefined
+
+Running test: testAnonymousConsoleContext
+anonymous#2
+anonymous#3
+anonymous#4
+
+Running test: testNamedConsoleContext
+named-context#6
+named-context#6
+named-context#6
+
+Running test: testTwoConsoleContextsWithTheSameName
+named-context#7
+named-context#8
+
+Running test: testConsoleCountInDifferentConsoleContexts
+[
+ [0] : {
+ type : string
+ value : 239: 1
+ }
+]
+[
+ [0] : {
+ type : string
+ value : 239: 1
+ }
+]
+
+Running test: testConsoleCountForNamedConsoleContext
+[
+ [0] : {
+ type : string
+ value : 239: 1
+ }
+]
+[
+ [0] : {
+ type : string
+ value : 239: 2
+ }
+]
diff --git a/deps/v8/test/inspector/runtime/console-context.js b/deps/v8/test/inspector/runtime/console-context.js
new file mode 100644
index 0000000000..74996ae595
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/console-context.js
@@ -0,0 +1,106 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} = InspectorTest.start('Tests console.context');
+
+InspectorTest.runAsyncTestSuite([
+ async function testConsoleContextMethod() {
+ InspectorTest.log('console.context description:');
+ var {result:{result}} = await Protocol.Runtime.evaluate({
+ expression: 'console.context'});
+ InspectorTest.logMessage(result);
+
+ InspectorTest.log('console.context() methods:');
+ var {result:{result:{value}}} = await Protocol.Runtime.evaluate({
+ expression: 'Object.keys(console.context())', returnByValue: true});
+ InspectorTest.logMessage(value);
+ },
+
+ async function testDefaultConsoleContext() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: 'console.log(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ Protocol.Runtime.evaluate({expression: 'console.info(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ Protocol.Runtime.evaluate({expression: 'console.debug(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ await Protocol.Runtime.evaluate({expression: 'console.clear()'});
+ await Protocol.Runtime.disable();
+ },
+
+ async function testAnonymousConsoleContext() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: 'console.context().log(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ Protocol.Runtime.evaluate({expression: 'console.context().info(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ Protocol.Runtime.evaluate({expression: 'console.context().debug(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ await Protocol.Runtime.evaluate({expression: 'console.context().clear()'});
+ await Protocol.Runtime.disable();
+ },
+
+ async function testNamedConsoleContext() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: `
+ var context = console.context('named-context');
+ context.log(239);
+ context.info(239);
+ context.debug(239);
+ `});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ await Protocol.Runtime.evaluate({expression: 'console.clear()'});
+ await Protocol.Runtime.disable();
+ },
+
+ async function testTwoConsoleContextsWithTheSameName() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: 'console.context(\'named-context\').log(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ Protocol.Runtime.evaluate({expression: 'console.context(\'named-context\').log(239)'});
+ var {params:{context}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.log(context);
+ await Protocol.Runtime.evaluate({expression: 'console.clear()'});
+ await Protocol.Runtime.disable();
+ },
+
+ async function testConsoleCountInDifferentConsoleContexts() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: 'console.context(\'named-context\').count(239)'});
+ var {params:{args}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.logMessage(args);
+ Protocol.Runtime.evaluate({expression: 'console.context(\'named-context\').count(239)'});
+ var {params:{args}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.logMessage(args);
+ await Protocol.Runtime.evaluate({expression: 'console.clear()'});
+ await Protocol.Runtime.disable();
+ },
+
+ async function testConsoleCountForNamedConsoleContext() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: `
+ var context = console.context('named-context');
+ context.count(239);
+ context.count(239);
+ `});
+ var {params:{args}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.logMessage(args);
+ var {params:{args}} = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.logMessage(args);
+ await Protocol.Runtime.evaluate({expression: 'console.clear()'});
+ await Protocol.Runtime.disable();
+ }
+]);
diff --git a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt
deleted file mode 100644
index 9a5e1708c1..0000000000
--- a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected-expected.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Tests that contextDesrtoyed nofitication is fired when context is collected.
-{
- method : Runtime.executionContextDestroyed
- params : {
- executionContextId : <executionContextId>
- }
-}
diff --git a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js b/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js
deleted file mode 100644
index 9f715937c6..0000000000
--- a/deps/v8/test/inspector/runtime/context-destroyed-on-context-collected.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-let {session, contextGroup, Protocol} =
- InspectorTest.start('Tests that contextDesrtoyed nofitication is fired when context is collected.');
-
-(async function test() {
- await Protocol.Runtime.enable();
- Protocol.Runtime.onExecutionContextDestroyed(InspectorTest.logMessage);
- contextGroup.addScript('inspector.freeContext()');
- await Protocol.HeapProfiler.collectGarbage();
- InspectorTest.completeTest();
-})();
diff --git a/deps/v8/test/inspector/runtime/evaluate-async-expected.txt b/deps/v8/test/inspector/runtime/evaluate-async-expected.txt
index c521648f7b..2f45fa122d 100644
--- a/deps/v8/test/inspector/runtime/evaluate-async-expected.txt
+++ b/deps/v8/test/inspector/runtime/evaluate-async-expected.txt
@@ -35,6 +35,98 @@ Running test: testRejectedPromise
}
}
+Running test: testRejectedPromiseWithError
+{
+ id : <messageId>
+ result : {
+ exceptionDetails : {
+ columnNumber : 11
+ exception : {
+ className : Error
+ description : Error: MyError at foo (<anonymous>:13:11) at throwError (<anonymous>:15:3) at <anonymous>
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ exceptionId : <exceptionId>
+ lineNumber : 13
+ scriptId : <scriptId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 10
+ functionName : foo
+ lineNumber : 12
+ scriptId : <scriptId>
+ url :
+ }
+ [1] : {
+ columnNumber : 2
+ functionName : throwError
+ lineNumber : 14
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught (in promise) Error: MyError
+ }
+ result : {
+ className : Error
+ description : Error: MyError at foo (<anonymous>:13:11) at throwError (<anonymous>:15:3) at <anonymous>
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ }
+}
+
+Running test: testRejectedPromiseWithSyntaxError
+{
+ id : <messageId>
+ result : {
+ exceptionDetails : {
+ columnNumber : 5
+ exception : {
+ className : SyntaxError
+ description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3) at <anonymous>
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ exceptionId : <exceptionId>
+ lineNumber : 21
+ scriptId : <scriptId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 4
+ functionName : foo
+ lineNumber : 20
+ scriptId : <scriptId>
+ url :
+ }
+ [1] : {
+ columnNumber : 2
+ functionName : throwSyntaxError
+ lineNumber : 22
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught (in promise) SyntaxError: Unexpected token }
+ }
+ result : {
+ className : SyntaxError
+ description : SyntaxError: Unexpected token } at foo (<anonymous>:21:5) at throwSyntaxError (<anonymous>:23:3) at <anonymous>
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ }
+}
+
Running test: testPrimitiveValueInsteadOfPromise
{
error : {
diff --git a/deps/v8/test/inspector/runtime/evaluate-async.js b/deps/v8/test/inspector/runtime/evaluate-async.js
index db02d9c150..c456a01c2f 100644
--- a/deps/v8/test/inspector/runtime/evaluate-async.js
+++ b/deps/v8/test/inspector/runtime/evaluate-async.js
@@ -11,7 +11,24 @@ function createPromiseAndScheduleResolve()
var promise = new Promise((resolve) => resolveCallback = resolve);
setTimeout(resolveCallback.bind(null, { a : 239 }), 0);
return promise;
-}`);
+}
+
+function throwError()
+{
+ function foo() {
+ throw new Error('MyError');
+ }
+ foo();
+}
+
+function throwSyntaxError()
+{
+ function foo() {
+ eval('}');
+ }
+ foo();
+}
+`);
InspectorTest.runTestSuite([
function testResolvedPromise(next)
@@ -28,6 +45,24 @@ InspectorTest.runTestSuite([
.then(() => next());
},
+ function testRejectedPromiseWithError(next)
+ {
+ Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({ expression: "Promise.resolve().then(throwError)", awaitPromise: true })
+ .then(result => InspectorTest.logMessage(result))
+ .then(Protocol.Runtime.disable)
+ .then(() => next());
+ },
+
+ function testRejectedPromiseWithSyntaxError(next)
+ {
+ Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({ expression: "Promise.resolve().then(throwSyntaxError)", awaitPromise: true })
+ .then(result => InspectorTest.logMessage(result))
+ .then(Protocol.Runtime.disable)
+ .then(() => next());
+ },
+
function testPrimitiveValueInsteadOfPromise(next)
{
Protocol.Runtime.evaluate({ expression: "true", awaitPromise: true })
diff --git a/deps/v8/test/inspector/runtime/internal-properties-expected.txt b/deps/v8/test/inspector/runtime/internal-properties-expected.txt
index deee4cfdbd..10c2f83b7e 100644
--- a/deps/v8/test/inspector/runtime/internal-properties-expected.txt
+++ b/deps/v8/test/inspector/runtime/internal-properties-expected.txt
@@ -339,16 +339,6 @@ expression: gen1.next();gen1
}
}
}
- [4] : {
- name : [[Scopes]]
- value : {
- className : Array
- description : Scopes[2]
- objectId : <objectId>
- subtype : internal#scopeList
- type : object
- }
- }
]
}
}
diff --git a/deps/v8/test/inspector/runtime/regression-732717-expected.txt b/deps/v8/test/inspector/runtime/regression-732717-expected.txt
new file mode 100644
index 0000000000..68ddd76d19
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/regression-732717-expected.txt
@@ -0,0 +1 @@
+Regression test for crbug.com/732717
diff --git a/deps/v8/test/inspector/runtime/regression-732717.js b/deps/v8/test/inspector/runtime/regression-732717.js
new file mode 100644
index 0000000000..f874b2f851
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/regression-732717.js
@@ -0,0 +1,17 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} =
+ InspectorTest.start('Regression test for crbug.com/732717');
+
+Protocol.Runtime.evaluate({expression: `var v3 = {};
+var v6 = {};
+Array.prototype.__defineGetter__(0, function() {
+ this[0] = 2147483647;
+})
+Array.prototype.__defineSetter__(0, function() {
+console.context(v3);
+this[0] = v6;
+});
+v60 = Array(0x8000).join();`}).then(InspectorTest.completeTest);
diff --git a/deps/v8/test/inspector/runtime/regression-736302-expected.txt b/deps/v8/test/inspector/runtime/regression-736302-expected.txt
new file mode 100644
index 0000000000..17243f2745
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/regression-736302-expected.txt
@@ -0,0 +1,82 @@
+crbug.com/736302
+
+Running test: testThrowException
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : 1
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 12
+ functionName :
+ lineNumber : 1
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : count
+ }
+}
+
+Running test: testCustomName
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : [object MyObject]: 1
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 12
+ functionName :
+ lineNumber : 1
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : count
+ }
+}
+
+Running test: testObject
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : [object Object]: 1
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 12
+ functionName :
+ lineNumber : 1
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : count
+ }
+}
diff --git a/deps/v8/test/inspector/runtime/regression-736302.js b/deps/v8/test/inspector/runtime/regression-736302.js
new file mode 100644
index 0000000000..083e34af2d
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/regression-736302.js
@@ -0,0 +1,40 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} = InspectorTest.start('crbug.com/736302');
+
+InspectorTest.runAsyncTestSuite([
+ async function testThrowException() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: `
+ console.count({
+ get [Symbol.toStringTag]() {
+ throw new Error();
+ }
+ });`});
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+ await Protocol.Runtime.disable();
+ },
+
+ async function testCustomName() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: `
+ console.count({
+ get [Symbol.toStringTag]() {
+ return 'MyObject';
+ }
+ });`});
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+ await Protocol.Runtime.disable();
+ },
+
+ async function testObject() {
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: `
+ console.count({});`});
+ InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled());
+ await Protocol.Runtime.disable();
+ }
+
+]);
diff --git a/deps/v8/test/inspector/sessions/create-session-expected.txt b/deps/v8/test/inspector/sessions/create-session-expected.txt
new file mode 100644
index 0000000000..f8c31a47dd
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/create-session-expected.txt
@@ -0,0 +1,132 @@
+Tests that creating multiple sessions works.
+Connecting session 1
+From session 1
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 1
+ name :
+ origin :
+ }
+ }
+}
+Connecting session 2
+From session 2
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 1
+ name :
+ origin :
+ }
+ }
+}
+Reconnecting session 2
+From session 2
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 1
+ name :
+ origin :
+ }
+ }
+}
+Reconnecting session 1
+From session 1
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 1
+ name :
+ origin :
+ }
+ }
+}
+Connecting session 3
+From session 3
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 1
+ name :
+ origin :
+ }
+ }
+}
+Destroying and creating context
+From session 3
+{
+ method : Runtime.executionContextDestroyed
+ params : {
+ executionContextId : <executionContextId>
+ }
+}
+id matching: true
+From session 1
+{
+ method : Runtime.executionContextDestroyed
+ params : {
+ executionContextId : <executionContextId>
+ }
+}
+id matching: true
+From session 2
+{
+ method : Runtime.executionContextDestroyed
+ params : {
+ executionContextId : <executionContextId>
+ }
+}
+id matching: true
+From session 3
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 2
+ name :
+ origin :
+ }
+ }
+}
+From session 1
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 2
+ name :
+ origin :
+ }
+ }
+}
+From session 2
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 2
+ name :
+ origin :
+ }
+ }
+}
+Disconnecting all sessions
+Connecting session 4
+From session 4
+{
+ method : Runtime.executionContextCreated
+ params : {
+ context : {
+ id : 2
+ name :
+ origin :
+ }
+ }
+}
diff --git a/deps/v8/test/inspector/sessions/create-session.js b/deps/v8/test/inspector/sessions/create-session.js
new file mode 100644
index 0000000000..1163583845
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/create-session.js
@@ -0,0 +1,58 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that creating multiple sessions works.');
+
+function connect(contextGroup, num) {
+ var session = contextGroup.connect();
+ var executionContextId;
+ session.Protocol.Runtime.onExecutionContextCreated(message => {
+ InspectorTest.log('From session ' + num);
+ InspectorTest.logMessage(message);
+ executionContextId = message.params.context.id;
+ });
+ session.Protocol.Runtime.onExecutionContextDestroyed(message => {
+ InspectorTest.log('From session ' + num);
+ InspectorTest.logMessage(message);
+ InspectorTest.log('id matching: ' + (message.params.executionContextId === executionContextId));
+ });
+ return session;
+}
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ InspectorTest.log('Connecting session 1');
+ var session1 = connect(contextGroup, 1);
+ await session1.Protocol.Runtime.enable();
+
+ InspectorTest.log('Connecting session 2');
+ var session2 = connect(contextGroup, 2);
+ await session2.Protocol.Runtime.enable();
+
+ InspectorTest.log('Reconnecting session 2');
+ session2.reconnect();
+ await session2.Protocol.Runtime.enable();
+
+ InspectorTest.log('Reconnecting session 1');
+ session1.reconnect();
+ await session1.Protocol.Runtime.enable();
+
+ InspectorTest.log('Connecting session 3');
+ var session3 = connect(contextGroup, 3);
+ await session3.Protocol.Runtime.enable();
+
+ InspectorTest.log('Destroying and creating context');
+ await session2.Protocol.Runtime.evaluate({expression: 'inspector.fireContextDestroyed(); inspector.fireContextCreated(); '});
+
+ InspectorTest.log('Disconnecting all sessions');
+ session1.disconnect();
+ session2.disconnect();
+ session3.disconnect();
+
+ InspectorTest.log('Connecting session 4');
+ var session4 = connect(contextGroup, 4);
+ await session4.Protocol.Runtime.enable();
+
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints-expected.txt b/deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints-expected.txt
new file mode 100644
index 0000000000..73c1068eae
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints-expected.txt
@@ -0,0 +1,203 @@
+Tests how multiple sessions interact while pausing, stepping, setting breakpoints and blackboxing.
+Setting breakpoints in 1
+Setting breakpoints in 2
+Evaluating common breakpoint in 1
+Paused in 2:
+ reason: other
+ hit breakpoints: test.js:11:0
+ location: foo@11
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints: test.js:11:0
+ location: foo@11
+ data: null
+Resuming in 1
+Resumed in 2
+Resumed in 1
+Evaluating debugger in 1
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: bar@25
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: bar@25
+ data: null
+Resuming in 2
+Resumed in 2
+Resumed in 1
+Evaluating exclusive breakpoint in 1
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: baz@14
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints: test.js:14:0
+ location: baz@14
+ data: null
+Resuming in 1
+Resumed in 2
+Resumed in 1
+Evaluating common breakpoint in 2
+Paused in 2:
+ reason: other
+ hit breakpoints: test.js:11:0
+ location: foo@11
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints: test.js:11:0
+ location: foo@11
+ data: null
+Resuming in 2
+Resumed in 2
+Resumed in 1
+Evaluating debugger in 2
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: bar@25
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: bar@25
+ data: null
+Resuming in 2
+Resumed in 2
+Resumed in 1
+Evaluating exclusive breakpoint in 2
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: baz@14
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints: test.js:14:0
+ location: baz@14
+ data: null
+Resuming in 1
+Resumed in 2
+Resumed in 1
+Evaluating stepping in 1
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: stepping@17
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: stepping@17
+ data: null
+Stepping into in 2
+Resumed in 2
+Resumed in 1
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: stepping@18
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: stepping@18
+ data: null
+Stepping over in 1
+Resumed in 2
+Resumed in 1
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: stepping@19
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: stepping@19
+ data: null
+Stepping out in 2
+Resumed in 2
+Resumed in 1
+Paused in 2:
+ reason: other
+ hit breakpoints:
+ location: <anonymous>@0
+ data: null
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: <anonymous>@0
+ data: null
+Resuming in 1
+Resumed in 2
+Resumed in 1
+Pausing in next statement
+Paused in 2:
+ reason: some-reason
+ hit breakpoints:
+ location: <anonymous>@0
+ data: {"a":42}
+Paused in 1:
+ reason: some-reason
+ hit breakpoints:
+ location: <anonymous>@0
+ data: {"a":42}
+Resuming in 1
+Resumed in 2
+Resumed in 1
+Pausing in next statement
+Paused in 2:
+ reason: some-reason
+ hit breakpoints:
+ location: <anonymous>@0
+ data: {"a":42}
+Paused in 1:
+ reason: some-reason
+ hit breakpoints:
+ location: <anonymous>@0
+ data: {"a":42}
+Resuming in 2
+Resumed in 2
+Resumed in 1
+Blackboxing bar() in 2
+Evaluating bar() in 2
+Paused in 1:
+ reason: other
+ hit breakpoints:
+ location: bar@25
+ data: null
+Resuming in 1
+Resumed in 1
+Blackboxing bar() in 1
+Evaluating bar() in 2
+Skipping pauses in 1
+Evaluating common breakpoint in 1
+Paused in 2:
+ reason: other
+ hit breakpoints: test.js:11:0
+ location: foo@11
+ data: null
+Resuming in 2
+Resumed in 2
+Skipping pauses in 2
+Evaluating common breakpoint in 1
+Unskipping pauses in 1
+Unskipping pauses in 2
+Deactivating breakpoints in 1
+Evaluating common breakpoint in 1
+Paused in 2:
+ reason: other
+ hit breakpoints: test.js:11:0
+ location: foo@11
+ data: null
+Resuming in 2
+Resumed in 2
+Deactivating breakpoints in 2
+Evaluating common breakpoint in 1
diff --git a/deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints.js b/deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints.js
new file mode 100644
index 0000000000..8ecf8076e8
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/debugger-stepping-and-breakpoints.js
@@ -0,0 +1,191 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests how multiple sessions interact while pausing, stepping, setting breakpoints and blackboxing.');
+
+var contextGroup = new InspectorTest.ContextGroup();
+
+contextGroup.addScript(`
+function foo() {
+ return 1;
+}
+function baz() {
+ return 2;
+}
+function stepping() {
+ debugger;
+ var a = 1;
+ var b = 1;
+}
+//# sourceURL=test.js`, 9, 25);
+
+contextGroup.addScript(`
+function bar() {
+ debugger;
+}
+//# sourceURL=test2.js`, 23, 25);
+
+(async function test() {
+ var session1 = contextGroup.connect();
+ await session1.Protocol.Debugger.enable();
+ var session2 = contextGroup.connect();
+ await session2.Protocol.Debugger.enable();
+
+ InspectorTest.log('Setting breakpoints in 1');
+ await session1.Protocol.Debugger.setBreakpointByUrl({url: 'test.js', lineNumber: 11});
+ await session1.Protocol.Debugger.setBreakpointByUrl({url: 'test.js', lineNumber: 14});
+ InspectorTest.log('Setting breakpoints in 2');
+ await session2.Protocol.Debugger.setBreakpointByUrl({url: 'test.js', lineNumber: 11});
+
+ InspectorTest.log('Evaluating common breakpoint in 1');
+ session1.Protocol.Runtime.evaluate({expression: 'foo();'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 1');
+ session1.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Evaluating debugger in 1');
+ session1.Protocol.Runtime.evaluate({expression: 'bar();'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 2');
+ session2.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Evaluating exclusive breakpoint in 1');
+ session1.Protocol.Runtime.evaluate({expression: 'baz();'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 1');
+ session1.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Evaluating common breakpoint in 2');
+ session2.Protocol.Runtime.evaluate({expression: 'foo();'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 2');
+ session2.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Evaluating debugger in 2');
+ session2.Protocol.Runtime.evaluate({expression: 'bar();'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 2');
+ session2.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Evaluating exclusive breakpoint in 2');
+ session2.Protocol.Runtime.evaluate({expression: 'baz();'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 1');
+ session1.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Evaluating stepping in 1');
+ session1.Protocol.Runtime.evaluate({expression: 'stepping();'});
+ await waitForBothPaused();
+ InspectorTest.log('Stepping into in 2');
+ session2.Protocol.Debugger.stepInto();
+ await waitForBothResumed();
+ await waitForBothPaused();
+ InspectorTest.log('Stepping over in 1');
+ session1.Protocol.Debugger.stepOver();
+ await waitForBothResumed();
+ await waitForBothPaused();
+ InspectorTest.log('Stepping out in 2');
+ session2.Protocol.Debugger.stepOut();
+ await waitForBothResumed();
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 1');
+ session1.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Pausing in next statement');
+ contextGroup.schedulePauseOnNextStatement('some-reason', JSON.stringify({a: 42}));
+ session2.Protocol.Runtime.evaluate({expression: 'var a = 1;'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 1');
+ session1.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Pausing in next statement');
+ contextGroup.schedulePauseOnNextStatement('some-reason', JSON.stringify({a: 42}));
+ session2.Protocol.Runtime.evaluate({expression: 'var a = 1;'});
+ await waitForBothPaused();
+ InspectorTest.log('Resuming in 2');
+ session2.Protocol.Debugger.resume();
+ await waitForBothResumed();
+
+ InspectorTest.log('Blackboxing bar() in 2');
+ await session2.Protocol.Debugger.setBlackboxPatterns({patterns: ['test2.js']});
+ InspectorTest.log('Evaluating bar() in 2');
+ session2.Protocol.Runtime.evaluate({expression: 'bar();'});
+ await waitForPaused(session1, 1);
+ InspectorTest.log('Resuming in 1');
+ session1.Protocol.Debugger.resume();
+ await waitForResumed(session1, 1);
+
+ InspectorTest.log('Blackboxing bar() in 1');
+ await session1.Protocol.Debugger.setBlackboxPatterns({patterns: ['test2.js']});
+ InspectorTest.log('Evaluating bar() in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'bar();'});
+
+ InspectorTest.log('Skipping pauses in 1');
+ await session1.Protocol.Debugger.setSkipAllPauses({skip: true});
+ InspectorTest.log('Evaluating common breakpoint in 1');
+ session1.Protocol.Runtime.evaluate({expression: 'foo();'});
+ await waitForPaused(session2, 2);
+ InspectorTest.log('Resuming in 2');
+ session2.Protocol.Debugger.resume();
+ await waitForResumed(session2, 2);
+
+ InspectorTest.log('Skipping pauses in 2');
+ await session2.Protocol.Debugger.setSkipAllPauses({skip: true});
+ InspectorTest.log('Evaluating common breakpoint in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'foo();'});
+
+ InspectorTest.log('Unskipping pauses in 1');
+ await session1.Protocol.Debugger.setSkipAllPauses({skip: false});
+ InspectorTest.log('Unskipping pauses in 2');
+ await session2.Protocol.Debugger.setSkipAllPauses({skip: false});
+
+ InspectorTest.log('Deactivating breakpoints in 1');
+ await session1.Protocol.Debugger.setBreakpointsActive({active: false});
+ InspectorTest.log('Evaluating common breakpoint in 1');
+ session1.Protocol.Runtime.evaluate({expression: 'foo();'});
+ await waitForPaused(session2, 2);
+ InspectorTest.log('Resuming in 2');
+ session2.Protocol.Debugger.resume();
+ await waitForResumed(session2, 2);
+
+ InspectorTest.log('Deactivating breakpoints in 2');
+ await session2.Protocol.Debugger.setBreakpointsActive({active: false});
+ InspectorTest.log('Evaluating common breakpoint in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'foo();'});
+
+ InspectorTest.completeTest();
+
+ function waitForBothPaused() {
+ return Promise.all([waitForPaused(session1, 1), waitForPaused(session2, 2)]);
+ }
+
+ function waitForBothResumed() {
+ return Promise.all([waitForResumed(session1, 1), waitForResumed(session2, 2)]);
+ }
+})();
+
+function waitForPaused(session, num) {
+ return session.Protocol.Debugger.oncePaused().then(message => {
+ InspectorTest.log(`Paused in ${num}:`);
+ InspectorTest.log(` reason: ${message.params.reason}`);
+ InspectorTest.log(` hit breakpoints: ${(message.params.hitBreakpoints || []).join(';')}`);
+ var callFrame = message.params.callFrames[0];
+ InspectorTest.log(` location: ${callFrame.functionName || '<anonymous>'}@${callFrame.location.lineNumber}`);
+ InspectorTest.log(` data: ${JSON.stringify(message.params.data || null)}`);
+ });
+}
+
+function waitForResumed(session, num) {
+ return session.Protocol.Debugger.onceResumed().then(message => {
+ InspectorTest.log(`Resumed in ${num}`);
+ });
+}
diff --git a/deps/v8/test/inspector/sessions/pause-on-console-assert-expected.txt b/deps/v8/test/inspector/sessions/pause-on-console-assert-expected.txt
new file mode 100644
index 0000000000..c8bfa3ae44
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/pause-on-console-assert-expected.txt
@@ -0,0 +1,24 @@
+Tests that multiple sessions pause once on console.assert.
+Pausing on exceptions in 1
+Asserting in 1
+Paused in 2 with reason assert
+Paused in 1 with reason assert
+Asserting in 2
+Paused in 2 with reason assert
+Paused in 1 with reason assert
+Pausing on exceptions in both
+Asserting in 1
+Paused in 2 with reason assert
+Paused in 1 with reason assert
+Asserting in 2
+Paused in 2 with reason assert
+Paused in 1 with reason assert
+Not pausing on exceptions
+Asserting in 1
+Asserting in 2
+Pausing on exceptions in 3 (different context group)
+Asserting in 3
+Paused in 3 with reason assert
+Asserting in 1
+Paused in 2 with reason assert
+Paused in 1 with reason assert
diff --git a/deps/v8/test/inspector/sessions/pause-on-console-assert.js b/deps/v8/test/inspector/sessions/pause-on-console-assert.js
new file mode 100644
index 0000000000..6cfdeafc62
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/pause-on-console-assert.js
@@ -0,0 +1,54 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that multiple sessions pause once on console.assert.');
+
+(async function test() {
+ var contextGroup1 = new InspectorTest.ContextGroup();
+ var session1 = await connect(contextGroup1, 1);
+ var session2 = await connect(contextGroup1, 2);
+ var contextGroup2 = new InspectorTest.ContextGroup();
+ var session3 = await connect(contextGroup2, 3);
+
+ InspectorTest.log('Pausing on exceptions in 1');
+ await session1.Protocol.Debugger.setPauseOnExceptions({state: 'all'});
+ InspectorTest.log('Asserting in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+ InspectorTest.log('Asserting in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+
+ InspectorTest.log('Pausing on exceptions in both');
+ await session2.Protocol.Debugger.setPauseOnExceptions({state: 'all'});
+ InspectorTest.log('Asserting in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+ InspectorTest.log('Asserting in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+
+ InspectorTest.log('Not pausing on exceptions');
+ await session1.Protocol.Debugger.setPauseOnExceptions({state: 'none'});
+ await session2.Protocol.Debugger.setPauseOnExceptions({state: 'none'});
+ InspectorTest.log('Asserting in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+ InspectorTest.log('Asserting in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+
+ InspectorTest.log('Pausing on exceptions in 3 (different context group)');
+ await session3.Protocol.Debugger.setPauseOnExceptions({state: 'all'});
+ InspectorTest.log('Asserting in 3');
+ await session3.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+ InspectorTest.log('Asserting in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'});
+
+ InspectorTest.completeTest();
+})();
+
+async function connect(contextGroup, num) {
+ var session = contextGroup.connect();
+ await session.Protocol.Debugger.enable();
+ session.Protocol.Debugger.onPaused(message => {
+ InspectorTest.log(`Paused in ${num} with reason ${message.params.reason}`);
+ session.Protocol.Debugger.resume();
+ });
+ return session;
+}
diff --git a/deps/v8/test/inspector/sessions/runtime-command-line-api-expected.txt b/deps/v8/test/inspector/sessions/runtime-command-line-api-expected.txt
new file mode 100644
index 0000000000..98583a530f
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-command-line-api-expected.txt
@@ -0,0 +1,211 @@
+Tests that multiple sessions do not share command line api.
+Setting $0 in 1
+Evaluating $0 in 1
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Evaluating $0 in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : undefined
+ }
+ }
+}
+Setting $0 in 2
+Evaluating $0 in 1
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Evaluating $0 in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Setting $_ in 1
+Evaluating $_ in 1
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Evaluating $_ in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : undefined
+ }
+ }
+}
+Setting $_ in 2
+Evaluating $_ in 1
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Evaluating $_ in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Inspecting in 1
+inspectRequested from 1
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Inspecting in 1 through variable
+inspectRequested from 1
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Inspecting in 2
+inspectRequested from 2
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Inspecting in 2 through variable
+inspectRequested from 2
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Inspecting in 2 through variable from 1
+inspectRequested from 1
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Disconnecting 1
+Evaluating $0 in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Evaluating $_ in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Inspecting in 2
+inspectRequested from 2
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
+Inspecting in 2 through variable from 1
+Inspecting in 2 through variable
+inspectRequested from 2
+{
+ method : Runtime.inspectRequested
+ params : {
+ hints : {
+ }
+ object : {
+ description : 17
+ type : number
+ value : 17
+ }
+ }
+}
diff --git a/deps/v8/test/inspector/sessions/runtime-command-line-api.js b/deps/v8/test/inspector/sessions/runtime-command-line-api.js
new file mode 100644
index 0000000000..078783ac65
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-command-line-api.js
@@ -0,0 +1,76 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that multiple sessions do not share command line api.');
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ var session1 = contextGroup.connect();
+ await session1.Protocol.Runtime.enable();
+ session1.Protocol.Runtime.onInspectRequested(message => {
+ InspectorTest.log('inspectRequested from 1');
+ InspectorTest.logMessage(message);
+ });
+ var session2 = contextGroup.connect();
+ await session2.Protocol.Runtime.enable();
+ session2.Protocol.Runtime.onInspectRequested(message => {
+ InspectorTest.log('inspectRequested from 2');
+ InspectorTest.logMessage(message);
+ });
+
+ InspectorTest.log('Setting $0 in 1');
+ await session1.addInspectedObject(42);
+ InspectorTest.log('Evaluating $0 in 1');
+ InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
+ InspectorTest.log('Evaluating $0 in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
+
+ InspectorTest.log('Setting $0 in 2');
+ await session2.addInspectedObject(17);
+ InspectorTest.log('Evaluating $0 in 1');
+ InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
+ InspectorTest.log('Evaluating $0 in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
+
+ InspectorTest.log('Setting $_ in 1');
+ await session1.Protocol.Runtime.evaluate({expression: '42', objectGroup: 'console', includeCommandLineAPI: true});
+ InspectorTest.log('Evaluating $_ in 1');
+ InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
+ InspectorTest.log('Evaluating $_ in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
+
+ InspectorTest.log('Setting $_ in 2');
+ await session2.Protocol.Runtime.evaluate({expression: '17', objectGroup: 'console', includeCommandLineAPI: true});
+ InspectorTest.log('Evaluating $_ in 1');
+ InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
+ InspectorTest.log('Evaluating $_ in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
+
+ InspectorTest.log('Inspecting in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'var inspect1=inspect; inspect(42)', includeCommandLineAPI: true});
+ InspectorTest.log('Inspecting in 1 through variable');
+ await session1.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeCommandLineAPI: true});
+ InspectorTest.log('Inspecting in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'var inspect2=inspect; inspect(17)', includeCommandLineAPI: true});
+ InspectorTest.log('Inspecting in 2 through variable');
+ await session2.Protocol.Runtime.evaluate({expression: 'inspect2(17)', includeCommandLineAPI: true});
+ InspectorTest.log('Inspecting in 2 through variable from 1');
+ await session2.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeCommandLineAPI: true});
+
+ InspectorTest.log('Disconnecting 1');
+ session1.disconnect();
+
+ InspectorTest.log('Evaluating $0 in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
+ InspectorTest.log('Evaluating $_ in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
+ InspectorTest.log('Inspecting in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'inspect(17)', includeCommandLineAPI: true});
+ InspectorTest.log('Inspecting in 2 through variable from 1');
+ await session2.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeCommandLineAPI: true});
+ InspectorTest.log('Inspecting in 2 through variable');
+ await session2.Protocol.Runtime.evaluate({expression: 'inspect2(17)', includeCommandLineAPI: true});
+
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/sessions/runtime-console-api-called-expected.txt b/deps/v8/test/inspector/sessions/runtime-console-api-called-expected.txt
new file mode 100644
index 0000000000..4f4752b052
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-console-api-called-expected.txt
@@ -0,0 +1,217 @@
+Tests that all sessions get console api notifications.
+Error in 2
+From session 2
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ description : 1
+ type : number
+ value : 1
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 8
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : error
+ }
+}
+From session 1
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ description : 1
+ type : number
+ value : 1
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 8
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : error
+ }
+}
+Logging in 1
+From session 2
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ description : 2
+ type : number
+ value : 2
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 8
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : log
+ }
+}
+From session 1
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ description : 2
+ type : number
+ value : 2
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 8
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : log
+ }
+}
+Error in setTimeout 1
+From session 2
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : a
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 25
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : error
+ }
+}
+From session 1
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : a
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 25
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : error
+ }
+}
+Logging in setTimeout 2
+From session 2
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : b
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 25
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : log
+ }
+}
+From session 1
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ type : string
+ value : b
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 25
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : log
+ }
+}
diff --git a/deps/v8/test/inspector/sessions/runtime-console-api-called.js b/deps/v8/test/inspector/sessions/runtime-console-api-called.js
new file mode 100644
index 0000000000..fc9d79beba
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-console-api-called.js
@@ -0,0 +1,38 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that all sessions get console api notifications.');
+
+function connect(contextGroup, num) {
+ var session = contextGroup.connect();
+ session.Protocol.Runtime.onConsoleAPICalled(message => {
+ InspectorTest.log('From session ' + num);
+ InspectorTest.logMessage(message);
+ });
+ return session;
+}
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ var session1 = connect(contextGroup, 1);
+ var session2 = connect(contextGroup, 2);
+ await session1.Protocol.Runtime.enable();
+ await session2.Protocol.Runtime.enable();
+
+ InspectorTest.log('Error in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'console.error(1)'});
+
+ InspectorTest.log('Logging in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'console.log(2)'});
+
+ InspectorTest.log('Error in setTimeout 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => console.error("a"), 0)'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.log('Logging in setTimeout 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => console.log("b"), 0)'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/sessions/runtime-evaluate-exception-expected.txt b/deps/v8/test/inspector/sessions/runtime-evaluate-exception-expected.txt
new file mode 100644
index 0000000000..616456eec5
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-evaluate-exception-expected.txt
@@ -0,0 +1,277 @@
+Tests that all sessions get exception notifications.
+Throwing in 2
+Throwing in 1
+Throwing in setTimeout 1
+From session 2
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 19
+ exception : {
+ type : string
+ value : error3
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 19
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error3
+ }
+ timestamp : <timestamp>
+ }
+}
+From session 1
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 19
+ exception : {
+ type : string
+ value : error3
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 19
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error3
+ }
+ timestamp : <timestamp>
+ }
+}
+Throwing in setTimeout 2
+From session 2
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 19
+ exception : {
+ type : string
+ value : error4
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 19
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error4
+ }
+ timestamp : <timestamp>
+ }
+}
+From session 1
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 19
+ exception : {
+ type : string
+ value : error4
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 19
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error4
+ }
+ timestamp : <timestamp>
+ }
+}
+Rejecting in 2
+From session 2
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 40
+ exception : {
+ type : string
+ value : error5
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 40
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error5
+ }
+ timestamp : <timestamp>
+ }
+}
+From session 1
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 40
+ exception : {
+ type : string
+ value : error5
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 40
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error5
+ }
+ timestamp : <timestamp>
+ }
+}
+Revoking in 2
+From session 2
+{
+ method : Runtime.exceptionRevoked
+ params : {
+ exceptionId : <exceptionId>
+ reason : Handler added to rejected promise
+ }
+}
+id matching: true
+From session 1
+{
+ method : Runtime.exceptionRevoked
+ params : {
+ exceptionId : <exceptionId>
+ reason : Handler added to rejected promise
+ }
+}
+id matching: true
+Rejecting in 1
+From session 2
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 40
+ exception : {
+ type : string
+ value : error6
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 40
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error6
+ }
+ timestamp : <timestamp>
+ }
+}
+From session 1
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 40
+ exception : {
+ type : string
+ value : error6
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 0
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 40
+ functionName : setTimeout
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ text : Uncaught error6
+ }
+ timestamp : <timestamp>
+ }
+}
+Revoking in 1
+From session 2
+{
+ method : Runtime.exceptionRevoked
+ params : {
+ exceptionId : <exceptionId>
+ reason : Handler added to rejected promise
+ }
+}
+id matching: true
+From session 1
+{
+ method : Runtime.exceptionRevoked
+ params : {
+ exceptionId : <exceptionId>
+ reason : Handler added to rejected promise
+ }
+}
+id matching: true
diff --git a/deps/v8/test/inspector/sessions/runtime-evaluate-exception.js b/deps/v8/test/inspector/sessions/runtime-evaluate-exception.js
new file mode 100644
index 0000000000..8f3520fe18
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-evaluate-exception.js
@@ -0,0 +1,59 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that all sessions get exception notifications.');
+
+function connect(contextGroup, num) {
+ var session = contextGroup.connect();
+ var exceptionId;
+ session.Protocol.Runtime.onExceptionThrown(message => {
+ InspectorTest.log('From session ' + num);
+ InspectorTest.logMessage(message);
+ exceptionId = message.params.exceptionDetails.exceptionId;
+ });
+ session.Protocol.Runtime.onExceptionRevoked(message => {
+ InspectorTest.log('From session ' + num);
+ InspectorTest.logMessage(message);
+ InspectorTest.log('id matching: ' + (message.params.exceptionId === exceptionId));
+ });
+ return session;
+}
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ var session1 = connect(contextGroup, 1);
+ var session2 = connect(contextGroup, 2);
+ await session1.Protocol.Runtime.enable();
+ await session2.Protocol.Runtime.enable();
+
+ InspectorTest.log('Throwing in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'throw "error1";'});
+
+ InspectorTest.log('Throwing in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'throw "error2";'});
+
+ InspectorTest.log('Throwing in setTimeout 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { throw "error3"; }, 0)'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.log('Throwing in setTimeout 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { throw "error4"; }, 0)'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.log('Rejecting in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'var p2; setTimeout(() => { p2 = Promise.reject("error5") }, 0)'});
+ await InspectorTest.waitForPendingTasks();
+ InspectorTest.log('Revoking in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p2.catch() }, 0);'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.log('Rejecting in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'var p1; setTimeout(() => { p1 = Promise.reject("error6")} , 0)'});
+ await InspectorTest.waitForPendingTasks();
+ InspectorTest.log('Revoking in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { p1.catch() }, 0);'});
+ await InspectorTest.waitForPendingTasks();
+
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/sessions/runtime-evaluate-expected.txt b/deps/v8/test/inspector/sessions/runtime-evaluate-expected.txt
new file mode 100644
index 0000000000..f201ff6dde
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-evaluate-expected.txt
@@ -0,0 +1,25 @@
+Tests that multiple sessions share the context.
+Assigning in 1
+Evaluating in 2
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 42
+ type : number
+ value : 42
+ }
+ }
+}
+Awaiting in 1
+Resolving in 2
+Should resolve in 1
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : string
+ value : foo
+ }
+ }
+}
diff --git a/deps/v8/test/inspector/sessions/runtime-evaluate.js b/deps/v8/test/inspector/sessions/runtime-evaluate.js
new file mode 100644
index 0000000000..72ca178535
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-evaluate.js
@@ -0,0 +1,25 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that multiple sessions share the context.');
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ var session1 = contextGroup.connect();
+ var session2 = contextGroup.connect();
+
+ InspectorTest.log('Assigning in 1');
+ await session1.Protocol.Runtime.evaluate({expression: 'var a = 42;'});
+ InspectorTest.log('Evaluating in 2');
+ InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: 'a'}));
+
+ InspectorTest.log('Awaiting in 1');
+ var promise = session1.Protocol.Runtime.evaluate({expression: 'var cb; new Promise(f => cb = f)', awaitPromise: true});
+ InspectorTest.log('Resolving in 2');
+ await session2.Protocol.Runtime.evaluate({expression: 'cb("foo")'});
+ InspectorTest.log('Should resolve in 1');
+ InspectorTest.logMessage(await promise);
+
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt b/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt
new file mode 100644
index 0000000000..a8d0ec0c20
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-remote-object-expected.txt
@@ -0,0 +1,103 @@
+Tests that multiple sessions do not interfere with each other's remote objects.
+Evaluating in 1
+Evaluating in 2
+Retrieving properties in 2
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : a
+ value : {
+ description : 17
+ type : number
+ value : 17
+ }
+ writable : true
+ }
+ [1] : {
+ configurable : true
+ enumerable : false
+ isOwn : true
+ name : __proto__
+ value : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ writable : true
+ }
+ ]
+ }
+}
+Retrieving properties in 1
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : a
+ value : {
+ description : 42
+ type : number
+ value : 42
+ }
+ writable : true
+ }
+ [1] : {
+ configurable : true
+ enumerable : false
+ isOwn : true
+ name : __proto__
+ value : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ writable : true
+ }
+ ]
+ }
+}
+Disconnecting 2
+Retrieving properties in 1
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : a
+ value : {
+ description : 42
+ type : number
+ value : 42
+ }
+ writable : true
+ }
+ [1] : {
+ configurable : true
+ enumerable : false
+ isOwn : true
+ name : __proto__
+ value : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ writable : true
+ }
+ ]
+ }
+}
diff --git a/deps/v8/test/inspector/sessions/runtime-remote-object.js b/deps/v8/test/inspector/sessions/runtime-remote-object.js
new file mode 100644
index 0000000000..aaaccb41ba
--- /dev/null
+++ b/deps/v8/test/inspector/sessions/runtime-remote-object.js
@@ -0,0 +1,30 @@
+// Copyright 2017 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+InspectorTest.log('Tests that multiple sessions do not interfere with each other\'s remote objects.');
+
+(async function test() {
+ var contextGroup = new InspectorTest.ContextGroup();
+ var session1 = contextGroup.connect();
+ var session2 = contextGroup.connect();
+
+ InspectorTest.log('Evaluating in 1');
+ var result1 = await session1.Protocol.Runtime.evaluate({expression: '({a: 42})'});
+ InspectorTest.log('Evaluating in 2');
+ var result2 = await session2.Protocol.Runtime.evaluate({expression: '({a: 17})'});
+
+ await print(2, session2, result2);
+ await print(1, session1, result1);
+ InspectorTest.log('Disconnecting 2');
+ session2.disconnect();
+ await print(1, session1, result1);
+
+ InspectorTest.completeTest();
+})();
+
+async function print(num, session, message) {
+ InspectorTest.log('Retrieving properties in ' + num);
+ var objectId = message.result.result.objectId;
+ InspectorTest.logMessage(await session.Protocol.Runtime.getProperties({objectId, ownProperties: true}));
+}
diff --git a/deps/v8/test/inspector/task-runner.cc b/deps/v8/test/inspector/task-runner.cc
index 79ccc8a8ec..4035e1d0b9 100644
--- a/deps/v8/test/inspector/task-runner.cc
+++ b/deps/v8/test/inspector/task-runner.cc
@@ -4,8 +4,6 @@
#include "test/inspector/task-runner.h"
-#include "test/inspector/inspector-impl.h"
-
#if !defined(_WIN32) && !defined(_WIN64)
#include <unistd.h> // NOLINT
#endif // !defined(_WIN32) && !defined(_WIN64)
@@ -28,24 +26,16 @@ void ReportUncaughtException(v8::Isolate* isolate,
source_line.data(), line);
}
-v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
- v8::internal::Vector<uint16_t> buffer =
- v8::internal::Vector<uint16_t>::New(str->Length());
- str->Write(buffer.start(), 0, str->Length());
- return buffer;
-}
-
} // namespace
TaskRunner::TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks,
bool catch_exceptions,
v8::base::Semaphore* ready_semaphore,
- v8::StartupData* startup_data,
- InspectorClientImpl::FrontendChannel* channel)
+ v8::StartupData* startup_data, bool with_inspector)
: Thread(Options("Task Runner")),
setup_global_tasks_(std::move(setup_global_tasks)),
startup_data_(startup_data),
- channel_(channel),
+ with_inspector_(with_inspector),
catch_exceptions_(catch_exceptions),
ready_semaphore_(ready_semaphore),
data_(nullptr),
@@ -58,7 +48,7 @@ TaskRunner::~TaskRunner() { Join(); }
void TaskRunner::Run() {
data_.reset(new IsolateData(this, std::move(setup_global_tasks_),
- startup_data_, channel_));
+ startup_data_, with_inspector_));
if (ready_semaphore_) ready_semaphore_->Signal();
RunMessageLoop(false);
}
@@ -71,7 +61,7 @@ void TaskRunner::RunMessageLoop(bool only_protocol) {
v8::Isolate::Scope isolate_scope(isolate());
if (catch_exceptions_) {
v8::TryCatch try_catch(isolate());
- task->RunOnIsolate(data_.get());
+ task->Run(data_.get());
delete task;
if (try_catch.HasCaught()) {
ReportUncaughtException(isolate(), try_catch);
@@ -80,7 +70,7 @@ void TaskRunner::RunMessageLoop(bool only_protocol) {
_exit(0);
}
} else {
- task->RunOnIsolate(data_.get());
+ task->Run(data_.get());
delete task;
}
}
@@ -107,7 +97,7 @@ TaskRunner::Task* TaskRunner::GetNext(bool only_protocol) {
if (only_protocol) {
Task* task = nullptr;
if (queue_.Dequeue(&task)) {
- if (task->is_inspector_task()) return task;
+ if (task->is_priority_task()) return task;
deffered_queue_.Enqueue(task);
}
} else {
@@ -119,86 +109,3 @@ TaskRunner::Task* TaskRunner::GetNext(bool only_protocol) {
}
return nullptr;
}
-
-AsyncTask::AsyncTask(IsolateData* data, const char* task_name)
- : instrumenting_(data && task_name) {
- if (!instrumenting_) return;
- data->inspector()->inspector()->asyncTaskScheduled(
- v8_inspector::StringView(reinterpret_cast<const uint8_t*>(task_name),
- strlen(task_name)),
- this, false);
-}
-
-void AsyncTask::Run() {
- if (instrumenting_) data()->inspector()->inspector()->asyncTaskStarted(this);
- AsyncRun();
- if (instrumenting_) data()->inspector()->inspector()->asyncTaskFinished(this);
-}
-
-ExecuteStringTask::ExecuteStringTask(
- IsolateData* data, int context_group_id, const char* task_name,
- const v8::internal::Vector<uint16_t>& expression,
- v8::Local<v8::String> name, v8::Local<v8::Integer> line_offset,
- v8::Local<v8::Integer> column_offset, v8::Local<v8::Boolean> is_module)
- : AsyncTask(data, task_name),
- expression_(expression),
- name_(ToVector(name)),
- line_offset_(line_offset.As<v8::Int32>()->Value()),
- column_offset_(column_offset.As<v8::Int32>()->Value()),
- is_module_(is_module->Value()),
- context_group_id_(context_group_id) {}
-
-ExecuteStringTask::ExecuteStringTask(
- const v8::internal::Vector<const char>& expression, int context_group_id)
- : AsyncTask(nullptr, nullptr),
- expression_utf8_(expression),
- context_group_id_(context_group_id) {}
-
-void ExecuteStringTask::AsyncRun() {
- v8::MicrotasksScope microtasks_scope(isolate(),
- v8::MicrotasksScope::kRunMicrotasks);
- v8::HandleScope handle_scope(isolate());
- v8::Local<v8::Context> context = data()->GetContext(context_group_id_);
- v8::Context::Scope context_scope(context);
-
- v8::Local<v8::String> name =
- v8::String::NewFromTwoByte(isolate(), name_.start(),
- v8::NewStringType::kNormal, name_.length())
- .ToLocalChecked();
- v8::Local<v8::Integer> line_offset =
- v8::Integer::New(isolate(), line_offset_);
- v8::Local<v8::Integer> column_offset =
- v8::Integer::New(isolate(), column_offset_);
-
- v8::ScriptOrigin origin(
- name, line_offset, column_offset,
- /* resource_is_shared_cross_origin */ v8::Local<v8::Boolean>(),
- /* script_id */ v8::Local<v8::Integer>(),
- /* source_map_url */ v8::Local<v8::Value>(),
- /* resource_is_opaque */ v8::Local<v8::Boolean>(),
- /* is_wasm */ v8::Local<v8::Boolean>(),
- v8::Boolean::New(isolate(), is_module_));
- v8::Local<v8::String> source;
- if (expression_.length()) {
- source = v8::String::NewFromTwoByte(isolate(), expression_.start(),
- v8::NewStringType::kNormal,
- expression_.length())
- .ToLocalChecked();
- } else {
- source = v8::String::NewFromUtf8(isolate(), expression_utf8_.start(),
- v8::NewStringType::kNormal,
- expression_utf8_.length())
- .ToLocalChecked();
- }
-
- v8::ScriptCompiler::Source scriptSource(source, origin);
- if (!is_module_) {
- v8::Local<v8::Script> script;
- if (!v8::ScriptCompiler::Compile(context, &scriptSource).ToLocal(&script))
- return;
- v8::MaybeLocal<v8::Value> result;
- result = script->Run(context);
- } else {
- data()->RegisterModule(context, name_, &scriptSource);
- }
-}
diff --git a/deps/v8/test/inspector/task-runner.h b/deps/v8/test/inspector/task-runner.h
index c99bc6c95a..353c78326d 100644
--- a/deps/v8/test/inspector/task-runner.h
+++ b/deps/v8/test/inspector/task-runner.h
@@ -22,26 +22,13 @@ class TaskRunner : public v8::base::Thread {
class Task {
public:
virtual ~Task() {}
- virtual bool is_inspector_task() = 0;
- void RunOnIsolate(IsolateData* data) {
- data_ = data;
- Run();
- data_ = nullptr;
- }
-
- protected:
- virtual void Run() = 0;
- v8::Isolate* isolate() const { return data_->isolate(); }
- IsolateData* data() const { return data_; }
-
- private:
- IsolateData* data_ = nullptr;
+ virtual bool is_priority_task() = 0;
+ virtual void Run(IsolateData* data) = 0;
};
TaskRunner(IsolateData::SetupGlobalTasks setup_global_tasks,
bool catch_exceptions, v8::base::Semaphore* ready_semaphore,
- v8::StartupData* startup_data,
- InspectorClientImpl::FrontendChannel* channel);
+ v8::StartupData* startup_data, bool with_inspector);
virtual ~TaskRunner();
IsolateData* data() const { return data_.get(); }
@@ -63,7 +50,7 @@ class TaskRunner : public v8::base::Thread {
IsolateData::SetupGlobalTasks setup_global_tasks_;
v8::StartupData* startup_data_;
- InspectorClientImpl::FrontendChannel* channel_;
+ bool with_inspector_;
bool catch_exceptions_;
v8::base::Semaphore* ready_semaphore_;
std::unique_ptr<IsolateData> data_;
@@ -82,43 +69,4 @@ class TaskRunner : public v8::base::Thread {
DISALLOW_COPY_AND_ASSIGN(TaskRunner);
};
-class AsyncTask : public TaskRunner::Task {
- public:
- AsyncTask(IsolateData* data, const char* task_name);
- virtual ~AsyncTask() = default;
-
- protected:
- virtual void AsyncRun() = 0;
- void Run() override;
-
- bool instrumenting_;
-};
-
-class ExecuteStringTask : public AsyncTask {
- public:
- ExecuteStringTask(IsolateData* data, int context_group_id,
- const char* task_name,
- const v8::internal::Vector<uint16_t>& expression,
- v8::Local<v8::String> name,
- v8::Local<v8::Integer> line_offset,
- v8::Local<v8::Integer> column_offset,
- v8::Local<v8::Boolean> is_module);
- ExecuteStringTask(const v8::internal::Vector<const char>& expression,
- int context_group_id);
- bool is_inspector_task() override { return false; }
-
- private:
- void AsyncRun() override;
-
- v8::internal::Vector<uint16_t> expression_;
- v8::internal::Vector<const char> expression_utf8_;
- v8::internal::Vector<uint16_t> name_;
- int32_t line_offset_ = 0;
- int32_t column_offset_ = 0;
- bool is_module_ = false;
- int context_group_id_;
-
- DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask);
-};
-
#endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_