chrome-devtools-frontend 1.0.1534717 → 1.0.1536371

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/docs/contributing/images/issues-nearestslo.png +0 -0
  2. package/docs/contributing/issues.md +32 -58
  3. package/eslint.config.mjs +1 -0
  4. package/front_end/core/common/Console.ts +1 -8
  5. package/front_end/core/common/ParsedURL.ts +10 -20
  6. package/front_end/core/common/SegmentedRange.ts +1 -2
  7. package/front_end/core/common/StringOutputStream.ts +1 -4
  8. package/front_end/core/host/InspectorFrontendHost.ts +6 -0
  9. package/front_end/core/host/UserMetrics.ts +5 -1
  10. package/front_end/core/i18n/i18nImpl.ts +0 -24
  11. package/front_end/core/protocol_client/CDPConnection.ts +53 -5
  12. package/front_end/core/protocol_client/protocol_client.ts +2 -0
  13. package/front_end/core/sdk/AnimationModel.ts +1 -2
  14. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
  15. package/front_end/core/sdk/CSSModel.ts +1 -1
  16. package/front_end/core/sdk/CSSProperty.ts +3 -6
  17. package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -4
  18. package/front_end/core/sdk/DebuggerModel.ts +1 -2
  19. package/front_end/core/sdk/EnhancedTracesParser.ts +4 -0
  20. package/front_end/core/sdk/SourceMap.ts +2 -3
  21. package/front_end/devtools_compatibility.js +32 -24
  22. package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +2 -1
  23. package/front_end/generated/InspectorBackendCommands.js +1 -2
  24. package/front_end/generated/SupportedCSSProperties.js +57 -0
  25. package/front_end/generated/protocol.ts +0 -27
  26. package/front_end/panels/accessibility/AccessibilityNodeView.ts +18 -17
  27. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +9 -12
  28. package/front_end/panels/ai_assistance/PatchWidget.ts +39 -40
  29. package/front_end/panels/ai_assistance/components/ChatView.ts +5 -4
  30. package/front_end/panels/ai_assistance/components/ExploreWidget.ts +0 -2
  31. package/front_end/panels/application/AppManifestView.ts +7 -6
  32. package/front_end/panels/application/ApplicationPanelSidebar.ts +4 -4
  33. package/front_end/panels/application/OpenedWindowDetailsView.ts +6 -6
  34. package/front_end/panels/application/StorageView.ts +9 -8
  35. package/front_end/panels/application/components/BackForwardCacheView.ts +333 -314
  36. package/front_end/panels/application/components/ProtocolHandlersView.ts +3 -2
  37. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -1
  38. package/front_end/panels/autofill/AutofillView.ts +2 -3
  39. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +8 -8
  40. package/front_end/panels/changes/CombinedDiffView.ts +13 -14
  41. package/front_end/panels/common/BadgeNotification.ts +2 -1
  42. package/front_end/panels/common/GdpSignUpDialog.ts +2 -1
  43. package/front_end/panels/console/ConsoleInsightTeaser.ts +13 -2
  44. package/front_end/panels/console/ConsolePinPane.ts +12 -7
  45. package/front_end/panels/console/ConsoleView.ts +1 -0
  46. package/front_end/panels/console/consoleView.css +0 -1
  47. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +9 -9
  48. package/front_end/panels/elements/ComputedStyleWidget.ts +7 -7
  49. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  50. package/front_end/panels/elements/EventListenersWidget.ts +9 -9
  51. package/front_end/panels/elements/NodeStackTraceWidget.ts +6 -6
  52. package/front_end/panels/elements/PlatformFontsWidget.ts +5 -5
  53. package/front_end/panels/elements/PropertiesWidget.ts +8 -8
  54. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -1
  55. package/front_end/panels/layer_viewer/PaintProfilerView.ts +3 -3
  56. package/front_end/panels/network/RequestCookiesView.ts +2 -1
  57. package/front_end/panels/network/RequestTimingView.ts +2 -1
  58. package/front_end/panels/network/components/DirectSocketConnectionView.ts +4 -6
  59. package/front_end/panels/recorder/RecorderController.ts +34 -23
  60. package/front_end/panels/recorder/components/CreateRecordingView.ts +249 -240
  61. package/front_end/panels/security/CookieControlsView.ts +74 -67
  62. package/front_end/panels/security/CookieReportView.ts +18 -16
  63. package/front_end/panels/security/IPProtectionView.ts +1 -2
  64. package/front_end/panels/security/SecurityPanel.ts +19 -19
  65. package/front_end/panels/settings/AISettingsTab.ts +2 -1
  66. package/front_end/panels/settings/KeybindsSettingsTab.ts +6 -0
  67. package/front_end/panels/settings/components/SyncSection.ts +2 -1
  68. package/front_end/panels/sources/DebuggerPausedMessage.ts +4 -3
  69. package/front_end/panels/sources/ResourceOriginPlugin.ts +3 -2
  70. package/front_end/panels/sources/SourcesNavigator.ts +2 -1
  71. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -2
  72. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +9 -9
  73. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +36 -36
  74. package/front_end/panels/timeline/TimelineUIUtils.ts +3 -2
  75. package/front_end/panels/timeline/components/DetailsView.ts +5 -4
  76. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +2 -1
  77. package/front_end/panels/timeline/components/LiveMetricsView.ts +5 -4
  78. package/front_end/panels/timeline/components/MetricCompareStrings.ts +25 -24
  79. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +1 -2
  80. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +2 -1
  81. package/front_end/third_party/chromium/README.chromium +1 -1
  82. package/front_end/ui/components/docs/tooltip/basic.ts +1 -1
  83. package/front_end/ui/components/tooltips/Tooltip.ts +32 -17
  84. package/front_end/ui/i18n/i18n.ts +31 -0
  85. package/front_end/ui/legacy/SoftDropDown.ts +1 -12
  86. package/front_end/ui/legacy/ViewManager.ts +2 -4
  87. package/front_end/ui/legacy/Widget.ts +33 -17
  88. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -1
  89. package/front_end/ui/legacy/legacy.ts +0 -2
  90. package/front_end/ui/visual_logging/KnownContextValues.ts +5 -0
  91. package/mcp/mcp.ts +1 -0
  92. package/package.json +1 -1
  93. package/front_end/ui/components/docs/recorder_create_recording_view/basic.html +0 -20
  94. package/front_end/ui/components/docs/recorder_create_recording_view/basic.ts +0 -27
  95. package/front_end/ui/legacy/ThrottledWidget.ts +0 -48
@@ -48,10 +48,11 @@ to Markdown (with a preview below the text input box).
48
48
  1. Replace `<from chrome://version/>` and `<OS version>` with the relevant
49
49
  version information.
50
50
  1. Outline exact steps to reproduce the problem. Make sure to provide steps
51
- that are easy and accessible. Ideally create a minified test case on
52
- [glitch.com](http://glitch.com) or [GitHub](http://github.com). Also
53
- make sure to include screenshots and videos that help us to reproduce
54
- and understand the problem you are facing.
51
+ that are easy and accessible. Ideally create a [minimal, reproducible
52
+ example](https://stackoverflow.com/help/minimal-reproducible-example), e.g.
53
+ on [codepen.io](https://codepen.io), [jsbin.com](https://jsbin.com) or
54
+ [GitHub](https://github.com). Also make sure to include screenshots and
55
+ videos that help us to reproduce and understand the problem you are facing.
55
56
 
56
57
  ## Overview
57
58
 
@@ -61,53 +62,29 @@ Tracker]. This section provides an overview of the Chromium DevTools specifics.
61
62
  ### Issue types
62
63
 
63
64
  [crbug] supports a wide range of different issue types, with ambiguous semantics.
64
- For Chromium DevTools we explicitly limit the set of types we use and give them
65
- well-defined semantics:
65
+ For the Chromium DevTools component tree ([Chromium>Platform>DevTools]) we
66
+ explicitly limit the set of types we use and give them well-defined semantics:
66
67
 
67
68
  | Issue Type | Meaning |
68
69
  | -------------------- | ------------------------------------------ |
69
70
  | **Bug** | The behavior does not match what is supposed to occur or what is documented. The product does not work as expected. |
70
71
  | **Feature Request** | The product works as intended but could be improved. |
71
72
  | **Internal Cleanup** | This is typically a maintenance issue. The issue has no effect on the behavior of a product, but addressing it may allow more intuitive interaction. |
72
- | **Vulnerability** | Security vulnerabilities subject to the handling outlined in Google's [Vulnerability Priority Guidelines](http://go/vulnerability-slo). |
73
73
  | **Privacy Issue** | Privacy issues subject to the handling outlined in Google's [Privacy Issue Bugs](http://go/pib-slo). |
74
74
  | **Task** | A small unit of work. |
75
- | **Project** | A goal-driven effort with a finite start and end, focused on creating a unique product, service, or result. |
76
- | **Feature** | A collection of work that provides a specific value to the user. |
77
-
78
- The first 6 (**Bug** to **Task**) are used for day-to-day work and for issues
79
- reported by users. The last 2 (**Project** and **Feature**) are used to organize
80
- the other types of issues for the purpose of planning (ahead). We explicitly
81
- don't use Customer Issue, Process, Milestone, Epic, and Story within Chrome DevTools.
82
-
83
- *** promo
84
- **BEST PRACTICE:** Limit the nesting of **Project** and **Feature** to the bare
85
- minimum needed, and use **Task** for small chunks of work.
86
- ***
87
-
88
- ### Parent-Child Relationships and Blocking
89
-
90
- *** note
91
- **TL;DR:**
92
-
93
- - Prefer parent-child relationships to split work into smaller chunks.
94
- - Prefer blocking to express dependencies between independent / adjacent
95
- issues.
96
- ***
75
+ | **Vulnerability** | Security vulnerabilities subject to the handling outlined in Google's [Vulnerability Priority Guidelines](http://go/vulnerability-slo). |
97
76
 
98
- When splitting up work into smaller chunks or when scoping a project that
99
- encompasses multiple bugs or feature requests, favor to express this via a
100
- parent-child relationship. Consider the example of a CSS Nesting:
77
+ These are used to track day-to-day work, primarily issues reported by users. We
78
+ explicitly don't use the Customer Issue, Process, and Story types, because the
79
+ former is already sufficiently covered with **Bug**, **Privacy Issue** and
80
+ **Vulnerability**, while the latter two are basically just special sub types of
81
+ **Task** and this fine-grained distinction would add more confusion than good.
82
+ Any use of the disallowed issue types will be corrected automatically by the
83
+ [Blunderbuss](http://go/blunderbuss) bot.
101
84
 
102
- 1. This should start with an issue of type Feature which is about adding CSS
103
- Nesting support to Chromium DevTools.
104
- 1. This Feature has child issues of type Task, which are concerned with adding
105
- CSS Nesting support to the various parts of DevTools involved, for example
106
- the CDP (Chrome DevTools Protocol), the Elements panel, the Sources panel,
107
- and so forth.
108
- 1. Over the course of the project there'll likely also be Feature Requests and
109
- Bugs from internal and external developers, which should also be parented
110
- under the CSS Nesting Feature issue.
85
+ We also explicitly disallow goal-type issues in the [Chromium>Platform>DevTools]
86
+ component tree. Check out [go/chrome-tooling/project-management] for guidance
87
+ how to manage goals using **Feature** and **Project** (_Googlers-only_).
111
88
 
112
89
  ### Priorities
113
90
 
@@ -197,25 +174,21 @@ DevTools we want to
197
174
  1. reduce the number of regressions that ship to the (Chrome) Stable channel, and
198
175
  2. reduce the number of bugs overall.
199
176
 
200
- The following SLOs (Service Level Objectives) apply to issues of type Bug,
201
- Vulnerability, and Privacy Issue. other types of issues such as Feature Request
202
- or Task are out of scope for SLOs (with the notable exception of Postmortem action
203
- items, where Chrome also enforces SLOs for non-bug issues). We also explicitly
204
- restrict these SLOs to bugs in [crbug], and are not concerned with bugs that are
205
- tracked in other places such as GitHub. Below is a high level summary of our SLOs
206
- (Googlers can check the [Chrome DevTools SLO Policy] and [Chrome SLO Policy] for
207
- more details):
177
+ The following SLOs (Service Level Objectives) apply to issues of type "Bug",
178
+ "Vulnerability", and "Privacy Issue". other types of issues such as "Feature
179
+ Request" or "Task" are out of scope for SLOs (with the notable exception of
180
+ Postmortem action items, where Chrome also enforces SLOs for non-bug issues).
181
+ We also explicitly restrict these SLOs to bugs in [crbug], and are not concerned
182
+ with bugs that are tracked in other places such as GitHub. Below is a high level
183
+ summary of our SLOs (Googlers can check the [Chrome SLO Policy] for details):
208
184
 
209
185
  | | Assignment | Response | Closure
210
186
  | ---- | -------------- | ------------------ | --------
211
187
  | `P0` | 1 business day | Every business day | 1 week
212
188
  | `P1` | 1 week | 1 week | 4 weeks
213
- | `P2` | 2 months | - | 6 months
214
- | `P3` | 1 year | - | -
215
189
 
216
- The first two rows are identical to [go/chrome-slo], with the last two rows being
217
- specific to Chrome DevTools. [crbug] provides a **Nearest SLO** column that
218
- surfaces SLO violations easily:
190
+ These are identical to [go/chrome-slo]. [crbug] provides a **Nearest SLO**
191
+ column that surfaces SLO violations easily:
219
192
 
220
193
  ![Nearest SLO in crbug](./images/issues-nearestslo.png "Nearest SLO in crbug")
221
194
 
@@ -224,7 +197,7 @@ surfaces SLO violations easily:
224
197
 
225
198
  ### Release Blocking Issues
226
199
 
227
- In accordance with go/chrome-slo there are special SLOs for issues that are
200
+ In compliance with [go/chrome-slo] there are special SLOs for issues that are
228
201
  severe enough to block a release shipping to users (see [go/chrome-release-slos]).
229
202
  They apply to bug types in the same way as the above SLOs.
230
203
 
@@ -261,10 +234,11 @@ refreshed every 2-4 hours, to see SLO compliance for a given lead.
261
234
  [How to file a good browser bug]: https://web.dev/articles/how-to-file-a-good-bug
262
235
  [Open Chromium DevTools Bugs]: https://issues.chromium.org/issues?q=status:open%20componentid:1457055%2B%20type:bug
263
236
  [goo.gle/devtools-bug]: https://goo.gle/devtools-bug
264
- [Chrome DevTools SLO Policy]: https://b.corp.google.com/slos/61348
265
- [Chrome SLO Policy]: https://b.corp.google.com/slos/1834
237
+ [Chrome SLO Policy]: http://b/slos/1834
266
238
  [go/chrome-slo]: http://go/chrome-slo
267
239
  [go/chrome-release-slos]: http://go/chrome-release-slos
268
- [Buganizer SLO Compliance]: go/b-slo-compliance
240
+ [go/chrome-tooling/project-management]: http://go/chrome-tooling/project-management
241
+ [Buganizer SLO Compliance]: http://go/b-slo-compliance
269
242
  [TaskFlow]: http://go/chrome-devtools:taskflow
270
243
  [TaskFlow Inbox]: http://go/chrome-devtools:taskflow/inbox
244
+ [Chromium>Platform>DevTools]: https://issues.chromium.org/components/1457055
package/eslint.config.mjs CHANGED
@@ -84,6 +84,7 @@ export default defineConfig([
84
84
 
85
85
  linterOptions: {
86
86
  reportUnusedDisableDirectives: 'error',
87
+ reportUnusedInlineConfigs: 'error',
87
88
  },
88
89
 
89
90
  rules: {
@@ -8,14 +8,7 @@ import {reveal} from './Revealer.js';
8
8
  let consoleInstance: Console|undefined;
9
9
 
10
10
  export class Console extends ObjectWrapper<EventTypes> {
11
- readonly #messages: Message[];
12
- /**
13
- * Instantiable via the instance() factory below.
14
- */
15
- constructor() {
16
- super();
17
- this.#messages = [];
18
- }
11
+ readonly #messages: Message[] = [];
19
12
 
20
13
  static instance(opts?: {forceNew: boolean}): Console {
21
14
  if (!consoleInstance || opts?.forceNew) {
@@ -57,33 +57,23 @@ type BrandedPathString =
57
57
  Platform.DevToolsPath.UrlString|Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.EncodedPathString;
58
58
 
59
59
  export class ParsedURL {
60
- isValid: boolean;
60
+ isValid = false;
61
61
  url: string;
62
- scheme: string;
63
- user: string;
64
- host: string;
65
- port: string;
66
- path: string;
67
- queryParams: string;
68
- fragment: string;
69
- folderPathComponents: string;
70
- lastPathComponent: string;
62
+ scheme = '';
63
+ user = '';
64
+ host = '';
65
+ port = '';
66
+ path = '';
67
+ queryParams = '';
68
+ fragment = '';
69
+ folderPathComponents = '';
70
+ lastPathComponent = '';
71
71
  readonly blobInnerScheme: string|undefined;
72
72
  #displayName?: string;
73
73
  #dataURLDisplayName?: string;
74
74
 
75
75
  constructor(url: string) {
76
- this.isValid = false;
77
76
  this.url = url;
78
- this.scheme = '';
79
- this.user = '';
80
- this.host = '';
81
- this.port = '';
82
- this.path = '';
83
- this.queryParams = '';
84
- this.fragment = '';
85
- this.folderPathComponents = '';
86
- this.lastPathComponent = '';
87
77
 
88
78
  const isBlobUrl = this.url.startsWith('blob:');
89
79
  const urlToMatch = isBlobUrl ? url.substring(5) : url;
@@ -24,11 +24,10 @@ export class Segment<T> {
24
24
  }
25
25
 
26
26
  export class SegmentedRange<T> {
27
- #segments: Array<Segment<T>>;
27
+ #segments: Array<Segment<T>> = [];
28
28
  readonly #mergeCallback: ((arg0: Segment<T>, arg1: Segment<T>) => Segment<T>| null)|undefined;
29
29
 
30
30
  constructor(mergeCallback?: ((arg0: Segment<T>, arg1: Segment<T>) => Segment<T>| null)) {
31
- this.#segments = [];
32
31
  this.#mergeCallback = mergeCallback;
33
32
  }
34
33
 
@@ -8,10 +8,7 @@ export interface OutputStream {
8
8
  }
9
9
 
10
10
  export class StringOutputStream implements OutputStream {
11
- #data: string;
12
- constructor() {
13
- this.#data = '';
14
- }
11
+ #data = '';
15
12
 
16
13
  async write(chunk: string): Promise<void> {
17
14
  this.#data += chunk;
@@ -601,6 +601,12 @@ class InspectorFrontendAPIImpl {
601
601
  }
602
602
  }
603
603
 
604
+ /**
605
+ * Used in `front_end/devtools_compatibility.js` to verify that calls from there
606
+ * are valid.
607
+ */
608
+ export type InspectorFrontendAPIImplMethods = keyof InspectorFrontendAPIImpl;
609
+
604
610
  (function(): void {
605
611
 
606
612
  function initializeInspectorFrontendHost(): void {
@@ -523,7 +523,11 @@ export enum Action {
523
523
  AiCodeCompletionError = 188,
524
524
  AttributeLinkClicked = 189,
525
525
  InsightRequestedViaTeaser = 190,
526
- MAX_VALUE = 191,
526
+ InsightTeaserGenerationStarted = 191,
527
+ InsightTeaserGenerationCompleted = 192,
528
+ InsightTeaserGenerationAborted = 193,
529
+ InsightTeaserGenerationErrored = 194,
530
+ MAX_VALUE = 195,
527
531
  /* eslint-enable @typescript-eslint/naming-convention */
528
532
  }
529
533
 
@@ -1,7 +1,6 @@
1
1
  // Copyright 2020 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-imperative-dom-api */
5
4
 
6
5
  import * as I18n from '../../third_party/i18n/i18n.js';
7
6
  import type * as Platform from '../platform/platform.js';
@@ -117,29 +116,6 @@ export function registerUIStrings(
117
116
  return i18nInstance.registerFileStrings(path, stringStructure);
118
117
  }
119
118
 
120
- /**
121
- * Returns a span element that may contains other DOM element as placeholders
122
- */
123
- export function getFormatLocalizedString(
124
- registeredStrings: I18n.LocalizedStringSet.RegisteredFileStrings, stringId: string,
125
- placeholders: Record<string, Object>): HTMLSpanElement {
126
- const formatter =
127
- registeredStrings.getLocalizedStringSetFor(DevToolsLocale.instance().locale).getMessageFormatterFor(stringId);
128
-
129
- const element = document.createElement('span');
130
- for (const icuElement of formatter.getAst()) {
131
- if (icuElement.type === /* argumentElement */ 1) {
132
- const placeholderValue = placeholders[icuElement.value];
133
- if (placeholderValue) {
134
- element.append(placeholderValue as Node | string);
135
- }
136
- } else if ('value' in icuElement) {
137
- element.append(String(icuElement.value));
138
- }
139
- }
140
- return element;
141
- }
142
-
143
119
  export function serializeUIString(string: string, values: Record<string, Object> = {}): string {
144
120
  const serializedMessage = {string, values};
145
121
  return JSON.stringify(serializedMessage);
@@ -4,6 +4,55 @@
4
4
 
5
5
  import type {ProtocolMapping} from '../../generated/protocol-mapping.js';
6
6
 
7
+ export type CommandParams<T extends keyof ProtocolMapping.Commands> = ProtocolMapping.Commands[T]['paramsType'][0];
8
+ export type CommandResult<T extends keyof ProtocolMapping.Commands> = ProtocolMapping.Commands[T]['returnType'];
9
+ export type EventParams<T extends keyof ProtocolMapping.Events> = ProtocolMapping.Events[T];
10
+
11
+ export interface CDPBaseMessage {
12
+ sessionId?: string;
13
+ }
14
+
15
+ export interface CDPCommandRequest<T extends keyof ProtocolMapping.Commands> extends CDPBaseMessage {
16
+ id: number;
17
+ method: T;
18
+ params: CommandParams<T>;
19
+ }
20
+
21
+ export interface CDPCommandResponse<T extends keyof ProtocolMapping.Commands> extends CDPBaseMessage {
22
+ id: number;
23
+ result: CommandResult<T>;
24
+ }
25
+
26
+ export interface CDPEvent<T extends keyof ProtocolMapping.Events> extends CDPBaseMessage {
27
+ method: T;
28
+ params: EventParams<T>;
29
+ }
30
+
31
+ /**
32
+ * Keep this in sync with https://source.chromium.org/chromium/chromium/src/+/main:third_party/inspector_protocol/crdtp/dispatch.h.
33
+ */
34
+ export const enum CDPErrorStatus {
35
+ PARSE_ERROR = -32700,
36
+ INVALID_REQUEST = -32600,
37
+ METHOD_NOT_FOUND = -32601,
38
+ INVALID_PARAMS = -32602,
39
+ INTERNAL_ERROR = -32603,
40
+ SERVER_ERROR = -32000,
41
+ SESSION_NOT_FOUND = SERVER_ERROR - 1,
42
+ }
43
+
44
+ export interface CDPError extends CDPBaseMessage {
45
+ id?: number;
46
+ error: {
47
+ code: CDPErrorStatus,
48
+ message: string,
49
+ data?: string,
50
+ };
51
+ }
52
+
53
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
+ export type CDPMessage = CDPCommandRequest<any>|CDPCommandResponse<any>|CDPEvent<any>|CDPError;
55
+
7
56
  /**
8
57
  * Allows the sending and receiving of CDP commands and the notification of CDP events to observers.
9
58
  *
@@ -12,9 +61,8 @@ import type {ProtocolMapping} from '../../generated/protocol-mapping.js';
12
61
  * would conflict with any other shared traffic.
13
62
  */
14
63
  export interface CDPConnection {
15
- send<T extends keyof ProtocolMapping.Commands>(
16
- method: T, params: ProtocolMapping.Commands[T]['paramsType'][0],
17
- sessionId: string|undefined): Promise<ProtocolMapping.Commands[T]['returnType']|{getError(): string}>;
64
+ send<T extends keyof ProtocolMapping.Commands>(method: T, params: CommandParams<T>, sessionId: string|undefined):
65
+ Promise<CommandResult<T>|{getError(): string}>;
18
66
 
19
67
  observe(observer: CDPConnectionObserver): void;
20
68
  unobserve(observer: CDPConnectionObserver): void;
@@ -34,6 +82,6 @@ export interface DebuggableCDPConnection extends CDPConnection {
34
82
  }
35
83
 
36
84
  export interface RawMessageObserver {
37
- onMessageReceived(message: unknown): void;
38
- onMessageSent(message: unknown): void;
85
+ onMessageReceived(message: CDPMessage): void;
86
+ onMessageSent(message: CDPMessage): void;
39
87
  }
@@ -2,11 +2,13 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as CDPConnection from './CDPConnection.js';
5
6
  import * as ConnectionTransport from './ConnectionTransport.js';
6
7
  import * as InspectorBackend from './InspectorBackend.js';
7
8
  import * as NodeURL from './NodeURL.js';
8
9
 
9
10
  export {
11
+ CDPConnection,
10
12
  ConnectionTransport,
11
13
  InspectorBackend,
12
14
  NodeURL,
@@ -836,12 +836,11 @@ export class AnimationGroup {
836
836
  readonly #id: string;
837
837
  #scrollNode: AnimationDOMNode|undefined;
838
838
  #animations: AnimationImpl[];
839
- #paused: boolean;
839
+ #paused = false;
840
840
  constructor(animationModel: AnimationModel, id: string, animations: AnimationImpl[]) {
841
841
  this.#animationModel = animationModel;
842
842
  this.#id = id;
843
843
  this.#animations = animations;
844
- this.#paused = false;
845
844
  }
846
845
 
847
846
  isScrollDriven(): boolean {
@@ -361,7 +361,7 @@ export class CSSMatchedStyles {
361
361
  inheritedResult.matchedCSSRules = cleanUserAgentPayload(inheritedResult.matchedCSSRules);
362
362
  }
363
363
 
364
- this.#environmentVariables = await this.cssModel().getEnvironmentVariales();
364
+ this.#environmentVariables = await this.cssModel().getEnvironmentVariables();
365
365
 
366
366
  this.#mainDOMCascade = await this.buildMainCascade(
367
367
  inlinePayload, attributesPayload, matchedPayload, inheritedPayload, animationStylesPayload,
@@ -450,7 +450,7 @@ export class CSSMatchedStyles {
450
450
  nodeCascades.push(new NodeCascade(this, nodeStyles, this.#node, false /* #isInherited */));
451
451
 
452
452
  // Walk the node structure and identify styles with inherited properties.
453
- let parentNode: (DOMNode|null) = this.#node.parentNode;
453
+ let parentNode: DOMNode|null = this.#node.parentNode;
454
454
  const traverseParentInFlatTree = async(node: DOMNode): Promise<DOMNode|null> => {
455
455
  if (node.hasAssignedSlot()) {
456
456
  return await node.assignedSlot?.deferredNode.resolvePromise() ?? null;
@@ -407,7 +407,7 @@ export class CSSModel extends SDKModel<EventTypes> {
407
407
  };
408
408
  }
409
409
 
410
- async getEnvironmentVariales(): Promise<Record<string, string>> {
410
+ async getEnvironmentVariables(): Promise<Record<string, string>> {
411
411
  const response = await this.agent.invoke_getEnvironmentVariables();
412
412
  if (response.getError()) {
413
413
  return {};
@@ -41,9 +41,9 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
41
41
  implicit: boolean;
42
42
  text: string|null|undefined;
43
43
  range: TextUtils.TextRange.TextRange|null;
44
- #active: boolean;
45
- #nameRange: TextUtils.TextRange.TextRange|null;
46
- #valueRange: TextUtils.TextRange.TextRange|null;
44
+ #active = true;
45
+ #nameRange: TextUtils.TextRange.TextRange|null = null;
46
+ #valueRange: TextUtils.TextRange.TextRange|null = null;
47
47
  #invalidString?: Common.UIString.LocalizedString;
48
48
  #longhandProperties: CSSProperty[] = [];
49
49
 
@@ -62,9 +62,6 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
62
62
  this.implicit = implicit; // A longhand, implicitly set by missing values of shorthand.
63
63
  this.text = text;
64
64
  this.range = range ? TextUtils.TextRange.TextRange.fromObject(range) : null;
65
- this.#active = true;
66
- this.#nameRange = null;
67
- this.#valueRange = null;
68
65
 
69
66
  if (longhandProperties && longhandProperties.length > 0) {
70
67
  for (const property of longhandProperties) {
@@ -14,14 +14,14 @@ import type {Target} from './Target.js';
14
14
  export class CSSStyleDeclaration {
15
15
  readonly #cssModel: CSSModel;
16
16
  parentRule: CSSRule|null;
17
- #allProperties!: CSSProperty[];
17
+ #allProperties: CSSProperty[] = [];
18
18
  styleSheetId?: Protocol.CSS.StyleSheetId;
19
- range!: TextUtils.TextRange.TextRange|null;
19
+ range: TextUtils.TextRange.TextRange|null = null;
20
20
  cssText?: string;
21
21
  #shorthandValues = new Map<string, string>();
22
22
  #shorthandIsImportant = new Set<string>();
23
23
  #activePropertyMap = new Map<string, CSSProperty>();
24
- #leadingProperties!: CSSProperty[]|null;
24
+ #leadingProperties: CSSProperty[]|null = null;
25
25
  type: Type;
26
26
  // For CSSStyles coming from animations,
27
27
  // This holds the name of the animation.
@@ -97,7 +97,7 @@ export class CSSStyleDeclaration {
97
97
  this.#computeInactiveProperties();
98
98
 
99
99
  // TODO(changhaohan): verify if this #activePropertyMap is still necessary, or if it is
100
- // providing different information against the activeness in allPropertiesInternal.
100
+ // providing different information against the activeness in #allProperties.
101
101
  this.#activePropertyMap = new Map();
102
102
  for (const property of this.#allProperties) {
103
103
  if (!property.activeInStyle()) {
@@ -1402,14 +1402,13 @@ export class Scope implements ScopeChainEntry {
1402
1402
  readonly #name: string|undefined;
1403
1403
  #ordinal: number;
1404
1404
  readonly #locationRange: LocationRange|null;
1405
- #object: RemoteObject|null;
1405
+ #object: RemoteObject|null = null;
1406
1406
  constructor(callFrame: CallFrame, ordinal: number) {
1407
1407
  this.#callFrame = callFrame;
1408
1408
  this.#payload = callFrame.getPayload().scopeChain[ordinal];
1409
1409
  this.#type = this.#payload.type;
1410
1410
  this.#name = this.#payload.name;
1411
1411
  this.#ordinal = ordinal;
1412
- this.#object = null;
1413
1412
 
1414
1413
  const start =
1415
1414
  this.#payload.startLocation ? Location.fromPayload(callFrame.debuggerModel, this.#payload.startLocation) : null;
@@ -164,6 +164,10 @@ export class EnhancedTracesParser {
164
164
  if (frame.url === 'about:blank') {
165
165
  continue;
166
166
  }
167
+ if (!frame.isInPrimaryMainFrame) {
168
+ continue;
169
+ }
170
+
167
171
  const frameId = frame.frame as string as Protocol.Target.TargetID;
168
172
  if (!this.#targets.find(target => target.targetId === frameId)) {
169
173
  const frameType = frame.isOutermostMainFrame ? 'page' : 'iframe';
@@ -128,7 +128,7 @@ export class SourceMap {
128
128
  readonly #compiledURL: Platform.DevToolsPath.UrlString;
129
129
  readonly #sourceMappingURL: Platform.DevToolsPath.UrlString;
130
130
  readonly #baseURL: Platform.DevToolsPath.UrlString;
131
- #mappings: SourceMapEntry[]|null;
131
+ #mappings: SourceMapEntry[]|null = null;
132
132
 
133
133
  readonly #sourceInfos: SourceInfo[] = [];
134
134
  readonly #sourceInfoByURL = new Map<Platform.DevToolsPath.UrlString, SourceInfo>();
@@ -154,7 +154,6 @@ export class SourceMap {
154
154
  this.#baseURL = (Common.ParsedURL.schemeIs(sourceMappingURL, 'data:')) ? compiledURL : sourceMappingURL;
155
155
  this.#debugId = 'debugId' in payload ? (payload.debugId as DebugId | undefined) : undefined;
156
156
 
157
- this.#mappings = null;
158
157
  if ('sections' in this.#json) {
159
158
  if (this.#json.sections.find(section => 'url' in section)) {
160
159
  Common.Console.Console.instance().warn(
@@ -435,7 +434,7 @@ export class SourceMap {
435
434
  #computeReverseMappings(mappings: SourceMapEntry[]): void {
436
435
  const reverseMappingsPerUrl = new Map<Platform.DevToolsPath.UrlString, number[]>();
437
436
  for (let i = 0; i < mappings.length; i++) {
438
- const entryUrl = mappings[i].sourceURL;
437
+ const entryUrl = mappings[i]?.sourceURL;
439
438
  if (!entryUrl) {
440
439
  continue;
441
440
  }