v8/test/inspector/debugger/eval-without-codegen.js
Erik Luo bcbdcea734 Set RuntimeAgent evaluate to use DebugEvaluate::Global
Bug: chromium:810176
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I330fa0bdf81d0bb926cf6db794736e89c069f8f2
Reviewed-on: https://chromium-review.googlesource.com/907707
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Commit-Queue: Erik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51333}
2018-02-16 19:56:20 +00:00

39 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(
'Tests that evaluation works when code generation from strings is not allowed.');
Protocol.Debugger.enable();
Protocol.Runtime.enable();
InspectorTest.runAsyncTestSuite([
async function testEvaluateNotPaused() {
contextGroup.addScript(`inspector.setAllowCodeGenerationFromStrings(false);
var global1 = 'Global1';`);
await Protocol.Debugger.onceScriptParsed();
InspectorTest.logMessage(
await Protocol.Runtime.evaluate({expression: 'global1'}));
},
async function testEvaluatePaused() {
contextGroup.addScript(`inspector.setAllowCodeGenerationFromStrings(false);
var global2 = 'Global2';
function foo(x) {
var local = 'Local';
debugger;
return local + x;
}
foo();`);
let {params: {callFrames: [{callFrameId}]}} =
await Protocol.Debugger.oncePaused();
InspectorTest.logMessage(
await Protocol.Runtime.evaluate({expression: 'global2'}));
InspectorTest.logMessage(await Protocol.Debugger.evaluateOnCallFrame(
{callFrameId, expression: 'local'}));
await Protocol.Debugger.resume();
}
]);