From c9bd0c5000d3051bf7fe051dcddfe5d433f7cc1b Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Thu, 2 Nov 2023 14:31:50 +0100 Subject: [PATCH] lib: use primordials for navigator.userAgent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/50467 Reviewed-By: Geoffrey Booth Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: Yagiz Nizipli Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Ethan Arrowood --- lib/internal/navigator.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/navigator.js b/lib/internal/navigator.js index bfd2813414b26d..5b29a098fcd0d9 100644 --- a/lib/internal/navigator.js +++ b/lib/internal/navigator.js @@ -2,6 +2,8 @@ const { ObjectDefineProperties, + StringPrototypeIndexOf, + StringPrototypeSlice, Symbol, } = primordials; @@ -23,7 +25,7 @@ const nodeVersion = process.version; class Navigator { // Private properties are used to avoid brand validations. #availableParallelism; - #userAgent = `Node.js/${nodeVersion.slice(1, nodeVersion.indexOf('.'))}`; + #userAgent = `Node.js/${StringPrototypeSlice(nodeVersion, 1, StringPrototypeIndexOf(nodeVersion, '.'))}`; constructor() { if (arguments[0] === kInitialize) {