Skip to content

Commit 7851af0

Browse files
authored
lib: create global console properties at snapshot build time
It is safe to create the console properties for the global console at snapshot build time. Streams must still be created lazily however because they need special synchronization for the handles. PR-URL: #51700 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Moshe Atlow <[email protected]>
1 parent 2eaee28 commit 7851af0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/internal/console/constructor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,6 @@ Console.prototype.groupCollapsed = Console.prototype.group;
694694

695695
function initializeGlobalConsole(globalConsole) {
696696
globalConsole[kBindStreamsLazy](process);
697-
globalConsole[kBindProperties](true, 'auto');
698-
699697
const {
700698
namespace: {
701699
addSerializeCallback,

lib/internal/console/global.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const {
2121

2222
const {
2323
Console,
24+
kBindProperties,
2425
} = require('internal/console/constructor');
2526

2627
const globalConsole = { __proto__: {} };
@@ -41,6 +42,8 @@ for (const prop of ReflectOwnKeys(Console.prototype)) {
4142
ReflectDefineProperty(globalConsole, prop, desc);
4243
}
4344

45+
globalConsole[kBindProperties](true, 'auto');
46+
4447
// This is a legacy feature - the Console constructor is exposed on
4548
// the global console instance.
4649
globalConsole.Console = Console;

0 commit comments

Comments
 (0)