From 1ec357faf37916ba84ad7a57208e48103294885a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 22 Nov 2022 02:17:14 +0100 Subject: fix(inspector): ensure console methods provided by inspector are available (#16724) --- ext/console/02_console.js | 9 +++++++++ ext/console/lib.deno_console.d.ts | 9 +++++++++ 2 files changed, 18 insertions(+) (limited to 'ext') diff --git a/ext/console/02_console.js b/ext/console/02_console.js index 7554a88fc..9a9ead5a1 100644 --- a/ext/console/02_console.js +++ b/ext/console/02_console.js @@ -2239,6 +2239,12 @@ this.error(err.stack); }; + // These methods are noops, but when the inspector is connected, they + // call into V8. + profile = (_label) => {}; + profileEnd = (_label) => {}; + timeStamp = (_label) => {}; + static [SymbolHasInstance](instance) { return instance[isConsoleInstance]; } @@ -2332,6 +2338,9 @@ consoleFromV8[key], consoleFromDeno[key], ); + } else { + // Add additional console APIs from the inspector + consoleFromDeno[key] = consoleFromV8[key]; } } } diff --git a/ext/console/lib.deno_console.d.ts b/ext/console/lib.deno_console.d.ts index ef2dc1cca..b168d1322 100644 --- a/ext/console/lib.deno_console.d.ts +++ b/ext/console/lib.deno_console.d.ts @@ -26,4 +26,13 @@ declare interface Console { timeLog(label?: string, ...data: any[]): void; trace(...data: any[]): void; warn(...data: any[]): void; + + /** This method is a noop, unless used in inspector */ + timeStamp(label?: string): void; + + /** This method is a noop, unless used in inspector */ + profile(label?: string): void; + + /** This method is a noop, unless used in inspector */ + profileEnd(label?: string): void; } -- cgit v1.2.3