diff options
Diffstat (limited to 'runtime/js/99_main.js')
-rw-r--r-- | runtime/js/99_main.js | 12 |
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"); |