OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 InspectorTest.evaluateInPage( |
| 6 `function testFunction() |
| 7 { |
| 8 for (var a of [1]) { |
| 9 ++a; |
| 10 debugger; |
| 11 } |
| 12 }`); |
| 13 |
| 14 InspectorTest.sendCommandOrDie("Debugger.enable", {}); |
| 15 InspectorTest.eventHandler["Debugger.paused"] = dumpScopeOnPause; |
| 16 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "testFunction
()" }); |
| 17 |
| 18 var waitScopeObjects = 0; |
| 19 function dumpScopeOnPause(message) |
| 20 { |
| 21 var scopeChain = message.params.callFrames[0].scopeChain; |
| 22 var localScopeObjectIds = []; |
| 23 for (var scope of scopeChain) { |
| 24 if (scope.type === "local") |
| 25 localScopeObjectIds.push(scope.object.objectId); |
| 26 } |
| 27 waitScopeObjects = localScopeObjectIds.length; |
| 28 if (!waitScopeObjects) { |
| 29 InspectorTest.completeTest(); |
| 30 } else { |
| 31 for (var objectId of localScopeObjectIds) |
| 32 InspectorTest.sendCommandOrDie("Runtime.getProperties", { "objectId" : obj
ectId }, dumpProperties); |
| 33 } |
| 34 } |
| 35 |
| 36 function dumpProperties(message) |
| 37 { |
| 38 InspectorTest.logObject(message); |
| 39 --waitScopeObjects; |
| 40 if (!waitScopeObjects) |
| 41 InspectorTest.sendCommandOrDie("Debugger.resume", {}, () => InspectorTest.co
mpleteTest()); |
| 42 } |
OLD | NEW |