9e27dbca79
This CL fixes a wrong assumption in the LiveEdit machinery. Namely the assumption that every FunctionLiteral the parser finds, will have a corresponding SFI created by the compiler. This assumption does not hold in all cases. Inner functions that are never referenced by the outer function don't get an SFI. R=bmeurer@chromium.org Fixed: chromium:1328453 Change-Id: I674f023f948954c1fcae04a4aa2afb69ea1642aa Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663443 Commit-Queue: Simon Zünd <szuend@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/main@{#80735}
31 lines
837 B
JavaScript
31 lines
837 B
JavaScript
// Copyright 2022 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 {contextGroup, Protocol} = InspectorTest.start(
|
|
'Don\'t crash when live editing an unused inner function [crbug.com/1328453]');
|
|
|
|
contextGroup.addScript(`
|
|
function outerFn() {
|
|
function innerFn() {
|
|
console.log("aa"); // We'll edit the "aa".
|
|
}
|
|
}`);
|
|
|
|
const updatedScript = `
|
|
function outerFn() {
|
|
function innerFn() {
|
|
console.log("aabb");
|
|
}
|
|
}`;
|
|
|
|
(async () => {
|
|
Protocol.Debugger.enable();
|
|
const { params: {scriptId} } = await Protocol.Debugger.onceScriptParsed();
|
|
|
|
const response = await Protocol.Debugger.setScriptSource({ scriptId, scriptSource: updatedScript });
|
|
InspectorTest.logMessage(response);
|
|
|
|
InspectorTest.completeTest();
|
|
})();
|