diff options
author | Kenta Moriuchi <moriken@kimamass.com> | 2023-11-19 17:13:38 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-19 09:13:38 +0100 |
commit | c806fbdabe144c865612bbbc9ef596c9611c8310 (patch) | |
tree | edb38d58720377580677ccbeffb693ffa1225cc4 /runtime/js/98_global_scope.js | |
parent | a7548afb58b9848e501a085455446f5de897ffaa (diff) |
fix(ext,runtime): add missing custom inspections (#21219)
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, + ); } } |