From 5ffce3ef0666761904024637e3a6b11fa0aeeca9 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 14 May 2018 14:30:24 +0200 Subject: [PATCH] test: remove untested knownGlobals These values are all non-enumerable and will never be checked. By removing them, we make sure they will not become enumerable unnoticed. PR-URL: https://github.com/nodejs/node/pull/20717 Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- test/common/index.js | 25 ------------------------- test/common/index.mjs | 25 ------------------------- test/message/console_low_stack_space.js | 9 ++++++--- 3 files changed, 6 insertions(+), 53 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index 07c0992d65e8d2..743bf15fb8301d 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -310,8 +310,6 @@ let knownGlobals = [ clearImmediate, clearInterval, clearTimeout, - console, - constructor, // Enumerable in V8 3.21. global, process, setImmediate, @@ -341,29 +339,6 @@ if (global.COUNTER_NET_SERVER_CONNECTION) { knownGlobals.push(COUNTER_HTTP_CLIENT_RESPONSE); } -if (global.ArrayBuffer) { - knownGlobals.push(ArrayBuffer); - knownGlobals.push(Int8Array); - knownGlobals.push(Uint8Array); - knownGlobals.push(Uint8ClampedArray); - knownGlobals.push(Int16Array); - knownGlobals.push(Uint16Array); - knownGlobals.push(Int32Array); - knownGlobals.push(Uint32Array); - knownGlobals.push(Float32Array); - knownGlobals.push(Float64Array); - knownGlobals.push(DataView); -} - -// Harmony features. -if (global.Proxy) { - knownGlobals.push(Proxy); -} - -if (global.Symbol) { - knownGlobals.push(Symbol); -} - if (process.env.NODE_TEST_KNOWN_GLOBALS) { const knownFromEnv = process.env.NODE_TEST_KNOWN_GLOBALS.split(','); allowGlobals(...knownFromEnv); diff --git a/test/common/index.mjs b/test/common/index.mjs index 49b9e56bd9a10b..dd4ee2146e0720 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -8,8 +8,6 @@ let knownGlobals = [ clearImmediate, clearInterval, clearTimeout, - console, - constructor, // Enumerable in V8 3.21. global, process, setImmediate, @@ -50,29 +48,6 @@ export function leakedGlobals() { knownGlobals.push(COUNTER_HTTP_CLIENT_RESPONSE); } - if (global.ArrayBuffer) { - knownGlobals.push(ArrayBuffer); - knownGlobals.push(Int8Array); - knownGlobals.push(Uint8Array); - knownGlobals.push(Uint8ClampedArray); - knownGlobals.push(Int16Array); - knownGlobals.push(Uint16Array); - knownGlobals.push(Int32Array); - knownGlobals.push(Uint32Array); - knownGlobals.push(Float32Array); - knownGlobals.push(Float64Array); - knownGlobals.push(DataView); - } - - // Harmony features. - if (global.Proxy) { - knownGlobals.push(Proxy); - } - - if (global.Symbol) { - knownGlobals.push(Symbol); - } - const leaked = []; for (const val in global) { diff --git a/test/message/console_low_stack_space.js b/test/message/console_low_stack_space.js index 9128eb49d120e0..4834ffd9cd0b36 100644 --- a/test/message/console_low_stack_space.js +++ b/test/message/console_low_stack_space.js @@ -1,8 +1,11 @@ 'use strict'; -// copy console accessor because requiring ../common touches it +// Copy console accessor because requiring ../common touches it const consoleDescriptor = Object.getOwnPropertyDescriptor(global, 'console'); -delete global.console; -global.console = {}; +Object.defineProperty(global, 'console', { + configurable: true, + writable: true, + value: {} +}); require('../common');