summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorrandomicon00 <20146907+randomicon00@users.noreply.github.com>2022-05-14 11:00:02 +0100
committerGitHub <noreply@github.com>2022-05-14 12:00:02 +0200
commitf82a79ffdbc6b8f2fc4bbe6174ad33cb22e64386 (patch)
treeb8a6021de1157fe0cb70036a9eef79a4a2d0cac1 /runtime/js
parent20ee3110d84c72f4a28cc5c9083b5dda47181602 (diff)
feat: add userAgent property to Navigator's prototype (#14415)
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index d83a2e6c8..cf2525b06 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -301,7 +301,7 @@ delete Object.prototype.__proto__;
const navigator = webidl.createBranded(Navigator);
- let numCpus;
+ let numCpus, userAgent;
ObjectDefineProperties(Navigator.prototype, {
gpu: {
@@ -320,6 +320,14 @@ delete Object.prototype.__proto__;
return numCpus;
},
},
+ userAgent: {
+ configurable: true,
+ enumerable: true,
+ get() {
+ webidl.assertBranded(this, NavigatorPrototype);
+ return userAgent;
+ },
+ },
});
const NavigatorPrototype = Navigator.prototype;
@@ -575,6 +583,7 @@ delete Object.prototype.__proto__;
ppid,
unstableFlag,
cpuCount,
+ userAgent: userAgentInfo,
} = runtimeOptions;
colors.setNoColor(noColor || !isTty);
@@ -582,6 +591,7 @@ delete Object.prototype.__proto__;
location.setLocationHref(locationHref);
}
numCpus = cpuCount;
+ userAgent = userAgentInfo;
registerErrors();
const internalSymbol = Symbol("Deno.internal");