node/test/fixtures/snapshot/console.js
Joyee Cheung f0cf1005a3
bootstrap: clean up inspector console methods during serialization
Some console methods are created by the V8 inspector after
an inspector client is created, reset them to undefined during
sereialization to avoid holding on to invalid references in
the snapshot. V8 will take care of the re-initialization when
another inspector client is created during deserialization.

PR-URL: https://github.com/nodejs/node/pull/44279
Fixes: https://github.com/nodejs/node-v8/issues/237
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-09-07 11:20:40 +00:00

10 lines
236 B
JavaScript

const {
setDeserializeMainFunction,
} = require('v8').startupSnapshot;
console.log(JSON.stringify(Object.keys(console), null, 2));
setDeserializeMainFunction(() => {
console.log(JSON.stringify(Object.keys(console), null, 2));
});