2016-10-02 21:22:49 +00:00
|
|
|
// 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.
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Tests that scopes do not report variables with empty names');
|
|
|
|
|
|
|
|
contextGroup.addScript(
|
2016-10-02 21:22:49 +00:00
|
|
|
`function testFunction()
|
|
|
|
{
|
|
|
|
for (var a of [1]) {
|
|
|
|
++a;
|
|
|
|
debugger;
|
|
|
|
}
|
|
|
|
}`);
|
|
|
|
|
2016-10-03 23:32:52 +00:00
|
|
|
Protocol.Debugger.enable();
|
|
|
|
Protocol.Debugger.oncePaused().then(dumpScopeOnPause);
|
|
|
|
Protocol.Runtime.evaluate({ "expression": "testFunction()" });
|
2016-10-02 21:22:49 +00:00
|
|
|
|
|
|
|
var waitScopeObjects = 0;
|
|
|
|
function dumpScopeOnPause(message)
|
|
|
|
{
|
|
|
|
var scopeChain = message.params.callFrames[0].scopeChain;
|
|
|
|
var localScopeObjectIds = [];
|
|
|
|
for (var scope of scopeChain) {
|
|
|
|
if (scope.type === "local")
|
|
|
|
localScopeObjectIds.push(scope.object.objectId);
|
|
|
|
}
|
|
|
|
waitScopeObjects = localScopeObjectIds.length;
|
|
|
|
if (!waitScopeObjects) {
|
|
|
|
InspectorTest.completeTest();
|
|
|
|
} else {
|
|
|
|
for (var objectId of localScopeObjectIds)
|
2016-10-03 23:32:52 +00:00
|
|
|
Protocol.Runtime.getProperties({ "objectId" : objectId }).then(dumpProperties);
|
2016-10-02 21:22:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function dumpProperties(message)
|
|
|
|
{
|
2016-10-03 23:32:52 +00:00
|
|
|
InspectorTest.logMessage(message);
|
2016-10-02 21:22:49 +00:00
|
|
|
--waitScopeObjects;
|
|
|
|
if (!waitScopeObjects)
|
2016-10-03 23:32:52 +00:00
|
|
|
Protocol.Debugger.resume().then(InspectorTest.completeTest);
|
2016-10-02 21:22:49 +00:00
|
|
|
}
|