mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
lib: fix incorrect use of console intrinsic
The console object was not being frozen because the intrinsic freezing code was accessing undefined instead of the console object. PR-URL: https://github.com/nodejs/node/pull/46044 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
30a548475b
commit
57048acedc
2 files changed
+10
-1
No files matched your search
@@ -135,7 +135,7 @@ const {
|
||||
|
||||
module.exports = function() {
|
||||
const { Console } = require('internal/console/constructor');
|
||||
const { console } = require('internal/console/global');
|
||||
const console = require('internal/console/global');
|
||||
const {
|
||||
clearImmediate,
|
||||
clearInterval,
|
||||
|
||||
@@ -37,3 +37,12 @@ assert.throws(
|
||||
{ name: 'TypeError' });
|
||||
assert.strictEqual(globalThis.globalThis, globalThis);
|
||||
}
|
||||
|
||||
// Ensure that we cannot override console properties.
|
||||
{
|
||||
const { log } = console;
|
||||
|
||||
assert.throws(() => { console.log = null; },
|
||||
{ name: 'TypeError' });
|
||||
assert.strictEqual(console.log, log);
|
||||
}
|
||||
Reference in new issue
Block a user