node/deps/v8/test/inspector/runtime/preview-sideeffects.js
Michaël Zasso 7772a2df9d
deps: update V8 to 14.1.146.11
PR-URL: https://github.com/nodejs/node/pull/59805
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2025-10-04 18:47:18 +02:00

35 lines
929 B
JavaScript

// Copyright 2025 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('Checks that console preview does not run user code');
contextGroup.addScript(`
function testLogObject() {
let getterCalled = false;
const obj = {};
Object.defineProperty(obj, 'test', {
get: (() => {
getterCalled = true;
return 'value';
}).bind(null),
});
console.log(obj);
console.clear();
return {getterCalled};
}
//# sourceURL=test.js
`);
InspectorTest.runAsyncTestSuite([
async function ObjectGetter() {
await Protocol.Runtime.enable();
const result = await Protocol.Runtime.evaluate({expression: 'testLogObject()', returnByValue: true});
InspectorTest.logObject(result.result.result.value);
await Protocol.Runtime.disable();
}
]);