From 0a66b223e149a841669bfad5598e4254589730cb Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Tue, 1 Aug 2017 11:36:44 -0500 Subject: deps: update V8 to 6.0.286.52 PR-URL: https://github.com/nodejs/node/pull/14004 Reviewed-By: Anna Henningsen Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Colin Ihrig --- .../debugger/access-obsolete-frame-expected.txt | 3 +- .../inspector/debugger/access-obsolete-frame.js | 4 +- .../debugger/asm-js-breakpoint-before-exec.js | 4 +- .../debugger/asm-js-breakpoint-during-exec.js | 4 +- .../inspector/debugger/asm-js-stack-expected.txt | 1 + deps/v8/test/inspector/debugger/asm-js-stack.js | 4 +- .../debugger/async-console-count-doesnt-crash.js | 4 +- .../async-for-await-of-promise-stack-expected.txt | 53 ++-- .../debugger/async-for-await-of-promise-stack.js | 22 +- .../debugger/async-instrumentation-expected.txt | 4 +- .../inspector/debugger/async-instrumentation.js | 10 +- .../debugger/async-promise-late-then-expected.txt | 6 +- .../inspector/debugger/async-promise-late-then.js | 10 +- .../test/inspector/debugger/async-set-timeout.js | 10 +- .../debugger/async-stack-await-expected.txt | 15 +- .../test/inspector/debugger/async-stack-await.js | 10 +- .../async-stack-created-frame-expected.txt | 57 ++-- .../debugger/async-stack-created-frame.js | 11 +- .../debugger/async-stack-for-promise-expected.txt | 129 +++------ .../inspector/debugger/async-stack-for-promise.js | 10 +- .../debugger/async-stacks-limit-expected.txt | 140 ---------- .../test/inspector/debugger/async-stacks-limit.js | 164 ------------ .../debugger/break-on-exception-expected.txt | 2 +- .../test/inspector/debugger/break-on-exception.js | 4 +- .../call-frame-function-location-expected.txt | 1 + .../debugger/call-frame-function-location.js | 4 +- ...caught-exception-from-framework-inside-async.js | 8 +- .../debugger/caught-uncaught-exceptions.js | 4 +- .../collect-obsolete-async-tasks-expected.txt | 37 +++ .../debugger/collect-obsolete-async-tasks.js | 35 +++ .../collect-old-async-call-chains-expected.txt | 211 +++++++++++++++ .../debugger/collect-old-async-call-chains.js | 171 ++++++++++++ ...mmand-line-api-with-bound-function-expected.txt | 2 +- .../command-line-api-with-bound-function.js | 4 +- .../debugger/continue-to-location-expected.txt | 2 +- ...nue-to-location-target-call-frames-expected.txt | 81 ++++++ .../continue-to-location-target-call-frames.js | 139 ++++++++++ .../inspector/debugger/continue-to-location.js | 4 +- .../debugger/destory-in-break-program-expected.txt | 1 + .../inspector/debugger/destory-in-break-program.js | 13 + .../debugger/doesnt-step-into-injected-script.js | 6 +- .../inspector/debugger/es6-module-script-parsed.js | 12 +- .../debugger/es6-module-set-script-source.js | 8 +- .../inspector/debugger/eval-scopes-expected.txt | 3 +- deps/v8/test/inspector/debugger/eval-scopes.js | 4 +- .../debugger/framework-break-expected.txt | 4 +- deps/v8/test/inspector/debugger/framework-break.js | 18 +- .../framework-nested-scheduled-break-expected.txt | 18 +- .../debugger/framework-nested-scheduled-break.js | 20 +- .../inspector/debugger/framework-precise-ranges.js | 10 +- .../debugger/framework-stepping-expected.txt | 6 +- .../test/inspector/debugger/framework-stepping.js | 18 +- ...possible-breakpoints-array-literal-expected.txt | 1 + .../get-possible-breakpoints-array-literal.js | 4 +- ...et-possible-breakpoints-lazy-error-expected.txt | 26 ++ .../get-possible-breakpoints-lazy-error.js | 28 ++ .../get-possible-breakpoints-master-expected.txt | 12 +- .../debugger/get-possible-breakpoints-master.js | 4 +- ...et-possible-breakpoints-restrict-to-function.js | 8 +- .../inspector/debugger/get-possible-breakpoints.js | 4 +- .../debugger/inspector-break-api-expected.txt | 2 +- .../test/inspector/debugger/inspector-break-api.js | 18 +- .../max-async-call-chain-depth-expected.txt | 91 +++++++ .../debugger/max-async-call-chain-depth.js | 162 +++++++++++ .../debugger/object-preview-internal-properties.js | 2 +- deps/v8/test/inspector/debugger/pause-expected.txt | 3 + deps/v8/test/inspector/debugger/pause-on-oom.js | 4 +- deps/v8/test/inspector/debugger/pause.js | 128 +++++---- .../promise-chain-when-limit-hit-expected.txt | 235 ++++++++++++++++ .../debugger/promise-chain-when-limit-hit.js | 54 ++++ .../protocol-string-to-double-locale-expected.txt | 8 + .../debugger/protocol-string-to-double-locale.js | 24 ++ .../test/inspector/debugger/restore-breakpoint.js | 2 +- .../inspector/debugger/return-break-locations.js | 4 +- .../schedule-step-into-async-set-timeout.js | 8 +- .../inspector/debugger/schedule-step-into-async.js | 10 +- ...ope-skip-variables-with-empty-name-expected.txt | 3 +- .../scope-skip-variables-with-empty-name.js | 4 +- .../test/inspector/debugger/script-end-location.js | 4 +- .../inspector/debugger/script-on-after-compile.js | 2 +- .../debugger/script-parsed-for-runtime-evaluate.js | 6 +- .../debugger/script-parsed-hash-expected.txt | 3 +- .../test/inspector/debugger/script-parsed-hash.js | 2 + .../script-with-negative-offset-expected.txt | 19 ++ .../debugger/script-with-negative-offset.js | 31 +++ .../set-async-call-stack-depth-expected.txt | 37 +++ .../debugger/set-async-call-stack-depth.js | 79 ++++++ .../debugger/set-blackbox-patterns-expected.txt | 1 + .../inspector/debugger/set-blackbox-patterns.js | 10 +- .../set-breakpoint-before-enabling-expected.txt | 1 + .../debugger/set-breakpoint-before-enabling.js | 2 + .../debugger/set-script-source-exception.js | 4 +- .../debugger/set-script-source-expected.txt | 2 +- .../test/inspector/debugger/set-script-source.js | 4 +- .../side-effect-free-debug-evaluate-expected.txt | 1 + .../debugger/side-effect-free-debug-evaluate.js | 3 +- .../test/inspector/debugger/step-into-expected.txt | 45 +++- .../inspector/debugger/step-into-nested-arrow.js | 8 +- .../inspector/debugger/step-into-next-script.js | 16 +- deps/v8/test/inspector/debugger/step-into.js | 8 +- .../inspector/debugger/step-out-async-await.js | 8 +- .../debugger/step-over-another-context-group.js | 40 +-- .../step-over-caught-exception-expected.txt | 3 +- .../debugger/step-over-caught-exception.js | 4 +- .../inspector/debugger/step-snapshot-expected.txt | 35 +++ deps/v8/test/inspector/debugger/step-snapshot.js | 31 +++ ...ing-after-get-possible-breakpoints-expected.txt | 1 + .../stepping-after-get-possible-breakpoints.js | 4 +- .../stepping-and-break-program-api-expected.txt | 6 +- .../debugger/stepping-and-break-program-api.js | 10 +- .../stepping-ignores-injected-script-expected.txt | 1 + .../debugger/stepping-ignores-injected-script.js | 6 +- .../test/inspector/debugger/stepping-tail-call.js | 8 +- .../stepping-with-blackboxed-ranges-expected.txt | 2 + .../debugger/stepping-with-blackboxed-ranges.js | 8 +- ...pping-with-exposed-injected-script-expected.txt | 1 + .../stepping-with-exposed-injected-script.js | 6 +- .../stepping-with-natives-and-frameworks.js | 8 +- .../suspended-generator-scopes-expected.txt | 2 + .../debugger/suspended-generator-scopes.js | 4 +- .../debugger/update-call-frame-scopes-expected.txt | 2 +- .../inspector/debugger/update-call-frame-scopes.js | 4 +- .../wasm-get-breakable-locations-expected.txt | 1 + .../debugger/wasm-get-breakable-locations.js | 2 + .../inspector/debugger/wasm-imports-expected.txt | 1 + deps/v8/test/inspector/debugger/wasm-imports.js | 8 +- .../inspector/debugger/wasm-scripts-expected.txt | 1 + deps/v8/test/inspector/debugger/wasm-scripts.js | 7 +- .../inspector/debugger/wasm-source-expected.txt | 1 + deps/v8/test/inspector/debugger/wasm-source.js | 6 +- .../inspector/debugger/wasm-stack-expected.txt | 1 + deps/v8/test/inspector/debugger/wasm-stack.js | 4 +- .../inspector/debugger/wasm-stepping-expected.txt | 295 +++++++++++++++++++-- deps/v8/test/inspector/debugger/wasm-stepping.js | 49 +++- 134 files changed, 2409 insertions(+), 823 deletions(-) delete mode 100644 deps/v8/test/inspector/debugger/async-stacks-limit-expected.txt delete mode 100644 deps/v8/test/inspector/debugger/async-stacks-limit.js create mode 100644 deps/v8/test/inspector/debugger/collect-obsolete-async-tasks-expected.txt create mode 100644 deps/v8/test/inspector/debugger/collect-obsolete-async-tasks.js create mode 100644 deps/v8/test/inspector/debugger/collect-old-async-call-chains-expected.txt create mode 100644 deps/v8/test/inspector/debugger/collect-old-async-call-chains.js create mode 100644 deps/v8/test/inspector/debugger/continue-to-location-target-call-frames-expected.txt create mode 100644 deps/v8/test/inspector/debugger/continue-to-location-target-call-frames.js create mode 100644 deps/v8/test/inspector/debugger/destory-in-break-program-expected.txt create mode 100644 deps/v8/test/inspector/debugger/destory-in-break-program.js create mode 100644 deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt create mode 100644 deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error.js create mode 100644 deps/v8/test/inspector/debugger/max-async-call-chain-depth-expected.txt create mode 100644 deps/v8/test/inspector/debugger/max-async-call-chain-depth.js create mode 100644 deps/v8/test/inspector/debugger/promise-chain-when-limit-hit-expected.txt create mode 100644 deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js create mode 100644 deps/v8/test/inspector/debugger/protocol-string-to-double-locale-expected.txt create mode 100644 deps/v8/test/inspector/debugger/protocol-string-to-double-locale.js create mode 100644 deps/v8/test/inspector/debugger/script-with-negative-offset-expected.txt create mode 100644 deps/v8/test/inspector/debugger/script-with-negative-offset.js create mode 100644 deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt create mode 100644 deps/v8/test/inspector/debugger/set-async-call-stack-depth.js create mode 100644 deps/v8/test/inspector/debugger/step-snapshot-expected.txt create mode 100644 deps/v8/test/inspector/debugger/step-snapshot.js (limited to 'deps/v8/test/inspector/debugger') diff --git a/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt b/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt index 643d382f24..7093d76c2e 100644 --- a/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt +++ b/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt @@ -1,3 +1,4 @@ +Tests that accessing no longer valid call frames returns an error Paused on 'debugger;' resume restartFrame @@ -5,4 +6,4 @@ PASS, error message as expected evaluateOnFrame PASS, error message as expected setVariableValue -PASS, error message as expected \ No newline at end of file +PASS, error message as expected diff --git a/deps/v8/test/inspector/debugger/access-obsolete-frame.js b/deps/v8/test/inspector/debugger/access-obsolete-frame.js index b5a96e1c3c..9d498e041d 100644 --- a/deps/v8/test/inspector/debugger/access-obsolete-frame.js +++ b/deps/v8/test/inspector/debugger/access-obsolete-frame.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript(` +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that accessing no longer valid call frames returns an error'); + +contextGroup.addScript(` function testFunction() { debugger; diff --git a/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec.js b/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec.js index 78a7b8e57e..ec760ecf08 100644 --- a/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec.js +++ b/deps/v8/test/inspector/debugger/asm-js-breakpoint-before-exec.js @@ -4,7 +4,7 @@ // Flags: --validate-asm --allow-natives-syntax -InspectorTest.log( +let {session, contextGroup, Protocol} = InspectorTest.start( 'This test runs asm.js which calls back to JS. Before executing (after ' + 'the script is parsed) we set breakpoints in the asm.js code.'); @@ -50,7 +50,7 @@ InspectorTest.runTestSuite([ function addScript(next) { afterScriptParsedCallback = next; - InspectorTest.addScript(testFunction.toString()); + contextGroup.addScript(testFunction.toString()); }, function runTestFunction(next) { diff --git a/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec.js b/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec.js index 2a29dc1ea4..af3ac518b3 100644 --- a/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec.js +++ b/deps/v8/test/inspector/debugger/asm-js-breakpoint-during-exec.js @@ -4,7 +4,7 @@ // Flags: --validate-asm --allow-natives-syntax -InspectorTest.log( +let {session, contextGroup, Protocol} = InspectorTest.start( 'This test runs asm.js which calls back to JS. JS triggers a break, on ' + 'pause we set breakpoints in the asm.js code.'); @@ -53,7 +53,7 @@ InspectorTest.runTestSuite([ function addScript(next) { afterScriptParsedCallback = next; - InspectorTest.addScript(testFunction.toString()); + contextGroup.addScript(testFunction.toString()); }, function runTestFunction(next) { diff --git a/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt b/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt index f3bfd8de6a..e028f2a595 100644 --- a/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt +++ b/deps/v8/test/inspector/debugger/asm-js-stack-expected.txt @@ -1,3 +1,4 @@ +Tests that asm-js scripts produce correct stack Paused on 'debugger;' Number of frames: 5 - [0] {"functionName":"call_debugger","function_lineNumber":13,"function_columnNumber":24,"lineNumber":14,"columnNumber":4} diff --git a/deps/v8/test/inspector/debugger/asm-js-stack.js b/deps/v8/test/inspector/debugger/asm-js-stack.js index 37db088ba1..916ac5f22a 100644 --- a/deps/v8/test/inspector/debugger/asm-js-stack.js +++ b/deps/v8/test/inspector/debugger/asm-js-stack.js @@ -4,6 +4,8 @@ // Flags: --validate-asm +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that asm-js scripts produce correct stack'); + function testFunction() { function generateAsmJs(stdlib, foreign, heap) { 'use asm'; @@ -25,7 +27,7 @@ function testFunction() { fun(); } -InspectorTest.addScript(testFunction.toString()); +contextGroup.addScript(testFunction.toString()); Protocol.Debugger.enable(); Protocol.Debugger.oncePaused().then(handleDebuggerPaused); diff --git a/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js b/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js index 57c308878d..14f09b31a7 100644 --- a/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js +++ b/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log("setTimeout(console.count, 0) doesn't crash with enabled async stacks.") +let {session, contextGroup, Protocol} = InspectorTest.start("setTimeout(console.count, 0) doesn't crash with enabled async stacks.") Protocol.Debugger.enable(); Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 1 }); Protocol.Runtime.evaluate({ expression: "setTimeout(console.count, 0)" }); -InspectorTest.completeTestAfterPendingTimeouts(); +InspectorTest.waitForPendingTasks().then(InspectorTest.completeTest); diff --git a/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack-expected.txt b/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack-expected.txt index fb1403917a..0cfa3c4349 100644 --- a/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack-expected.txt +++ b/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack-expected.txt @@ -1,57 +1,58 @@ Checks that async chains for for-await-of are correct. Running test: testBasic -Debugger (test.js:10:2) -Basic (test.js:48:4) --- async function (test.js:46:20)-- -Basic (test.js:46:20) +Debugger (test.js:12:2) +Basic (test.js:50:4) +-- async function -- +Basic (test.js:48:20) (anonymous) (testBasic.js:0:0) Running test: testUncaughtReject -Debugger (test.js:10:2) --- async function (test.js:52:29)-- -UncaughtReject (test.js:52:29) +Debugger (test.js:12:2) +-- async function -- +UncaughtReject (test.js:54:29) (anonymous) (testUncaughtReject.js:0:0) Running test: testUncaughtThrow -Debugger (test.js:10:2) --- async function (test.js:61:28)-- -UncaughtThrow (test.js:61:28) +Debugger (test.js:12:2) +-- async function -- +UncaughtThrow (test.js:63:28) (anonymous) (testUncaughtThrow.js:0:0) Running test: testCaughtReject -Debugger (test.js:10:2) -CaughtReject (test.js:76:4) --- async function (test.js:70:27)-- -CaughtReject (test.js:70:27) +Debugger (test.js:12:2) +CaughtReject (test.js:78:4) +-- async function -- +CaughtReject (test.js:72:27) (anonymous) (testCaughtReject.js:0:0) Running test: testCaughtThrow -Debugger (test.js:10:2) -CaughtThrow (test.js:86:4) --- async function (test.js:80:26)-- -CaughtThrow (test.js:80:26) +Debugger (test.js:12:2) +CaughtThrow (test.js:88:4) +-- async function -- +CaughtThrow (test.js:82:26) (anonymous) (testCaughtThrow.js:0:0) Running test: testUncaughtRejectOnBreak Running test: testUncaughtThrowOnBreak -Debugger (test.js:10:2) --- async function (test.js:99:35)-- -UncaughtThrowOnBreak (test.js:99:35) +Debugger (test.js:12:2) +-- async function -- +UncaughtThrowOnBreak (test.js:101:35) (anonymous) (testUncaughtThrowOnBreak.js:0:0) Running test: testCaughtRejectOnBreak Running test: testCaughtThrowOnBreak -Debugger (test.js:10:2) -CaughtThrowOnBreak (test.js:124:4) --- async function (test.js:118:33)-- -CaughtThrowOnBreak (test.js:118:33) -(anonymous) (testCaughtThrowOnBreak.js:0:0) \ No newline at end of file +Debugger (test.js:12:2) +CaughtThrowOnBreak (test.js:126:4) +-- async function -- +CaughtThrowOnBreak (test.js:120:33) +(anonymous) (testCaughtThrowOnBreak.js:0:0) + diff --git a/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js b/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js index 4e6c0bf15e..6a2f4ce972 100644 --- a/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js +++ b/deps/v8/test/inspector/debugger/async-for-await-of-promise-stack.js @@ -4,9 +4,9 @@ // Flags: --harmony-async-iteration -InspectorTest.log('Checks that async chains for for-await-of are correct.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async chains for for-await-of are correct.'); -InspectorTest.addScript(` +contextGroup.addScript(` function Debugger(value) { debugger; @@ -50,7 +50,7 @@ async function Basic() { Debugger(); } } - +// TODO(kozyatinskiy): this stack trace is suspicious. async function UncaughtReject() { async function loop() { for await (let x of [Reject(new Error("boop"))]) { @@ -59,7 +59,7 @@ async function UncaughtReject() { } return loop().catch(Debugger); } - +// TODO(kozyatinskiy): this stack trace is suspicious. async function UncaughtThrow() { async function loop() { for await (let x of [Throw(new Error("boop"))]) { @@ -88,7 +88,7 @@ async function CaughtThrow() { Debugger(e); } } - +// TODO(kozyatinskiy): this stack trace is suspicious. async function UncaughtRejectOnBreak() { async function loop() { for await (let x of RejectOnReturn(["0", "1"])) { @@ -97,7 +97,7 @@ async function UncaughtRejectOnBreak() { } return loop().catch(Debugger); } - +// TODO(kozyatinskiy): this stack trace is suspicious. async function UncaughtThrowOnBreak() { async function loop() { for await (let x of ThrowOnReturn(["0", "1"])) { @@ -106,7 +106,7 @@ async function UncaughtThrowOnBreak() { } return loop().catch(Debugger); } - +// TODO(kozyatinskiy): this stack trace is suspicious. async function CaughtRejectOnBreak() { try { for await (let x of RejectOnReturn(["0", "1"])) { @@ -126,12 +126,12 @@ async function CaughtThrowOnBreak() { Debugger(e); } } -//# sourceURL=test.js`, 7, 129); +//# sourceURL=test.js`, 9, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); - InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); + session.logCallFrames(message.params.callFrames); + session.logAsyncStackTrace(message.params.asyncStackTrace); InspectorTest.log(''); Protocol.Debugger.resume(); }); diff --git a/deps/v8/test/inspector/debugger/async-instrumentation-expected.txt b/deps/v8/test/inspector/debugger/async-instrumentation-expected.txt index 2a538879ae..3b9f58aefc 100644 --- a/deps/v8/test/inspector/debugger/async-instrumentation-expected.txt +++ b/deps/v8/test/inspector/debugger/async-instrumentation-expected.txt @@ -9,12 +9,12 @@ test (test.js:21:2) foo (test.js:10:2) -- Promise.resolve -- -test (test.js:20:2) +test (test.js:19:14) (anonymous) (expr1.js:0:0) foo (test.js:12:2) -- Promise.resolve -- -test (test.js:20:2) +test (test.js:19:14) (anonymous) (expr1.js:0:0) diff --git a/deps/v8/test/inspector/debugger/async-instrumentation.js b/deps/v8/test/inspector/debugger/async-instrumentation.js index 6997c17ffe..6de2ce7d2f 100644 --- a/deps/v8/test/inspector/debugger/async-instrumentation.js +++ b/deps/v8/test/inspector/debugger/async-instrumentation.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks async instrumentation enabled in the middle.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks async instrumentation enabled in the middle.'); -InspectorTest.addScript(` +contextGroup.addScript(` function foo() { // asyncTaskStarted debugger; @@ -24,15 +24,15 @@ function test() { //# sourceURL=test.js`, 7, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { if (enableOnPause-- === 0) Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); var asyncStackTrace = message.params.asyncStackTrace; while (asyncStackTrace) { InspectorTest.log(`-- ${asyncStackTrace.description} --`); - InspectorTest.logCallFrames(asyncStackTrace.callFrames); + session.logCallFrames(asyncStackTrace.callFrames); asyncStackTrace = asyncStackTrace.parent; } InspectorTest.log(''); diff --git a/deps/v8/test/inspector/debugger/async-promise-late-then-expected.txt b/deps/v8/test/inspector/debugger/async-promise-late-then-expected.txt index ee91377178..dfdf81fe8c 100644 --- a/deps/v8/test/inspector/debugger/async-promise-late-then-expected.txt +++ b/deps/v8/test/inspector/debugger/async-promise-late-then-expected.txt @@ -1,16 +1,16 @@ Checks async stack for late .then handlers with gc foo1 (test.js:11:2) -- Promise.resolve -- -test (test.js:20:2) +test (test.js:18:14) (anonymous) (expr.js:0:0) foo1 (test.js:11:2) -- Promise.resolve -- -test (test.js:20:2) +test (test.js:22:14) (anonymous) (expr.js:0:0) foo1 (test.js:11:2) -- Promise.resolve -- -test (test.js:20:2) +test (test.js:24:14) (anonymous) (expr.js:0:0) diff --git a/deps/v8/test/inspector/debugger/async-promise-late-then.js b/deps/v8/test/inspector/debugger/async-promise-late-then.js index 83c610b921..cad3c7ed86 100644 --- a/deps/v8/test/inspector/debugger/async-promise-late-then.js +++ b/deps/v8/test/inspector/debugger/async-promise-late-then.js @@ -3,9 +3,9 @@ // found in the LICENSE file. // Flags: --expose-gc -InspectorTest.log('Checks async stack for late .then handlers with gc'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks async stack for late .then handlers with gc'); -InspectorTest.addScript(` +contextGroup.addScript(` function foo1() { gc(); debugger; @@ -27,13 +27,13 @@ function test() { } //# sourceURL=test.js`, 8, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); var asyncStackTrace = message.params.asyncStackTrace; while (asyncStackTrace) { InspectorTest.log(`-- ${asyncStackTrace.description} --`); - InspectorTest.logCallFrames(asyncStackTrace.callFrames); + session.logCallFrames(asyncStackTrace.callFrames); asyncStackTrace = asyncStackTrace.parent; } InspectorTest.log(''); diff --git a/deps/v8/test/inspector/debugger/async-set-timeout.js b/deps/v8/test/inspector/debugger/async-set-timeout.js index 31712329d3..30096b637f 100644 --- a/deps/v8/test/inspector/debugger/async-set-timeout.js +++ b/deps/v8/test/inspector/debugger/async-set-timeout.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks that async stack contains setTimeout'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async stack contains setTimeout'); -InspectorTest.addScript(` +contextGroup.addScript(` var resolveCallback; function foo1() { function inner1() { @@ -29,13 +29,13 @@ function foo3() { } //# sourceURL=test.js`, 7, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); var asyncStackTrace = message.params.asyncStackTrace; while (asyncStackTrace) { InspectorTest.log(`-- ${asyncStackTrace.description} --`); - InspectorTest.logCallFrames(asyncStackTrace.callFrames); + session.logCallFrames(asyncStackTrace.callFrames); asyncStackTrace = asyncStackTrace.parent; } InspectorTest.log(''); diff --git a/deps/v8/test/inspector/debugger/async-stack-await-expected.txt b/deps/v8/test/inspector/debugger/async-stack-await-expected.txt index 506b9a268a..4ebcefadad 100644 --- a/deps/v8/test/inspector/debugger/async-stack-await-expected.txt +++ b/deps/v8/test/inspector/debugger/async-stack-await-expected.txt @@ -1,34 +1,33 @@ Checks that async stacks works for async/await foo2 (test.js:15:2) --- async function (test.js:13:19)-- +-- async function -- foo2 (test.js:13:19) test (test.js:24:8) (anonymous) (expr.js:0:0) foo2 (test.js:17:2) --- async function (test.js:13:19)-- +-- async function -- foo2 (test.js:13:19) test (test.js:24:8) (anonymous) (expr.js:0:0) foo1 (test.js:9:2) foo2 (test.js:18:8) --- async function (test.js:13:19)-- +-- async function -- foo2 (test.js:13:19) test (test.js:24:8) (anonymous) (expr.js:0:0) foo1 (test.js:9:2) --- Promise.resolve (test.js:19:43)-- --- Promise.resolve (test.js:19:16)-- -foo2 (test.js:19:30) --- async function (test.js:13:19)-- +-- Promise.resolve -- +foo2 (test.js:19:43) +-- async function -- foo2 (test.js:13:19) test (test.js:24:8) (anonymous) (expr.js:0:0) foo2 (test.js:20:2) --- async function (test.js:13:19)-- +-- async function -- foo2 (test.js:13:19) test (test.js:24:8) (anonymous) (expr.js:0:0) diff --git a/deps/v8/test/inspector/debugger/async-stack-await.js b/deps/v8/test/inspector/debugger/async-stack-await.js index 155ff4a978..8f4b162807 100644 --- a/deps/v8/test/inspector/debugger/async-stack-await.js +++ b/deps/v8/test/inspector/debugger/async-stack-await.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks that async stacks works for async/await'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async stacks works for async/await'); -InspectorTest.addScript(` +contextGroup.addScript(` async function foo1() { debugger; return Promise.resolve(); @@ -25,10 +25,10 @@ async function test() { } //# sourceURL=test.js`, 7, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); - InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); + session.logCallFrames(message.params.callFrames); + session.logAsyncStackTrace(message.params.asyncStackTrace); InspectorTest.log(''); Protocol.Debugger.resume(); }); diff --git a/deps/v8/test/inspector/debugger/async-stack-created-frame-expected.txt b/deps/v8/test/inspector/debugger/async-stack-created-frame-expected.txt index 6e61d1aca4..f5197a1669 100644 --- a/deps/v8/test/inspector/debugger/async-stack-created-frame-expected.txt +++ b/deps/v8/test/inspector/debugger/async-stack-created-frame-expected.txt @@ -2,88 +2,79 @@ Checks created frame for async call chain Running test: testPromise foo1 (test.js:10:2) --- Promise.resolve (test.js:20:14)-- -promise (test.js:21:2) +-- Promise.resolve -- +promise (test.js:20:14) (anonymous) (expr.js:0:0) Running test: testPromiseThen foo1 (test.js:10:2) --- Promise.resolve (test.js:28:14)-- -promiseThen (test.js:30:2) +-- Promise.resolve -- +promiseThen (test.js:28:14) (anonymous) (expr.js:0:0) foo2 (test.js:14:2) --- Promise.resolve (test.js:29:14)-- --- Promise.resolve (test.js:28:14)-- -promiseThen (test.js:30:2) +-- Promise.resolve -- +promiseThen (test.js:29:14) (anonymous) (expr.js:0:0) Running test: testPromiseThenThen foo1 (test.js:10:2) --- Promise.resolve (test.js:37:14)-- -promiseThenThen (test.js:39:2) +-- Promise.resolve -- +promiseThenThen (test.js:37:14) (anonymous) (expr.js:0:0) foo1 (test.js:10:2) --- Promise.resolve (test.js:38:14)-- -promiseThenThen (test.js:39:2) +-- Promise.resolve -- +promiseThenThen (test.js:38:14) (anonymous) (expr.js:0:0) foo2 (test.js:14:2) --- Promise.resolve (test.js:37:25)-- --- Promise.resolve (test.js:37:14)-- -promiseThenThen (test.js:39:2) +-- Promise.resolve -- +promiseThenThen (test.js:37:25) (anonymous) (expr.js:0:0) Running test: testPromiseResolve foo1 (test.js:10:2) --- Promise.resolve (test.js:44:27)-- -promiseResolve (test.js:44:17) +-- Promise.resolve -- +promiseResolve (test.js:44:27) (anonymous) (expr.js:0:0) Running test: testPromiseReject foo1 (test.js:10:2) --- Promise.reject (test.js:48:31)-- -promiseReject (test.js:48:17) +-- Promise.reject -- +promiseReject (test.js:48:31) (anonymous) (expr.js:0:0) Running test: testPromiseAll foo1 (test.js:10:2) --- Promise.resolve (test.js:52:44)-- --- Promise.resolve (test.js:52:17)-- -promiseAll (test.js:52:31) +-- Promise.resolve -- +promiseAll (test.js:52:44) (anonymous) (expr.js:0:0) Running test: testPromiseRace foo1 (test.js:10:2) --- Promise.resolve (test.js:56:45)-- --- Promise.resolve (test.js:56:17)-- -promiseRace (test.js:56:32) +-- Promise.resolve -- +promiseRace (test.js:56:45) (anonymous) (expr.js:0:0) Running test: testThenableJob1 foo1 (test.js:10:2) --- Promise.resolve (test.js:60:72)-- --- Promise.resolve (test.js:60:56)-- -Promise.resolve.then (test.js:60:46) --- Promise.resolve (test.js:60:27)-- -thenableJob1 (test.js:60:17) +-- Promise.resolve -- +thenableJob1 (test.js:60:72) (anonymous) (expr.js:0:0) Running test: testThenableJob2 foo1 (test.js:10:2) --- Promise.resolve (test.js:64:57)-- -Promise.resolve.then (test.js:64:46) --- Promise.resolve (test.js:64:27)-- -thenableJob2 (test.js:64:17) +-- Promise.resolve -- +thenableJob2 (test.js:64:57) (anonymous) (expr.js:0:0) diff --git a/deps/v8/test/inspector/debugger/async-stack-created-frame.js b/deps/v8/test/inspector/debugger/async-stack-created-frame.js index f73591dc29..0f2c7a1e78 100644 --- a/deps/v8/test/inspector/debugger/async-stack-created-frame.js +++ b/deps/v8/test/inspector/debugger/async-stack-created-frame.js @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks created frame for async call chain'); +// TODO(kozyatinskiy): fix this test. +let {session, contextGroup, Protocol} = InspectorTest.start('Checks created frame for async call chain'); -InspectorTest.addScript( +contextGroup.addScript( ` function foo1() { debugger; @@ -76,10 +77,10 @@ function setTimeouts() { //# sourceURL=test.js`, 8, 4); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); - InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); + session.logCallFrames(message.params.callFrames); + session.logAsyncStackTrace(message.params.asyncStackTrace); InspectorTest.log(''); Protocol.Debugger.resume(); }); diff --git a/deps/v8/test/inspector/debugger/async-stack-for-promise-expected.txt b/deps/v8/test/inspector/debugger/async-stack-for-promise-expected.txt index a948803f28..81640849ec 100644 --- a/deps/v8/test/inspector/debugger/async-stack-for-promise-expected.txt +++ b/deps/v8/test/inspector/debugger/async-stack-for-promise-expected.txt @@ -2,173 +2,118 @@ Checks that async chains for promises are correct. Running test: testPromise foo1 (test.js:9:2) --- Promise.resolve (test.js:19:14)-- -promise (test.js:20:2) +-- Promise.resolve -- +promise (test.js:19:14) (anonymous) (testPromise.js:0:0) Running test: testPromiseResolvedBySetTimeout foo1 (test.js:9:2) --- Promise.resolve (test.js:27:14)-- --- setTimeout -- -promiseResolvedBySetTimeout (test.js:28:2) +-- Promise.resolve -- +promiseResolvedBySetTimeout (test.js:27:14) (anonymous) (testPromiseResolvedBySetTimeout.js:0:0) Running test: testPromiseAll foo1 (test.js:9:2) --- Promise.resolve (test.js:37:35)-- --- Promise.resolve (test.js:37:19)-- -promiseAll (test.js:39:2) +-- Promise.resolve -- +promiseAll (test.js:37:35) (anonymous) (testPromiseAll.js:0:0) Running test: testPromiseAllReverseOrder foo1 (test.js:9:2) --- Promise.resolve (test.js:48:35)-- --- Promise.resolve (test.js:48:19)-- -promiseAllReverseOrder (test.js:50:2) +-- Promise.resolve -- +promiseAllReverseOrder (test.js:48:35) (anonymous) (testPromiseAllReverseOrder.js:0:0) Running test: testPromiseRace foo1 (test.js:9:2) --- Promise.resolve (test.js:59:36)-- --- Promise.resolve (test.js:59:19)-- -promiseRace (test.js:60:2) +-- Promise.resolve -- +promiseRace (test.js:59:36) (anonymous) (testPromiseRace.js:0:0) Running test: testTwoChainedCallbacks foo1 (test.js:9:2) --- Promise.resolve (test.js:68:14)-- -twoChainedCallbacks (test.js:69:2) +-- Promise.resolve -- +twoChainedCallbacks (test.js:68:14) (anonymous) (testTwoChainedCallbacks.js:0:0) foo2 (test.js:13:2) --- Promise.resolve (test.js:68:25)-- --- Promise.resolve (test.js:68:14)-- -twoChainedCallbacks (test.js:69:2) +-- Promise.resolve -- +twoChainedCallbacks (test.js:68:25) (anonymous) (testTwoChainedCallbacks.js:0:0) Running test: testPromiseResolve foo1 (test.js:9:2) --- Promise.resolve (test.js:74:27)-- -promiseResolve (test.js:74:17) +-- Promise.resolve -- +promiseResolve (test.js:74:27) (anonymous) (testPromiseResolve.js:0:0) foo2 (test.js:13:2) --- Promise.resolve (test.js:74:38)-- --- Promise.resolve (test.js:74:27)-- -promiseResolve (test.js:74:17) +-- Promise.resolve -- +promiseResolve (test.js:74:38) (anonymous) (testPromiseResolve.js:0:0) Running test: testThenableJobResolvedInSetTimeout foo1 (test.js:9:2) --- Promise.resolve (test.js:86:40)-- --- setTimeout -- -thenableJob (test.js:81:4) -p1.then (test.js:86:25) --- Promise.resolve (test.js:86:14)-- -thenableJobResolvedInSetTimeout (test.js:87:2) +-- Promise.resolve -- +thenableJobResolvedInSetTimeout (test.js:86:40) (anonymous) (testThenableJobResolvedInSetTimeout.js:0:0) Running test: testThenableJobResolvedInSetTimeoutWithStack foo1 (test.js:9:2) --- Promise.resolve (test.js:104:40)-- -inner (test.js:94:6) --- setTimeout -- -thenableJob (test.js:99:4) -p1.then (test.js:104:25) --- Promise.resolve (test.js:104:14)-- -thenableJobResolvedInSetTimeoutWithStack (test.js:105:2) +-- Promise.resolve -- +thenableJobResolvedInSetTimeoutWithStack (test.js:104:40) (anonymous) (testThenableJobResolvedInSetTimeoutWithStack.js:0:0) Running test: testThenableJobResolvedByPromise foo1 (test.js:9:2) --- Promise.resolve (test.js:118:40)-- --- Promise.resolve (test.js:113:22)-- -thenableJob (test.js:113:12) -p1.then (test.js:118:25) --- Promise.resolve (test.js:118:14)-- -thenableJobResolvedByPromise (test.js:119:2) +-- Promise.resolve -- +thenableJobResolvedByPromise (test.js:118:40) (anonymous) (testThenableJobResolvedByPromise.js:0:0) Running test: testThenableJobResolvedByPromiseWithStack foo1 (test.js:9:2) --- Promise.resolve (test.js:136:40)-- -inner (test.js:126:6) --- Promise.resolve (test.js:131:22)-- -thenableJob (test.js:131:12) -p1.then (test.js:136:25) --- Promise.resolve (test.js:136:14)-- -thenableJobResolvedByPromiseWithStack (test.js:137:2) +-- Promise.resolve -- +thenableJobResolvedByPromiseWithStack (test.js:136:40) (anonymous) (testThenableJobResolvedByPromiseWithStack.js:0:0) Running test: testLateThenCallback foo1 (test.js:9:2) --- Promise.resolve (test.js:145:12)-- -lateThenCallback (test.js:144:2) +-- Promise.resolve -- +lateThenCallback (test.js:145:12) (anonymous) (testLateThenCallback.js:0:0) Running test: testComplex inner1 (test.js:154:6) foo1 (test.js:156:4) --- Promise.resolve (test.js:202:5)-- -inner2 (test.js:162:6) --- Promise.resolve (test.js:165:22)-- -foo2 (test.js:165:12) --- Promise.resolve (test.js:201:5)-- -inner3 (test.js:172:6) --- setTimeout -- -foo3 (test.js:175:4) --- Promise.resolve (test.js:200:5)-- --- Promise.resolve (test.js:199:5)-- --- Promise.resolve (test.js:188:7)-- --- Promise.resolve (test.js:187:19)-- -foo5 (test.js:187:52) --- Promise.resolve (test.js:198:5)-- --- Promise.resolve (test.js:193:7)-- --- Promise.resolve (test.js:192:19)-- -foo6 (test.js:192:34) --- Promise.resolve (test.js:197:5)-- -complex (test.js:196:18) +-- Promise.resolve -- +complex (test.js:202:5) (anonymous) (testComplex.js:0:0) p.then (test.js:207:8) --- Promise.resolve (test.js:206:8)-- --- Promise.resolve (test.js:202:5)-- -inner2 (test.js:162:6) --- Promise.resolve (test.js:165:22)-- -foo2 (test.js:165:12) --- Promise.resolve (test.js:201:5)-- -inner3 (test.js:172:6) +-- Promise.resolve -- +p.then (test.js:206:8) +-- Promise.resolve -- +setTimeout (test.js:205:6) -- setTimeout -- -foo3 (test.js:175:4) --- Promise.resolve (test.js:200:5)-- --- Promise.resolve (test.js:199:5)-- --- Promise.resolve (test.js:188:7)-- --- Promise.resolve (test.js:187:19)-- -foo5 (test.js:187:52) --- Promise.resolve (test.js:198:5)-- --- Promise.resolve (test.js:193:7)-- --- Promise.resolve (test.js:192:19)-- -foo6 (test.js:192:34) --- Promise.resolve (test.js:197:5)-- -complex (test.js:196:18) +complex (test.js:204:2) (anonymous) (testComplex.js:0:0) Running test: testReject foo1 (test.js:9:2) --- Promise.reject (test.js:217:31)-- -reject (test.js:217:17) +-- Promise.reject -- +reject (test.js:217:31) (anonymous) (testReject.js:0:0) diff --git a/deps/v8/test/inspector/debugger/async-stack-for-promise.js b/deps/v8/test/inspector/debugger/async-stack-for-promise.js index 9865d7a767..198c971e12 100644 --- a/deps/v8/test/inspector/debugger/async-stack-for-promise.js +++ b/deps/v8/test/inspector/debugger/async-stack-for-promise.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks that async chains for promises are correct.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async chains for promises are correct.'); -InspectorTest.addScript(` +contextGroup.addScript(` function foo1() { debugger; } @@ -219,10 +219,10 @@ function reject() { //# sourceURL=test.js`, 7, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); - InspectorTest.logAsyncStackTrace(message.params.asyncStackTrace); + session.logCallFrames(message.params.callFrames); + session.logAsyncStackTrace(message.params.asyncStackTrace); InspectorTest.log(''); Protocol.Debugger.resume(); }); diff --git a/deps/v8/test/inspector/debugger/async-stacks-limit-expected.txt b/deps/v8/test/inspector/debugger/async-stacks-limit-expected.txt deleted file mode 100644 index 8dd1456990..0000000000 --- a/deps/v8/test/inspector/debugger/async-stacks-limit-expected.txt +++ /dev/null @@ -1,140 +0,0 @@ -Checks that async stacks works good with different limits - -Running test: testZeroLimit -foo1 (test.js:11:2) - - -Running test: testTwoLimit -foo1 (test.js:11:2) --- Promise.resolve -- -promise (test.js:23:2) -(anonymous) (expr.js:0:0) - - -Running test: testOneLimitTwoPromises -foo1 (test.js:11:2) - -foo2 (test.js:15:2) - - -Running test: testFourLimitTwoPromises -foo1 (test.js:11:2) - -foo2 (test.js:15:2) - - -Running test: testSixLimitTwoPromises -foo1 (test.js:11:2) - -foo2 (test.js:15:2) --- Promise.resolve -- -twoPromises (test.js:35:2) -(anonymous) (expr.js:0:0) - - -Running test: testTwoLimitTwoSetTimeouts -foo1 (test.js:11:2) - -foo2 (test.js:15:2) --- setTimeout -- -twoSetTimeout (test.js:41:2) -(anonymous) (expr.js:0:0) - - -Running test: testThreeLimitTwoSetTimeouts -foo1 (test.js:11:2) --- setTimeout -- -twoSetTimeout (test.js:40:2) -(anonymous) (expr.js:0:0) - -foo2 (test.js:15:2) --- setTimeout -- -twoSetTimeout (test.js:41:2) -(anonymous) (expr.js:0:0) - - -Running test: testTenLimitTwentySetTimeouts -foo1 (:0:17) -(anonymous) (:0:28) - -foo2 (:0:17) -(anonymous) (:0:28) - -foo3 (:0:17) -(anonymous) (:0:28) - -foo4 (:0:17) -(anonymous) (:0:28) - -foo5 (:0:17) -(anonymous) (:0:28) - -foo6 (:0:17) -(anonymous) (:0:28) - -foo7 (:0:17) -(anonymous) (:0:28) - -foo8 (:0:17) -(anonymous) (:0:28) - -foo9 (:0:17) -(anonymous) (:0:28) - -foo10 (:0:18) -(anonymous) (:0:29) - -foo11 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo12 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo13 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo14 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo15 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo16 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo17 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo18 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - -foo19 (:0:18) -(anonymous) (:0:29) --- setTimeout -- -twentySetTimeout (test.js:49:4) -(anonymous) (expr.js:0:0) - diff --git a/deps/v8/test/inspector/debugger/async-stacks-limit.js b/deps/v8/test/inspector/debugger/async-stacks-limit.js deleted file mode 100644 index 62206750df..0000000000 --- a/deps/v8/test/inspector/debugger/async-stacks-limit.js +++ /dev/null @@ -1,164 +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. - -InspectorTest.log('Checks that async stacks works good with different limits'); - -InspectorTest.addScript(` -var resolveTest; - -function foo1() { - debugger; -} - -function foo2() { - debugger; - if (resolveTest) resolveTest(); -} - -function promise() { - var resolve1; - var p1 = new Promise(resolve => resolve1 = resolve); - var p2 = p1.then(foo1); - resolve1(); - return p2; -} - -function twoPromises() { - var resolve1; - var resolve2; - var p1 = new Promise(resolve => resolve1 = resolve); - var p2 = new Promise(resolve => resolve2 = resolve); - var p3 = p1.then(foo1); - var p4 = p2.then(foo2); - resolve1(); - resolve2(); - return Promise.all([p3, p4]); -} - -function twoSetTimeout() { - setTimeout(foo1, 0); - setTimeout(foo2, 0); - return new Promise(resolve => resolveTest = resolve); -} - -function twentySetTimeout() { - var resolve1; - var p1 = new Promise(resolve => resolve1 = resolve); - for (var i = 1; i <= 19; ++i) - setTimeout('(function foo' + i + '(){debugger;})()',0); - setTimeout(resolve1, 0); - return p1; -} - -//# sourceURL=test.js`, 7, 26); - -InspectorTest.setupScriptMap(); -Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); - var asyncStackTrace = message.params.asyncStackTrace; - while (asyncStackTrace) { - InspectorTest.log(`-- ${asyncStackTrace.description} --`); - InspectorTest.logCallFrames(asyncStackTrace.callFrames); - asyncStackTrace = asyncStackTrace.parent; - } - InspectorTest.log(''); - Protocol.Debugger.resume(); -}); - -Protocol.Debugger.enable(); -Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); -InspectorTest.runTestSuite([ - function testZeroLimit(next) { - Protocol.Runtime.evaluate({ - expression: 'setMaxAsyncTaskStacks(0)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'promise()//# sourceURL=expr.js', awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testTwoLimit(next) { - // we need one stack for parent task and one for next task. - Protocol.Runtime - .evaluate({expression: 'setMaxAsyncTaskStacks(2)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'promise()//# sourceURL=expr.js', - awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testOneLimitTwoPromises(next) { - // Should be no async stacks because when first microtask is finished - // it will resolve and schedule p3 - will remove async stack for scheduled - // p2. - Protocol.Runtime.evaluate({ - expression: 'setMaxAsyncTaskStacks(1)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'twoPromises()//# sourceURL=expr.js', awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testFourLimitTwoPromises(next) { - Protocol.Runtime - .evaluate({expression: 'setMaxAsyncTaskStacks(4)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'twoPromises()//# sourceURL=expr.js', - awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testSixLimitTwoPromises(next) { - Protocol.Runtime - .evaluate({expression: 'setMaxAsyncTaskStacks(6)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'twoPromises()//# sourceURL=expr.js', - awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testTwoLimitTwoSetTimeouts(next) { - Protocol.Runtime.evaluate({ - expression: 'setMaxAsyncTaskStacks(2)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'twoSetTimeout()//# sourceURL=expr.js', awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testThreeLimitTwoSetTimeouts(next) { - Protocol.Runtime.evaluate({ - expression: 'setMaxAsyncTaskStacks(3)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'twoSetTimeout()//# sourceURL=expr.js', awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - }, - - function testTenLimitTwentySetTimeouts(next) { - Protocol.Runtime.evaluate({ - expression: 'setMaxAsyncTaskStacks(10)//# sourceURL=expr.js'}) - .then(() => Protocol.Runtime.evaluate({ - expression: 'twentySetTimeout()//# sourceURL=expr.js', - awaitPromise: true - })) - .then(() => cancelAllAsyncTasks()) - .then(next); - } -]); - -function cancelAllAsyncTasks() { - return Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 0 }) - .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 })); -} diff --git a/deps/v8/test/inspector/debugger/break-on-exception-expected.txt b/deps/v8/test/inspector/debugger/break-on-exception-expected.txt index 92a38f0e83..f4d70f09b9 100644 --- a/deps/v8/test/inspector/debugger/break-on-exception-expected.txt +++ b/deps/v8/test/inspector/debugger/break-on-exception-expected.txt @@ -9,4 +9,4 @@ Running test: breakOnCaughtException paused in throwUncaughtException paused in throwCaughtException -Running test: noBreakInEvaluateInSilentMode \ No newline at end of file +Running test: noBreakInEvaluateInSilentMode diff --git a/deps/v8/test/inspector/debugger/break-on-exception.js b/deps/v8/test/inspector/debugger/break-on-exception.js index d9a208dadf..6f47ec86d7 100644 --- a/deps/v8/test/inspector/debugger/break-on-exception.js +++ b/deps/v8/test/inspector/debugger/break-on-exception.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log("Check that inspector correctly change break on exception state."); +let {session, contextGroup, Protocol} = InspectorTest.start("Check that inspector correctly change break on exception state."); -InspectorTest.addScript(` +contextGroup.addScript(` function scheduleUncaughtException() { setTimeout(throwUncaughtException, 0); diff --git a/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt b/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt index 8a34f45272..211352c2a2 100644 --- a/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt +++ b/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt @@ -1,3 +1,4 @@ +Tests that function location in call frames is correct Paused on 'debugger;' Top frame location: {"scriptId":"42","lineNumber":3,"columnNumber":4} Top frame functionLocation: {"scriptId":"42","lineNumber":0,"columnNumber":21} diff --git a/deps/v8/test/inspector/debugger/call-frame-function-location.js b/deps/v8/test/inspector/debugger/call-frame-function-location.js index c91164a037..4775b30f6d 100644 --- a/deps/v8/test/inspector/debugger/call-frame-function-location.js +++ b/deps/v8/test/inspector/debugger/call-frame-function-location.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that function location in call frames is correct'); + +contextGroup.addScript( `function testFunction() { var a = 2; diff --git a/deps/v8/test/inspector/debugger/caught-exception-from-framework-inside-async.js b/deps/v8/test/inspector/debugger/caught-exception-from-framework-inside-async.js index 3bc7b6efa8..f59e71fda3 100644 --- a/deps/v8/test/inspector/debugger/caught-exception-from-framework-inside-async.js +++ b/deps/v8/test/inspector/debugger/caught-exception-from-framework-inside-async.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Async caught exception prediction and blackboxing.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Async caught exception prediction and blackboxing.'); -InspectorTest.addScript(` +contextGroup.addScript(` function constructorThrow() { return new Promise((resolve, reject) => Promise.resolve().then(() => @@ -18,7 +18,7 @@ function dotCatch(producer) { } //# sourceURL=framework.js`); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); (async function test() { Protocol.Debugger.enable(); Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); @@ -33,6 +33,6 @@ InspectorTest.setupScriptMap(); async function waitPauseAndDumpLocation() { var message = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - InspectorTest.logSourceLocation(message.params.callFrames[0].location); + session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js index d049cf0da0..38b622d3db 100644 --- a/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js +++ b/deps/v8/test/inspector/debugger/caught-uncaught-exceptions.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log("Check that inspector correctly passes caught/uncaught information."); +let {session, contextGroup, Protocol} = InspectorTest.start("Check that inspector correctly passes caught/uncaught information."); -InspectorTest.addScript( +contextGroup.addScript( `function throwCaught() { try { throw new Error(); } catch (_) {} } function throwUncaught() { throw new Error(); } function schedule(f) { setTimeout(f, 0); } diff --git a/deps/v8/test/inspector/debugger/collect-obsolete-async-tasks-expected.txt b/deps/v8/test/inspector/debugger/collect-obsolete-async-tasks-expected.txt new file mode 100644 index 0000000000..c114e34012 --- /dev/null +++ b/deps/v8/test/inspector/debugger/collect-obsolete-async-tasks-expected.txt @@ -0,0 +1,37 @@ +Checks that we collect obsolete async tasks with async stacks. +Async stacks count: 2 +Scheduled async tasks: 1 +Created async tasks: 1 +Async tasks with parent: 0 +Recurring async tasks: 1 + +Async stacks count: 0 +Scheduled async tasks: 0 +Created async tasks: 0 +Async tasks with parent: 0 +Recurring async tasks: 0 + +Async stacks count: 2 +Scheduled async tasks: 0 +Created async tasks: 2 +Async tasks with parent: 2 +Recurring async tasks: 0 + +Async stacks count: 0 +Scheduled async tasks: 0 +Created async tasks: 0 +Async tasks with parent: 0 +Recurring async tasks: 0 + +Async stacks count: 1 +Scheduled async tasks: 1 +Created async tasks: 0 +Async tasks with parent: 0 +Recurring async tasks: 0 + +Async stacks count: 0 +Scheduled async tasks: 0 +Created async tasks: 0 +Async tasks with parent: 0 +Recurring async tasks: 0 + diff --git a/deps/v8/test/inspector/debugger/collect-obsolete-async-tasks.js b/deps/v8/test/inspector/debugger/collect-obsolete-async-tasks.js new file mode 100644 index 0000000000..cfef345d19 --- /dev/null +++ b/deps/v8/test/inspector/debugger/collect-obsolete-async-tasks.js @@ -0,0 +1,35 @@ +// 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('Checks that we collect obsolete async tasks with async stacks.'); + +contextGroup.addScript(` +function test() { + inspector.setMaxAsyncTaskStacks(128); + var p = Promise.resolve(); + + inspector.dumpAsyncTaskStacksStateForTest(); + inspector.setMaxAsyncTaskStacks(128); + inspector.dumpAsyncTaskStacksStateForTest(); + + p.then(() => 42).then(() => 239); + + inspector.dumpAsyncTaskStacksStateForTest(); + inspector.setMaxAsyncTaskStacks(128); + inspector.dumpAsyncTaskStacksStateForTest(); + + setTimeout(() => 42, 0); + + inspector.dumpAsyncTaskStacksStateForTest(); + inspector.setMaxAsyncTaskStacks(128); + inspector.dumpAsyncTaskStacksStateForTest(); +} +`); + +(async function test() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + await Protocol.Runtime.evaluate({expression: 'test()'}); + InspectorTest.completeTest(); +})() diff --git a/deps/v8/test/inspector/debugger/collect-old-async-call-chains-expected.txt b/deps/v8/test/inspector/debugger/collect-old-async-call-chains-expected.txt new file mode 100644 index 0000000000..64fef4af77 --- /dev/null +++ b/deps/v8/test/inspector/debugger/collect-old-async-call-chains-expected.txt @@ -0,0 +1,211 @@ +Checks that we drop old async call chains. + +Running test: testInfrastructure +inspector.setMaxAsyncTaskStacks(1024) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1024) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1024) +Run expression 'console.trace(42)' with async chain len: 5 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1024) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1024) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(1024) +Run expression 'console.trace(42)' with async chain len: 5 +actual async chain len: 5 + + +Running test: testZeroLimit +inspector.setMaxAsyncTaskStacks(0) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 0 + +inspector.setMaxAsyncTaskStacks(0) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 0 + +inspector.setMaxAsyncTaskStacks(0) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 0 + +inspector.setMaxAsyncTaskStacks(0) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 0 + + +Running test: testOneLimit +inspector.setMaxAsyncTaskStacks(1) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(1) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + + +Running test: testTwoLimit +inspector.setMaxAsyncTaskStacks(2) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(2) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 0 + +inspector.setMaxAsyncTaskStacks(2) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(2) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(2) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(2) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + + +Running test: testMoreThanTwoLimit +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 3 + +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 3 + +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 3 + +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 3 + +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace(42)' with async chain len: 1 +actual async chain len: 1 + +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace(42)' with async chain len: 2 +actual async chain len: 2 + +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace(42)' with async chain len: 3 +actual async chain len: 3 + diff --git a/deps/v8/test/inspector/debugger/collect-old-async-call-chains.js b/deps/v8/test/inspector/debugger/collect-old-async-call-chains.js new file mode 100644 index 0000000000..7ac822534b --- /dev/null +++ b/deps/v8/test/inspector/debugger/collect-old-async-call-chains.js @@ -0,0 +1,171 @@ +// 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('Checks that we drop old async call chains.'); + +Protocol.Debugger.enable(); +Protocol.Runtime.enable(); +InspectorTest.runAsyncTestSuite([ + async function testInfrastructure() { + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + await setMaxAsyncTaskStacks(1024); + runWithAsyncChainPromise(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(1024); + runWithAsyncChainPromise(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(1024); + runWithAsyncChainPromise(5, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(1024); + runWithAsyncChainSetTimeout(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(1024); + runWithAsyncChainSetTimeout(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(1024); + runWithAsyncChainSetTimeout(5, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function testZeroLimit() { + const limit = 0; + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function testOneLimit() { + const limit = 1; + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function testTwoLimit() { + const limit = 2; + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(3, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(3, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function testMoreThanTwoLimit() { + for (let limit = 3; limit <= 7; ++limit) { + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainPromise(3, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(1, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(2, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(limit); + runWithAsyncChainSetTimeout(3, 'console.trace(42)'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + } + }, +]); + +function runWithAsyncChainPromise(len, source) { + InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); + let then = '.then(() => 1)'; + let pause = `.then(() => { ${source} })`; + Protocol.Runtime.evaluate({ + expression: `Promise.resolve()${then.repeat(len - 1)}${pause}` + }); +} + +function runWithAsyncChainSetTimeout(len, source) { + InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); + let setTimeoutPrefix = '() => setTimeout('; + let setTimeoutSuffix = ', 0)'; + Protocol.Runtime.evaluate({ + expression: `setTimeout(${setTimeoutPrefix.repeat(len - 1)}'${source}'${setTimeoutSuffix.repeat(len - 1)}, 0)` + }); +} + +function dumpAsyncChainLength(message) { + let stackTrace = message.params.asyncStackTrace || message.params.stackTrace.parent; + let asyncChainCount = 0; + while (stackTrace) { + ++asyncChainCount; + stackTrace = stackTrace.parent; + } + InspectorTest.log(`actual async chain len: ${asyncChainCount}\n`); +} + +async function setMaxAsyncTaskStacks(max) { + let expression = `inspector.setMaxAsyncTaskStacks(${max})`; + InspectorTest.log(expression); + await Protocol.Runtime.evaluate({expression}); +} diff --git a/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt index 821ce46cd3..338b136c8f 100644 --- a/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt +++ b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt @@ -20,4 +20,4 @@ paused in boo function boo called > debug and unmonitor bar > call bar -paused in boo \ No newline at end of file +paused in boo diff --git a/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js index d857d4191d..3c00585d21 100644 --- a/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js +++ b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log("Check that debug and monitor methods from Command Line API works with bound function."); +let {session, contextGroup, Protocol} = InspectorTest.start("Check that debug and monitor methods from Command Line API works with bound function."); -InspectorTest.addScript(` +contextGroup.addScript(` function foo() {} function boo() {} var bar = boo.bind(null); diff --git a/deps/v8/test/inspector/debugger/continue-to-location-expected.txt b/deps/v8/test/inspector/debugger/continue-to-location-expected.txt index d0c6ce715a..948edd85fb 100644 --- a/deps/v8/test/inspector/debugger/continue-to-location-expected.txt +++ b/deps/v8/test/inspector/debugger/continue-to-location-expected.txt @@ -1,3 +1,4 @@ +Tests Debugger.continueToLocation Paused on debugger statement Paused after continueToLocation Stopped on line 8, expected 8, requested 8, (0-based numbers). @@ -28,4 +29,3 @@ Paused after continueToLocation Stopped on line 17, expected 17, requested 17, (0-based numbers). Control parameter 'step' calculation result: 6, expected: 6 SUCCESS - diff --git a/deps/v8/test/inspector/debugger/continue-to-location-target-call-frames-expected.txt b/deps/v8/test/inspector/debugger/continue-to-location-target-call-frames-expected.txt new file mode 100644 index 0000000000..1f41dcfc6d --- /dev/null +++ b/deps/v8/test/inspector/debugger/continue-to-location-target-call-frames-expected.txt @@ -0,0 +1,81 @@ +Check that continue-to-location works with different strategies. + +Running test: testAwaitAny +(anonymous) (expr.js:0:0) + +asyncFact (test.js:9:2) +(anonymous) (expr.js:0:0) + +asyncFact (test.js:11:2) +-- async function -- +asyncFact (test.js:8:24) +asyncFact (test.js:10:20) +asyncFact (test.js:10:20) +asyncFact (test.js:10:20) +(anonymous) (expr.js:0:0) + + +Running test: testAwaitCurrent +(anonymous) (expr.js:0:0) + +asyncFact (test.js:9:2) +(anonymous) (expr.js:0:0) + +asyncFact (test.js:11:2) +-- async function -- +asyncFact (test.js:8:24) +(anonymous) (expr.js:0:0) + + +Running test: testAny +(anonymous) (expr.js:0:0) + +fact (test.js:16:2) +(anonymous) (expr.js:0:0) + +fact (test.js:18:2) +fact (test.js:17:14) +fact (test.js:17:14) +fact (test.js:17:14) +(anonymous) (expr.js:0:0) + + +Running test: testCurrent +(anonymous) (expr.js:0:0) + +fact (test.js:16:2) +(anonymous) (expr.js:0:0) + +fact (test.js:18:2) +(anonymous) (expr.js:0:0) + + +Running test: testTopLevelAny +(anonymous) (expr.js:0:0) + +topLevel (test.js:23:2) +(anonymous) (expr.js:0:0) + +(anonymous) (:1:10) +topLevel (test.js:23:2) +(anonymous) (expr.js:0:0) + +(anonymous) (:4:10) +topLevel (test.js:23:2) +(anonymous) (expr.js:0:0) + + +Running test: testTopLevelCurrent +(anonymous) (expr.js:0:0) + +topLevel (test.js:23:2) +(anonymous) (expr.js:0:0) + +(anonymous) (:1:10) +topLevel (test.js:23:2) +(anonymous) (expr.js:0:0) + +(anonymous) (:4:10) +topLevel (test.js:23:2) +(anonymous) (expr.js:0:0) + diff --git a/deps/v8/test/inspector/debugger/continue-to-location-target-call-frames.js b/deps/v8/test/inspector/debugger/continue-to-location-target-call-frames.js new file mode 100644 index 0000000000..c33ff6b93c --- /dev/null +++ b/deps/v8/test/inspector/debugger/continue-to-location-target-call-frames.js @@ -0,0 +1,139 @@ +// 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('Check that continue-to-location works with different strategies.'); + +contextGroup.addScript(` +async function asyncFact(n) { + if (n == 0) return 1; + let r = n * await asyncFact(n - 1); + console.log(r); + return r; +} + +function fact(n) { + if (n == 0) return 1; + let r = n * fact(n - 1); + console.log(r); + return r; +} + +function topLevel() { + eval(` + '`' + ` + var a = 1; + var b = 2; + fact(3); + console.log(a + b); + ` + '`' + `); +} + +//# sourceURL=test.js`, 7, 26); + +session.setupScriptMap(); +InspectorTest.runAsyncTestSuite([ + async function testAwaitAny() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); + Protocol.Debugger.pause(); + Protocol.Runtime.evaluate({expression: 'asyncFact(4)//# sourceURL=expr.js'}); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + let message = await pausedAndDumpStack(); + let location = message.params.callFrames[0].location; + location.lineNumber = 11; + Protocol.Debugger.continueToLocation({location, targetCallFrames: 'any'}); + await pausedAndDumpStack(); + Protocol.Debugger.disable(); + }, + + async function testAwaitCurrent() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); + Protocol.Debugger.pause(); + Protocol.Runtime.evaluate({expression: 'asyncFact(4)//# sourceURL=expr.js'}); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + let message = await pausedAndDumpStack(); + let location = message.params.callFrames[0].location; + location.lineNumber = 11; + Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'}); + await pausedAndDumpStack(); + await Protocol.Debugger.resume(); + Protocol.Debugger.disable(); + }, + + async function testAny() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); + Protocol.Debugger.pause(); + Protocol.Runtime.evaluate({expression: 'fact(4)//# sourceURL=expr.js'}); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + let message = await pausedAndDumpStack(); + let location = message.params.callFrames[0].location; + location.lineNumber = 18; + Protocol.Debugger.continueToLocation({location, targetCallFrames: 'any'}); + await pausedAndDumpStack(); + Protocol.Debugger.disable(); + }, + + async function testCurrent() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); + Protocol.Debugger.pause(); + Protocol.Runtime.evaluate({expression: 'fact(4)//# sourceURL=expr.js'}); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + let message = await pausedAndDumpStack(); + let location = message.params.callFrames[0].location; + location.lineNumber = 18; + Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'}); + await pausedAndDumpStack(); + await Protocol.Debugger.resume(); + Protocol.Debugger.disable(); + }, + + async function testTopLevelAny() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); + Protocol.Debugger.pause(); + Protocol.Runtime.evaluate({expression: 'topLevel()//# sourceURL=expr.js'}); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + let message = await pausedAndDumpStack(); + let location = message.params.callFrames[0].location; + location.lineNumber = 4; + Protocol.Debugger.continueToLocation({location, targetCallFrames: 'any'}); + await pausedAndDumpStack(); + Protocol.Debugger.disable(); + }, + + async function testTopLevelCurrent() { + Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); + Protocol.Debugger.pause(); + Protocol.Runtime.evaluate({expression: 'topLevel()//# sourceURL=expr.js'}); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + await pausedAndDumpStack(); + Protocol.Debugger.stepInto(); + let message = await pausedAndDumpStack(); + let location = message.params.callFrames[0].location; + location.lineNumber = 4; + Protocol.Debugger.continueToLocation({location, targetCallFrames: 'current'}); + await pausedAndDumpStack(); + await Protocol.Debugger.resume(); + Protocol.Debugger.disable(); + } +]); + +async function pausedAndDumpStack() { + let message = await Protocol.Debugger.oncePaused(); + session.logCallFrames(message.params.callFrames); + session.logAsyncStackTrace(message.params.asyncStackTrace); + InspectorTest.log(''); + return message; +} diff --git a/deps/v8/test/inspector/debugger/continue-to-location.js b/deps/v8/test/inspector/debugger/continue-to-location.js index b72c8585e6..878499d1fe 100644 --- a/deps/v8/test/inspector/debugger/continue-to-location.js +++ b/deps/v8/test/inspector/debugger/continue-to-location.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests Debugger.continueToLocation'); + +contextGroup.addScript( `function statementsExample() { var self = arguments.callee; diff --git a/deps/v8/test/inspector/debugger/destory-in-break-program-expected.txt b/deps/v8/test/inspector/debugger/destory-in-break-program-expected.txt new file mode 100644 index 0000000000..c0ce88ecbc --- /dev/null +++ b/deps/v8/test/inspector/debugger/destory-in-break-program-expected.txt @@ -0,0 +1 @@ +Check destroying agent inside of breakProgram diff --git a/deps/v8/test/inspector/debugger/destory-in-break-program.js b/deps/v8/test/inspector/debugger/destory-in-break-program.js new file mode 100644 index 0000000000..e002328aa1 --- /dev/null +++ b/deps/v8/test/inspector/debugger/destory-in-break-program.js @@ -0,0 +1,13 @@ +// 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('Check destroying agent inside of breakProgram'); + +(async function test(){ + await Protocol.Debugger.enable(); + Protocol.Runtime.evaluate({expression: 'inspector.breakProgram(\'\', \'{}\')'}); + await Protocol.Debugger.oncePaused(); + session.disconnect(); + InspectorTest.quitImmediately(); +})(); diff --git a/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js b/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js index 45ca0ee0dd..98c7bf2cff 100644 --- a/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js +++ b/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Check that stepInto at then end of the script go to next user script instead InjectedScriptSource.js.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Check that stepInto at then end of the script go to next user script instead InjectedScriptSource.js.'); (async function test() { - InspectorTest.setupScriptMap(); + session.setupScriptMap(); await Protocol.Debugger.enable(); Protocol.Runtime.evaluate({expression: '(function boo() { setTimeout(() => 239, 0); debugger; })()\n'}); await waitPauseAndDumpLocation(); @@ -22,6 +22,6 @@ InspectorTest.log('Check that stepInto at then end of the script go to next user async function waitPauseAndDumpLocation() { var message = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - InspectorTest.logSourceLocation(message.params.callFrames[0].location); + session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/es6-module-script-parsed.js b/deps/v8/test/inspector/debugger/es6-module-script-parsed.js index e8fd8c69d1..94b623d0e9 100644 --- a/deps/v8/test/inspector/debugger/es6-module-script-parsed.js +++ b/deps/v8/test/inspector/debugger/es6-module-script-parsed.js @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Debugger.scriptParsed and Debugger.scriptFailedToParse with ES6 module'); +let {session, contextGroup, Protocol} = InspectorTest.start('Debugger.scriptParsed and Debugger.scriptFailedToParse with ES6 module'); let moduleSource = ` export function foo() { return 42; }`; -InspectorTest.addModule(moduleSource, 'module1.js'); -InspectorTest.addModule('}', 'module-with-syntax-error-1.js'); +contextGroup.addModule(moduleSource, 'module1.js'); +contextGroup.addModule('}', 'module-with-syntax-error-1.js'); Protocol.Debugger.onScriptParsed(InspectorTest.logMessage); Protocol.Debugger.onScriptFailedToParse(InspectorTest.logMessage); @@ -21,8 +21,8 @@ InspectorTest.runTestSuite([ }, function testScriptEventsWhenDebuggerIsEnabled(next) { - InspectorTest.addModule(moduleSource, 'module2.js'); - InspectorTest.addModule('}', 'module-with-syntax-error-2.js'); - InspectorTest.waitPendingTasks().then(next); + contextGroup.addModule(moduleSource, 'module2.js'); + contextGroup.addModule('}', 'module-with-syntax-error-2.js'); + InspectorTest.waitForPendingTasks().then(next); } ]); diff --git a/deps/v8/test/inspector/debugger/es6-module-set-script-source.js b/deps/v8/test/inspector/debugger/es6-module-set-script-source.js index 5e191ca8a8..81d97b6d78 100644 --- a/deps/v8/test/inspector/debugger/es6-module-set-script-source.js +++ b/deps/v8/test/inspector/debugger/es6-module-set-script-source.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. -InspectorTest.log('Checks that Debugger.setScriptSource doesn\'t crash with modules'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that Debugger.setScriptSource doesn\'t crash with modules'); var module1 = ` export function foo() { @@ -25,9 +25,9 @@ Protocol.Debugger.onScriptParsed(message => { module1Id = message.params.scriptId; }); Protocol.Debugger.enable() - .then(() => InspectorTest.addModule(module1, 'module1')) - .then(() => InspectorTest.addModule(module2, 'module2')) - .then(() => InspectorTest.waitPendingTasks()) + .then(() => contextGroup.addModule(module1, 'module1')) + .then(() => contextGroup.addModule(module2, 'module2')) + .then(() => InspectorTest.waitForPendingTasks()) .then(() => Protocol.Debugger.setScriptSource({ scriptId: module1Id, scriptSource: editedModule1 })) .then(InspectorTest.logMessage) .then(InspectorTest.completeTest); diff --git a/deps/v8/test/inspector/debugger/eval-scopes-expected.txt b/deps/v8/test/inspector/debugger/eval-scopes-expected.txt index af27f113ec..71d6618c8e 100644 --- a/deps/v8/test/inspector/debugger/eval-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/eval-scopes-expected.txt @@ -1,3 +1,4 @@ +Tests that variables introduced in eval scopes are accessible { id : result : { @@ -16,4 +17,4 @@ } ] } -} \ No newline at end of file +} diff --git a/deps/v8/test/inspector/debugger/eval-scopes.js b/deps/v8/test/inspector/debugger/eval-scopes.js index 46e0c4b5a7..e5a0f131b4 100644 --- a/deps/v8/test/inspector/debugger/eval-scopes.js +++ b/deps/v8/test/inspector/debugger/eval-scopes.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that variables introduced in eval scopes are accessible'); + +contextGroup.addScript( `function testNonEmptyEvalScope() { eval("'use strict'; var hest = 420; debugger;"); } diff --git a/deps/v8/test/inspector/debugger/framework-break-expected.txt b/deps/v8/test/inspector/debugger/framework-break-expected.txt index 4339645cc8..e858e836e8 100644 --- a/deps/v8/test/inspector/debugger/framework-break-expected.txt +++ b/deps/v8/test/inspector/debugger/framework-break-expected.txt @@ -43,13 +43,13 @@ Running test: testDebuggerStatement Running test: testSyncDOMBreakpoint > all frames in framework: > mixed, top frame in framework: -syncDOMBreakpoint (framework.js:33:2) +syncDOMBreakpoint (framework.js:33:12) (anonymous) (user.js:0:0) Running test: testSyncDOMBreakpointWithInlinedUserFrame > mixed, top frame in framework: -syncDOMBreakpoint (framework.js:33:2) +syncDOMBreakpoint (framework.js:33:12) userFunction (user.js:70:2) inlinedWrapper (framework.js:64:4) syncDOMBreakpointWithInlinedUserFrame (framework.js:67:2) diff --git a/deps/v8/test/inspector/debugger/framework-break.js b/deps/v8/test/inspector/debugger/framework-break.js index 1566c264a2..9b9fee6f3e 100644 --- a/deps/v8/test/inspector/debugger/framework-break.js +++ b/deps/v8/test/inspector/debugger/framework-break.js @@ -3,9 +3,9 @@ // found in the LICENSE file. // Flags: --allow-natives-syntax -InspectorTest.log('Checks that breaks in framework code correctly processed.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that breaks in framework code correctly processed.'); -InspectorTest.addScript(` +contextGroup.addScript(` function frameworkAssert() { console.assert(false); } @@ -30,7 +30,7 @@ function debuggerStatement() { } function syncDOMBreakpoint() { - breakProgram('', ''); + inspector.breakProgram('', ''); } function asyncDOMBreakpoint() { @@ -69,7 +69,7 @@ function syncDOMBreakpointWithInlinedUserFrame() { //# sourceURL=framework.js`, 8, 26); -InspectorTest.addScript(` +contextGroup.addScript(` function throwUserException() { throw new Error(); } @@ -80,9 +80,9 @@ function userFunction() { //# sourceURL=user.js`, 64, 26) -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); InspectorTest.log(''); Protocol.Debugger.resume(); }); @@ -188,16 +188,16 @@ InspectorTest.runTestSuite([ }, function testAsyncDOMBreakpoint(next) { - utils.schedulePauseOnNextStatement('', ''); + contextGroup.schedulePauseOnNextStatement('', ''); InspectorTest.log('> all frames in framework:'); Protocol.Runtime .evaluate( {expression: 'asyncDOMBreakpoint()//# sourceURL=framework.js'}) - .then(() => utils.cancelPauseOnNextStatement()) + .then(() => contextGroup.cancelPauseOnNextStatement()) .then( () => Protocol.Runtime.evaluate( {expression: '42//# sourceURL=user.js'})) - .then(() => utils.schedulePauseOnNextStatement('', '')) + .then(() => contextGroup.schedulePauseOnNextStatement('', '')) .then( () => Protocol.Runtime.evaluate( {expression: 'asyncDOMBreakpoint()//# sourceURL=user.js'})) diff --git a/deps/v8/test/inspector/debugger/framework-nested-scheduled-break-expected.txt b/deps/v8/test/inspector/debugger/framework-nested-scheduled-break-expected.txt index a7ab22229e..f9901f099b 100644 --- a/deps/v8/test/inspector/debugger/framework-nested-scheduled-break-expected.txt +++ b/deps/v8/test/inspector/debugger/framework-nested-scheduled-break-expected.txt @@ -3,10 +3,10 @@ break reason: framework-break break aux data: { "data": "data for framework-break" } -doFrameworkBreak (framework.js:20:2) -doFrameworkWork (framework.js:15:2) -frameworkCall (framework.js:9:2) -testFunction (user.js:27:2) +doFrameworkBreak (framework.js:20:12) +doFrameworkWork (framework.js:15:12) +frameworkCall (framework.js:9:12) +testFunction (user.js:27:12) (anonymous) (expr.js:0:0) break reason: ambiguous @@ -25,17 +25,17 @@ break aux data: { } callback (user.js:31:17) doFrameworkWork (framework.js:16:2) -frameworkCall (framework.js:9:2) -testFunction (user.js:27:2) +frameworkCall (framework.js:9:12) +testFunction (user.js:27:12) (anonymous) (expr.js:0:0) break reason: user-break break aux data: { "data": "data for user-break" } -callback (user.js:32:2) +callback (user.js:32:12) doFrameworkWork (framework.js:16:2) -frameworkCall (framework.js:9:2) -testFunction (user.js:27:2) +frameworkCall (framework.js:9:12) +testFunction (user.js:27:12) (anonymous) (expr.js:0:0) diff --git a/deps/v8/test/inspector/debugger/framework-nested-scheduled-break.js b/deps/v8/test/inspector/debugger/framework-nested-scheduled-break.js index bb1e47199c..3e6299154d 100644 --- a/deps/v8/test/inspector/debugger/framework-nested-scheduled-break.js +++ b/deps/v8/test/inspector/debugger/framework-nested-scheduled-break.js @@ -2,44 +2,44 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks nested scheduled break in framework code.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks nested scheduled break in framework code.'); -InspectorTest.addScript(` +contextGroup.addScript(` function frameworkCall(callback) { - callWithScheduledBreak(doFrameworkWork.bind(null, callback), + inspector.callWithScheduledBreak(doFrameworkWork.bind(null, callback), 'top-framework-scheduled-break', JSON.stringify({ data: 'data for top-framework-scheduled-break' })); } function doFrameworkWork(callback) { - callWithScheduledBreak(doFrameworkBreak, 'should-not-be-a-reason', ''); + inspector.callWithScheduledBreak(doFrameworkBreak, 'should-not-be-a-reason', ''); callback(); } function doFrameworkBreak() { - breakProgram('framework-break', JSON.stringify({ data: 'data for framework-break' })); + inspector.breakProgram('framework-break', JSON.stringify({ data: 'data for framework-break' })); } //# sourceURL=framework.js`, 7, 26); -InspectorTest.addScript(` +contextGroup.addScript(` function testFunction() { - callWithScheduledBreak(frameworkCall.bind(null, callback), + inspector.callWithScheduledBreak(frameworkCall.bind(null, callback), 'top-scheduled-break', ''); } function callback() { - breakProgram('user-break', JSON.stringify({ data: 'data for user-break' })); + inspector.breakProgram('user-break', JSON.stringify({ data: 'data for user-break' })); return 42; } //# sourceURL=user.js`, 25, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { InspectorTest.log('break reason: ' + message.params.reason); InspectorTest.log('break aux data: ' + JSON.stringify(message.params.data || {}, null, ' ')); - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); InspectorTest.log(''); Protocol.Debugger.resume(); }); diff --git a/deps/v8/test/inspector/debugger/framework-precise-ranges.js b/deps/v8/test/inspector/debugger/framework-precise-ranges.js index 3b23cf50df..4f76033a96 100644 --- a/deps/v8/test/inspector/debugger/framework-precise-ranges.js +++ b/deps/v8/test/inspector/debugger/framework-precise-ranges.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks framework debugging with blackboxed ranges.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks framework debugging with blackboxed ranges.'); -InspectorTest.addScript( +contextGroup.addScript( ` function foo() { return boo(); @@ -18,9 +18,9 @@ function testFunction() { //# sourceURL=test.js`, 7, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); InspectorTest.log(''); Protocol.Debugger.stepInto(); }); @@ -64,7 +64,7 @@ var testSuite = [ ]; function testPositions(positions) { - utils.schedulePauseOnNextStatement('', ''); + contextGroup.schedulePauseOnNextStatement('', ''); return Protocol.Debugger .setBlackboxedRanges({scriptId: scriptId, positions: positions}) .then(InspectorTest.logMessage) diff --git a/deps/v8/test/inspector/debugger/framework-stepping-expected.txt b/deps/v8/test/inspector/debugger/framework-stepping-expected.txt index aee4bf3eaf..fa2bb35f5a 100644 --- a/deps/v8/test/inspector/debugger/framework-stepping-expected.txt +++ b/deps/v8/test/inspector/debugger/framework-stepping-expected.txt @@ -67,7 +67,7 @@ testStepFromUser (user.js:31:2) Executing resume... Running test: testStepIntoFromFramework -frameworkBreakAndCall (framework.js:14:2) +frameworkBreakAndCall (framework.js:14:12) testStepFromFramework (user.js:35:2) (anonymous) (expr.js:0:0) @@ -80,7 +80,7 @@ testStepFromFramework (user.js:35:2) Executing resume... Running test: testStepOverFromFramework -frameworkBreakAndCall (framework.js:14:2) +frameworkBreakAndCall (framework.js:14:12) testStepFromFramework (user.js:35:2) (anonymous) (expr.js:0:0) @@ -91,7 +91,7 @@ testStepFromFramework (user.js:36:0) Executing resume... Running test: testStepOutFromFramework -frameworkBreakAndCall (framework.js:14:2) +frameworkBreakAndCall (framework.js:14:12) testStepFromFramework (user.js:35:2) (anonymous) (expr.js:0:0) diff --git a/deps/v8/test/inspector/debugger/framework-stepping.js b/deps/v8/test/inspector/debugger/framework-stepping.js index 6c6ae9caa0..f91c06ba52 100644 --- a/deps/v8/test/inspector/debugger/framework-stepping.js +++ b/deps/v8/test/inspector/debugger/framework-stepping.js @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks stepping with blackboxed frames on stack'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks stepping with blackboxed frames on stack'); -InspectorTest.addScript( +contextGroup.addScript( ` function frameworkCall(funcs) { for (var f of funcs) f(); } function frameworkBreakAndCall(funcs) { - breakProgram('', ''); + inspector.breakProgram('', ''); for (var f of funcs) f(); } //# sourceURL=framework.js`, 8, 4); -InspectorTest.addScript( +contextGroup.addScript( ` function userFoo() { return 1; @@ -37,7 +37,7 @@ function testStepFromFramework() { //# sourceURL=user.js`, 21, 4); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.enable() .then( @@ -47,7 +47,7 @@ Protocol.Debugger.enable() var testSuite = [ function testStepIntoFromUser(next) { - utils.schedulePauseOnNextStatement('', ''); + contextGroup.schedulePauseOnNextStatement('', ''); test('testStepFromUser()', [ 'print', // before testStepFromUser call 'stepInto', 'stepInto', 'print', // userFoo @@ -57,7 +57,7 @@ var testSuite = [ }, function testStepOverFromUser(next) { - utils.schedulePauseOnNextStatement('', ''); + contextGroup.schedulePauseOnNextStatement('', ''); test('testStepFromUser()', [ 'print', // before testStepFromUser call 'stepInto', 'stepInto', 'print', // userFoo @@ -67,7 +67,7 @@ var testSuite = [ }, function testStepOutFromUser(next) { - utils.schedulePauseOnNextStatement('', ''); + contextGroup.schedulePauseOnNextStatement('', ''); test('testStepFromUser()', [ 'print', // before testStepFromUser call 'stepInto', 'stepInto', 'print', // userFoo @@ -101,7 +101,7 @@ function test(entryExpression, actions) { Protocol.Debugger.onPaused(message => { var action = actions.shift() || 'resume'; if (action === 'print') { - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); InspectorTest.log(''); action = actions.shift() || 'resume'; } diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal-expected.txt index eff9225d66..c5d8c2466c 100644 --- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal-expected.txt +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal-expected.txt @@ -1,3 +1,4 @@ +Tests possible breakpoints in array literal { id : result : { diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal.js index 13e2920cc7..a5aeeff34b 100644 --- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal.js +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-array-literal.js @@ -2,6 +2,8 @@ // 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 possible breakpoints in array literal'); + Protocol.Debugger.enable(); Protocol.Debugger.onceScriptParsed().then(message => message.params.scriptId) @@ -9,4 +11,4 @@ Protocol.Debugger.onceScriptParsed().then(message => message.params.scriptId) .then(InspectorTest.logMessage) .then(InspectorTest.completeTest); -InspectorTest.addScript("() => []"); +contextGroup.addScript("() => []"); diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt new file mode 100644 index 0000000000..9c65ba2325 --- /dev/null +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error-expected.txt @@ -0,0 +1,26 @@ +getPossibleBreakpoints should not crash during lazy compilation (crbug.com/715334) +{ + method : Debugger.scriptParsed + params : { + endColumn : 21 + endLine : 2 + executionContextId : + hasSourceURL : true + hash : FA2A959297747012766FE9C5006E7F522D88FA72 + isLiveEdit : false + isModule : false + length : 52 + scriptId : + sourceMapURL : + startColumn : 0 + startLine : 0 + url : test.js + } +} +{ + id : + result : { + locations : [ + ] + } +} diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error.js new file mode 100644 index 0000000000..d1326e967f --- /dev/null +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-lazy-error.js @@ -0,0 +1,28 @@ +// 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('getPossibleBreakpoints should not crash during lazy compilation (crbug.com/715334)'); + +contextGroup.addScript(` +function test() { continue; } +//# sourceURL=test.js`); + +(async function test() { + Protocol.Debugger.enable(); + let script = await Protocol.Debugger.onceScriptParsed(); + InspectorTest.logMessage(script); + let scriptId = script.params.scriptId; + Protocol.Debugger.onScriptFailedToParse(msg => { + InspectorTest.logMessage(msg); + if (msg.params.scriptId !== script.params.scriptId) { + InspectorTest.log('Failed script to parse event has different scriptId'); + } else { + InspectorTest.log('One script is reported twice'); + } + }); + let response = await Protocol.Debugger.getPossibleBreakpoints({ + start: {scriptId, lineNumber: 0, columnNumber: 0}}); + InspectorTest.logMessage(response); + InspectorTest.completeTest(); +})(); 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 7a118e6c3d..d83a4aa137 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 @@ -183,7 +183,7 @@ function testCaughtException() { |R|} function testClasses() { - |_|class Cat { + class Cat { constructor(name) { |_|this.name = name; |R|} @@ -191,7 +191,7 @@ function testClasses() { speak() { |R|} } - |_|class Lion extends Cat { + class Lion extends Cat { constructor(name) { |C|super(name); |R|} @@ -204,17 +204,17 @@ function testClasses() { |R|} async function asyncFoo() { - |_|await Promise.resolve().then(v => v |_|* 2|R|); + |_|await Promise.|C|resolve().|C|then(v => v |_|* 2|R|); |C|return42(); |_|await |C|asyncBoo(); |R|} async function asyncBoo() { - |_|await Promise.resolve(); + |_|await Promise.|C|resolve(); |R|} async function testAsyncAwait() { - |_|await asyncFoo(); + |_|await |C|asyncFoo(); |_|await |C|awaitBoo(); |R|} @@ -247,7 +247,7 @@ async function testPromiseComplex() { var testPromise = |C|new Promise(resolve => nextTest |_|= resolve|R|); async function main() { async function foo() { - |_|await Promise.resolve(); + |_|await Promise.|C|resolve(); |_|return 42; |R|} var x = |_|1; 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 482f68f87f..07f90e7a25 100644 --- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-master.js @@ -4,10 +4,10 @@ // Flags: --turbo -InspectorTest.log('Checks Debugger.getPossibleBreakpoints'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks Debugger.getPossibleBreakpoints'); var source = utils.read('test/inspector/debugger/resources/break-locations.js'); -InspectorTest.addScript(source); +contextGroup.addScript(source); Protocol.Debugger.onceScriptParsed() .then(message => Protocol.Debugger.getPossibleBreakpoints({ start: { lineNumber: 0, columnNumber : 0, scriptId: message.params.scriptId }})) 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 f5020eb64b..27c65fe290 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 @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks Debugger.getPossibleBreakpoints with ignoreNestedFunctions'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks Debugger.getPossibleBreakpoints with ignoreNestedFunctions'); var source = ` function test() { @@ -17,7 +17,7 @@ function test() { nested2(); } //# sourceURL=test.js`; -InspectorTest.addScript(source); +contextGroup.addScript(source); var scriptId; Protocol.Debugger.onceScriptParsed().then(message => { @@ -25,7 +25,7 @@ Protocol.Debugger.onceScriptParsed().then(message => { scriptId = message.params.scriptId; }).then(() => InspectorTest.runTestSuite(tests)); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(dumpBreakLocationInSourceAndResume); Protocol.Debugger.enable(); @@ -103,7 +103,7 @@ function dumpAllLocations(message) { } function dumpBreakLocationInSourceAndResume(message) { - InspectorTest.logCallFrames([ message.params.callFrames[0] ]); + session.logCallFrames([ message.params.callFrames[0] ]); var location = message.params.callFrames[0].location; var sourceLines = source.split('\n') diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints.js index ef996e910b..3232d59574 100644 --- a/deps/v8/test/inspector/debugger/get-possible-breakpoints.js +++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints.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. -InspectorTest.log('Test for Debugger.getPossibleBreakpoints'); +let {session, contextGroup, Protocol} = InspectorTest.start('Test for Debugger.getPossibleBreakpoints'); Protocol.Runtime.enable(); Protocol.Debugger.enable(); @@ -153,7 +153,7 @@ function foo6() { Promise.resolve().then(() => 42) }`; function compileScript(source, origin) { var promise = Protocol.Debugger.onceScriptParsed().then(message => message.params.scriptId); if (!origin) origin = { name: '', line_offset: 0, column_offset: 0 }; - utils.compileAndRunWithOrigin(source, origin.name, origin.line_offset, origin.column_offset, false); + contextGroup.addScript(source, origin.line_offset, origin.column_offset, origin.name); return promise; } diff --git a/deps/v8/test/inspector/debugger/inspector-break-api-expected.txt b/deps/v8/test/inspector/debugger/inspector-break-api-expected.txt index f3b019d058..1677b5923a 100644 --- a/deps/v8/test/inspector/debugger/inspector-break-api-expected.txt +++ b/deps/v8/test/inspector/debugger/inspector-break-api-expected.txt @@ -2,7 +2,7 @@ Checks breakProgram,(schedule|cancel)PauseOnNextStatement test API Running test: testBreakProgram Stack: -callBreakProgram (:9:2) +callBreakProgram (:9:12) (anonymous) (:0:0) Other data: { diff --git a/deps/v8/test/inspector/debugger/inspector-break-api.js b/deps/v8/test/inspector/debugger/inspector-break-api.js index 009bf717a4..dc39924200 100644 --- a/deps/v8/test/inspector/debugger/inspector-break-api.js +++ b/deps/v8/test/inspector/debugger/inspector-break-api.js @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log("Checks breakProgram,(schedule|cancel)PauseOnNextStatement test API"); +let {session, contextGroup, Protocol} = InspectorTest.start("Checks breakProgram,(schedule|cancel)PauseOnNextStatement test API"); -InspectorTest.addScript(` +contextGroup.addScript(` function callBreakProgram() { - breakProgram('reason', JSON.stringify({a: 42})); + inspector.breakProgram('reason', JSON.stringify({a: 42})); } function foo() { return 42; }`, 7, 26); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { InspectorTest.log('Stack:'); - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); delete message.params.callFrames; InspectorTest.log('Other data:'); InspectorTest.logMessage(message); @@ -33,17 +33,17 @@ InspectorTest.runTestSuite([ }, function testSchedulePauseOnNextStatement(next) { - utils.schedulePauseOnNextStatement('reason', JSON.stringify({a: 42})); + contextGroup.schedulePauseOnNextStatement('reason', JSON.stringify({a: 42})); Protocol.Runtime.evaluate({ expression: 'foo()//# sourceURL=expr1.js'}) .then(() => Protocol.Runtime.evaluate({ expression: 'foo()//# sourceURL=expr2.js'})) - .then(() => utils.cancelPauseOnNextStatement()) + .then(() => contextGroup.cancelPauseOnNextStatement()) .then(next); }, function testCancelPauseOnNextStatement(next) { - utils.schedulePauseOnNextStatement('reason', JSON.stringify({a: 42})); - utils.cancelPauseOnNextStatement(); + contextGroup.schedulePauseOnNextStatement('reason', JSON.stringify({a: 42})); + contextGroup.cancelPauseOnNextStatement(); Protocol.Runtime.evaluate({ expression: 'foo()'}) .then(next); } diff --git a/deps/v8/test/inspector/debugger/max-async-call-chain-depth-expected.txt b/deps/v8/test/inspector/debugger/max-async-call-chain-depth-expected.txt new file mode 100644 index 0000000000..0c421da607 --- /dev/null +++ b/deps/v8/test/inspector/debugger/max-async-call-chain-depth-expected.txt @@ -0,0 +1,91 @@ +Checks that we trim async call chains correctly. +set async chain depth to 8 + +Running test: testDebuggerPaused +Run expression 'debugger;' with async chain len: 4 +actual async chain len: 1 +Run expression 'debugger;' with async chain len: 8 +actual async chain len: 1 +Run expression 'debugger;' with async chain len: 9 +actual async chain len: 1 +Run expression 'debugger;' with async chain len: 32 +actual async chain len: 1 + +Running test: testConsoleTrace +Run expression 'console.trace(42);' with async chain len: 4 +actual async chain len: 1 +Run expression 'console.trace(42);' with async chain len: 8 +actual async chain len: 1 +Run expression 'console.trace(42);' with async chain len: 9 +actual async chain len: 1 +Run expression 'console.trace(42);' with async chain len: 32 +actual async chain len: 1 + +Running test: testDebuggerPausedSetTimeout +Run expression 'debugger;' with async chain len: 4 +actual async chain len: 4 +Run expression 'debugger;' with async chain len: 8 +actual async chain len: 8 +Run expression 'debugger;' with async chain len: 9 +actual async chain len: 8 +Run expression 'debugger;' with async chain len: 32 +actual async chain len: 8 + +Running test: testConsoleTraceSetTimeout +Run expression 'console.trace(42);' with async chain len: 4 +actual async chain len: 4 +Run expression 'console.trace(42);' with async chain len: 8 +actual async chain len: 8 +Run expression 'console.trace(42);' with async chain len: 9 +actual async chain len: 8 +Run expression 'console.trace(42);' with async chain len: 32 +actual async chain len: 8 + +Running test: testConsoleTraceWithEmptySync +{ + callFrames : [ + [0] : { + columnNumber : 66 + functionName : Promise.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 47 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + description : Promise.resolve + } +} + +Running test: testDebuggerPausedThenableJob +Run expression 'debugger;' with async chain len: 4 +actual async chain len: 1 +Run expression 'debugger;' with async chain len: 8 +actual async chain len: 1 +Run expression 'debugger;' with async chain len: 9 +actual async chain len: 1 +Run expression 'debugger;' with async chain len: 32 +actual async chain len: 1 + +Running test: testConsoleTraceThenableJob +Run expression 'console.trace(42);' with async chain len: 4 +actual async chain len: 1 +Run expression 'console.trace(42);' with async chain len: 8 +actual async chain len: 1 +Run expression 'console.trace(42);' with async chain len: 9 +actual async chain len: 1 +Run expression 'console.trace(42);' with async chain len: 32 +actual async chain len: 1 + +Running test: twoConsoleAssert +actual async chain len: 1 +actual async chain len: 2 diff --git a/deps/v8/test/inspector/debugger/max-async-call-chain-depth.js b/deps/v8/test/inspector/debugger/max-async-call-chain-depth.js new file mode 100644 index 0000000000..ae98f55037 --- /dev/null +++ b/deps/v8/test/inspector/debugger/max-async-call-chain-depth.js @@ -0,0 +1,162 @@ +// 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. + +// TODO(kozyatinskiy): fix or remove it later. +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we trim async call chains correctly.'); + +Protocol.Debugger.enable(); +InspectorTest.log('set async chain depth to 8'); +Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 8}); +InspectorTest.runAsyncTestSuite([ + async function testDebuggerPaused() { + runWithAsyncChain(4, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithAsyncChain(8, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithAsyncChain(9, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithAsyncChain(32, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + }, + + async function testConsoleTrace() { + Protocol.Runtime.enable(); + runWithAsyncChain(4, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithAsyncChain(8, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithAsyncChain(9, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithAsyncChain(32, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function testDebuggerPausedSetTimeout() { + runWithAsyncChainSetTimeout(4, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithAsyncChainSetTimeout(8, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithAsyncChainSetTimeout(9, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithAsyncChainSetTimeout(32, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + }, + + async function testConsoleTraceSetTimeout() { + runWithAsyncChainSetTimeout(4, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithAsyncChainSetTimeout(8, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithAsyncChainSetTimeout(9, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithAsyncChainSetTimeout(32, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function testConsoleTraceWithEmptySync() { + Protocol.Runtime.evaluate({ + expression: 'new Promise(resolve => setTimeout(resolve, 0)).then(() => console.trace(42))' + }); + InspectorTest.logMessage((await Protocol.Runtime.onceConsoleAPICalled()).params.stackTrace); + }, + + async function testDebuggerPausedThenableJob() { + runWithThenableJob(4, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithThenableJob(8, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithThenableJob(9, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + + runWithThenableJob(32, 'debugger;'); + dumpAsyncChainLength(await Protocol.Debugger.oncePaused()); + await Protocol.Debugger.resume(); + }, + + async function testConsoleTraceThenableJob() { + runWithThenableJob(4, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithThenableJob(8, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithThenableJob(9, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + + runWithThenableJob(32, 'console.trace(42);'); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + }, + + async function twoConsoleAssert() { + Protocol.Runtime.evaluate({ + expression: 'setTimeout(' + + 'setTimeout.bind(null, ' + + 'setTimeout.bind(null, () => { console.assert(); setTimeout(console.assert, 0) }, 0), 0), 0)' + }); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + dumpAsyncChainLength(await Protocol.Runtime.onceConsoleAPICalled()); + } +]); + +function runWithAsyncChain(len, source) { + InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); + let then = '.then(() => 1)'; + let pause = `.then(() => { ${source} })`; + Protocol.Runtime.evaluate({ + expression: `Promise.resolve()${then.repeat(len - 1)}${pause}` + }); +} + +function runWithAsyncChainSetTimeout(len, source) { + InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); + let setTimeout = 'setTimeout(() => {'; + let suffix = '}, 0)'; + Protocol.Runtime.evaluate({ + expression: `${setTimeout.repeat(len)}${source}${suffix.repeat(len)}` + }); +} + +function runWithThenableJob(len, source) { + InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); + let then = '.then(Promise.resolve.bind(Promise, 0))'; + let pause = `.then(() => { ${source} })`; + Protocol.Runtime.evaluate({ + expression: `Promise.resolve()${then.repeat(len - 1)}${pause}` + }); +} + +function dumpAsyncChainLength(message) { + let stackTrace = message.params.asyncStackTrace || message.params.stackTrace.parent; + let asyncChainCount = 0; + while (stackTrace) { + ++asyncChainCount; + stackTrace = stackTrace.parent; + } + InspectorTest.log(`actual async chain len: ${asyncChainCount}`); +} diff --git a/deps/v8/test/inspector/debugger/object-preview-internal-properties.js b/deps/v8/test/inspector/debugger/object-preview-internal-properties.js index 78d4d8326e..442ca8149a 100644 --- a/deps/v8/test/inspector/debugger/object-preview-internal-properties.js +++ b/deps/v8/test/inspector/debugger/object-preview-internal-properties.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. -InspectorTest.log("Check internal properties reported in object preview."); +let {session, contextGroup, Protocol} = InspectorTest.start("Check internal properties reported in object preview."); Protocol.Debugger.enable(); Protocol.Runtime.enable(); diff --git a/deps/v8/test/inspector/debugger/pause-expected.txt b/deps/v8/test/inspector/debugger/pause-expected.txt index 29b7e14082..a51bc8d0bc 100644 --- a/deps/v8/test/inspector/debugger/pause-expected.txt +++ b/deps/v8/test/inspector/debugger/pause-expected.txt @@ -19,6 +19,9 @@ Running test: testSkipOtherContext2 paused at: #var a = 239; +paused at: +var a = #239; + Running test: testWithNativeBreakpoint paused at: diff --git a/deps/v8/test/inspector/debugger/pause-on-oom.js b/deps/v8/test/inspector/debugger/pause-on-oom.js index e36d251b26..fe5d61b492 100644 --- a/deps/v8/test/inspector/debugger/pause-on-oom.js +++ b/deps/v8/test/inspector/debugger/pause-on-oom.js @@ -4,9 +4,9 @@ // Flags: --max-old-space-size=8 -InspectorTest.log('Check pause on OOM'); +let {session, contextGroup, Protocol} = InspectorTest.start('Check pause on OOM'); -InspectorTest.addScript(` +contextGroup.addScript(` var arr = []; var stop = false; function generateGarbage() { diff --git a/deps/v8/test/inspector/debugger/pause.js b/deps/v8/test/inspector/debugger/pause.js index 33f76f9dce..33ebeb830c 100644 --- a/deps/v8/test/inspector/debugger/pause.js +++ b/deps/v8/test/inspector/debugger/pause.js @@ -3,87 +3,99 @@ // found in the LICENSE file. InspectorTest.log('Checks Debugger.pause'); +let contextGroup1 = new InspectorTest.ContextGroup(); +let session1 = contextGroup1.connect(); +let Protocol1 = session1.Protocol; -InspectorTest.setupScriptMap(); -Protocol.Debugger.enable(); +session1.setupScriptMap(); +Protocol1.Debugger.enable(); InspectorTest.runAsyncTestSuite([ async function testPause() { - Protocol.Debugger.pause(); - Protocol.Runtime.evaluate({expression: 'var a = 42;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); + Protocol1.Debugger.pause(); + Protocol1.Runtime.evaluate({expression: 'var a = 42;'}); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); }, async function testSkipFrameworks() { - Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); - Protocol.Debugger.pause(); - Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'}); - Protocol.Runtime.evaluate({expression: 'var a = 239;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); + Protocol1.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); + Protocol1.Debugger.pause(); + Protocol1.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'}); + Protocol1.Runtime.evaluate({expression: 'var a = 239;'}); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); }, async function testSkipOtherContext1() { - let contextGroupId = utils.createContextGroup(); - Protocol.Debugger.enable({}, contextGroupId); - Protocol.Debugger.pause(); - Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'}); - Protocol.Runtime.evaluate({expression: 'var a = 239;'}, contextGroupId); - Protocol.Runtime.evaluate({expression: 'var a = 1;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); - await Protocol.Debugger.disable({}, contextGroupId); + let contextGroup2 = new InspectorTest.ContextGroup(); + let session2 = contextGroup2.connect(); + let Protocol2 = session2.Protocol; + Protocol2.Debugger.enable({}); + Protocol1.Debugger.pause(); + Protocol1.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'}); + Protocol2.Runtime.evaluate({expression: 'var a = 239;'}); + Protocol1.Runtime.evaluate({expression: 'var a = 1;'}); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); + await Protocol2.Debugger.disable({}); }, async function testSkipOtherContext2() { - let contextGroupId = utils.createContextGroup(); - Protocol.Debugger.enable({}, contextGroupId); - Protocol.Debugger.pause({}, contextGroupId); - Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'}); - Protocol.Runtime.evaluate({expression: 'var a = 239;'}, contextGroupId); - Protocol.Runtime.evaluate({expression: 'var a = 1;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); - await Protocol.Debugger.disable({}, contextGroupId); + let contextGroup2 = new InspectorTest.ContextGroup(); + let session2 = contextGroup2.connect(); + let Protocol2 = session2.Protocol; + session2.setupScriptMap(); + Protocol2.Debugger.enable({}); + Protocol2.Debugger.pause({}); + Protocol1.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'}); + Protocol2.Runtime.evaluate({expression: 'var a = 239;'}); + Protocol1.Runtime.evaluate({expression: 'var a = 1;'}); + await waitPauseAndDumpLocation(session2); + // should not resume pause from different context group id. + Protocol1.Debugger.resume(); + Protocol2.Debugger.stepOver({}); + await waitPauseAndDumpLocation(session2); + await Protocol2.Debugger.resume({}); + await Protocol2.Debugger.disable({}); }, async function testWithNativeBreakpoint() { - utils.schedulePauseOnNextStatement('', ''); - await Protocol.Debugger.pause(); - utils.cancelPauseOnNextStatement(); - Protocol.Runtime.evaluate({expression: 'var a = 42;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); + contextGroup1.schedulePauseOnNextStatement('', ''); + await Protocol1.Debugger.pause(); + contextGroup1.cancelPauseOnNextStatement(); + Protocol1.Runtime.evaluate({expression: 'var a = 42;'}); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); - await Protocol.Debugger.pause(); - utils.schedulePauseOnNextStatement('', ''); - utils.cancelPauseOnNextStatement(); - Protocol.Runtime.evaluate({expression: 'var a = 42;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); + await Protocol1.Debugger.pause(); + contextGroup1.schedulePauseOnNextStatement('', ''); + contextGroup1.cancelPauseOnNextStatement(); + Protocol1.Runtime.evaluate({expression: 'var a = 42;'}); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); - utils.schedulePauseOnNextStatement('', ''); - utils.cancelPauseOnNextStatement(); - await Protocol.Debugger.pause(); - Protocol.Runtime.evaluate({expression: 'var a = 42;'}); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); + contextGroup1.schedulePauseOnNextStatement('', ''); + contextGroup1.cancelPauseOnNextStatement(); + await Protocol1.Debugger.pause(); + Protocol1.Runtime.evaluate({expression: 'var a = 42;'}); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); }, async function testDisableBreaksShouldCancelPause() { - await Protocol.Debugger.pause(); - await Protocol.Debugger.setBreakpointsActive({active: false}); - Protocol.Runtime.evaluate({expression: 'var a = 42;'}) - .then(() => Protocol.Debugger.setBreakpointsActive({active: true})) - .then(() => Protocol.Runtime.evaluate({expression: 'debugger'})); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.resume(); + await Protocol1.Debugger.pause(); + await Protocol1.Debugger.setBreakpointsActive({active: false}); + Protocol1.Runtime.evaluate({expression: 'var a = 42;'}) + .then(() => Protocol1.Debugger.setBreakpointsActive({active: true})) + .then(() => Protocol1.Runtime.evaluate({expression: 'debugger'})); + await waitPauseAndDumpLocation(session1); + await Protocol1.Debugger.resume(); } ]); -async function waitPauseAndDumpLocation() { - var message = await Protocol.Debugger.oncePaused(); +async function waitPauseAndDumpLocation(session) { + var message = await session.Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - await InspectorTest.logSourceLocation(message.params.callFrames[0].location); + await session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit-expected.txt b/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit-expected.txt new file mode 100644 index 0000000000..57357ab15a --- /dev/null +++ b/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit-expected.txt @@ -0,0 +1,235 @@ +Tests how async promise chains behave when reaching the limit of stacks +Checks correctness of promise chains when limit hit +inspector.setMaxAsyncTaskStacks(3) +Run expression 'console.trace()' with async chain len: 3 +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : console.trace + } + ] + executionContextId : + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 67 + functionName : Promise.resolve.then.then.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 46 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + } + } + timestamp : + type : trace + } +} +inspector.setMaxAsyncTaskStacks(4) +Run expression 'console.trace()' with async chain len: 3 +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : console.trace + } + ] + executionContextId : + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 67 + functionName : Promise.resolve.then.then.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 46 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + description : Promise.resolve + } + } + timestamp : + type : trace + } +} +inspector.setMaxAsyncTaskStacks(5) +Run expression 'console.trace()' with async chain len: 3 +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : console.trace + } + ] + executionContextId : + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 67 + functionName : Promise.resolve.then.then.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 46 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + description : Promise.resolve + } + } + timestamp : + type : trace + } +} +inspector.setMaxAsyncTaskStacks(6) +Run expression 'console.trace()' with async chain len: 3 +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : console.trace + } + ] + executionContextId : + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 67 + functionName : Promise.resolve.then.then.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 46 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + description : Promise.resolve + } + } + timestamp : + type : trace + } +} +inspector.setMaxAsyncTaskStacks(7) +Run expression 'console.trace()' with async chain len: 3 +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : console.trace + } + ] + executionContextId : + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 67 + functionName : Promise.resolve.then.then.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 46 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + description : Promise.resolve + } + } + timestamp : + type : trace + } +} +inspector.setMaxAsyncTaskStacks(8) +Run expression 'console.trace()' with async chain len: 3 +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : console.trace + } + ] + executionContextId : + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 67 + functionName : Promise.resolve.then.then.then + lineNumber : 0 + scriptId : + url : + } + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 46 + functionName : + lineNumber : 0 + scriptId : + url : + } + ] + description : Promise.resolve + } + } + timestamp : + type : trace + } +} diff --git a/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js b/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.js new file mode 100644 index 0000000000..072af732c4 --- /dev/null +++ b/deps/v8/test/inspector/debugger/promise-chain-when-limit-hit.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. + +// TODO(kozyatinskiy): fix or remove it later. +let {session, contextGroup, Protocol} = InspectorTest.start('Tests how async promise chains behave when reaching the limit of stacks'); + +(async function test(){ + InspectorTest.log('Checks correctness of promise chains when limit hit'); + await Protocol.Runtime.enable(); + await Protocol.Debugger.enable(); + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: 128}); + + await setMaxAsyncTaskStacks(3); + runWithAsyncChainPromise(3, 'console.trace()'); + InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(4); + runWithAsyncChainPromise(3, 'console.trace()'); + InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(5); + runWithAsyncChainPromise(3, 'console.trace()'); + InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(6); + runWithAsyncChainPromise(3, 'console.trace()'); + InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(7); + runWithAsyncChainPromise(3, 'console.trace()'); + InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); + + await setMaxAsyncTaskStacks(8); + runWithAsyncChainPromise(3, 'console.trace()'); + InspectorTest.logMessage(await Protocol.Runtime.onceConsoleAPICalled()); + + InspectorTest.completeTest(); +})(); + +function runWithAsyncChainPromise(len, source) { + InspectorTest.log(`Run expression '${source}' with async chain len: ${len}`); + let then = '.then(() => 1)'; + let pause = `.then(() => { ${source} })`; + Protocol.Runtime.evaluate({ + expression: `Promise.resolve()${then.repeat(len - 1)}${pause}` + }); +} + +async function setMaxAsyncTaskStacks(max) { + let expression = `inspector.setMaxAsyncTaskStacks(${max})`; + InspectorTest.log(expression); + await Protocol.Runtime.evaluate({expression}); +} diff --git a/deps/v8/test/inspector/debugger/protocol-string-to-double-locale-expected.txt b/deps/v8/test/inspector/debugger/protocol-string-to-double-locale-expected.txt new file mode 100644 index 0000000000..52919c1d18 --- /dev/null +++ b/deps/v8/test/inspector/debugger/protocol-string-to-double-locale-expected.txt @@ -0,0 +1,8 @@ +Tests that double numbers are parsed and serialized correctly on different locales +This test verifies that we correctly parse doubles with non-US locale +{ + a : 0.5 +} +{ + a : 1 +} diff --git a/deps/v8/test/inspector/debugger/protocol-string-to-double-locale.js b/deps/v8/test/inspector/debugger/protocol-string-to-double-locale.js new file mode 100644 index 0000000000..89b6d826ff --- /dev/null +++ b/deps/v8/test/inspector/debugger/protocol-string-to-double-locale.js @@ -0,0 +1,24 @@ +// 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 double numbers are parsed and serialized correctly on different locales'); + +(async function() { + InspectorTest.log('This test verifies that we correctly parse doubles with non-US locale'); + utils.setlocale("fr_CA.UTF-8"); + Protocol.Debugger.enable(); + Protocol.Runtime.evaluate({ + expression: 'inspector.breakProgram(\'\', JSON.stringify({a: 0.5}))'}); + let message = await Protocol.Debugger.oncePaused(); + InspectorTest.logObject(message.params.data || {}); + Protocol.Debugger.resume(); + + Protocol.Runtime.evaluate({ + expression: 'inspector.breakProgram(\'\', JSON.stringify({a: 1}))'}); + message = await Protocol.Debugger.oncePaused(); + InspectorTest.logObject(message.params.data || {}); + Protocol.Debugger.resume(); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/restore-breakpoint.js b/deps/v8/test/inspector/debugger/restore-breakpoint.js index 3a10f5378e..e0d2b84766 100644 --- a/deps/v8/test/inspector/debugger/restore-breakpoint.js +++ b/deps/v8/test/inspector/debugger/restore-breakpoint.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. -InspectorTest.log('Checks that debugger agent uses source content to restore breakpoints.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that debugger agent uses source content to restore breakpoints.'); Protocol.Debugger.enable(); InspectorTest.runTestSuite([ diff --git a/deps/v8/test/inspector/debugger/return-break-locations.js b/deps/v8/test/inspector/debugger/return-break-locations.js index 73e0416b0d..b253b88417 100644 --- a/deps/v8/test/inspector/debugger/return-break-locations.js +++ b/deps/v8/test/inspector/debugger/return-break-locations.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Return break locations within function'); +let {session, contextGroup, Protocol} = InspectorTest.start('Return break locations within function'); -InspectorTest.addScript(` +contextGroup.addScript(` function fib(x) { if (x < 0) return; if (x === 0) return 1; diff --git a/deps/v8/test/inspector/debugger/schedule-step-into-async-set-timeout.js b/deps/v8/test/inspector/debugger/schedule-step-into-async-set-timeout.js index f6ffe6e0a7..f2171a5037 100644 --- a/deps/v8/test/inspector/debugger/schedule-step-into-async-set-timeout.js +++ b/deps/v8/test/inspector/debugger/schedule-step-into-async-set-timeout.js @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks Debugger.scheduleStepIntoAsync with setTimeout.'); -InspectorTest.setupScriptMap(); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks Debugger.scheduleStepIntoAsync with setTimeout.'); +session.setupScriptMap(); Protocol.Debugger.enable(); InspectorTest.runAsyncTestSuite([ async function testSetTimeout() { @@ -42,7 +42,7 @@ InspectorTest.runAsyncTestSuite([ Protocol.Debugger.stepOver(); await waitPauseAndDumpLocation(); await Protocol.Debugger.resume(); - await InspectorTest.waitPendingTasks(); + await InspectorTest.waitForPendingTasks(); }, async function testSetTimeoutWithoutJS() { @@ -70,6 +70,6 @@ InspectorTest.runAsyncTestSuite([ async function waitPauseAndDumpLocation() { var message = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - await InspectorTest.logSourceLocation(message.params.callFrames[0].location); + await session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/schedule-step-into-async.js b/deps/v8/test/inspector/debugger/schedule-step-into-async.js index 1556e8a55a..c4dfb73992 100644 --- a/deps/v8/test/inspector/debugger/schedule-step-into-async.js +++ b/deps/v8/test/inspector/debugger/schedule-step-into-async.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks Debugger.scheduleStepIntoAsync.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks Debugger.scheduleStepIntoAsync.'); -InspectorTest.addScript(` +contextGroup.addScript(` function testNoScheduledTask() { debugger; return 42; @@ -47,7 +47,7 @@ function testBlackboxedCreatePromise() { } //# sourceURL=test.js`); -InspectorTest.addScript(` +contextGroup.addScript(` function createPromise() { return Promise.resolve().then(v => v * 3).then(v => v * 4); @@ -55,7 +55,7 @@ function createPromise() { //# sourceURL=framework.js`) -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.enable(); InspectorTest.runAsyncTestSuite([ @@ -154,6 +154,6 @@ InspectorTest.runAsyncTestSuite([ async function waitPauseAndDumpLocation() { var message = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - InspectorTest.logSourceLocation(message.params.callFrames[0].location); + session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt index b3dce305d8..626f9787c3 100644 --- a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt +++ b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt @@ -1,3 +1,4 @@ +Tests that scopes do not report variables with empty names { id : result : { @@ -16,4 +17,4 @@ } ] } -} \ No newline at end of file +} diff --git a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js index e2b38d8ec9..72cbeeefcb 100644 --- a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js +++ b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that scopes do not report variables with empty names'); + +contextGroup.addScript( `function testFunction() { for (var a of [1]) { diff --git a/deps/v8/test/inspector/debugger/script-end-location.js b/deps/v8/test/inspector/debugger/script-end-location.js index cdfff8cda6..57d12350e0 100644 --- a/deps/v8/test/inspector/debugger/script-end-location.js +++ b/deps/v8/test/inspector/debugger/script-end-location.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. -InspectorTest.log('Checks that we report correct endLine, endColumn and source for scripts.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we report correct endLine, endColumn and source for scripts.'); var sources = [ '', @@ -27,7 +27,7 @@ var sources = [ (async function test() { Protocol.Debugger.enable(); for (let source of sources) { - InspectorTest.addScript(source); + contextGroup.addScript(source); var message = await Protocol.Debugger.onceScriptParsed(); var inspectorSource = (await Protocol.Debugger.getScriptSource({ scriptId: message.params.scriptId })).result.scriptSource; var lines = source.split('\n'); diff --git a/deps/v8/test/inspector/debugger/script-on-after-compile.js b/deps/v8/test/inspector/debugger/script-on-after-compile.js index 6a5a55b5ff..544dbaaae2 100644 --- a/deps/v8/test/inspector/debugger/script-on-after-compile.js +++ b/deps/v8/test/inspector/debugger/script-on-after-compile.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. -InspectorTest.log("Checks that inspector correctly process compiled scripts"); +let {session, contextGroup, Protocol} = InspectorTest.start("Checks that inspector correctly process compiled scripts"); function addScripts() { // sourceURL in the same line diff --git a/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate.js b/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate.js index 300821baa3..bebf64bddc 100644 --- a/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate.js +++ b/deps/v8/test/inspector/debugger/script-parsed-for-runtime-evaluate.js @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log("Checks that inspector reports script compiled in Runtime.evaluate, " + +let {session, contextGroup, Protocol} = InspectorTest.start("Checks that inspector reports script compiled in Runtime.evaluate, " + "Runtime.callFunctionOn and Runtime.compileScript"); -InspectorTest.addScript(` +contextGroup.addScript(` function fooTop() { eval(\` function foo() { @@ -15,7 +15,7 @@ function fooTop() { } //# sourceURL=top-frame.js`, 8, 26); -InspectorTest.addScript(` +contextGroup.addScript(` function fooTopFail() { eval(\` function fooFail() { diff --git a/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt b/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt index 20fdb859fd..8836266f77 100644 --- a/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt +++ b/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt @@ -1,3 +1,4 @@ +Tests scripts hasing Hash received: 1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18 Hash received: EBF1ECD351E7A3294CB5762843D429DC872EBA18 -Hash received: 86A31E7131896CF01BA837945C2894385F369F24 \ No newline at end of file +Hash received: 86A31E7131896CF01BA837945C2894385F369F24 diff --git a/deps/v8/test/inspector/debugger/script-parsed-hash.js b/deps/v8/test/inspector/debugger/script-parsed-hash.js index 5dd1dfacee..15c82ad7a8 100644 --- a/deps/v8/test/inspector/debugger/script-parsed-hash.js +++ b/deps/v8/test/inspector/debugger/script-parsed-hash.js @@ -2,6 +2,8 @@ // 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 scripts hasing'); + var hashes = new Set(["1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18", "EBF1ECD351E7A3294CB5762843D429DC872EBA18", "86A31E7131896CF01BA837945C2894385F369F24"]); diff --git a/deps/v8/test/inspector/debugger/script-with-negative-offset-expected.txt b/deps/v8/test/inspector/debugger/script-with-negative-offset-expected.txt new file mode 100644 index 0000000000..ebdf8f3ee1 --- /dev/null +++ b/deps/v8/test/inspector/debugger/script-with-negative-offset-expected.txt @@ -0,0 +1,19 @@ +Locations in script with negative offset. +[ + [0] : { + columnNumber : 16 + lineNumber : 0 + scriptId : + type : debuggerStatement + } + [1] : { + columnNumber : 26 + lineNumber : 0 + scriptId : + type : return + } +] +foo (:-1:16) +(anonymous) (:0:0) +boo (:0:16) +(anonymous) (:0:0) diff --git a/deps/v8/test/inspector/debugger/script-with-negative-offset.js b/deps/v8/test/inspector/debugger/script-with-negative-offset.js new file mode 100644 index 0000000000..fbc0b34302 --- /dev/null +++ b/deps/v8/test/inspector/debugger/script-with-negative-offset.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('Locations in script with negative offset.'); + +(async function test() { + contextGroup.addScript(`function foo() { debugger; } +function boo(){ debugger; } +`, -1, -1); + session.setupScriptMap(); + Protocol.Debugger.enable(); + let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed(); + let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({ + start: {scriptId, lineNumber: 0, columnNumber: 0} + }); + InspectorTest.logMessage(locations); + + Protocol.Runtime.evaluate({expression: 'foo()'}); + var {params:{callFrames}} = await Protocol.Debugger.oncePaused(); + session.logCallFrames(callFrames); + await Protocol.Debugger.resume(); + + Protocol.Runtime.evaluate({expression: 'boo()'}); + var {params:{callFrames}} = await Protocol.Debugger.oncePaused(); + session.logCallFrames(callFrames); + await Protocol.Debugger.resume(); + + InspectorTest.completeTest(); +})(); diff --git a/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt b/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt new file mode 100644 index 0000000000..98fccebe68 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt @@ -0,0 +1,37 @@ +Checks that we report not more then maxDepth call chains. + +Running test: testPaused +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 16 +reported: 1 + +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 8 +reported: 1 + +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 7 +reported: 1 + +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 0 +reported: 0 + + +Running test: testConsoleTrace +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 16 +reported: 1 + +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 8 +reported: 1 + +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 7 +reported: 1 + +Actual call chain length: 8 +setAsyncCallStackDepth(maxDepth): 0 +reported: 0 + diff --git a/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js b/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js new file mode 100644 index 0000000000..0c7567f499 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js @@ -0,0 +1,79 @@ +// 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. + +// TODO(kozyatinskiy): fix or remove it later with new stack traces it's almost +// imposible to hit limit. +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we report not more then maxDepth call chains.'); + +contextGroup.addScript(` +function promisesChain(num) { + var p = Promise.resolve(); + for (var i = 0; i < num - 1; ++i) { + p = p.then(() => 42); + } + return p; +} +`); + +Protocol.Debugger.enable(); +InspectorTest.runAsyncTestSuite([ + async function testPaused() { + let callback = '() => { debugger; }'; + startTest({ generated: 8, limit: 16, callback}); + dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace); + await Protocol.Debugger.resume(); + + startTest({ generated: 8, limit: 8, callback}); + dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace); + await Protocol.Debugger.resume(); + + startTest({ generated: 8, limit: 7, callback}); + dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace); + await Protocol.Debugger.resume(); + + startTest({ generated: 8, limit: 0, callback}); + dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace); + await Protocol.Debugger.resume(); + }, + + async function testConsoleTrace() { + await Protocol.Runtime.enable(); + let callback = '() => { console.trace(42); }'; + startTest({ generated: 8, limit: 16, callback}); + let msg = await Protocol.Runtime.onceConsoleAPICalled(); + dumpCaptured(msg.params.stackTrace.parent); + + startTest({ generated: 8, limit: 8, callback}); + msg = await Protocol.Runtime.onceConsoleAPICalled(); + dumpCaptured(msg.params.stackTrace.parent); + + startTest({ generated: 8, limit: 7, callback}); + msg = await Protocol.Runtime.onceConsoleAPICalled(); + dumpCaptured(msg.params.stackTrace.parent); + + startTest({ generated: 8, limit: 0, callback}); + msg = await Protocol.Runtime.onceConsoleAPICalled(); + dumpCaptured(msg.params.stackTrace.parent); + + await Protocol.Runtime.disable(); + } +]); + +function startTest(params) { + InspectorTest.log('Actual call chain length: ' + params.generated); + InspectorTest.log('setAsyncCallStackDepth(maxDepth): ' + params.limit); + + Protocol.Debugger.setAsyncCallStackDepth({maxDepth: params.limit}); + Protocol.Runtime.evaluate({expression: + `promisesChain(${params.generated}).then(${params.callback})`}); +} + +function dumpCaptured(stack) { + let count = 0; + while (stack) { + ++count; + stack = stack.parent; + } + InspectorTest.log('reported: ' + count + '\n'); +} 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 fb54163107..bb3055a62d 100644 --- a/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt +++ b/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt @@ -1,3 +1,4 @@ +Tests blackboxing by patterns Pattern parser error: Uncaught SyntaxError: Invalid regular expression: /(foo([)/: Unterminated character class Paused in (...):1 diff --git a/deps/v8/test/inspector/debugger/set-blackbox-patterns.js b/deps/v8/test/inspector/debugger/set-blackbox-patterns.js index 12e9e214d3..d060c90a9d 100644 --- a/deps/v8/test/inspector/debugger/set-blackbox-patterns.js +++ b/deps/v8/test/inspector/debugger/set-blackbox-patterns.js @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests blackboxing by patterns'); + +contextGroup.addScript( `function bar() { return 42; }`); -InspectorTest.addScript( +contextGroup.addScript( `function foo() { var a = bar(); @@ -16,7 +18,7 @@ InspectorTest.addScript( } //# sourceURL=foo.js`); -InspectorTest.addScript( +contextGroup.addScript( `function qwe() { var a = foo(); @@ -24,7 +26,7 @@ InspectorTest.addScript( } //# sourceURL=qwe.js`); -InspectorTest.addScript( +contextGroup.addScript( `function baz() { var a = qwe(); diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt index e4fdd95d5f..26017349ef 100644 --- a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt +++ b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt @@ -1,3 +1,4 @@ +Tests that setting breakpoint before enabling debugger produces an error setBreakpointByUrl error: undefined setBreakpoint error: { "code": -32602, diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js index 8480aa6f75..84541be37d 100644 --- a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js +++ b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js @@ -2,6 +2,8 @@ // 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 setting breakpoint before enabling debugger produces an error'); + Protocol.Debugger.setBreakpointByUrl({ url: "http://example.com", lineNumber: 10 }).then(didSetBreakpointByUrlBeforeEnable); function didSetBreakpointByUrlBeforeEnable(message) diff --git a/deps/v8/test/inspector/debugger/set-script-source-exception.js b/deps/v8/test/inspector/debugger/set-script-source-exception.js index d3082789f2..627aa7ec1e 100644 --- a/deps/v8/test/inspector/debugger/set-script-source-exception.js +++ b/deps/v8/test/inspector/debugger/set-script-source-exception.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. -InspectorTest.log('Check that setScriptSource completes correctly when an exception is thrown.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Check that setScriptSource completes correctly when an exception is thrown.'); Protocol.Debugger.enable(); @@ -18,6 +18,6 @@ InspectorTest.runTestSuite([ .then(message => Protocol.Debugger.setScriptSource({ scriptId: message.params.scriptId, scriptSource: 'a # b' })) .then(InspectorTest.logMessage) .then(next); - InspectorTest.addScript('function foo() {}'); + contextGroup.addScript('function foo() {}'); } ]); diff --git a/deps/v8/test/inspector/debugger/set-script-source-expected.txt b/deps/v8/test/inspector/debugger/set-script-source-expected.txt index 1b76ec5f95..e77aafd690 100644 --- a/deps/v8/test/inspector/debugger/set-script-source-expected.txt +++ b/deps/v8/test/inspector/debugger/set-script-source-expected.txt @@ -1,3 +1,4 @@ +Tests Debugger.setScriptSource Function evaluate: {"type":"number","value":6,"description":"6"} PASS, result value: 6 Function evaluate: {"type":"number","value":8,"description":"8"} @@ -5,4 +6,3 @@ PASS, result value: 8 Has error reported: PASS Reported error is a compile error: PASS PASS, result value: 1 - diff --git a/deps/v8/test/inspector/debugger/set-script-source.js b/deps/v8/test/inspector/debugger/set-script-source.js index 36944cca6c..f13a3a39bb 100644 --- a/deps/v8/test/inspector/debugger/set-script-source.js +++ b/deps/v8/test/inspector/debugger/set-script-source.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests Debugger.setScriptSource'); + +contextGroup.addScript( `function TestExpression(a, b) { return a + b; }`); diff --git a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt index d77870e737..6d113861dd 100644 --- a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt +++ b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate-expected.txt @@ -1,3 +1,4 @@ +Tests side-effect-free evaluation Paused on 'debugger;' f() returns 1 g() returns 2 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 705901ad78..34e3a25981 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 @@ -3,8 +3,9 @@ // found in the LICENSE file. // Flags: --ignition --turbo +let {session, contextGroup, Protocol} = InspectorTest.start('Tests side-effect-free evaluation'); -InspectorTest.addScript(` +contextGroup.addScript(` function testFunction() { var o = 0; diff --git a/deps/v8/test/inspector/debugger/step-into-expected.txt b/deps/v8/test/inspector/debugger/step-into-expected.txt index b912b82fa2..8be36948b2 100644 --- a/deps/v8/test/inspector/debugger/step-into-expected.txt +++ b/deps/v8/test/inspector/debugger/step-into-expected.txt @@ -746,16 +746,6 @@ break at: Running test: testClasses -break at: -function testClasses() { - #class Cat { - constructor(name) { - -break at: - } - #class Lion extends Cat { - constructor(name) { - break at: } #new Lion().speak(); @@ -808,11 +798,21 @@ break at: Running test: testAsyncAwait +break at: +async function testAsyncAwait() { + #await asyncFoo(); + 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); @@ -843,6 +843,11 @@ break at: #} +break at: +async function asyncBoo() { + #await Promise.resolve(); +} + break at: async function asyncBoo() { await Promise.#resolve(); @@ -880,6 +885,11 @@ break at: #setTimeout(returnCall, 0); await foo(); +break at: + setTimeout(returnCall, 0); + #await foo(); + await foo(); + break at: setTimeout(returnCall, 0); await #foo(); @@ -905,6 +915,11 @@ break at: #setTimeout(resolveNested, 0); await p; +break at: + setTimeout(resolveNested, 0); + #await p; + } + break at: setTimeout(resolveNested, 0); await #p; @@ -935,6 +950,11 @@ break at: #setTimeout(resolveNested, 0); await p; +break at: + setTimeout(resolveNested, 0); + #await p; + } + break at: setTimeout(resolveNested, 0); await #p; @@ -1062,6 +1082,11 @@ break at: returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = await #foo((a => 2 *a)(5)); nextTest(); +break at: + async function foo() { + #await Promise.resolve(); + return 42; + break at: async function foo() { await Promise.#resolve(); diff --git a/deps/v8/test/inspector/debugger/step-into-nested-arrow.js b/deps/v8/test/inspector/debugger/step-into-nested-arrow.js index 0b0307a5e6..305796754a 100644 --- a/deps/v8/test/inspector/debugger/step-into-nested-arrow.js +++ b/deps/v8/test/inspector/debugger/step-into-nested-arrow.js @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log( +let {session, contextGroup, Protocol} = InspectorTest.start( 'Checks that stepInto nested arrow function doesn\'t produce crash.'); -InspectorTest.setupScriptMap(); -InspectorTest.addScript(` +session.setupScriptMap(); +contextGroup.addScript(` const rec = (x) => (y) => rec(); //# sourceURL=test.js`); Protocol.Debugger.onPaused(message => { InspectorTest.log("paused"); - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); Protocol.Debugger.stepInto(); }) diff --git a/deps/v8/test/inspector/debugger/step-into-next-script.js b/deps/v8/test/inspector/debugger/step-into-next-script.js index 37436be1d5..80e9a9180f 100644 --- a/deps/v8/test/inspector/debugger/step-into-next-script.js +++ b/deps/v8/test/inspector/debugger/step-into-next-script.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Debugger breaks in next script after stepOut from previous one.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Debugger breaks in next script after stepOut from previous one.'); -InspectorTest.addScript(` +contextGroup.addScript(` function test() { setTimeout('var a = 1;//# sourceURL=timeout1.js', 0); setTimeout(foo, 0); @@ -13,16 +13,16 @@ function test() { } //# sourceURL=foo.js`, 7, 26); -InspectorTest.addScript(` +contextGroup.addScript(` function foo() { return 42; } //# sourceURL=timeout2.js`) -InspectorTest.setupScriptMap(); +session.setupScriptMap(); var stepAction; Protocol.Debugger.onPaused(message => { - InspectorTest.logCallFrames(message.params.callFrames); + session.logCallFrames(message.params.callFrames); InspectorTest.log(''); Protocol.Debugger[stepAction](); }); @@ -31,21 +31,21 @@ InspectorTest.runTestSuite([ function testStepOut(next) { stepAction = 'stepOut'; Protocol.Runtime.evaluate({ expression: 'test()' }) - .then(() => InspectorTest.waitPendingTasks()) + .then(() => InspectorTest.waitForPendingTasks()) .then(next); }, function testStepOver(next) { stepAction = 'stepOver'; Protocol.Runtime.evaluate({ expression: 'test()' }) - .then(() => InspectorTest.waitPendingTasks()) + .then(() => InspectorTest.waitForPendingTasks()) .then(next); }, function testStepInto(next) { stepAction = 'stepInto'; Protocol.Runtime.evaluate({ expression: 'test()' }) - .then(() => InspectorTest.waitPendingTasks()) + .then(() => InspectorTest.waitForPendingTasks()) .then(next); } ]); diff --git a/deps/v8/test/inspector/debugger/step-into.js b/deps/v8/test/inspector/debugger/step-into.js index e08707c9fc..b0b83b3d59 100644 --- a/deps/v8/test/inspector/debugger/step-into.js +++ b/deps/v8/test/inspector/debugger/step-into.js @@ -4,9 +4,9 @@ // Flags: --turbo -InspectorTest.log('Checks possible break locations.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks possible break locations.'); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.onPaused(message => { var frames = message.params.callFrames; if (frames.length === 1) { @@ -15,11 +15,11 @@ Protocol.Debugger.onPaused(message => { } var scriptId = frames[0].location.scriptId; InspectorTest.log('break at:'); - InspectorTest.logSourceLocation(frames[0].location) + session.logSourceLocation(frames[0].location) .then(() => Protocol.Debugger.stepInto()); }); -InspectorTest.loadScript('test/inspector/debugger/resources/break-locations.js'); +contextGroup.loadScript('test/inspector/debugger/resources/break-locations.js'); Protocol.Debugger.enable(); Protocol.Runtime.evaluate({ expression: 'Object.keys(this).filter(name => name.indexOf(\'test\') === 0)', returnByValue: true }) diff --git a/deps/v8/test/inspector/debugger/step-out-async-await.js b/deps/v8/test/inspector/debugger/step-out-async-await.js index 3b249dc7f3..ff83b82e78 100644 --- a/deps/v8/test/inspector/debugger/step-out-async-await.js +++ b/deps/v8/test/inspector/debugger/step-out-async-await.js @@ -6,9 +6,9 @@ // of async generator we should break at next instruction of resumed generator // instead of next scheduled microtask. -InspectorTest.log('StepOut from return position of async function.'); +let {session, contextGroup, Protocol} = InspectorTest.start('StepOut from return position of async function.'); -InspectorTest.addScript(` +contextGroup.addScript(` async function testFunction() { async function foo() { var p = Promise.resolve(); @@ -21,7 +21,7 @@ InspectorTest.addScript(` } `); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.enable(); InspectorTest.runAsyncTestSuite([ async function testStepInto() { @@ -68,5 +68,5 @@ InspectorTest.runAsyncTestSuite([ ]); function logPauseLocation(message) { - return InspectorTest.logSourceLocation(message.params.callFrames[0].location); + return session.logSourceLocation(message.params.callFrames[0].location); } diff --git a/deps/v8/test/inspector/debugger/step-over-another-context-group.js b/deps/v8/test/inspector/debugger/step-over-another-context-group.js index c860ef9f46..758ff84697 100644 --- a/deps/v8/test/inspector/debugger/step-over-another-context-group.js +++ b/deps/v8/test/inspector/debugger/step-over-another-context-group.js @@ -4,27 +4,33 @@ InspectorTest.log('Checks stepping with more then one context group.'); +var contextGroup1 = new InspectorTest.ContextGroup(); +var session1 = contextGroup1.connect(); +session1.setupScriptMap(); + +let contextGroup2 = new InspectorTest.ContextGroup(); +let session2 = contextGroup2.connect(); +session2.setupScriptMap(); + (async function test() { - InspectorTest.setupScriptMap(); - await Protocol.Debugger.enable(); - let contextGroupId = utils.createContextGroup(); - await Protocol.Debugger.enable({}, contextGroupId); - Protocol.Runtime.evaluate({expression: 'debugger'}); - Protocol.Runtime.evaluate({expression: 'setTimeout(() => { debugger }, 0)'}, contextGroupId); - Protocol.Runtime.evaluate({expression: 'setTimeout(() => 42, 0)'}); - await waitPauseAndDumpLocation(); - Protocol.Debugger.stepOver(); - await Protocol.Debugger.oncePaused(); - Protocol.Debugger.stepOver(); - await waitPauseAndDumpLocation(); - await Protocol.Debugger.disable({}, contextGroupId); - await Protocol.Debugger.disable(); + await session1.Protocol.Debugger.enable(); + await session2.Protocol.Debugger.enable({}); + session1.Protocol.Runtime.evaluate({expression: 'debugger'}); + session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { debugger }, 0)'}); + session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => 42, 0)'}); + await waitPauseAndDumpLocation(session1); + session1.Protocol.Debugger.stepOver(); + await session1.Protocol.Debugger.oncePaused(); + session1.Protocol.Debugger.stepOver(); + await waitPauseAndDumpLocation(session1); + await session2.Protocol.Debugger.disable({}); + await session1.Protocol.Debugger.disable(); InspectorTest.completeTest(); })(); -async function waitPauseAndDumpLocation() { - var message = await Protocol.Debugger.oncePaused(); +async function waitPauseAndDumpLocation(session) { + var message = await session.Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - await InspectorTest.logSourceLocation(message.params.callFrames[0].location); + await session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt b/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt index a18b0934cb..5b72d4cce0 100644 --- a/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt +++ b/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt @@ -1,4 +1,5 @@ +Tests that stepping over caught exception will pause when asked for testFunction:9 testFunction:11 testFunction:9 -testFunction:11 \ No newline at end of file +testFunction:11 diff --git a/deps/v8/test/inspector/debugger/step-over-caught-exception.js b/deps/v8/test/inspector/debugger/step-over-caught-exception.js index e00dcf27dc..c8e711b0be 100644 --- a/deps/v8/test/inspector/debugger/step-over-caught-exception.js +++ b/deps/v8/test/inspector/debugger/step-over-caught-exception.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that stepping over caught exception will pause when asked for'); + +contextGroup.addScript( `function testFunction() { function foo() diff --git a/deps/v8/test/inspector/debugger/step-snapshot-expected.txt b/deps/v8/test/inspector/debugger/step-snapshot-expected.txt new file mode 100644 index 0000000000..7853ed7370 --- /dev/null +++ b/deps/v8/test/inspector/debugger/step-snapshot-expected.txt @@ -0,0 +1,35 @@ +Embedding script 'function c(f, ...args) { return f(...args); }' +Tests that stepping works on snapshotted function +paused + } + #debugger; + c(f, 2); + +paused + debugger; + #c(f, 2); +} + +paused +function c(f, ...args) { #return f(...args); } + +paused + function f(x) { + #return x * 2; + } + +paused + return x * 2; + #} + debugger; + +paused +function c(f, ...args) { return f(...args); #} + +paused + c(f, 2); +#} + +paused +test(#) + diff --git a/deps/v8/test/inspector/debugger/step-snapshot.js b/deps/v8/test/inspector/debugger/step-snapshot.js new file mode 100644 index 0000000000..a4ecbf2f28 --- /dev/null +++ b/deps/v8/test/inspector/debugger/step-snapshot.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. + +// Embed a user function in the snapshot and step through it. + +// Flags: --embed 'function c(f, ...args) { return f(...args); }' + +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that stepping works on snapshotted function'); +session.setupScriptMap(); + +contextGroup.addScript(` +function test() { + function f(x) { + return x * 2; + } + debugger; + c(f, 2); +} +//# sourceURL=test.js`); + +Protocol.Debugger.onPaused(message => { + InspectorTest.log("paused"); + var frames = message.params.callFrames; + session.logSourceLocation(frames[0].location); + Protocol.Debugger.stepInto(); +}) + +Protocol.Debugger.enable() + .then(() => Protocol.Runtime.evaluate({ expression: 'test()' })) + .then(InspectorTest.completeTest); diff --git a/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints-expected.txt b/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints-expected.txt index abe85f5c80..67f38301fd 100644 --- a/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints-expected.txt +++ b/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints-expected.txt @@ -1,3 +1,4 @@ +Tests that stepping works after calling getPossibleBreakpoints -- call boo: (top) (top) diff --git a/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints.js b/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints.js index 7d6577b82a..c36a36cb07 100644 --- a/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints.js +++ b/deps/v8/test/inspector/debugger/stepping-after-get-possible-breakpoints.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript(` +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that stepping works after calling getPossibleBreakpoints'); + +contextGroup.addScript(` function boo() {} boo(); function foo() {} diff --git a/deps/v8/test/inspector/debugger/stepping-and-break-program-api-expected.txt b/deps/v8/test/inspector/debugger/stepping-and-break-program-api-expected.txt index cd7c214b75..438177ade6 100644 --- a/deps/v8/test/inspector/debugger/stepping-and-break-program-api-expected.txt +++ b/deps/v8/test/inspector/debugger/stepping-and-break-program-api-expected.txt @@ -2,16 +2,16 @@ Checks that stepping is cleared after breakProgram. paused at: function callBreakProgram() { #debugger; - breakProgram('reason', ''); + inspector.breakProgram('reason', ''); paused at: debugger; - #breakProgram('reason', ''); + #inspector.breakProgram('reason', ''); } paused at: debugger; - #breakProgram('reason', ''); + inspector.#breakProgram('reason', ''); } paused at: diff --git a/deps/v8/test/inspector/debugger/stepping-and-break-program-api.js b/deps/v8/test/inspector/debugger/stepping-and-break-program-api.js index 4900843fc5..f54bad827c 100644 --- a/deps/v8/test/inspector/debugger/stepping-and-break-program-api.js +++ b/deps/v8/test/inspector/debugger/stepping-and-break-program-api.js @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks that stepping is cleared after breakProgram.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks that stepping is cleared after breakProgram.'); -InspectorTest.addScript(` +contextGroup.addScript(` function callBreakProgram() { debugger; - breakProgram('reason', ''); + inspector.breakProgram('reason', ''); }`); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); (async function test() { Protocol.Debugger.enable(); Protocol.Runtime.evaluate({expression: 'callBreakProgram();'}); @@ -29,6 +29,6 @@ InspectorTest.setupScriptMap(); async function waitPauseAndDumpLocation() { var message = await Protocol.Debugger.oncePaused(); InspectorTest.log('paused at:'); - InspectorTest.logSourceLocation(message.params.callFrames[0].location); + session.logSourceLocation(message.params.callFrames[0].location); return message; } diff --git a/deps/v8/test/inspector/debugger/stepping-ignores-injected-script-expected.txt b/deps/v8/test/inspector/debugger/stepping-ignores-injected-script-expected.txt index e4557d5cf7..5a63493dc7 100644 --- a/deps/v8/test/inspector/debugger/stepping-ignores-injected-script-expected.txt +++ b/deps/v8/test/inspector/debugger/stepping-ignores-injected-script-expected.txt @@ -1 +1,2 @@ +Tests that stepping ignores injected script InjectedSciptSource was not reached diff --git a/deps/v8/test/inspector/debugger/stepping-ignores-injected-script.js b/deps/v8/test/inspector/debugger/stepping-ignores-injected-script.js index 31c958084a..9021664a96 100644 --- a/deps/v8/test/inspector/debugger/stepping-ignores-injected-script.js +++ b/deps/v8/test/inspector/debugger/stepping-ignores-injected-script.js @@ -2,8 +2,10 @@ // 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 stepping ignores injected script'); + Protocol.Debugger.onPaused(message => { - let url = InspectorTest._scriptMap.get(message.params.callFrames[0].location.scriptId).url; + let url = session._scriptMap.get(message.params.callFrames[0].location.scriptId).url; if (url !== 'test.js') { InspectorTest.log('InjectedSciptSource on stack.'); InspectorTest.completeTest(); @@ -11,7 +13,7 @@ Protocol.Debugger.onPaused(message => { Protocol.Debugger.stepInto(); }); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.enable(); Protocol.Debugger.pause(); Protocol.Runtime.evaluate({expression: 'console.log(42)//# sourceURL=test.js'}) diff --git a/deps/v8/test/inspector/debugger/stepping-tail-call.js b/deps/v8/test/inspector/debugger/stepping-tail-call.js index 763b23b8a6..797df7d675 100644 --- a/deps/v8/test/inspector/debugger/stepping-tail-call.js +++ b/deps/v8/test/inspector/debugger/stepping-tail-call.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Checks stepping over tail calls.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Checks stepping over tail calls.'); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); InspectorTest.logProtocolCommandCalls('Debugger.pause'); InspectorTest.logProtocolCommandCalls('Debugger.stepInto'); InspectorTest.logProtocolCommandCalls('Debugger.stepOver'); @@ -76,6 +76,6 @@ InspectorTest.runAsyncTestSuite([ ]); function logPauseLocation(message) { - InspectorTest.logCallFrames(message.params.callFrames); - return InspectorTest.logSourceLocation(message.params.callFrames[0].location); + session.logCallFrames(message.params.callFrames); + return session.logSourceLocation(message.params.callFrames[0].location); } 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 acea22fd5f..7e23082c4b 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 @@ -1,3 +1,4 @@ +Tests that blackboxed ranges are respected while stepping foo: 8:4 blackboxedBoo: 3:12 notBlackboxedFoo: 3:12 @@ -52,3 +53,4 @@ notBlackboxedFoo: 3:12 blackboxedFoo: 10:12 notBlackboxedBoo: 17:12 testFunction: 3:4 + diff --git a/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js index 65b694b566..c1029a8785 100644 --- a/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js +++ b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that blackboxed ranges are respected while stepping'); + +contextGroup.addScript( `function blackboxedBoo() { var a = 42; @@ -11,7 +13,7 @@ InspectorTest.addScript( } //# sourceURL=blackboxed-script.js`); -InspectorTest.addScript( +contextGroup.addScript( `function notBlackboxedFoo() { var a = 42; @@ -34,7 +36,7 @@ function notBlackboxedBoo() } //# sourceURL=mixed-source.js`); -InspectorTest.addScript( +contextGroup.addScript( `function testFunction() { notBlackboxedBoo(); // for setup ranges and stepOut diff --git a/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script-expected.txt b/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script-expected.txt index 8fa52f1916..65c32c3ec9 100644 --- a/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script-expected.txt +++ b/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script-expected.txt @@ -1 +1,2 @@ +Tests that stepping does not ignore injected script when passed a flag InjectedSciptSource on stack. diff --git a/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script.js b/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script.js index 499611c897..d608137c81 100644 --- a/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script.js +++ b/deps/v8/test/inspector/debugger/stepping-with-exposed-injected-script.js @@ -3,8 +3,10 @@ // found in the LICENSE file. // Flags: --expose-inspector-scripts +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that stepping does not ignore injected script when passed a flag'); + Protocol.Debugger.onPaused(message => { - let url = InspectorTest._scriptMap.get(message.params.callFrames[0].location.scriptId).url; + let url = session._scriptMap.get(message.params.callFrames[0].location.scriptId).url; if (url !== 'test.js') { InspectorTest.log('InjectedSciptSource on stack.'); InspectorTest.completeTest(); @@ -12,7 +14,7 @@ Protocol.Debugger.onPaused(message => { Protocol.Debugger.stepInto(); }); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); Protocol.Debugger.enable(); Protocol.Debugger.pause(); Protocol.Runtime.evaluate({expression: 'console.log(42)//# sourceURL=test.js'}) diff --git a/deps/v8/test/inspector/debugger/stepping-with-natives-and-frameworks.js b/deps/v8/test/inspector/debugger/stepping-with-natives-and-frameworks.js index 1be1acdd28..c6648ec932 100644 --- a/deps/v8/test/inspector/debugger/stepping-with-natives-and-frameworks.js +++ b/deps/v8/test/inspector/debugger/stepping-with-natives-and-frameworks.js @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.log('Stepping with natives and frameworks.'); +let {session, contextGroup, Protocol} = InspectorTest.start('Stepping with natives and frameworks.'); -InspectorTest.addScript(` +contextGroup.addScript(` function callAll() { for (var f of arguments) f(); } //# sourceURL=framework.js`); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); InspectorTest.logProtocolCommandCalls('Debugger.pause'); InspectorTest.logProtocolCommandCalls('Debugger.stepInto'); InspectorTest.logProtocolCommandCalls('Debugger.stepOver'); @@ -296,5 +296,5 @@ InspectorTest.runAsyncTestSuite([ ]); function logPauseLocation(message) { - return InspectorTest.logSourceLocation(message.params.callFrames[0].location); + return session.logSourceLocation(message.params.callFrames[0].location); } 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 ed60c3e43c..f529c7ee24 100644 --- a/deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/suspended-generator-scopes-expected.txt @@ -1,3 +1,5 @@ +Tests that suspended generators produce scopes + Running test: testScopesPaused { id : diff --git a/deps/v8/test/inspector/debugger/suspended-generator-scopes.js b/deps/v8/test/inspector/debugger/suspended-generator-scopes.js index edce5951ff..f7d389072a 100644 --- a/deps/v8/test/inspector/debugger/suspended-generator-scopes.js +++ b/deps/v8/test/inspector/debugger/suspended-generator-scopes.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests that suspended generators produce scopes'); + +contextGroup.addScript( `function *gen(a) { var b = 42; yield a; diff --git a/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt b/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt index ed52d231c2..acad9cea39 100644 --- a/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt +++ b/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt @@ -1,7 +1,7 @@ +Tests updating call frame scopes Paused on 'debugger;' Variable value changed Stacktrace re-read again Scope variables downloaded anew New variable is 55, expected is 55, old was: 2 SUCCESS - diff --git a/deps/v8/test/inspector/debugger/update-call-frame-scopes.js b/deps/v8/test/inspector/debugger/update-call-frame-scopes.js index f4a0f12397..e0b7307b92 100644 --- a/deps/v8/test/inspector/debugger/update-call-frame-scopes.js +++ b/deps/v8/test/inspector/debugger/update-call-frame-scopes.js @@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -InspectorTest.addScript( +let {session, contextGroup, Protocol} = InspectorTest.start('Tests updating call frame scopes'); + +contextGroup.addScript( `function TestFunction() { var a = 2; diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt index 7f869bf040..96c7a64bd4 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations-expected.txt @@ -1,3 +1,4 @@ +Tests breakable locations in wasm Running testFunction... Script nr 0 parsed. URL: v8://test/setup Script nr 1 parsed. URL: v8://test/runTestFunction diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js index eb70b29a82..ea2a116be5 100644 --- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js +++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js @@ -4,6 +4,8 @@ // Flags: --expose-wasm +let {session, contextGroup, Protocol} = InspectorTest.start('Tests breakable locations in wasm'); + utils.load('test/mjsunit/wasm/wasm-constants.js'); utils.load('test/mjsunit/wasm/wasm-module-builder.js'); diff --git a/deps/v8/test/inspector/debugger/wasm-imports-expected.txt b/deps/v8/test/inspector/debugger/wasm-imports-expected.txt index 0a53bdc521..a98b9d29b4 100644 --- a/deps/v8/test/inspector/debugger/wasm-imports-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-imports-expected.txt @@ -1,3 +1,4 @@ +Tests imports in wasm Installing code and global variable. Calling instantiate function for module A. Waiting for wasm script to be parsed. diff --git a/deps/v8/test/inspector/debugger/wasm-imports.js b/deps/v8/test/inspector/debugger/wasm-imports.js index e2a87867e3..dbe96ce671 100644 --- a/deps/v8/test/inspector/debugger/wasm-imports.js +++ b/deps/v8/test/inspector/debugger/wasm-imports.js @@ -2,6 +2,8 @@ // 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 imports in wasm'); + utils.load('test/mjsunit/wasm/wasm-constants.js'); utils.load('test/mjsunit/wasm/wasm-module-builder.js'); @@ -39,7 +41,7 @@ function instantiate(bytes, imp) { var evalWithUrl = (code, url) => Protocol.Runtime.evaluate( {'expression': code + '\n//# sourceURL=v8://test/' + url}); -InspectorTest.setupScriptMap(); +session.setupScriptMap(); // Main promise chain: Protocol.Debugger.enable() @@ -61,7 +63,7 @@ Protocol.Debugger.enable() url => Protocol.Debugger.setBreakpointByUrl({lineNumber: 1, url: url})) .then(printFailure) - .then(msg => InspectorTest.logSourceLocations(msg.result.locations)) + .then(msg => session.logSourceLocations(msg.result.locations)) .then(() => InspectorTest.log('Calling instantiate function for module B.')) .then( () => @@ -84,7 +86,7 @@ Protocol.Debugger.oncePaused() (InspectorTest.log( 'Paused at ' + loc.lineNumber + ':' + loc.columnNumber + '.'), loc)) - .then(InspectorTest.logSourceLocation) + .then(session.logSourceLocation.bind(session)) .then( () => InspectorTest.log( 'Getting current stack trace via "new Error().stack".')) diff --git a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt index 41d2c0b380..5d23605566 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-scripts-expected.txt @@ -1,3 +1,4 @@ +Tests how wasm scripts are reported Check that inspector gets two wasm scripts at module creation time. Script #0 parsed. URL: v8://test/testFunction Script #1 parsed. URL: v8://test/runTestRunction diff --git a/deps/v8/test/inspector/debugger/wasm-scripts.js b/deps/v8/test/inspector/debugger/wasm-scripts.js index 9fe8c26e6a..0993f11b53 100644 --- a/deps/v8/test/inspector/debugger/wasm-scripts.js +++ b/deps/v8/test/inspector/debugger/wasm-scripts.js @@ -4,6 +4,8 @@ // Flags: --expose-wasm +let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scripts are reported'); + utils.load('test/mjsunit/wasm/wasm-constants.js'); utils.load('test/mjsunit/wasm/wasm-module-builder.js'); @@ -27,9 +29,8 @@ function testFunction(bytes) { new WebAssembly.Module(buffer); } -InspectorTest.addScriptWithUrl( - testFunction.toString(), 'v8://test/testFunction'); -InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); +contextGroup.addScript(testFunction.toString(), 0, 0, 'v8://test/testFunction'); +contextGroup.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); Protocol.Debugger.enable(); Protocol.Debugger.onScriptParsed(handleScriptParsed); diff --git a/deps/v8/test/inspector/debugger/wasm-source-expected.txt b/deps/v8/test/inspector/debugger/wasm-source-expected.txt index 8e2c125676..b140be0876 100644 --- a/deps/v8/test/inspector/debugger/wasm-source-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-source-expected.txt @@ -1,3 +1,4 @@ +Tests how wasm scrips report the source Check that inspector gets disassembled wasm code Paused on debugger! Number of frames: 5 diff --git a/deps/v8/test/inspector/debugger/wasm-source.js b/deps/v8/test/inspector/debugger/wasm-source.js index cadd44f909..bf7bab735c 100644 --- a/deps/v8/test/inspector/debugger/wasm-source.js +++ b/deps/v8/test/inspector/debugger/wasm-source.js @@ -4,6 +4,8 @@ // Flags: --expose-wasm +let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scrips report the source'); + utils.load('test/mjsunit/wasm/wasm-constants.js'); utils.load('test/mjsunit/wasm/wasm-module-builder.js'); @@ -45,8 +47,8 @@ function testFunction(bytes) { instance.exports.main(); } -InspectorTest.addScript(testFunction.toString()); -InspectorTest.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); +contextGroup.addScript(testFunction.toString()); +contextGroup.addScript('var module_bytes = ' + JSON.stringify(module_bytes)); Protocol.Debugger.enable(); Protocol.Debugger.onPaused(handleDebuggerPaused); diff --git a/deps/v8/test/inspector/debugger/wasm-stack-expected.txt b/deps/v8/test/inspector/debugger/wasm-stack-expected.txt index df7d3a3f5a..c3226f5631 100644 --- a/deps/v8/test/inspector/debugger/wasm-stack-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stack-expected.txt @@ -1,3 +1,4 @@ +Tests call stack in wasm scripts Running testFunction with generated WASM bytes... Paused on 'debugger;' Number of frames: 5 diff --git a/deps/v8/test/inspector/debugger/wasm-stack.js b/deps/v8/test/inspector/debugger/wasm-stack.js index 45ab6097f7..2603c31784 100644 --- a/deps/v8/test/inspector/debugger/wasm-stack.js +++ b/deps/v8/test/inspector/debugger/wasm-stack.js @@ -4,6 +4,8 @@ // Flags: --expose-wasm +let {session, contextGroup, Protocol} = InspectorTest.start('Tests call stack in wasm scripts'); + utils.load('test/mjsunit/wasm/wasm-constants.js'); utils.load('test/mjsunit/wasm/wasm-module-builder.js'); @@ -40,7 +42,7 @@ function testFunction(bytes) { instance.exports.main(); } -InspectorTest.addScript(testFunction.toString()); +contextGroup.addScript(testFunction.toString()); Protocol.Debugger.enable(); Protocol.Debugger.onPaused(handleDebuggerPaused); diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt index a2df3e47b9..793552f7f5 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt +++ b/deps/v8/test/inspector/debugger/wasm-stepping-expected.txt @@ -1,3 +1,4 @@ +Tests stepping through wasm scripts Installing code an global variable. Calling instantiate function. Waiting for two wasm scripts to be parsed. @@ -32,52 +33,298 @@ Setting breakpoint on line 7 (on the setlocal before the call), url wasm://wasm/ scriptId : } Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >set_local 0 -Step action: stepInto +at wasm_B (7:6): + - scope (global): + -- skipped + - scope (local): + param#0: 4 (number) + stack: {"0":3} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 -Step action: stepInto +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 3 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop -Step action: stepOver +at wasm_A (1:2): + - scope (global): + -- skipped + - scope (local): + stack: {} (Object) +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 3 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOver called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:2:2: >nop -Step action: stepOut +at wasm_A (2:2): + - scope (global): + -- skipped + - scope (local): + stack: {} (Object) +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 3 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOut called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 -Step action: stepOut +at wasm_B (9:6): + - scope (global): + -- skipped + - scope (local): + param#0: 3 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOut called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >set_local 0 -Step action: stepOver +at wasm_B (7:6): + - scope (global): + -- skipped + - scope (local): + param#0: 3 (number) + stack: {"0":2} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOver called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 -Step action: stepOver +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 2 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOver called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 -Step action: resume +at wasm_B (9:6): + - scope (global): + -- skipped + - scope (local): + param#0: 2 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.resume called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >set_local 0 -Step action: stepInto +at wasm_B (7:6): + - scope (global): + -- skipped + - scope (local): + param#0: 2 (number) + stack: {"0":1} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 -Step action: stepInto +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop -Step action: stepOut +at wasm_A (1:2): + - scope (global): + -- skipped + - scope (local): + stack: {} (Object) +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepOut called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 -Step action: stepInto +at wasm_B (9:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:1:2: >loop -Step action: stepInto +at wasm_B (1:2): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:2:4: >get_local 0 -Step action: stepInto +at wasm_B (2:4): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:3:4: >if -Step action: stepInto +at wasm_B (3:4): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {"0":1} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:4:6: >get_local 0 -Step action: stepInto +at wasm_B (4:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:5:6: >i32.const 1 -Step action: stepInto +at wasm_B (5:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {"0":1} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:6:6: >i32.sub -Step action: stepInto +at wasm_B (6:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {"0":1,"1":1} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:7:6: >set_local 0 -Step action: stepInto +at wasm_B (7:6): + - scope (global): + -- skipped + - scope (local): + param#0: 1 (number) + stack: {"0":0} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:8:6: >call 0 -Step action: stepInto +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 0 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:1:2: >nop -Step action: stepInto +at wasm_A (1:2): + - scope (global): + -- skipped + - scope (local): + stack: {} (Object) +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 0 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:2:2: >nop -Step action: stepInto +at wasm_A (2:2): + - scope (global): + -- skipped + - scope (local): + stack: {} (Object) +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 0 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-0:3:0: >end -Step action: stepInto +at wasm_A (3:0): + - scope (global): + -- skipped + - scope (local): + stack: {} (Object) +at wasm_B (8:6): + - scope (global): + -- skipped + - scope (local): + param#0: 0 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.stepInto called Paused at wasm://wasm/wasm-0c10a5fe/wasm-0c10a5fe-1:9:6: >br 1 -Step action: resume +at wasm_B (9:6): + - scope (global): + -- skipped + - scope (local): + param#0: 0 (number) + stack: {} (Object) +at (anonymous) (0:17): + - scope (global): + -- skipped +Debugger.resume called exports.main returned! Finished! diff --git a/deps/v8/test/inspector/debugger/wasm-stepping.js b/deps/v8/test/inspector/debugger/wasm-stepping.js index 5f132df3ba..d3a2c64048 100644 --- a/deps/v8/test/inspector/debugger/wasm-stepping.js +++ b/deps/v8/test/inspector/debugger/wasm-stepping.js @@ -2,6 +2,8 @@ // 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 stepping through wasm scripts'); + utils.load('test/mjsunit/wasm/wasm-constants.js'); utils.load('test/mjsunit/wasm/wasm-module-builder.js'); @@ -68,6 +70,9 @@ var step_actions = [ // then just resume. 'resume' ]; +for (var action of step_actions) { + InspectorTest.logProtocolCommandCalls('Debugger.' + action) +} var sources = {}; var urls = {}; var afterTwoSourcesCallback; @@ -151,10 +156,48 @@ function printPauseLocation(scriptId, lineNr, columnNr) { line); } +async function getValueString(value) { + if (value.type == 'object') { + var msg = await Protocol.Runtime.callFunctionOn({ + objectId: value.objectId, + functionDeclaration: 'function () { return JSON.stringify(this); }' + }); + printFailure(msg); + return msg.result.result.value + ' (' + value.description + ')'; + } + return 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); + } + } + } +} + function handlePaused(msg) { var loc = msg.params.callFrames[0].location; printPauseLocation(loc.scriptId, loc.lineNumber, loc.columnNumber); - var action = step_actions.shift(); - InspectorTest.log('Step action: ' + action); - Protocol.Debugger[action](); + dumpScopeChainsOnPause(msg) + .then(Protocol.Debugger[step_actions.shift() || 'resume']); } -- cgit v1.2.1