Skip to content

Commit 45f5c9b

Browse files
authored
lib: use primordials for navigator.userAgent
PR-URL: #50467 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]>
1 parent 5d01042 commit 45f5c9b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/navigator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
const {
44
ObjectDefineProperties,
5+
StringPrototypeIndexOf,
6+
StringPrototypeSlice,
57
Symbol,
68
} = primordials;
79

@@ -23,7 +25,7 @@ const nodeVersion = process.version;
2325
class Navigator {
2426
// Private properties are used to avoid brand validations.
2527
#availableParallelism;
26-
#userAgent = `Node.js/${nodeVersion.slice(1, nodeVersion.indexOf('.'))}`;
28+
#userAgent = `Node.js/${StringPrototypeSlice(nodeVersion, 1, StringPrototypeIndexOf(nodeVersion, '.'))}`;
2729

2830
constructor() {
2931
if (arguments[0] === kInitialize) {

0 commit comments

Comments
 (0)