ba081a32d2
This tests calling Debugger.getPossibleBreakpoints on a user function embedded into the startup snapshot. Currently, this fails because inspector does not know how to handle scripts without an associated context. The test should be updated once we have a fix. Bug: v8:9029 Change-Id: Id2391a2df203fa7f119f39ea1c34da6a7c54206f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1581643 Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#61063}
40 lines
1.5 KiB
JavaScript
40 lines
1.5 KiB
JavaScript
// Copyright 2019 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.
|
|
|
|
// Embed a user function in the snapshot and listen for scriptParsed events.
|
|
|
|
// Flags: --embed 'function f() { return 42; }; f();'
|
|
// Flags: --no-turbo-rewrite-far-jumps
|
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start(
|
|
'Tests that getPossibleBreakpoints works on a snapshotted function');
|
|
session.setupScriptMap();
|
|
|
|
Protocol.Debugger.onScriptParsed(requestSourceAndDump);
|
|
|
|
Protocol.Debugger.enable()
|
|
.then(InspectorTest.waitForPendingTasks)
|
|
.then(InspectorTest.completeTest);
|
|
|
|
function requestSourceAndDump(scriptParsedMessage) {
|
|
const scriptId = scriptParsedMessage.params.scriptId;
|
|
Protocol.Debugger.getScriptSource({ scriptId: scriptId })
|
|
.then((sourceMessage) => dumpScriptParsed(
|
|
scriptParsedMessage, sourceMessage))
|
|
.then(() => Protocol.Debugger.getPossibleBreakpoints({
|
|
start: { lineNumber: 0, columnNumber: 0, scriptId: scriptId },
|
|
end: { lineNumber: 0, columnNumber: 1, scriptId: scriptId },
|
|
restrictToFunction: false
|
|
}))
|
|
.then(InspectorTest.logMessage);
|
|
}
|
|
|
|
function dumpScriptParsed(scriptParsedMessage, sourceMessage) {
|
|
var sourceResult = sourceMessage.result;
|
|
sourceResult.scriptSource = sourceResult.scriptSource.replace(/\n/g, "<nl>");
|
|
InspectorTest.log("scriptParsed");
|
|
InspectorTest.logObject(sourceResult);
|
|
InspectorTest.logMessage(scriptParsedMessage.params);
|
|
}
|