|
28 | 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 | */ |
30 | 30 |
|
31 | | -// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration) |
32 | | -/* eslint-disable @typescript-eslint/no-unused-vars */ |
33 | | - |
34 | 31 | import * as Common from '../common/common.js'; |
35 | 32 | import * as i18n from '../i18n/i18n.js'; |
36 | 33 | import * as Platform from '../platform/platform.js'; |
@@ -89,8 +86,14 @@ const OVERRIDES_FILE_SYSTEM_PATH = '/overrides' as Platform.DevToolsPath.RawPath |
89 | 86 | */ |
90 | 87 | export class InspectorFrontendHostStub implements InspectorFrontendHostAPI { |
91 | 88 | readonly #urlsBeingSaved = new Map<Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, string[]>(); |
92 | | - events!: Common.EventTarget.EventTarget<EventTypes>; |
93 | 89 | #fileSystem: FileSystem|null = null; |
| 90 | + /** |
| 91 | + * Injected bellow in both stub and normal runs via: |
| 92 | + * ```ts |
| 93 | + * InspectorFrontendHostInstance.events = new Common.ObjectWrapper.ObjectWrapper(); |
| 94 | + * ``` |
| 95 | + */ |
| 96 | + declare events: Common.EventTarget.EventTarget<EventTypes>; |
94 | 97 |
|
95 | 98 | recordedCountHistograms: |
96 | 99 | Array<{histogramName: string, sample: number, min: number, exclusiveMax: number, bucketSize: number}> = []; |
@@ -224,7 +227,7 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI { |
224 | 227 | try { |
225 | 228 | const trimmed = Platform.StringUtilities.trimURL(url); |
226 | 229 | fileName = Platform.StringUtilities.removeURLFragment(trimmed); |
227 | | - } catch (error) { |
| 230 | + } catch { |
228 | 231 | // If url is not a valid URL, it is probably a filename. |
229 | 232 | fileName = url; |
230 | 233 | } |
@@ -593,19 +596,15 @@ class InspectorFrontendAPIImpl { |
593 | 596 | (function(): void { |
594 | 597 |
|
595 | 598 | function initializeInspectorFrontendHost(): void { |
596 | | - let proto; |
597 | 599 | if (!InspectorFrontendHostInstance) { |
598 | 600 | // Instantiate stub for web-hosted mode if necessary. |
599 | 601 | // @ts-expect-error Global injected by devtools_compatibility.js |
600 | 602 | globalThis.InspectorFrontendHost = InspectorFrontendHostInstance = new InspectorFrontendHostStub(); |
601 | 603 | } else { |
602 | 604 | // Otherwise add stubs for missing methods that are declared in the interface. |
603 | | - proto = InspectorFrontendHostStub.prototype; |
604 | | - for (const name of Object.getOwnPropertyNames(proto)) { |
605 | | - // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration) |
606 | | - // @ts-expect-error |
| 605 | + const proto = InspectorFrontendHostStub.prototype; |
| 606 | + for (const name of (Object.getOwnPropertyNames(proto) as Array<keyof InspectorFrontendHostAPI>)) { |
607 | 607 | const stub = proto[name]; |
608 | | - // @ts-expect-error Global injected by devtools_compatibility.js |
609 | 608 | if (typeof stub !== 'function' || InspectorFrontendHostInstance[name]) { |
610 | 609 | continue; |
611 | 610 | } |
|
0 commit comments