chrome-devtools-frontend 1.0.1516909 → 1.0.1519267

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 (162) hide show
  1. package/config/owner/COMMON_OWNERS +2 -2
  2. package/docs/checklist/README.md +2 -2
  3. package/docs/checklist/javascript.md +1 -1
  4. package/docs/contributing/README.md +1 -1
  5. package/docs/contributing/settings-experiments-features.md +9 -8
  6. package/docs/cookbook/devtools_on_devtools.md +2 -2
  7. package/docs/cookbook/localization.md +10 -10
  8. package/docs/devtools-protocol.md +9 -8
  9. package/docs/ecosystem/automatic_workspace_folders.md +3 -3
  10. package/docs/get_the_code.md +0 -2
  11. package/docs/styleguide/ux/components.md +166 -85
  12. package/docs/styleguide/ux/numbers.md +3 -4
  13. package/eslint.config.mjs +1 -0
  14. package/front_end/core/common/README.md +13 -12
  15. package/front_end/core/host/GdpClient.ts +16 -1
  16. package/front_end/core/host/UserMetrics.ts +4 -2
  17. package/front_end/core/root/Runtime.ts +13 -0
  18. package/front_end/core/sdk/CSSMatchedStyles.ts +5 -1
  19. package/front_end/core/sdk/EnhancedTracesParser.ts +5 -5
  20. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +211 -0
  21. package/front_end/core/sdk/TargetManager.ts +4 -0
  22. package/front_end/entrypoints/main/MainImpl.ts +6 -3
  23. package/front_end/generated/InspectorBackendCommands.js +10 -7
  24. package/front_end/generated/SupportedCSSProperties.js +40 -11
  25. package/front_end/generated/protocol-mapping.d.ts +16 -1
  26. package/front_end/generated/protocol-proxy-api.d.ts +13 -1
  27. package/front_end/generated/protocol.ts +95 -0
  28. package/front_end/models/ai_assistance/agents/AiAgent.ts +57 -10
  29. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +119 -51
  30. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -31
  31. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +14 -181
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +19 -315
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +224 -50
  34. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +310 -11
  35. package/front_end/models/ai_assistance/performance/AIContext.ts +15 -2
  36. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +22 -11
  37. package/front_end/models/badges/AiExplorerBadge.ts +19 -3
  38. package/front_end/models/badges/Badge.ts +10 -3
  39. package/front_end/models/badges/CodeWhispererBadge.ts +3 -4
  40. package/front_end/models/badges/DOMDetectiveBadge.ts +1 -0
  41. package/front_end/models/badges/SpeedsterBadge.ts +1 -0
  42. package/front_end/models/badges/StarterBadge.ts +3 -2
  43. package/front_end/models/badges/UserBadges.ts +21 -3
  44. package/front_end/models/badges/badges.ts +1 -0
  45. package/front_end/models/javascript_metadata/NativeFunctions.js +2 -2
  46. package/front_end/models/trace/EventsSerializer.ts +4 -3
  47. package/front_end/models/trace/README.md +28 -1
  48. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +101 -73
  49. package/front_end/models/trace/handlers/UserTimingsHandler.ts +1 -1
  50. package/front_end/models/trace/helpers/Timing.ts +1 -1
  51. package/front_end/models/trace/helpers/Trace.ts +99 -43
  52. package/front_end/models/trace/types/TraceEvents.ts +9 -0
  53. package/front_end/panels/accessibility/ARIAAttributesView.ts +113 -191
  54. package/front_end/panels/accessibility/AccessibilityNodeView.ts +9 -9
  55. package/front_end/panels/accessibility/AccessibilitySubPane.ts +6 -4
  56. package/front_end/panels/accessibility/accessibilityProperties.css +2 -0
  57. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +20 -3
  58. package/front_end/panels/ai_assistance/components/ChatView.ts +9 -10
  59. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +44 -0
  60. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +2 -2
  61. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +32 -9
  62. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +7 -1
  63. package/front_end/panels/common/BadgeNotification.ts +21 -5
  64. package/front_end/panels/common/GdpSignUpDialog.ts +20 -12
  65. package/front_end/panels/console/ConsolePrompt.ts +1 -1
  66. package/front_end/panels/console/ConsoleView.ts +6 -2
  67. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +5 -5
  68. package/front_end/panels/elements/ElementsPanel.ts +4 -0
  69. package/front_end/panels/elements/ElementsTreeElement.ts +18 -0
  70. package/front_end/panels/elements/ElementsTreeOutline.ts +13 -0
  71. package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -6
  72. package/front_end/panels/media/TickingFlameChart.ts +1 -1
  73. package/front_end/panels/profiler/HeapSnapshotView.ts +34 -19
  74. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  75. package/front_end/panels/search/SearchResultsPane.ts +167 -152
  76. package/front_end/panels/search/SearchView.ts +36 -26
  77. package/front_end/panels/search/searchResultsPane.css +9 -0
  78. package/front_end/panels/security/CookieControlsView.ts +2 -1
  79. package/front_end/panels/settings/AISettingsTab.ts +6 -3
  80. package/front_end/panels/settings/components/SyncSection.ts +39 -17
  81. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +1 -1
  82. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +9 -1
  83. package/front_end/panels/sources/SourcesPanel.ts +4 -1
  84. package/front_end/panels/sources/sourcesView.css +6 -1
  85. package/front_end/panels/timeline/AppenderUtils.ts +2 -2
  86. package/front_end/panels/timeline/ExtensionTrackAppender.ts +13 -4
  87. package/front_end/panels/timeline/GPUTrackAppender.ts +2 -1
  88. package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -1
  89. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +2 -1
  90. package/front_end/panels/timeline/ThreadAppender.ts +12 -3
  91. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +9 -4
  92. package/front_end/panels/timeline/TimelinePanel.ts +3 -2
  93. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -4
  94. package/front_end/panels/timeline/TimingsTrackAppender.ts +6 -1
  95. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +95 -82
  96. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +1 -1
  97. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  98. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +1 -1
  99. package/front_end/panels/timeline/components/RelatedInsightChips.ts +1 -1
  100. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  101. package/front_end/panels/timeline/components/cpuThrottlingSelector.css +17 -15
  102. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -0
  103. package/front_end/third_party/chromium/README.chromium +1 -1
  104. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  105. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  106. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +6 -9
  107. package/front_end/third_party/codemirror.next/package.json +2 -1
  108. package/front_end/third_party/diff/README.chromium +1 -0
  109. package/front_end/third_party/puppeteer/README.chromium +2 -2
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +1 -0
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.d.ts.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.js +16 -25
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  126. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +19 -28
  127. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  131. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +1 -0
  133. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  135. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  136. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.d.ts.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.js +16 -25
  139. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.js.map +1 -1
  140. package/front_end/third_party/puppeteer/package/package.json +10 -3
  141. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  142. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  143. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +1 -0
  144. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  145. package/front_end/third_party/puppeteer/package/src/util/Function.ts +22 -30
  146. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  147. package/front_end/ui/components/markdown_view/MarkdownImage.ts +4 -5
  148. package/front_end/ui/components/switch/SwitchImpl.ts +12 -1
  149. package/front_end/ui/components/text_editor/config.ts +22 -9
  150. package/front_end/ui/components/tooltips/Tooltip.ts +70 -31
  151. package/front_end/ui/legacy/README.md +33 -24
  152. package/front_end/ui/legacy/SearchableView.ts +19 -26
  153. package/front_end/ui/legacy/TextPrompt.ts +166 -1
  154. package/front_end/ui/legacy/Treeoutline.ts +19 -3
  155. package/front_end/ui/legacy/UIUtils.ts +15 -2
  156. package/front_end/ui/legacy/XElement.ts +0 -43
  157. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +20 -4
  158. package/front_end/ui/legacy/components/source_frame/XMLView.ts +12 -11
  159. package/front_end/ui/lit/i18n-template.ts +5 -2
  160. package/front_end/ui/visual_logging/KnownContextValues.ts +23 -6
  161. package/front_end/ui/visual_logging/README.md +43 -27
  162. package/package.json +1 -1
@@ -76,7 +76,7 @@ space.
76
76
 
77
77
  Usage with lit-html:
78
78
 
79
- ```js
79
+ ```ts
80
80
  html`<devtools-button class="some-class"
81
81
  .variant=${Buttons.Button.Variant.PRIMARY}
82
82
  .title=${i18nString(UIStrings.someString)}
@@ -86,13 +86,13 @@ html`<devtools-button class="some-class"
86
86
 
87
87
  Usage with the imperative API:
88
88
 
89
- ```js
89
+ ```ts
90
90
  const button = new Buttons.Button.Button();
91
91
  button.data = {
92
- variant: Buttons.Button.Variant.PRIMARY,
93
- title: i18nString(UIStrings.someString),
94
- jslogContext: 'some-context',
95
- };
92
+ variant: Buttons.Button.Variant.PRIMARY,
93
+ title: i18nString(UIStrings.someString),
94
+ jslogContext: 'some-context',
95
+ };
96
96
  button.classList.add('some-class');
97
97
  button.addEventListener('click', event => onClick(event));
98
98
  ```
@@ -164,28 +164,36 @@ button.addEventListener('click', event => onClick(event));
164
164
 
165
165
  Usage with lit-html:
166
166
 
167
- ```js
168
- html`<select aria-label="Choose your champion"
169
- @onchange=${onChange}>
167
+ ```ts
168
+ html`<select aria-label="Choose your champion" @onchange=${onChange}>
170
169
  <option hidden value="Choose your champion"></option>
171
- <option jslog=${VisualLogging.item('hamster').track({click: true})}
172
- value="Hamster">Hamster</option>
173
- <option jslog=${VisualLogging.item('mouse').track({click: true})}
174
- value="Mouse">Mouse</option>
175
- <option jslog=${VisualLogging.item('cat').track({click: true})}
176
- value="Cat">Cat</option>
177
- </select>`
170
+ <option
171
+ jslog=${VisualLogging.item('hamster').track({ click: true })}
172
+ value="Hamster"
173
+ >
174
+ Hamster
175
+ </option>
176
+ <option
177
+ jslog=${VisualLogging.item('mouse').track({ click: true })}
178
+ value="Mouse"
179
+ >
180
+ Mouse
181
+ </option>
182
+ <option jslog=${VisualLogging.item('cat').track({ click: true })} value="Cat">
183
+ Cat
184
+ </option>
185
+ </select>`;
178
186
  ```
179
187
 
180
188
  Usage with the imperative API:
181
189
 
182
- ```js
190
+ ```ts
183
191
  const select = UI.UIUtils.createSelect('Choose your champion', [
184
192
  'Hamster',
185
193
  'Mouse',
186
194
  'Cat',
187
195
  ]);
188
- select.addEventListener('change', event => onChange(event))
196
+ select.addEventListener('change', event => onChange(event));
189
197
  ```
190
198
 
191
199
  ## Radio Buttons
@@ -212,16 +220,22 @@ select.addEventListener('change', event => onChange(event))
212
220
 
213
221
  Usage with lit-html:
214
222
 
215
- ```js
216
- const jslog = VisualLogging.toggle().track({change: true}).context(jslogContext);
217
- html`<label><input type="radio" name=${name} jslog=${jslog}>${title}</label>`
223
+ ```ts
224
+ const jslog = VisualLogging.toggle()
225
+ .track({ change: true })
226
+ .context(jslogContext);
227
+ html`<label><input type="radio" name=${name} jslog=${jslog} />${title}</label>`;
218
228
  ```
219
229
 
220
230
  Usage with the imperative API:
221
231
 
222
- ```js
223
- const {label, radio} = UI.UIUtils.createRadioButton(name, title, jslogContext);
224
- radio.addEventListener('change', event => onChange(event))
232
+ ```ts
233
+ const { label, radio } = UI.UIUtils.createRadioButton(
234
+ name,
235
+ title,
236
+ jslogContext,
237
+ );
238
+ radio.addEventListener('change', event => onChange(event));
225
239
  ```
226
240
 
227
241
  ## Sliders
@@ -247,19 +261,21 @@ radio.addEventListener('change', event => onChange(event))
247
261
 
248
262
  Usage with lit-html:
249
263
 
250
- ```js
251
- html`<input type="range"
252
- min=${min}
253
- max=${max}
254
- tabindex=${tabIndex}
255
- @change=${onChange}>`
264
+ ```ts
265
+ html`<input
266
+ type="range"
267
+ min=${min}
268
+ max=${max}
269
+ tabindex=${tabIndex}
270
+ @change=${onChange}
271
+ />`;
256
272
  ```
257
273
 
258
274
  Usage with the imperative API:
259
275
 
260
- ```js
276
+ ```ts
261
277
  const slider = UI.UIUtils.createSlider(min, max, tabIndex);
262
- slider.addEventListener('change', event => onChange(event))
278
+ slider.addEventListener('change', event => onChange(event));
263
279
  ```
264
280
 
265
281
  ## Icons
@@ -293,13 +309,13 @@ For some frequently used icons e.g. cross-circle, warning-filled etc. colors are
293
309
 
294
310
  Usage with lit-html:
295
311
 
296
- ```js
297
- html`<devtools-icon name=${'some-icon-name'}></devtools-icon>`
312
+ ```ts
313
+ html`<devtools-icon name=${'some-icon-name'}></devtools-icon>`;
298
314
  ```
299
315
 
300
316
  Usage with the imperative API:
301
317
 
302
- ```js
318
+ ```ts
303
319
  const someIcon = IconButton.Icon.create('some-icon-name', 'some-class');
304
320
  ```
305
321
 
@@ -379,53 +395,71 @@ Generally, we do not recommend using shortcuts in context menus since this goes
379
395
 
380
396
  Usage with lit-html (left-click on a `<devtools-menu-button>` opens a menu):
381
397
 
382
- ```js
398
+ ```ts
383
399
  html`
384
- <devtools-menu-button
385
- icon-name="some-icon-name"
386
- .populateMenuCall=${(menu: UI.ContextMenu.ContextMenu) => {
387
- menu.defaultSection().appendItem('Item', () => {
388
- console.log('Item clicked');
389
- }, {jslogContext: 'item'});
390
- }}
391
- jslogContext="my-menu-button"
392
- ></devtools-menu-button>
393
- `
400
+ <devtools-menu-button
401
+ icon-name="some-icon-name"
402
+ .populateMenuCall=${(menu: UI.ContextMenu.ContextMenu) => {
403
+ menu.defaultSection().appendItem(
404
+ 'Item',
405
+ () => {
406
+ console.log('Item clicked');
407
+ },
408
+ { jslogContext: 'item' },
409
+ );
410
+ }}
411
+ jslogContext="my-menu-button"
412
+ ></devtools-menu-button>
413
+ `;
394
414
  ```
395
415
 
396
416
  Usage with the imperative API (menu shows on a right-click)
397
417
 
398
418
  Various simple menu items:
399
419
 
400
- ```js
420
+ ```ts
401
421
  const element = this.shadowRoot.querySelector('.element-to-add-menu-to');
402
422
  element.addEventListener('contextmenu', (event: MouseEvent) => {
403
423
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
404
424
 
405
- // Regular item
406
- contextMenu.defaultSection().appendItem('Regular item', () => {
407
- console.log('Regular item clicked ');
408
- }, { jslogContext: 'regular-item' });
409
-
410
- // Disabled item
411
- contextMenu.defaultSection().appendItem('Disabled item', () => {
412
- console.log('Will not be printed');
413
- }, { jslogContext: 'disabled-item',
414
- disabled: true });
415
-
416
- // Experimental item
417
- const item = contextMenu.defaultSection().appendItem('Experimental item', () => {
418
- console.log('Experimental item clicked');
419
- }, { jslogContext: 'experimental-item',
420
- isPreviewFeature: true });
421
-
422
- // Separator
425
+ // Regular item
426
+ contextMenu.defaultSection().appendItem(
427
+ 'Regular item',
428
+ () => {
429
+ console.log('Regular item clicked ');
430
+ },
431
+ { jslogContext: 'regular-item' },
432
+ );
433
+
434
+ // Disabled item
435
+ contextMenu.defaultSection().appendItem(
436
+ 'Disabled item',
437
+ () => {
438
+ console.log('Will not be printed');
439
+ },
440
+ { jslogContext: 'disabled-item', disabled: true },
441
+ );
442
+
443
+ // Experimental item
444
+ const item = contextMenu.defaultSection().appendItem(
445
+ 'Experimental item',
446
+ () => {
447
+ console.log('Experimental item clicked');
448
+ },
449
+ { jslogContext: 'experimental-item', isPreviewFeature: true },
450
+ );
451
+
452
+ // Separator
423
453
  contextMenu.defaultSection().appendSeparator();
424
454
 
425
- // Checkbox item
426
- contextMenu.defaultSection().appendCheckboxItem('Checkbox item', () => {
427
- console.log('Checkbox item clicked');
428
- }, { checked: true, jslogContext: 'checkbox-item' });
455
+ // Checkbox item
456
+ contextMenu.defaultSection().appendCheckboxItem(
457
+ 'Checkbox item',
458
+ () => {
459
+ console.log('Checkbox item clicked');
460
+ },
461
+ { checked: true, jslogContext: 'checkbox-item' },
462
+ );
429
463
 
430
464
  void contextMenu.show();
431
465
  });
@@ -433,39 +467,85 @@ element.addEventListener('contextmenu', (event: MouseEvent) => {
433
467
 
434
468
  Custom section:
435
469
 
436
- ```js
437
- const customSection = contextMenu.section('Custom section');
438
- customSection.appendItem('Section inner item 1', () => { /* ... */ }, {jslogContext: 'my-inner-item-1'});
470
+ ```ts
471
+ const customSection = contextMenu.section('Custom section');
472
+ customSection.appendItem(
473
+ 'Section inner item 1',
474
+ () => {
475
+ /* ... */
476
+ },
477
+ { jslogContext: 'my-inner-item-1' },
478
+ );
439
479
 
440
- customSection.appendItem('Section inner item 2', () => { /* ... */ }, {jslogContext: 'my-inner-item-2'});
480
+ customSection.appendItem(
481
+ 'Section inner item 2',
482
+ () => {
483
+ /* ... */
484
+ },
485
+ { jslogContext: 'my-inner-item-2' },
486
+ );
441
487
  ```
442
488
 
443
489
  Sub menu:
444
490
 
445
- ```js
446
- const subMenu = contextMenu.defaultSection().appendSubMenuItem('Item to open sub menu', /* disabled */ false, 'my-sub-menu');
447
- subMenu.defaultSection().appendItem('Sub menu inner item 1', () => { /* ... */ }, {jslogContext: 'my-inner-item-1'});
448
- subMenu.defaultSection().appendItem('Sub menu inner item 2', () => { /* ... */ }, {jslogContext: 'my-inner-item-2'});
491
+ ```ts
492
+ const subMenu = contextMenu
493
+ .defaultSection()
494
+ .appendSubMenuItem(
495
+ 'Item to open sub menu',
496
+ /* disabled */ false,
497
+ 'my-sub-menu',
498
+ );
499
+ subMenu.defaultSection().appendItem(
500
+ 'Sub menu inner item 1',
501
+ () => {
502
+ /* ... */
503
+ },
504
+ { jslogContext: 'my-inner-item-1' },
505
+ );
506
+ subMenu.defaultSection().appendItem(
507
+ 'Sub menu inner item 2',
508
+ () => {
509
+ /* ... */
510
+ },
511
+ { jslogContext: 'my-inner-item-2' },
512
+ );
449
513
  ```
450
514
 
451
515
  Context menu provider registration (adds items dynamically based on the context menu’s target):
452
516
 
453
517
  ```js
454
518
  // Define provider
455
- class MyCustomNodeProvider implements UI.ContextMenu.Provider<SomeTarget|SomeOtherTarget> {
456
- appendApplicableItems(event: Event, contextMenu: UI.ContextMenu.ContextMenu, target: SomeTarget|SomeOtherTarget) {
519
+ class MyCustomNodeProvider
520
+ implements UI.ContextMenu.Provider<SomeTarget | SomeOtherTarget>
521
+ {
522
+ appendApplicableItems(
523
+ event: Event,
524
+ contextMenu: UI.ContextMenu.ContextMenu,
525
+ target: SomeTarget | SomeOtherTarget,
526
+ ) {
457
527
  if (target instanceof SomeTarget) {
458
- contextMenu.defaultSection().appendItem('Item 1', () => {
459
- console.log('Item 1 clicked');}, {jsLogContext: 'my-item-1'});
528
+ contextMenu.defaultSection().appendItem(
529
+ 'Item 1',
530
+ () => {
531
+ console.log('Item 1 clicked');
532
+ },
533
+ { jsLogContext: 'my-item-1' },
534
+ );
460
535
  } else {
461
- contextMenu.defaultSection().appendItem('Item 2', () => {
462
- console.log('Item 2 clicked');}, {jsLogContext: 'my-item-2'});
536
+ contextMenu.defaultSection().appendItem(
537
+ 'Item 2',
538
+ () => {
539
+ console.log('Item 2 clicked');
540
+ },
541
+ { jsLogContext: 'my-item-2' },
542
+ );
463
543
  }
464
544
  }
465
545
  }
466
546
  ```
467
547
 
468
- ```js
548
+ ```ts
469
549
  // Register provider
470
550
  UI.ContextMenu.registerProvider<SDK.DOMModel.DOMNode>({
471
551
  contextTypes: () => [SomeTarget, SomeOtherTarget],
@@ -479,11 +559,12 @@ UI.ContextMenu.registerProvider<SDK.DOMModel.DOMNode>({
479
559
 
480
560
  Static menu item registration via ItemLocation (adds an action to a predefined menu location):
481
561
 
482
- ```js
562
+ ```ts
483
563
  UI.ContextMenu.registerItem({
484
564
  location: UI.ContextMenu.ItemLocation.NAVIGATOR_MENU_DEFAULT,
485
565
  actionId: 'quick-open.show',
486
566
  order: undefined,
487
567
  });
488
568
  ```
569
+
489
570
  This will automatically add the "Open file" action to the context menu that appears when clicking the Elements panel's 3-dot button.
@@ -52,7 +52,7 @@ initialized.
52
52
  Prefer the helper exported by [ByteUtilities.ts] when formatting byte values.
53
53
  For example:
54
54
 
55
- ```js
55
+ ```ts
56
56
  // Formatting bytes
57
57
  i18n.ByteUtilities.bytesToString(99);
58
58
 
@@ -68,7 +68,7 @@ i18n.ByteUtilities.bytesToString(1500 * 1000);
68
68
  Prefer the helpers exported by [time-utilities.ts] when formatting time values.
69
69
  For example:
70
70
 
71
- ```js
71
+ ```ts
72
72
  // Formatting precise milliseconds
73
73
  i18n.TimeUtilities.preciseMillisToString(6.12345);
74
74
 
@@ -90,7 +90,7 @@ invocation of `format()` or `formatToParts()` methods, and therefore it's safe
90
90
  to define the formatters this way without running into the issue that the
91
91
  `DevToolsLocale` isn't initialized yet:
92
92
 
93
- ```js
93
+ ```ts
94
94
  import * as i18n from 'path/to/i18n/i18n.js';
95
95
 
96
96
  const percentageFormatter = i18n.NumberFormatter.defineFormatter({
@@ -99,7 +99,6 @@ const percentageFormatter = i18n.NumberFormatter.defineFormatter({
99
99
  });
100
100
  ```
101
101
 
102
-
103
102
  [Intl.NumberFormat]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
104
103
  [ByteUtilities.ts]: ../../../front_end/core/i18n/ByteUtilities.ts
105
104
  [NumberFormatter.ts]: ../../../front_end/core/i18n/NumberFormatter.ts
package/eslint.config.mjs CHANGED
@@ -720,6 +720,7 @@ export default defineConfig([
720
720
  'rulesdir/no-assert-deep-strict-equal': 'error',
721
721
  'rulesdir/no-assert-equal': 'error',
722
722
  'rulesdir/no-assert-equal-boolean-null-undefined': 'error',
723
+ 'rulesdir/no-capture-screenshot': 'error',
723
724
  'rulesdir/no-imperative-dom-api': 'off',
724
725
  'rulesdir/no-lit-render-outside-of-view': 'off',
725
726
  'rulesdir/prefer-assert-instance-of': 'error',
@@ -6,23 +6,24 @@ A settings registration is represented by the `SettingRegistration` interface, d
6
6
 
7
7
  All settings have to be registered using the function `Common.Settings.registerSettingExtension` which expects an object of type `SettingRegistration` as parameter.
8
8
 
9
- As an example, take the registration of the `showHTMLComments` settting, which allows users to determine if HTML comments are shown in the Elements tree:
10
- ```js
9
+ As an example, take the registration of the `showHTMLComments` setting, which allows users to determine if HTML comments are shown in the Elements tree:
10
+
11
+ ```ts
11
12
  Common.Settings.registerSettingExtension({
12
- category: Common.Settings.SettingCategory.ELEMENTS,
13
- order: 3,
14
- title: ls`Show HTML comments`,
15
- settingName: 'showHTMLComments',
16
- settingType: Common.Settings.SettingType.BOOLEAN,
17
- defaultValue: true,
13
+ category: Common.Settings.SettingCategory.ELEMENTS,
14
+ order: 3,
15
+ title: ls`Show HTML comments`,
16
+ settingName: 'showHTMLComments',
17
+ settingType: Common.Settings.SettingType.BOOLEAN,
18
+ defaultValue: true,
18
19
  options: [
19
20
  {
20
- value: true,
21
- title: ls`Show HTML comments`,
21
+ value: true,
22
+ title: ls`Show HTML comments`,
22
23
  },
23
24
  {
24
- value: false,
25
- title: ls`Hide HTML comments`,
25
+ value: false,
26
+ title: ls`Hide HTML comments`,
26
27
  },
27
28
  ],
28
29
  });
@@ -80,7 +80,7 @@ function normalizeBadgeName(name: string): string {
80
80
  export const GOOGLE_DEVELOPER_PROGRAM_PROFILE_LINK = 'https://developers.google.com/profile/u/me';
81
81
 
82
82
  async function makeHttpRequest<R extends object>(request: DispatchHttpRequestRequest): Promise<R|null> {
83
- if (!Root.Runtime.hostConfig.devToolsGdpProfiles?.enabled || Root.Runtime.hostConfig.isOffTheRecord) {
83
+ if (!isGdpProfilesAvailable()) {
84
84
  return null;
85
85
  }
86
86
 
@@ -224,5 +224,20 @@ function setDebugGdpIntegrationEnabled(enabled: boolean): void {
224
224
  }
225
225
  }
226
226
 
227
+ export function isGdpProfilesAvailable(): boolean {
228
+ const isBaseFeatureEnabled = Boolean(Root.Runtime.hostConfig.devToolsGdpProfiles?.enabled);
229
+ const isBrandedBuild = Boolean(Root.Runtime.hostConfig.devToolsGdpProfilesAvailability?.enabled);
230
+ const isOffTheRecordProfile = Root.Runtime.hostConfig.isOffTheRecord;
231
+ const isDisabledByEnterprisePolicy =
232
+ getGdpProfilesEnterprisePolicy() === Root.Runtime.GdpProfilesEnterprisePolicyValue.DISABLED;
233
+ return isBaseFeatureEnabled && isBrandedBuild && !isOffTheRecordProfile && !isDisabledByEnterprisePolicy;
234
+ }
235
+
236
+ export function getGdpProfilesEnterprisePolicy(): Root.Runtime.GdpProfilesEnterprisePolicyValue {
237
+ return (
238
+ Root.Runtime.hostConfig.devToolsGdpProfilesAvailability?.enterprisePolicyValue ??
239
+ Root.Runtime.GdpProfilesEnterprisePolicyValue.DISABLED);
240
+ }
241
+
227
242
  // @ts-expect-error
228
243
  globalThis.setDebugGdpIntegrationEnabled = setDebugGdpIntegrationEnabled;
@@ -511,7 +511,8 @@ export enum Action {
511
511
  AiCodeCompletionSuggestionDisplayed = 186,
512
512
  AiCodeCompletionSuggestionAccepted = 187,
513
513
  AiCodeCompletionError = 188,
514
- MAX_VALUE = 189,
514
+ AttributeLinkClicked = 189,
515
+ MAX_VALUE = 190,
515
516
  /* eslint-enable @typescript-eslint/naming-convention */
516
517
  }
517
518
 
@@ -1194,7 +1195,8 @@ export const enum SwatchType {
1194
1195
  ANGLE = 7,
1195
1196
  LENGTH = 8,
1196
1197
  POSITION_TRY_LINK = 10,
1197
- MAX_VALUE = 11,
1198
+ ATTR_LINK = 11,
1199
+ MAX_VALUE = 12,
1198
1200
  }
1199
1201
 
1200
1202
  export const enum BadgeType {
@@ -479,6 +479,18 @@ interface GdpProfiles {
479
479
  starterBadgeEnabled: boolean;
480
480
  }
481
481
 
482
+ export enum GdpProfilesEnterprisePolicyValue {
483
+ ENABLED = 0,
484
+ ENABLED_WITHOUT_BADGES = 1,
485
+ DISABLED = 2,
486
+ }
487
+
488
+ interface GdpProfilesAvailability {
489
+ // Whether GDP profiles can be enabled on this host (only possible on branded builds).
490
+ enabled: boolean;
491
+ enterprisePolicyValue: GdpProfilesEnterprisePolicyValue;
492
+ }
493
+
482
494
  interface LiveEdit {
483
495
  enabled: boolean;
484
496
  }
@@ -529,6 +541,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
529
541
  devToolsIpProtectionInDevTools: IpProtectionInDevTools,
530
542
  devToolsGlobalAiButton: GlobalAiButton,
531
543
  devToolsGdpProfiles: GdpProfiles,
544
+ devToolsGdpProfilesAvailability: GdpProfilesAvailability,
532
545
  devToolsLiveEdit: LiveEdit,
533
546
  devToolsFlexibleLayout: DevToolsFlexibleLayout,
534
547
  }>;
@@ -869,14 +869,18 @@ export class CSSMatchedStyles {
869
869
  return domCascade ? domCascade.computeAttribute(style, attributeName, type) : null;
870
870
  }
871
871
 
872
- rawAttributeValueFromStyle(style: CSSStyleDeclaration, attributeName: string): string|null {
872
+ originatingNodeForStyle(style: CSSStyleDeclaration): DOMNode|null {
873
873
  let node: DOMNode|null = this.nodeForStyle(style) ?? this.node();
874
874
 
875
875
  // If it's a pseudo-element, we need to find the originating element.
876
876
  while (node?.pseudoType()) {
877
877
  node = node.parentNode;
878
878
  }
879
+ return node;
880
+ }
879
881
 
882
+ rawAttributeValueFromStyle(style: CSSStyleDeclaration, attributeName: string): string|null {
883
+ const node = this.originatingNodeForStyle(style);
880
884
  if (!node) {
881
885
  return null;
882
886
  }
@@ -459,11 +459,11 @@ export class EnhancedTracesParser {
459
459
  for (const orphanScript of orphanScripts) {
460
460
  const orphanScriptExecutionContextIsolateId =
461
461
  this.getExecutionContextIsolateId(orphanScript.isolate, orphanScript.executionContextId);
462
- if (orphanScriptExecutionContextIsolateId in executionContextIsolateToTarget) {
463
- const frameId = executionContextIsolateToTarget.get(orphanScriptExecutionContextIsolateId);
464
- if (frameId) {
465
- targetToScripts.get(frameId)?.push(orphanScript);
466
- }
462
+ const frameId = executionContextIsolateToTarget.get(orphanScriptExecutionContextIsolateId);
463
+
464
+ if (frameId) {
465
+ // Found a link via execution context, use it.
466
+ targetToScripts.get(frameId)?.push(orphanScript);
467
467
  } else if (orphanScript.pid) {
468
468
  const target = targets.find(target => target.pid === orphanScript.pid);
469
469
  if (target) {