lib: use primordials for navigator.userAgent

PR-URL: https://github.com/nodejs/node/pull/50467
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
This commit is contained in:
Aras Abbasi
2023-11-02 14:31:50 +01:00
committed by GitHub
parent 5d01042e34
commit 45f5c9ba4e

View File

@@ -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) {