lib: make console writable and non-enumerable
According to the standard the property descriptor of console should be writable and non-enumerable. PR-URL: https://github.com/nodejs/node/pull/17708 Fixes: https://github.com/nodejs/node/issues/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>
This commit is contained in:
parent
f054855bbf
commit
e99ae7764d
6
lib/internal/bootstrap_node.js
vendored
6
lib/internal/bootstrap_node.js
vendored
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user