summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorawait-ovo <13152410380@163.com>2023-08-15 23:04:36 +0800
committerGitHub <noreply@github.com>2023-08-15 17:04:36 +0200
commit41cad2179fb36c2371ab84ce587d3460af64b5fb (patch)
treec4d4f05e660cdcd9cbb74eb10ca37515241ca913 /runtime/js
parentddbb5fdfb034517f200e298c1a5de8aa03b5e5e5 (diff)
fix(runtime): navigator.userAgent in web worker (#20129)
Fixes https://github.com/denoland/deno/issues/20079 --------- Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/98_global_scope.js36
-rw-r--r--runtime/js/99_main.js3
2 files changed, 24 insertions, 15 deletions
diff --git a/runtime/js/98_global_scope.js b/runtime/js/98_global_scope.js
index 1084f5c24..c916ef819 100644
--- a/runtime/js/98_global_scope.js
+++ b/runtime/js/98_global_scope.js
@@ -225,21 +225,29 @@ ObjectDefineProperties(WorkerNavigator.prototype, {
webidl.assertBranded(this, WorkerNavigatorPrototype);
return numCpus;
},
- language: {
- configurable: true,
- enumerable: true,
- get() {
- webidl.assertBranded(this, WorkerNavigatorPrototype);
- return language;
- },
+ },
+ userAgent: {
+ configurable: true,
+ enumerable: true,
+ get() {
+ webidl.assertBranded(this, WorkerNavigatorPrototype);
+ return userAgent;
+ },
+ },
+ language: {
+ configurable: true,
+ enumerable: true,
+ get() {
+ webidl.assertBranded(this, WorkerNavigatorPrototype);
+ return language;
},
- languages: {
- configurable: true,
- enumerable: true,
- get() {
- webidl.assertBranded(this, WorkerNavigatorPrototype);
- return [language];
- },
+ },
+ languages: {
+ configurable: true,
+ enumerable: true,
+ get() {
+ webidl.assertBranded(this, WorkerNavigatorPrototype);
+ return [language];
},
},
});
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index dc6839646..c8fdabc25 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -567,7 +567,7 @@ function bootstrapWorkerRuntime(
10: pid,
11: target,
12: v8Version,
- // 13: userAgent,
+ 13: userAgent,
// 14: inspectFlag,
15: enableTestingFeaturesFlag,
} = runtimeOptions;
@@ -633,6 +633,7 @@ function bootstrapWorkerRuntime(
location.setLocationHref(location_);
setNumCpus(cpuCount);
+ setUserAgent(userAgent);
setLanguage(locale);
globalThis.pollForMessages = pollForMessages;