diff options
Diffstat (limited to 'runtime/js/98_global_scope.js')
-rw-r--r-- | runtime/js/98_global_scope.js | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/runtime/js/98_global_scope.js b/runtime/js/98_global_scope.js index aada57d70..cc2fe3f9d 100644 --- a/runtime/js/98_global_scope.js +++ b/runtime/js/98_global_scope.js @@ -5,6 +5,7 @@ const ops = core.ops; const primordials = globalThis.__bootstrap.primordials; const { ObjectDefineProperties, + ObjectPrototypeIsPrototypeOf, SymbolFor, } = primordials; @@ -151,8 +152,20 @@ class Navigator { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${inspect({})}`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + console.createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(NavigatorPrototype, this), + keys: [ + "hardwareConcurrency", + "userAgent", + "language", + "languages", + ], + }), + inspectOptions, + ); } } @@ -213,8 +226,20 @@ class WorkerNavigator { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${inspect({})}`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + console.createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(WorkerNavigatorPrototype, this), + keys: [ + "hardwareConcurrency", + "userAgent", + "language", + "languages", + ], + }), + inspectOptions, + ); } } |