Skip to content

Commit

Permalink
lib: use primordials for navigator.userAgent
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
Uzlopak authored and targos committed Nov 14, 2023
1 parent f70a2dd commit c9bd0c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/navigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

const {
ObjectDefineProperties,
StringPrototypeIndexOf,
StringPrototypeSlice,
Symbol,
} = primordials;

Expand All @@ -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) {
Expand Down

0 comments on commit c9bd0c5

Please sign in to comment.