chrome-devtools-frontend 1.0.1575174 → 1.0.1575635

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 (89) hide show
  1. package/.stylelintrc.json +1 -1
  2. package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
  3. package/front_end/core/sdk/CSSMatchedStyles.ts +27 -0
  4. package/front_end/entrypoints/main/MainImpl.ts +13 -7
  5. package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +3 -2
  6. package/front_end/generated/InspectorBackendCommands.ts +37 -0
  7. package/front_end/generated/protocol-mapping.d.ts +257 -0
  8. package/front_end/generated/protocol-proxy-api.d.ts +256 -0
  9. package/front_end/generated/protocol.ts +359 -0
  10. package/front_end/models/ai_assistance/AiConversation.ts +31 -10
  11. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -0
  12. package/front_end/models/ai_assistance/agents/AiAgent.ts +29 -5
  13. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +73 -0
  14. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +141 -0
  15. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  16. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -0
  17. package/front_end/models/live-metrics/LiveMetrics.ts +31 -51
  18. package/front_end/models/stack_trace/StackTrace.ts +2 -1
  19. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +72 -6
  20. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +1 -0
  21. package/front_end/panels/ai_assistance/components/ChatMessage.ts +6 -4
  22. package/front_end/panels/ai_assistance/components/ChatView.ts +5 -6
  23. package/front_end/panels/ai_assistance/components/chatView.css +10 -0
  24. package/front_end/panels/application/StorageView.ts +3 -3
  25. package/front_end/panels/application/preloading/components/preloadingDisabledInfobar.css +1 -1
  26. package/front_end/panels/common/aiCodeCompletionSummaryToolbar.css +1 -1
  27. package/front_end/panels/console/ConsoleContextSelector.ts +4 -3
  28. package/front_end/panels/elements/ElementsTreeElement.ts +2 -2
  29. package/front_end/panels/elements/StylePropertyTreeElement.ts +63 -0
  30. package/front_end/panels/elements/StylesSidebarPane.ts +17 -2
  31. package/front_end/panels/elements/stylePropertiesTreeOutline.css +4 -0
  32. package/front_end/panels/issues/AffectedMetadataAllowedSitesView.ts +3 -3
  33. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -1
  34. package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -6
  35. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +3 -2
  36. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -3
  37. package/front_end/panels/network/SignedExchangeInfoView.ts +3 -4
  38. package/front_end/panels/network/components/HeaderSectionRow.css +1 -1
  39. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  40. package/front_end/panels/recorder/components/recordingView.css +5 -0
  41. package/front_end/panels/security/SecurityPanelSidebar.ts +10 -9
  42. package/front_end/panels/settings/AISettingsTab.ts +2 -1
  43. package/front_end/panels/settings/KeybindsSettingsTab.ts +3 -5
  44. package/front_end/panels/settings/SettingsScreen.ts +2 -3
  45. package/front_end/panels/sources/CallStackSidebarPane.ts +10 -0
  46. package/front_end/panels/sources/DebuggerPlugin.ts +18 -12
  47. package/front_end/panels/sources/ScopeChainSidebarPane.ts +4 -3
  48. package/front_end/panels/sources/SourcesNavigator.ts +2 -2
  49. package/front_end/panels/sources/SourcesPanel.ts +6 -3
  50. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -2
  51. package/front_end/panels/sources/sources-meta.ts +2 -1
  52. package/front_end/panels/timeline/TimelinePanel.ts +2 -1
  53. package/front_end/panels/timeline/TimelineUIUtils.ts +2 -2
  54. package/front_end/panels/timeline/components/DetailsView.ts +7 -7
  55. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -2
  56. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
  57. package/front_end/panels/whats_new/releaseNoteView.css +1 -1
  58. package/front_end/third_party/chromium/README.chromium +1 -1
  59. package/front_end/third_party/puppeteer/README.chromium +2 -2
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js +30 -25
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  64. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  65. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  66. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  67. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +30 -21
  68. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  69. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js +31 -26
  70. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  73. package/front_end/third_party/puppeteer/package/package.json +3 -3
  74. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +45 -44
  75. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  76. package/front_end/ui/components/buttons/Button.ts +2 -2
  77. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  78. package/front_end/ui/components/panel_feedback/panelFeedback.css +1 -1
  79. package/front_end/ui/kit/link/Link.ts +31 -0
  80. package/front_end/ui/legacy/LinkContextMenuProvider.ts +3 -5
  81. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +2 -2
  82. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +336 -250
  83. package/front_end/ui/legacy/inspectorCommon.css +0 -1
  84. package/front_end/ui/legacy/legacy.ts +0 -4
  85. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  86. package/front_end/ui/visual_logging/LoggingDriver.ts +10 -6
  87. package/package.json +1 -1
  88. package/front_end/ui/legacy/XElement.ts +0 -41
  89. package/front_end/ui/legacy/XLink.ts +0 -128
@@ -7,7 +7,8 @@
7
7
  import type {Protocol} from 'devtools-protocol';
8
8
 
9
9
  import type {TargetFilterCallback} from '../api/Browser.js';
10
- import {CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
10
+ import type {CDPSession} from '../api/CDPSession.js';
11
+ import {CDPSessionEvent} from '../api/CDPSession.js';
11
12
  import {EventEmitter} from '../common/EventEmitter.js';
12
13
  import {debugError} from '../common/util.js';
13
14
  import {assert} from '../util/assert.js';
@@ -196,15 +197,36 @@ export class TargetManager
196
197
  this.#attachedToTargetListenersBySession.delete(session);
197
198
  }
198
199
 
199
- if (this.#detachedFromTargetListenersBySession.has(session)) {
200
- session.off(
201
- 'Target.detachedFromTarget',
202
- this.#detachedFromTargetListenersBySession.get(session)!,
203
- );
200
+ const detachedListener =
201
+ this.#detachedFromTargetListenersBySession.get(session);
202
+ if (detachedListener) {
203
+ session.off('Target.detachedFromTarget', detachedListener);
204
204
  this.#detachedFromTargetListenersBySession.delete(session);
205
205
  }
206
206
  }
207
207
 
208
+ #silentDetach = async (
209
+ session: CdpCDPSession,
210
+ parentSession: Connection | CDPSession,
211
+ ): Promise<void> => {
212
+ await session.send('Runtime.runIfWaitingForDebugger').catch(debugError);
213
+ // We don't use `session.detach()` because that dispatches all commands on
214
+ // the connection instead of the parent session.
215
+ await parentSession
216
+ .send('Target.detachFromTarget', {
217
+ sessionId: session.id(),
218
+ })
219
+ .catch(debugError);
220
+ };
221
+
222
+ #getParentTarget = (
223
+ parentSession: Connection | CDPSession,
224
+ ): CdpTarget | null => {
225
+ return parentSession instanceof CdpCDPSession
226
+ ? parentSession.target()
227
+ : null;
228
+ };
229
+
208
230
  #onSessionDetached = (session: CDPSession) => {
209
231
  this.#removeAttachmentListeners(session);
210
232
  };
@@ -234,10 +256,7 @@ export class TargetManager
234
256
  const targetInfo = this.#discoveredTargetsByTargetId.get(event.targetId);
235
257
  this.#discoveredTargetsByTargetId.delete(event.targetId);
236
258
  this.#finishInitializationIfReady(event.targetId);
237
- if (
238
- targetInfo?.type === 'service_worker' &&
239
- this.#attachedTargetsByTargetId.has(event.targetId)
240
- ) {
259
+ if (targetInfo?.type === 'service_worker') {
241
260
  // Special case for service workers: report TargetGone event when
242
261
  // the worker is destroyed.
243
262
  const target = this.#attachedTargetsByTargetId.get(event.targetId);
@@ -256,7 +275,6 @@ export class TargetManager
256
275
 
257
276
  if (
258
277
  this.#ignoredTargets.has(event.targetInfo.targetId) ||
259
- !this.#attachedTargetsByTargetId.has(event.targetInfo.targetId) ||
260
278
  !event.targetInfo.attached
261
279
  ) {
262
280
  return;
@@ -273,7 +291,7 @@ export class TargetManager
273
291
  target._initializedDeferred.value() === InitializationStatus.SUCCESS;
274
292
 
275
293
  if (isPageTargetBecomingPrimary(target, event.targetInfo)) {
276
- const session = target?._session();
294
+ const session = target._session();
277
295
  assert(
278
296
  session,
279
297
  'Target that is being activated is missing a CDPSession.',
@@ -302,17 +320,6 @@ export class TargetManager
302
320
  throw new Error(`Session ${event.sessionId} was not created.`);
303
321
  }
304
322
 
305
- const silentDetach = async () => {
306
- await session.send('Runtime.runIfWaitingForDebugger').catch(debugError);
307
- // We don't use `session.detach()` because that dispatches all commands on
308
- // the connection instead of the parent session.
309
- await parentSession
310
- .send('Target.detachFromTarget', {
311
- sessionId: session.id(),
312
- })
313
- .catch(debugError);
314
- };
315
-
316
323
  if (!this.#connection.isAutoAttached(targetInfo.targetId)) {
317
324
  return;
318
325
  }
@@ -325,7 +332,7 @@ export class TargetManager
325
332
  // should determine if a target is auto-attached or not with the help of
326
333
  // CDP.
327
334
  if (targetInfo.type === 'service_worker') {
328
- await silentDetach();
335
+ await this.#silentDetach(session, parentSession);
329
336
  if (this.#attachedTargetsByTargetId.has(targetInfo.targetId)) {
330
337
  return;
331
338
  }
@@ -336,27 +343,25 @@ export class TargetManager
336
343
  return;
337
344
  }
338
345
 
339
- const isExistingTarget = this.#attachedTargetsByTargetId.has(
340
- targetInfo.targetId,
341
- );
346
+ let target = this.#attachedTargetsByTargetId.get(targetInfo.targetId);
347
+ const isExistingTarget = target !== undefined;
342
348
 
343
- const target = isExistingTarget
344
- ? this.#attachedTargetsByTargetId.get(targetInfo.targetId)!
345
- : this.#targetFactory(
346
- targetInfo,
347
- session,
348
- parentSession instanceof CdpCDPSession ? parentSession : undefined,
349
- );
349
+ if (!target) {
350
+ target = this.#targetFactory(
351
+ targetInfo,
352
+ session,
353
+ parentSession instanceof CdpCDPSession ? parentSession : undefined,
354
+ );
355
+ }
350
356
 
351
- const parentTarget =
352
- parentSession instanceof CdpCDPSession ? parentSession.target() : null;
357
+ const parentTarget = this.#getParentTarget(parentSession);
353
358
 
354
359
  if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {
355
360
  this.#ignoredTargets.add(targetInfo.targetId);
356
361
  if (parentTarget?.type() === 'tab') {
357
362
  this.#finishInitializationIfReady(parentTarget._targetId);
358
363
  }
359
- await silentDetach();
364
+ await this.#silentDetach(session, parentSession);
360
365
  return;
361
366
  }
362
367
 
@@ -372,10 +377,7 @@ export class TargetManager
372
377
 
373
378
  if (isExistingTarget) {
374
379
  session.setTarget(target);
375
- this.#attachedTargetsBySessionId.set(
376
- session.id(),
377
- this.#attachedTargetsByTargetId.get(targetInfo.targetId)!,
378
- );
380
+ this.#attachedTargetsBySessionId.set(session.id(), target);
379
381
  } else {
380
382
  target._initialize();
381
383
  this.#attachedTargetsByTargetId.set(targetInfo.targetId, target);
@@ -425,15 +427,14 @@ export class TargetManager
425
427
  event: Protocol.Target.DetachedFromTargetEvent,
426
428
  ) => {
427
429
  const target = this.#attachedTargetsBySessionId.get(event.sessionId);
428
-
429
430
  this.#attachedTargetsBySessionId.delete(event.sessionId);
430
431
 
431
432
  if (!target) {
432
433
  return;
433
434
  }
434
435
 
435
- if (parentSession instanceof CDPSession) {
436
- (parentSession as CdpCDPSession).target()._removeChildTarget(target);
436
+ if (parentSession instanceof CdpCDPSession) {
437
+ parentSession.target()._removeChildTarget(target);
437
438
  }
438
439
  this.#attachedTargetsByTargetId.delete(target._targetId);
439
440
  this.emit(TargetManagerEvent.TargetGone, target);
@@ -6,5 +6,5 @@
6
6
 
7
7
  // If moved update release-please config
8
8
  // x-release-please-start-version
9
- export const packageVersion = '24.36.0';
9
+ export const packageVersion = '24.36.1';
10
10
  // x-release-please-end
@@ -117,7 +117,7 @@ export class Button extends HTMLElement {
117
117
  longClickable: false,
118
118
  };
119
119
  #internals = this.attachInternals();
120
- #slotRef = Lit.Directives.createRef();
120
+ #slotRef = Lit.Directives.createRef<HTMLSlotElement>();
121
121
 
122
122
  constructor() {
123
123
  super();
@@ -326,7 +326,7 @@ export class Button extends HTMLElement {
326
326
  }
327
327
 
328
328
  #render(): void {
329
- const nodes = (this.#slotRef.value as HTMLSlotElement | undefined)?.assignedNodes();
329
+ const nodes = this.#slotRef.value?.assignedNodes();
330
330
  const isEmpty = !Boolean(nodes?.length);
331
331
  if (!this.#props.variant) {
332
332
  throw new Error('Button requires a variant to be defined');
@@ -3,8 +3,8 @@
3
3
  // found in the LICENSE file.
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
5
5
 
6
- import '../../../ui/legacy/legacy.js';
7
6
  import '../../../ui/kit/kit.js';
7
+ import '../../legacy/legacy.js';
8
8
 
9
9
  import * as i18n from '../../../core/i18n/i18n.js';
10
10
  import * as Root from '../../../core/root/root.js';
@@ -59,7 +59,7 @@ devtools-link {
59
59
  text-decoration-line: underline;
60
60
  }
61
61
 
62
- x-link.quick-start-link {
62
+ devtools-link.quick-start-link {
63
63
  font-size: 14px;
64
64
  line-height: 22px;
65
65
  letter-spacing: 0.04em;
@@ -133,6 +133,37 @@ export class Link extends HTMLElement {
133
133
  );
134
134
  // clang-format on
135
135
  }
136
+
137
+ /**
138
+ * Should be used only by old code relying on imperative API,
139
+ * which we are activly migrating away from.
140
+ * @deprecated
141
+ */
142
+ static create(
143
+ url: string,
144
+ linkText?: string,
145
+ className?: string,
146
+ jsLogContext?: string,
147
+ tabindex = 0,
148
+ ): Link {
149
+ const link = new Link();
150
+ link.href = url as Platform.DevToolsPath.UrlString;
151
+ linkText = linkText ?? url;
152
+ link.textContent = Platform.StringUtilities.trimMiddle(linkText, 150);
153
+
154
+ const classes = className ? `${className} devtools-link` : 'devtools-link';
155
+ link.setAttribute('class', classes);
156
+
157
+ if (jsLogContext) {
158
+ link.setAttribute('jslogcontext', jsLogContext);
159
+ }
160
+
161
+ if (tabindex !== 0) {
162
+ link.setAttribute('tabindex', String(tabindex));
163
+ }
164
+
165
+ return link;
166
+ }
136
167
  }
137
168
 
138
169
  customElements.define('devtools-link', Link);
@@ -11,23 +11,21 @@ import {
11
11
  copyLinkAddressLabel,
12
12
  openLinkExternallyLabel,
13
13
  } from './UIUtils.js';
14
- import {XLink} from './XLink.js';
15
14
 
16
15
  /**
17
16
  * We can move this next to the Link after
18
- * the x-link is removed and the context menu
19
- * is decoupled from the legacy bundle
17
+ * the context menu is decoupled from the legacy bundle
20
18
  */
21
19
  export class LinkContextMenuProvider implements Provider<Node> {
22
20
  appendApplicableItems(_event: Event, contextMenu: ContextMenu, target: Node): void {
23
21
  let targetNode: Node|null = target;
24
- while (targetNode && !(targetNode instanceof XLink || targetNode instanceof Link)) {
22
+ while (targetNode && !(targetNode instanceof Link)) {
25
23
  targetNode = targetNode.parentNodeOrShadowHost();
26
24
  }
27
25
  if (!targetNode?.href) {
28
26
  return;
29
27
  }
30
- const node: XLink|Link = targetNode;
28
+ const node: Link = targetNode;
31
29
  contextMenu.revealSection().appendItem(openLinkExternallyLabel(), () => {
32
30
  if (node.href) {
33
31
  UIHelpers.openInNewTab(node.href);
@@ -8,6 +8,7 @@ import * as i18n from '../../../../core/i18n/i18n.js';
8
8
  import * as Platform from '../../../../core/platform/platform.js';
9
9
  import * as SDK from '../../../../core/sdk/sdk.js';
10
10
  import * as Geometry from '../../../../models/geometry/geometry.js';
11
+ import {Link} from '../../../kit/kit.js';
11
12
  import {render} from '../../../lit/lit.js';
12
13
  import * as UI from '../../legacy.js';
13
14
  import * as Components from '../utils/utils.js';
@@ -109,8 +110,7 @@ export class ObjectPopoverHelper {
109
110
  descriptionDiv.dataset.stableNameForTest = 'object-popover-content';
110
111
  popover.registerRequiredCSS(objectPopoverStyles);
111
112
  descriptionDiv.textContent = description;
112
- const learnMoreLink =
113
- UI.XLink.XLink.create(link, i18nString(UIStrings.learnMore), undefined, undefined, 'learn-more');
113
+ const learnMoreLink = Link.create(link, i18nString(UIStrings.learnMore), undefined, 'learn-more');
114
114
  const footerDiv = document.createElement('div');
115
115
  footerDiv.classList.add('object-popover-footer');
116
116
  footerDiv.appendChild(learnMoreLink);