[inspector] Add regression test for leaking vars in debug-evaluate
This CL adds the regression test originally authored for crbug.com/1085693. It no longer crashes or re-produces but we were unable to bisect to the CL that fixed the problem since bisecting seems to be broken. R=bmeurer@chromium.org Fixed: chromium:1085693 Change-Id: Iaaf2b557767a02829fc497591ed7f3623965a66c Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4012718 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org> Cr-Commit-Position: refs/heads/main@{#84108}
This commit is contained in:
parent
cb25ca93e6
commit
e24c3ac022
15
test/inspector/regress/regress-crbug-1085693-expected.txt
Normal file
15
test/inspector/regress/regress-crbug-1085693-expected.txt
Normal file
@ -0,0 +1,15 @@
|
||||
Test that var does not leak into object in parent scope. crbug.com/1085693
|
||||
Paused in arrow function
|
||||
{
|
||||
className : Object
|
||||
description : Object
|
||||
objectId : <objectId>
|
||||
preview : {
|
||||
description : Object
|
||||
overflow : false
|
||||
properties : [
|
||||
]
|
||||
type : object
|
||||
}
|
||||
type : object
|
||||
}
|
43
test/inspector/regress/regress-crbug-1085693.js
Normal file
43
test/inspector/regress/regress-crbug-1085693.js
Normal file
@ -0,0 +1,43 @@
|
||||
// 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(
|
||||
'Test that var does not leak into object in parent scope. crbug.com/1085693');
|
||||
|
||||
const inputSnippet = `
|
||||
function testFunction() {
|
||||
const objectWeShouldNotLeakInto = {};
|
||||
(() => {
|
||||
debugger; // evaluate "var leakedProperty = 1" at this break
|
||||
console.log(objectWeShouldNotLeakInto);
|
||||
})();
|
||||
}
|
||||
testFunction();
|
||||
`;
|
||||
|
||||
(async () => {
|
||||
await Protocol.Debugger.enable();
|
||||
await Protocol.Runtime.enable();
|
||||
|
||||
Protocol.Runtime.evaluate({
|
||||
expression: inputSnippet,
|
||||
replMode: true,
|
||||
});
|
||||
|
||||
const pausedMessage = await Protocol.Debugger.oncePaused();
|
||||
|
||||
InspectorTest.log('Paused in arrow function');
|
||||
|
||||
const topFrame = pausedMessage.params.callFrames[0];
|
||||
await Protocol.Debugger.evaluateOnCallFrame({
|
||||
expression: 'var leakedProperty = 1;',
|
||||
callFrameId: topFrame.callFrameId,
|
||||
});
|
||||
Protocol.Debugger.resume();
|
||||
|
||||
const { params } = await Protocol.Runtime.onceConsoleAPICalled();
|
||||
InspectorTest.logMessage(params.args[0]);
|
||||
|
||||
InspectorTest.completeTest();
|
||||
})();
|
Loading…
Reference in New Issue
Block a user