Skip to content

Commit e99ae77

Browse files
committed
lib: make console writable and non-enumerable
According to the standard the property descriptor of console should be writable and non-enumerable. PR-URL: #17708 Fixes: #11805 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
1 parent f054855 commit e99ae77

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/internal/bootstrap_node.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,8 @@
321321
const wrappedConsole = NativeModule.require('console');
322322
Object.defineProperty(global, 'console', {
323323
configurable: true,
324-
enumerable: true,
325-
get() {
326-
return wrappedConsole;
327-
}
324+
enumerable: false,
325+
value: wrappedConsole
328326
});
329327
setupInspector(originalConsole, wrappedConsole, Module);
330328
}

test/message/console_low_stack_space.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function a() {
1616
try {
1717
return a();
1818
} catch (e) {
19-
compiledConsole = consoleDescriptor.get();
19+
compiledConsole = consoleDescriptor.value;
2020
if (compiledConsole.log) {
2121
// Using `console.log` itself might not succeed yet, but the code for it
2222
// has been compiled.

0 commit comments

Comments
 (0)