v8/test/inspector/debugger/evaluate-at-first-module-line.js
Alexey Kozyatinskiy e439681323 debug: LoadLookupSlot should initialize receiver for modules..
.. otherwise V8 crashes on attempt to use imported function as part
of expression passed to Debugger.evaluateOnCallFrame.

R=neis@chromium.org

Bug: chromium:878029
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I61b837f5c7b84a80d91a9cdaaac0422a24aa1620
Reviewed-on: https://chromium-review.googlesource.com/1241475
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56216}
2018-09-25 14:52:41 +00:00

32 lines
967 B
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.
const {session, contextGroup, Protocol} =
InspectorTest.start('Evaluate at first line of module should not crash');
const utilsModule = `export function identity(value) {
return value;
}`;
const mainModule = `import {identity} from 'utils';
console.log(identity(0));`;
(async function test() {
Protocol.Debugger.enable();
Protocol.Debugger.setBreakpointByUrl({
lineNumber: 1,
url: 'main'
});
contextGroup.addModule(utilsModule, 'utils');
contextGroup.addModule(mainModule, 'main');
const { params: { callFrames } } = await Protocol.Debugger.oncePaused();
const result = await Protocol.Debugger.evaluateOnCallFrame({
callFrameId: callFrames[0].callFrameId,
expression: 'identity(0)'
});
InspectorTest.logMessage(result);
InspectorTest.completeTest();
})()