v8/test/inspector/runtime/function-location.js
Alexey Kozyatinskiy c31bb8a4e4 [debug] retire ScriptWrapper
- rewritten couple tests,
- migrated JSMessageObject to real Script instead of wrapper,
- removed wrapper.

R=yangguo@chromium.org
TBR=ulan@chromium.org

Bug: v8:5530
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia95492344c7b5978a940e2ab007b389384537148
Reviewed-on: https://chromium-review.googlesource.com/1112851
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54274}
2018-07-05 21:33:03 +00:00

57 lines
1.3 KiB
JavaScript

// Copyright 2018 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 [[FunctionLocation]] internal property');
contextGroup.addScript(
`function a() { b(); };
function b() {
c(true);
};
function c(x) {
if (x) {
return 1;
} else {
return 1;
}
};
function d(x) {
x = 1 ;
x = 2 ;
x = 3 ;
x = 4 ;
x = 5 ;
x = 6 ;
x = 7 ;
x = 8 ;
x = 9 ;
x = 10;
x = 11;
x = 12;
x = 13;
x = 14;
x = 15;
}`);
(async function test() {
session.setupScriptMap();
Protocol.Debugger.enable();
await session.logSourceLocation(await functionLocation('a'), true);
await session.logSourceLocation(await functionLocation('b'), true);
await session.logSourceLocation(await functionLocation('c'), true);
await session.logSourceLocation(await functionLocation('d'), true);
InspectorTest.completeTest();
})();
async function functionLocation(name) {
const {result:{result}} = await Protocol.Runtime.evaluate({expression: name});
const {result:{internalProperties}} = await Protocol.Runtime.getProperties({
objectId: result.objectId
});
const {value:{value}} = internalProperties.find(
prop => prop.name === '[[FunctionLocation]]');
return value;
}