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: #17708
Fixes: #11805
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
  • Loading branch information
BridgeAR committed Jan 18, 2018
1 parent f054855 commit e99ae77
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 e99ae77

Please sign in to comment.