53fc4807cd
Previously we'd allow to replace the source of functions that are on the current execution stack under certain conditions, but this has resulted in an endless stream of bugs due to weird edge cases, and so we're now limiting LiveEdit to functions that don't have any activation (including not a suspended generator / async function activation). We might eventually add the ability to LiveEdit functions with activations and have them "upgrade upon next invocation", but that doesn't seem to be an extremely important use case right now. Fixed: chromium:1195927 Change-Id: I87a45ba4d0ddcfbf867bd4e73738d76b2d789e04 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2846892 Auto-Submit: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#74249}
55 lines
1.5 KiB
JavaScript
55 lines
1.5 KiB
JavaScript
// Copyright 2021 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('Regression test for crbug.com/1195927');
|
|
|
|
const source = `
|
|
function foo(x) {
|
|
x = x + 1;
|
|
return x;
|
|
}
|
|
`;
|
|
|
|
const newSource = `
|
|
function foo(x) {
|
|
x = x + 2;
|
|
return x;
|
|
}
|
|
`;
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
async function test() {
|
|
session.setupScriptMap();
|
|
await Protocol.Runtime.enable();
|
|
await Protocol.Debugger.enable();
|
|
contextGroup.addScript(source, 0, 0, 'foo.js');
|
|
const { params: { scriptId } } = await Protocol.Debugger.onceScriptParsed();
|
|
|
|
let {result} = await Protocol.Debugger.setBreakpoint({location: {
|
|
scriptId,
|
|
lineNumber: 2,
|
|
}});
|
|
InspectorTest.log('Debugger.setBreakpoint result:');
|
|
InspectorTest.logMessage(result);
|
|
|
|
const callPromise = Protocol.Runtime.evaluate({expression: 'foo(42)'});
|
|
|
|
let {params: {callFrames}} = await Protocol.Debugger.oncePaused();
|
|
InspectorTest.log('Debugger.paused call frames:');
|
|
session.logCallFrames(callFrames);
|
|
|
|
({result} = await Protocol.Debugger.setScriptSource({
|
|
scriptId,
|
|
scriptSource: newSource
|
|
}));
|
|
InspectorTest.log('Debugger.setScriptSource result:');
|
|
InspectorTest.logMessage(result);
|
|
|
|
([, {result}] = await Promise.all([Protocol.Debugger.resume(), callPromise]));
|
|
InspectorTest.log('foo(42) result:');
|
|
InspectorTest.logMessage(result);
|
|
}
|
|
]);
|