Skip to content

Commit d6e8d03

Browse files
joyeecheungrichardlau
authored andcommitted
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 fdc7d75 commit d6e8d03

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/internal/console/constructor.js

-2
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,6 @@ Console.prototype.groupCollapsed = Console.prototype.group;
689689

690690
function initializeGlobalConsole(globalConsole) {
691691
globalConsole[kBindStreamsLazy](process);
692-
globalConsole[kBindProperties](true, 'auto');
693-
694692
const {
695693
namespace: {
696694
addSerializeCallback,

lib/internal/console/global.js

+3
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)