Skip to content

Commit

Permalink
lib: make console writable and non-enumerable
Browse files Browse the repository at this point in the history
According to the standard the property descriptor of console
should be writable and non-enumerable.

PR-URL: nodejs#17708
Fixes: nodejs#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>
  • Loading branch information
BridgeAR authored and MayaLekova committed May 8, 2018
1 parent 395ffe3 commit 0c1fef4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,8 @@
const wrappedConsole = NativeModule.require('console');
Object.defineProperty(global, 'console', {
configurable: true,
enumerable: true,
get() {
return wrappedConsole;
}
enumerable: false,
value: wrappedConsole
});
setupInspector(originalConsole, wrappedConsole, Module);
}
Expand Down
2 changes: 1 addition & 1 deletion test/message/console_low_stack_space.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function a() {
try {
return a();
} catch (e) {
compiledConsole = consoleDescriptor.get();
compiledConsole = consoleDescriptor.value;
if (compiledConsole.log) {
// Using `console.log` itself might not succeed yet, but the code for it
// has been compiled.
Expand Down

0 comments on commit 0c1fef4

Please sign in to comment.