v8/test/inspector/debugger/set-script-source-repl-mode.js
Simon Zünd 104c564460 [liveedit] Fix DCHECK when changing outer scope variables
This CL fixes the ScopeInfo::Equals DCHECK when we update "unchanged"
functions. We don't need to make sure the outer scope info matches
exactly. LiveEdit already makes sure that outer scope infos don't
change in a way that would be bad for "unchanged" functions. It's
fine if they only change subtly by e.g. moving a outer context variable from `let` to `const`.

Note that we don't touch existing closures on the heap, those
will still reference the old scope info.

R=jarin@chromium.org

Bug: chromium:1363561
Change-Id: I5117d345d1f70e08ea436ed89f2c6deaff3f0538
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3953496
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83713}
2022-10-14 11:35:15 +00:00

31 lines
862 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 {session, contextGroup, Protocol} =
InspectorTest.start('Check that setScriptSource works with REPL mode');
const script = `
function foo() { return 42; }
const bar = foo();
`;
const changedScript = script.replace('const', 'let');
(async function test() {
await Protocol.Debugger.enable();
Protocol.Runtime.evaluate({
expression: script,
replMode: true,
});
const { params: { scriptId } } = await Protocol.Debugger.onceScriptParsed();
const { result: { status } } = await Protocol.Debugger.setScriptSource({
scriptId,
scriptSource: changedScript,
});
InspectorTest.log(`Debugger.setScriptSource: ${status}`);
InspectorTest.completeTest();
})();