v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js
kozyatinskiy 270db7903a [inspector] added inspector test runner [part 5]
- added most part of inspector tests that depends only on JavaScript domains.

BUG=chromium:635948
R=dgozman@chromium.org,alph@chromium.org

Committed: https://crrev.com/9ddbdab195923fc87fae3587ae06c5c1c5ca6d79
Review-Url: https://codereview.chromium.org/2369753004
Cr-Original-Commit-Position: refs/heads/master@{#39897}
Cr-Commit-Position: refs/heads/master@{#39931}
2016-10-02 21:23:03 +00:00

43 lines
1.2 KiB
JavaScript

// 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.evaluateInPage(
`function testFunction()
{
for (var a of [1]) {
++a;
debugger;
}
}`);
InspectorTest.sendCommandOrDie("Debugger.enable", {});
InspectorTest.eventHandler["Debugger.paused"] = dumpScopeOnPause;
InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "testFunction()" });
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)
InspectorTest.sendCommandOrDie("Runtime.getProperties", { "objectId" : objectId }, dumpProperties);
}
}
function dumpProperties(message)
{
InspectorTest.logObject(message);
--waitScopeObjects;
if (!waitScopeObjects)
InspectorTest.sendCommandOrDie("Debugger.resume", {}, () => InspectorTest.completeTest());
}