From a29d70fcfbc926d6fb63801ee35634a530305991 Mon Sep 17 00:00:00 2001 From: Voltrex <62040526+VoltrexMaster@users.noreply.github.com> Date: Tue, 25 May 2021 02:42:32 +0430 Subject: [PATCH] lib: use primordial for noop Most of the internal modules use the `FunctionPrototype` primordial for no-op functions, we could use them here for consistency. --- lib/internal/bootstrap/switches/is_main_thread.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/internal/bootstrap/switches/is_main_thread.js b/lib/internal/bootstrap/switches/is_main_thread.js index 08623898edafac..d9cb5f39b6e242 100644 --- a/lib/internal/bootstrap/switches/is_main_thread.js +++ b/lib/internal/bootstrap/switches/is_main_thread.js @@ -1,6 +1,9 @@ 'use strict'; -const { ObjectDefineProperty } = primordials; +const { + FunctionPrototype, + ObjectDefineProperty +} = primordials; const rawMethods = internalBinding('process_methods'); // TODO(joyeecheung): deprecate and remove these underscore methods @@ -10,8 +13,8 @@ process._debugEnd = rawMethods._debugEnd; // See the discussion in https://github.com/nodejs/node/issues/19009 and // https://github.com/nodejs/node/pull/34010 for why these are no-ops. // Five word summary: they were broken beyond repair. -process._startProfilerIdleNotifier = () => {}; -process._stopProfilerIdleNotifier = () => {}; +process._startProfilerIdleNotifier = FunctionPrototype; +process._stopProfilerIdleNotifier = FunctionPrototype; function defineStream(name, getter) { ObjectDefineProperty(process, name, {