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.addScript( |
| 6 `function testNonEmptyEvalScope() { |
| 7 eval("'use strict'; var hest = 420; debugger;"); |
| 8 } |
| 9 function testEmptyEvalScope() { |
| 10 eval("var fisk = 42; testNonEmptyEvalScope();"); |
| 11 }`); |
| 12 |
| 13 Protocol.Debugger.enable(); |
| 14 Protocol.Debugger.oncePaused().then(dumpScopeOnPause); |
| 15 Protocol.Runtime.evaluate({ "expression": "testEmptyEvalScope();" }); |
| 16 |
| 17 var waitScopeObjects = 0; |
| 18 function dumpScopeOnPause(message) |
| 19 { |
| 20 var scopeChain = message.params.callFrames[0].scopeChain; |
| 21 var evalScopeObjectIds = []; |
| 22 for (var scope of scopeChain) { |
| 23 if (scope.type === "eval") { |
| 24 evalScopeObjectIds.push(scope.object.objectId); |
| 25 } |
| 26 } |
| 27 waitScopeObjects = evalScopeObjectIds.length; |
| 28 if (!waitScopeObjects) { |
| 29 InspectorTest.completeTest(); |
| 30 } else { |
| 31 for (var objectId of evalScopeObjectIds) |
| 32 Protocol.Runtime.getProperties({ "objectId" : objectId }) |
| 33 .then(dumpProperties); |
| 34 } |
| 35 } |
| 36 |
| 37 function dumpProperties(message) |
| 38 { |
| 39 InspectorTest.logMessage(message); |
| 40 --waitScopeObjects; |
| 41 if (!waitScopeObjects) |
| 42 Protocol.Debugger.resume().then(InspectorTest.completeTest); |
| 43 } |
OLD | NEW |