Commit e4396813 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

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/1241475Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56216}
parent 72131a74
......@@ -801,6 +801,8 @@ MaybeHandle<Object> LoadLookupSlot(Isolate* isolate, Handle<String> name,
if (isolate->has_pending_exception()) return MaybeHandle<Object>();
if (!holder.is_null() && holder->IsModule()) {
Handle<Object> receiver = isolate->factory()->undefined_value();
if (receiver_return) *receiver_return = receiver;
return Module::LoadVariable(isolate, Handle<Module>::cast(holder), index);
}
if (index != Context::kNotFound) {
......
Evaluate at first line of module should not crash
{
id : <messageId>
result : {
result : {
description : 0
type : number
value : 0
}
}
}
// 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();
})()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment