chrome-devtools-frontend 1.0.1593959 → 1.0.1595090

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 (73) hide show
  1. package/docs/contributing/settings-experiments-features.md +25 -5
  2. package/front_end/core/common/README.md +126 -0
  3. package/front_end/core/sdk/CSSModel.ts +22 -0
  4. package/front_end/core/sdk/CSSNavigation.ts +33 -0
  5. package/front_end/core/sdk/CSSRule.ts +12 -2
  6. package/front_end/core/sdk/sdk-meta.ts +22 -18
  7. package/front_end/core/sdk/sdk.ts +2 -0
  8. package/front_end/design_system_tokens.css +538 -259
  9. package/front_end/entrypoints/main/main-meta.ts +2 -2
  10. package/front_end/generated/SupportedCSSProperties.js +12 -0
  11. package/front_end/models/issues_manager/Issue.ts +1 -0
  12. package/front_end/models/issues_manager/IssueAggregator.ts +9 -0
  13. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  14. package/front_end/models/issues_manager/SelectivePermissionsInterventionIssue.ts +65 -0
  15. package/front_end/models/issues_manager/descriptions/selectivePermissionsIntervention.md +7 -0
  16. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  17. package/front_end/models/javascript_metadata/NativeFunctions.js +44 -9
  18. package/front_end/models/persistence/persistence-meta.ts +4 -4
  19. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +12 -1
  20. package/front_end/panels/ai_assistance/components/ChatInput.ts +37 -30
  21. package/front_end/panels/ai_assistance/components/ChatView.ts +4 -2
  22. package/front_end/panels/ai_assistance/components/chatInput.css +26 -1
  23. package/front_end/panels/application/StorageView.ts +8 -2
  24. package/front_end/panels/application/preloading/PreloadingView.ts +105 -7
  25. package/front_end/panels/application/preloading/preloadingView.css +4 -0
  26. package/front_end/panels/console/ConsoleView.ts +2 -2
  27. package/front_end/panels/console/console-meta.ts +18 -14
  28. package/front_end/panels/elements/ComputedStyleWidget.ts +12 -7
  29. package/front_end/panels/elements/ElementsPanel.ts +1 -1
  30. package/front_end/panels/elements/ElementsTreeOutline.ts +4 -6
  31. package/front_end/panels/elements/ImagePreviewPopover.ts +6 -9
  32. package/front_end/panels/elements/StylePropertiesSection.ts +30 -0
  33. package/front_end/panels/elements/StylesSidebarPane.ts +13 -7
  34. package/front_end/panels/elements/elements-meta.ts +12 -8
  35. package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +120 -0
  36. package/front_end/panels/issues/IssueView.ts +2 -0
  37. package/front_end/panels/issues/IssuesPane.ts +6 -0
  38. package/front_end/panels/issues/issues.ts +2 -0
  39. package/front_end/panels/lighthouse/LighthouseStartView.ts +99 -38
  40. package/front_end/panels/lighthouse/LighthouseTimespanView.ts +53 -14
  41. package/front_end/panels/lighthouse/RadioSetting.ts +33 -19
  42. package/front_end/panels/lighthouse/lighthouse.ts +2 -0
  43. package/front_end/panels/media/PlayerMessagesView.ts +62 -49
  44. package/front_end/panels/media/media.ts +2 -0
  45. package/front_end/panels/media/playerMessagesView.css +1 -1
  46. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +49 -24
  47. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +2 -2
  48. package/front_end/panels/sources/sources-meta.ts +8 -4
  49. package/front_end/panels/utils/utils.ts +11 -5
  50. package/front_end/third_party/chromium/README.chromium +1 -1
  51. package/front_end/third_party/lit/lib/async-directive.d.ts +465 -0
  52. package/front_end/third_party/lit/lib/async-directive.js +23 -0
  53. package/front_end/third_party/lit/lib/async-directive.js.map +1 -0
  54. package/front_end/third_party/lit/lib/decorators.d.ts +7 -1
  55. package/front_end/third_party/lit/lib/decorators.js +2 -2
  56. package/front_end/third_party/lit/lib/decorators.js.map +1 -1
  57. package/front_end/third_party/lit/lib/directive.js.map +1 -1
  58. package/front_end/third_party/lit/lib/directives.d.ts +27 -8
  59. package/front_end/third_party/lit/lib/directives.js +8 -8
  60. package/front_end/third_party/lit/lib/directives.js.map +1 -1
  61. package/front_end/third_party/lit/lib/lit.d.ts +15 -5
  62. package/front_end/third_party/lit/lib/lit.js +4 -4
  63. package/front_end/third_party/lit/lib/lit.js.map +1 -1
  64. package/front_end/third_party/lit/lib/static-html.js +2 -2
  65. package/front_end/third_party/lit/lib/static-html.js.map +1 -1
  66. package/front_end/third_party/lit/lit.ts +2 -1
  67. package/front_end/third_party/lit/rollup.config.mjs +1 -1
  68. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +5 -0
  69. package/front_end/ui/legacy/components/utils/ImagePreview.ts +27 -23
  70. package/front_end/ui/lit/lit.ts +1 -0
  71. package/front_end/ui/visual_logging/Debugging.ts +1 -1
  72. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  73. package/package.json +1 -1
@@ -135,11 +135,11 @@ const UIStrings = {
135
135
  /**
136
136
  * @description Title of a setting under the Appearance category in Settings
137
137
  */
138
- enableCtrlShortcutToSwitchPanels: 'Enable Ctrl + 1-9 shortcut to switch panels',
138
+ enableCtrlShortcutToSwitchPanels: 'Use Ctrl + 1-9 to switch panels',
139
139
  /**
140
140
  * @description (Mac only) Title of a setting under the Appearance category in Settings
141
141
  */
142
- enableShortcutToSwitchPanels: 'Enable ⌘ + 1-9 shortcut to switch panels',
142
+ enableShortcutToSwitchPanels: 'Use ⌘ + 1-9 to switch panels',
143
143
  /**
144
144
  * @description A drop-down menu option to dock to right
145
145
  */
@@ -623,6 +623,7 @@ export const generatedProperties = [
623
623
  "page-margin-safety",
624
624
  "page-orientation",
625
625
  "paint-order",
626
+ "path-length",
626
627
  "pathname",
627
628
  "pattern",
628
629
  "perspective",
@@ -3574,6 +3575,12 @@ export const generatedProperties = [
3574
3575
  ],
3575
3576
  "name": "paint-order"
3576
3577
  },
3578
+ {
3579
+ "keywords": [
3580
+ "none"
3581
+ ],
3582
+ "name": "path-length"
3583
+ },
3577
3584
  {
3578
3585
  "name": "pathname"
3579
3586
  },
@@ -6590,6 +6597,11 @@ export const generatedPropertyValues = {
6590
6597
  "markers"
6591
6598
  ]
6592
6599
  },
6600
+ "path-length": {
6601
+ "values": [
6602
+ "none"
6603
+ ]
6604
+ },
6593
6605
  "perspective": {
6594
6606
  "values": [
6595
6607
  "none"
@@ -52,6 +52,7 @@ export const enum IssueCategory {
52
52
  ATTRIBUTION_REPORTING = 'AttributionReporting',
53
53
  QUIRKS_MODE = 'QuirksMode',
54
54
  PERMISSION_ELEMENT = 'PermissionElement',
55
+ SELECTIVE_PERMISSIONS_INTERVENTION = 'SelectivePermissionsIntervention',
55
56
  OTHER = 'Other',
56
57
  }
57
58
 
@@ -22,6 +22,7 @@ import {MixedContentIssue} from './MixedContentIssue.js';
22
22
  import {PartitioningBlobURLIssue} from './PartitioningBlobURLIssue.js';
23
23
  import {PermissionElementIssue} from './PermissionElementIssue.js';
24
24
  import {QuirksModeIssue} from './QuirksModeIssue.js';
25
+ import {SelectivePermissionsInterventionIssue} from './SelectivePermissionsInterventionIssue.js';
25
26
  import {SharedArrayBufferIssue} from './SharedArrayBufferIssue.js';
26
27
 
27
28
  export interface IssuesProvider extends Common.EventTarget.EventTarget<IssuesManagerEventsTypes> {
@@ -67,6 +68,7 @@ export class AggregatedIssue extends Issue {
67
68
  #mixedContentIssues = new Set<MixedContentIssue>();
68
69
  #partitioningBlobURLIssues = new Set<PartitioningBlobURLIssue>();
69
70
  #permissionElementIssues = new Set<PermissionElementIssue>();
71
+ #selectivePermissionsInterventionIssues = new Set<SelectivePermissionsInterventionIssue>();
70
72
  #sharedArrayBufferIssues = new Set<SharedArrayBufferIssue>();
71
73
  #quirksModeIssues = new Set<QuirksModeIssue>();
72
74
  #attributionReportingIssues = new Set<AttributionReportingIssue>();
@@ -144,6 +146,10 @@ export class AggregatedIssue extends Issue {
144
146
  return this.#affectedRequests.values();
145
147
  }
146
148
 
149
+ getSelectivePermissionsInterventionIssues(): Iterable<SelectivePermissionsInterventionIssue> {
150
+ return this.#selectivePermissionsInterventionIssues;
151
+ }
152
+
147
153
  getSharedArrayBufferIssues(): Iterable<SharedArrayBufferIssue> {
148
154
  return this.#sharedArrayBufferIssues;
149
155
  }
@@ -282,6 +288,9 @@ export class AggregatedIssue extends Issue {
282
288
  if (issue instanceof PermissionElementIssue) {
283
289
  this.#permissionElementIssues.add(issue);
284
290
  }
291
+ if (issue instanceof SelectivePermissionsInterventionIssue) {
292
+ this.#selectivePermissionsInterventionIssues.add(issue);
293
+ }
285
294
  }
286
295
 
287
296
  getKind(): IssueKind {
@@ -27,6 +27,7 @@ import {PartitioningBlobURLIssue} from './PartitioningBlobURLIssue.js';
27
27
  import {PermissionElementIssue} from './PermissionElementIssue.js';
28
28
  import {PropertyRuleIssue} from './PropertyRuleIssue.js';
29
29
  import {QuirksModeIssue} from './QuirksModeIssue.js';
30
+ import {SelectivePermissionsInterventionIssue} from './SelectivePermissionsInterventionIssue.js';
30
31
  import {SharedArrayBufferIssue} from './SharedArrayBufferIssue.js';
31
32
  import {SharedDictionaryIssue} from './SharedDictionaryIssue.js';
32
33
  import {SourceFrameIssuesManager} from './SourceFrameIssuesManager.js';
@@ -148,6 +149,10 @@ const issueCodeHandlers = new Map<
148
149
  Protocol.Audits.InspectorIssueCode.PermissionElementIssue,
149
150
  PermissionElementIssue.fromInspectorIssue,
150
151
  ],
152
+ [
153
+ Protocol.Audits.InspectorIssueCode.SelectivePermissionsInterventionIssue,
154
+ SelectivePermissionsInterventionIssue.fromInspectorIssue,
155
+ ],
151
156
  ]);
152
157
 
153
158
  /**
@@ -0,0 +1,65 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as i18n from '../../core/i18n/i18n.js';
6
+ import type * as SDK from '../../core/sdk/sdk.js';
7
+ import * as Protocol from '../../generated/protocol.js';
8
+
9
+ import {Issue, IssueCategory, IssueKind} from './Issue.js';
10
+ import type {MarkdownIssueDescription} from './MarkdownIssueDescription.js';
11
+
12
+ const UIStrings = {
13
+ /**
14
+ * @description Title for a learn more link in Selective Permissions Intervention issue description
15
+ */
16
+ selectivePermissionsIntervention: 'Selective Permissions Intervention',
17
+ } as const;
18
+ const str_ = i18n.i18n.registerUIStrings('models/issues_manager/SelectivePermissionsInterventionIssue.ts', UIStrings);
19
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
+
21
+ export class SelectivePermissionsInterventionIssue extends
22
+ Issue<Protocol.Audits.SelectivePermissionsInterventionIssueDetails> {
23
+ constructor(
24
+ issueDetails: Protocol.Audits.SelectivePermissionsInterventionIssueDetails,
25
+ issuesModel: SDK.IssuesModel.IssuesModel|null) {
26
+ super(Protocol.Audits.InspectorIssueCode.SelectivePermissionsInterventionIssue, issueDetails, issuesModel);
27
+ }
28
+
29
+ primaryKey(): string {
30
+ return `${Protocol.Audits.InspectorIssueCode.SelectivePermissionsInterventionIssue}-${
31
+ JSON.stringify(this.details())}`;
32
+ }
33
+
34
+ getDescription(): MarkdownIssueDescription {
35
+ return {
36
+ file: 'selectivePermissionsIntervention.md',
37
+ links: [
38
+ {
39
+ link: 'https://crbug.com/435223477',
40
+ linkTitle: i18nString(UIStrings.selectivePermissionsIntervention),
41
+ },
42
+ ],
43
+ };
44
+ }
45
+
46
+ getCategory(): IssueCategory {
47
+ return IssueCategory.SELECTIVE_PERMISSIONS_INTERVENTION;
48
+ }
49
+
50
+ getKind(): IssueKind {
51
+ return IssueKind.PAGE_ERROR;
52
+ }
53
+
54
+ static fromInspectorIssue(
55
+ issuesModel: SDK.IssuesModel.IssuesModel|null,
56
+ inspectorIssue: Protocol.Audits.InspectorIssue): SelectivePermissionsInterventionIssue[] {
57
+ const selectivePermissionsInterventionIssueDetails =
58
+ inspectorIssue.details.selectivePermissionsInterventionIssueDetails;
59
+ if (!selectivePermissionsInterventionIssueDetails) {
60
+ console.warn('Selective Permissions Intervention issue without details received.');
61
+ return [];
62
+ }
63
+ return [new SelectivePermissionsInterventionIssue(selectivePermissionsInterventionIssueDetails, issuesModel)];
64
+ }
65
+ }
@@ -0,0 +1,7 @@
1
+ # Selective Permissions Intervention
2
+
3
+ The Selective Permissions Intervention blocks calls to privacy-sensitive APIs when they are called from ad scripts in order to align the permission grant with the user's intent. The particular API that was blocked, the call-stack that triggered the intervention, and why the script that called the API is considered ad-related is shown below.
4
+
5
+ Note that Chrome considers any script with a URL that matches a rule in the [filterlist](ChromeFilterlistRepository) as ad script, and the matching rule is shown in the Ad Ancestry section. In addition, any script loaded while an ad script is in the JavaScript stack will also be considered an ad script by Chrome and is also shown in Ad Ancestry.
6
+
7
+ If you believe this intervention was in error (e.g., this call would occur even when loading the page with an ad blocker enabled), then please [file a bug](SelectivePermissionsInterventionIssue).
@@ -27,6 +27,7 @@ import * as PermissionElementIssue from './PermissionElementIssue.js';
27
27
  import * as PropertyRuleIssue from './PropertyRuleIssue.js';
28
28
  import * as QuirksModeIssue from './QuirksModeIssue.js';
29
29
  import * as RelatedIssue from './RelatedIssue.js';
30
+ import * as SelectivePermissionsInterventionIssue from './SelectivePermissionsInterventionIssue.js';
30
31
  import * as SharedArrayBufferIssue from './SharedArrayBufferIssue.js';
31
32
  import * as SharedDictionaryIssue from './SharedDictionaryIssue.js';
32
33
  import * as SourceFrameIssuesManager from './SourceFrameIssuesManager.js';
@@ -60,6 +61,7 @@ export {
60
61
  PropertyRuleIssue,
61
62
  QuirksModeIssue,
62
63
  RelatedIssue,
64
+ SelectivePermissionsInterventionIssue,
63
65
  SharedArrayBufferIssue,
64
66
  SharedDictionaryIssue,
65
67
  SourceFrameIssuesManager,
@@ -2485,6 +2485,11 @@ export const NativeFunctions = [
2485
2485
  signatures: [["qualifiedName"],["name"]],
2486
2486
  receivers: ["Element"]
2487
2487
  },
2488
+ {
2489
+ name: "getAttribute",
2490
+ signatures: [["name"]],
2491
+ receivers: ["ProcessingInstruction"]
2492
+ },
2488
2493
  {
2489
2494
  name: "getAttribute",
2490
2495
  signatures: [["tag"]],
@@ -2508,7 +2513,13 @@ export const NativeFunctions = [
2508
2513
  },
2509
2514
  {
2510
2515
  name: "hasAttribute",
2511
- signatures: [["qualifiedName"],["name"]]
2516
+ signatures: [["qualifiedName"],["name"]],
2517
+ receivers: ["Element"]
2518
+ },
2519
+ {
2520
+ name: "hasAttribute",
2521
+ signatures: [["name"]],
2522
+ receivers: ["ProcessingInstruction"]
2512
2523
  },
2513
2524
  {
2514
2525
  name: "hasAttributeNS",
@@ -2543,6 +2554,11 @@ export const NativeFunctions = [
2543
2554
  signatures: [["qualifiedName"],["name"]],
2544
2555
  receivers: ["Element"]
2545
2556
  },
2557
+ {
2558
+ name: "removeAttribute",
2559
+ signatures: [["name"]],
2560
+ receivers: ["ProcessingInstruction"]
2561
+ },
2546
2562
  {
2547
2563
  name: "removeAttribute",
2548
2564
  signatures: [["attribute"]],
@@ -2586,6 +2602,11 @@ export const NativeFunctions = [
2586
2602
  signatures: [["qualifiedName","value"],["name","value"]],
2587
2603
  receivers: ["Element"]
2588
2604
  },
2605
+ {
2606
+ name: "setAttribute",
2607
+ signatures: [["name","value"]],
2608
+ receivers: ["ProcessingInstruction"]
2609
+ },
2589
2610
  {
2590
2611
  name: "setAttribute",
2591
2612
  signatures: [["tag","value"]],
@@ -2619,7 +2640,13 @@ export const NativeFunctions = [
2619
2640
  },
2620
2641
  {
2621
2642
  name: "toggleAttribute",
2622
- signatures: [["qualifiedName","?force"]]
2643
+ signatures: [["qualifiedName","?force"]],
2644
+ receivers: ["Element"]
2645
+ },
2646
+ {
2647
+ name: "toggleAttribute",
2648
+ signatures: [["name","?force"]],
2649
+ receivers: ["ProcessingInstruction"]
2623
2650
  },
2624
2651
  {
2625
2652
  name: "webkitMatchesSelector",
@@ -3149,7 +3176,7 @@ export const NativeFunctions = [
3149
3176
  },
3150
3177
  {
3151
3178
  name: "initKeyboardEvent",
3152
- signatures: [["typeArg","?bubblesArg","?cancelableArg","?viewArg","?keyArg","?locationArg","?ctrlKey","?altKey","?shiftKey","?metaKey"]]
3179
+ signatures: [["typeArg","?bubblesArg","?cancelableArg","?viewArg","?keyArg","?locationArg","?ctrlKey","?altKey","?shiftKey","?metaKey"],["type","?bubbles","?cancelable","?view","?keyIdentifier","?location","?ctrlKey","?altKey","?shiftKey","?metaKey"]]
3153
3180
  },
3154
3181
  {
3155
3182
  name: "setKeyframes",
@@ -4183,7 +4210,7 @@ export const NativeFunctions = [
4183
4210
  },
4184
4211
  {
4185
4212
  name: "initUIEvent",
4186
- signatures: [["typeArg","?bubblesArg","?cancelableArg","?viewArg","?detailArg"],["type","?bubbles","?cancelable","?view","?detail"]]
4213
+ signatures: [["typeArg","?bubblesArg","?cancelableArg","?viewArg","?detailArg"]]
4187
4214
  },
4188
4215
  {
4189
4216
  name: "getTranslatedShaderSource",
@@ -6817,6 +6844,10 @@ export const NativeFunctions = [
6817
6844
  name: "ErrorEvent",
6818
6845
  signatures: [["type","?eventInitDict"]]
6819
6846
  },
6847
+ {
6848
+ name: "FocusEvent",
6849
+ signatures: [["type","?eventInitDict"]]
6850
+ },
6820
6851
  {
6821
6852
  name: "HashChangeEvent",
6822
6853
  signatures: [["type","?eventInitDict"]]
@@ -6829,6 +6860,10 @@ export const NativeFunctions = [
6829
6860
  name: "InterestEvent",
6830
6861
  signatures: [["type","?eventInitDict"]]
6831
6862
  },
6863
+ {
6864
+ name: "KeyboardEvent",
6865
+ signatures: [["type","?eventInitDict"]]
6866
+ },
6832
6867
  {
6833
6868
  name: "MessageEvent",
6834
6869
  signatures: [["type","?eventInitDict"]]
@@ -6866,7 +6901,7 @@ export const NativeFunctions = [
6866
6901
  signatures: [["type","?eventInitDict"]]
6867
6902
  },
6868
6903
  {
6869
- name: "UIEvent",
6904
+ name: "TouchEvent",
6870
6905
  signatures: [["type","?eventInitDict"]]
6871
6906
  },
6872
6907
  {
@@ -7325,10 +7360,6 @@ export const NativeFunctions = [
7325
7360
  name: "TaskPriorityChangeEvent",
7326
7361
  signatures: [["type","eventInitDict"]]
7327
7362
  },
7328
- {
7329
- name: "provideContext",
7330
- signatures: [["?options"]]
7331
- },
7332
7363
  {
7333
7364
  name: "registerTool",
7334
7365
  signatures: [["tool"]]
@@ -9254,6 +9285,10 @@ export const NativeFunctions = [
9254
9285
  name: "MIDIMessageEvent",
9255
9286
  signatures: [["type","?eventInitDict"]]
9256
9287
  },
9288
+ {
9289
+ name: "startDiagnosticLogging",
9290
+ signatures: [["?options"]]
9291
+ },
9257
9292
  {
9258
9293
  name: "CloseEvent",
9259
9294
  signatures: [["type","?eventInitDict"]]
@@ -9,7 +9,7 @@ const UIStrings = {
9
9
  /**
10
10
  * @description Title of a setting under the Persistence category in Settings
11
11
  */
12
- enableLocalOverrides: 'Enable Local Overrides',
12
+ localOverrides: 'Local overrides',
13
13
  /**
14
14
  * @description A tag of Enable Local Overrides setting that can be searched in the command menu
15
15
  */
@@ -32,11 +32,11 @@ const UIStrings = {
32
32
  */
33
33
  request: 'request',
34
34
  /**
35
- * @description Title of a setting under the Persistence category that can be invoked through the Command Menu
35
+ * @description Title of an option under the Persistence category that can be invoked through the Command Menu
36
36
  */
37
37
  enableOverrideNetworkRequests: 'Enable override network requests',
38
38
  /**
39
- * @description Title of a setting under the Persistence category that can be invoked through the Command Menu
39
+ * @description Title of an option under the Persistence category that can be invoked through the Command Menu
40
40
  */
41
41
  disableOverrideNetworkRequests: 'Disable override network requests',
42
42
  } as const;
@@ -45,7 +45,7 @@ const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined
45
45
 
46
46
  Common.Settings.registerSettingExtension({
47
47
  category: Common.Settings.SettingCategory.PERSISTENCE,
48
- title: i18nLazyString(UIStrings.enableLocalOverrides),
48
+ title: i18nLazyString(UIStrings.localOverrides),
49
49
  settingName: 'persistence-network-overrides-enabled',
50
50
  settingType: Common.Settings.SettingType.BOOLEAN,
51
51
  defaultValue: false,
@@ -693,7 +693,15 @@ export class AiAssistancePanel extends UI.Panel.Panel {
693
693
  blockedByCrossOrigin: this.#conversation.isBlockedByOrigin,
694
694
  isLoading: this.#isLoading,
695
695
  messages: this.#messages,
696
- selectedContext: this.#conversation.selectedContext ?? null,
696
+ /**
697
+ * We pass either the selected context with isContextSelected=true
698
+ * to make sure the pill is show with normal styling and a remove button.
699
+ * Or we pass the panels default context with isContextSelected=false
700
+ * to display a placeholder pill with neutral styling and an add button.
701
+ */
702
+ context:
703
+ this.#conversation.selectedContext ?? this.#getConversationContext(this.#getDefaultConversationType()),
704
+ isContextSelected: Boolean(this.#conversation.selectedContext),
697
705
  conversationType: this.#conversation.type,
698
706
  isReadOnly: this.#conversation.isReadOnly ?? false,
699
707
  changeSummary: this.#getChangeSummary(),
@@ -857,17 +865,20 @@ export class AiAssistancePanel extends UI.Panel.Panel {
857
865
  #selectDefaultAgentIfNeeded(): void {
858
866
  // We don't change the current agent when there is a message in flight.
859
867
  if (this.#isLoading) {
868
+ this.requestUpdate();
860
869
  return;
861
870
  }
862
871
 
863
872
  // If there already is an agent and if it is not empty,
864
873
  // we don't automatically change the agent.
865
874
  if (this.#conversation && !this.#conversation.isEmpty) {
875
+ this.requestUpdate();
866
876
  return;
867
877
  }
868
878
 
869
879
  const targetConversationType = this.#getDefaultConversationType();
870
880
  if (this.#conversation?.type === targetConversationType) {
881
+ this.requestUpdate();
871
882
  // The above if makes sure even if we have an active agent it's empty
872
883
  // So we can just reuse it
873
884
  return;
@@ -134,7 +134,8 @@ export interface ViewInput {
134
134
  blockedByCrossOrigin: boolean;
135
135
  isTextInputDisabled: boolean;
136
136
  inputPlaceholder: Platform.UIString.LocalizedString;
137
- selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null;
137
+ context: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null;
138
+ isContextSelected: boolean;
138
139
  inspectElementToggled: boolean;
139
140
  disclaimerText: string;
140
141
  conversationType: AiAssistanceModel.AiHistoryStorage.ConversationType;
@@ -183,7 +184,7 @@ function getContextRemoveLabel(context: AiAssistanceModel.AiAgent.ConversationCo
183
184
  export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTMLElement): void => {
184
185
  const chatInputContainerCls = Lit.Directives.classMap({
185
186
  'chat-input-container': true,
186
- 'single-line-layout': !input.selectedContext && !input.onContextAdd,
187
+ 'single-line-layout': !input.context,
187
188
  disabled: input.isTextInputDisabled,
188
189
  });
189
190
 
@@ -300,7 +301,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
300
301
  ></textarea>
301
302
  <div class="chat-input-actions">
302
303
  <div class="chat-input-actions-left">
303
- ${input.selectedContext ?
304
+ ${input.context ?
304
305
  html`
305
306
  <div class="select-element">
306
307
  ${input.conversationType === AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING ?
@@ -321,29 +322,33 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
321
322
  ></devtools-button>`
322
323
  : Lit.nothing}
323
324
  <div
324
- class="resource-link"
325
+ class=${Lit.Directives.classMap({
326
+ 'resource-link': true,
327
+ disabled: !input.isContextSelected,
328
+ })}
325
329
  >
326
330
  ${
327
- input.selectedContext instanceof AiAssistanceModel.StylingAgent.NodeContext ?
331
+ input.context instanceof AiAssistanceModel.StylingAgent.NodeContext ?
328
332
  html`
329
333
  <devtools-widget
330
334
  class="title"
331
335
  .widgetConfig=${UI.Widget.widgetConfig(PanelsCommon.DOMLinkifier.DOMNodeLink, {
332
- node: input.selectedContext.getItem(),
336
+ node: input.context.getItem(),
333
337
  options: {
334
- hiddenClassList: input.selectedContext.getItem().classNames().filter(
338
+ disabled: !input.isContextSelected,
339
+ hiddenClassList: input.context.getItem().classNames().filter(
335
340
  className => className.startsWith(AiAssistanceModel.Injected.AI_ASSISTANCE_CSS_CLASS_NAME)),
336
341
  ariaDescription: i18nString(UIStrings.revealContextDescription),
337
342
  },
338
343
  })}
339
344
  ></devtools-widget>` :
340
345
  html`
341
- ${input.selectedContext instanceof AiAssistanceModel.NetworkAgent.RequestContext ?
342
- PanelUtils.PanelUtils.getIconForNetworkRequest(input.selectedContext.getItem()) :
343
- input.selectedContext instanceof AiAssistanceModel.FileAgent.FileContext ?
344
- PanelUtils.PanelUtils.getIconForSourceFile(input.selectedContext.getItem()) :
345
- input.selectedContext instanceof AiAssistanceModel.PerformanceAgent.PerformanceTraceContext ?
346
- html`<devtools-icon name="performance" title="Performance"></devtools-icon>` :
346
+ ${input.context instanceof AiAssistanceModel.NetworkAgent.RequestContext ?
347
+ PanelUtils.PanelUtils.getIconForNetworkRequest(input.context.getItem()) :
348
+ input.context instanceof AiAssistanceModel.FileAgent.FileContext ?
349
+ PanelUtils.PanelUtils.getIconForSourceFile(input.context.getItem()) :
350
+ input.context instanceof AiAssistanceModel.PerformanceAgent.PerformanceTraceContext ?
351
+ html`<devtools-icon class="icon" name="performance" title="Performance"></devtools-icon>` :
347
352
  Lit.nothing}
348
353
  <span
349
354
  role="button"
@@ -356,31 +361,31 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
356
361
  }
357
362
  }}
358
363
  aria-description=${i18nString(UIStrings.revealContextDescription)}
359
- >${input.selectedContext.getTitle()}</span>`
364
+ >${input.context.getTitle()}</span>`
360
365
  }
361
- ${input.onContextRemoved ? html`
366
+ ${input.isContextSelected && input.onContextRemoved ? html`
362
367
  <devtools-button
363
- title=${getContextRemoveLabel(input.selectedContext)}
364
- aria-label=${getContextRemoveLabel(input.selectedContext)}
368
+ title=${getContextRemoveLabel(input.context)}
369
+ aria-label=${getContextRemoveLabel(input.context)}
365
370
  class="remove-context"
366
371
  .iconName=${'cross'}
367
372
  .size=${Buttons.Button.Size.MICRO}
368
373
  .jslogContext=${'context-removed'}
369
374
  .variant=${Buttons.Button.Variant.ICON}
370
375
  @click=${input.onContextRemoved}></devtools-button>` : Lit.nothing}
376
+ ${!input.isContextSelected && input.onContextAdd ? html`
377
+ <devtools-button
378
+ title=${lockedString(UIStringsNotTranslate.addContext)}
379
+ aria-label=${lockedString(UIStringsNotTranslate.addContext)}
380
+ class="add-context"
381
+ .iconName=${'plus'}
382
+ .size=${Buttons.Button.Size.MICRO}
383
+ .jslogContext=${'context-added'}
384
+ .variant=${Buttons.Button.Variant.ICON}
385
+ @click=${input.onContextAdd}></devtools-button>` : Lit.nothing}
371
386
  </div>
372
387
  </div>`
373
- :
374
- input.onContextAdd ? html`
375
- <devtools-button
376
- title=${lockedString(UIStringsNotTranslate.addContext)}
377
- aria-label=${lockedString(UIStringsNotTranslate.addContext)}
378
- class="add-context"
379
- .iconName=${'plus'}
380
- .size=${Buttons.Button.Size.SMALL}
381
- .jslogContext=${'context-added'}
382
- .variant=${Buttons.Button.Variant.ICON}
383
- @click=${input.onContextAdd}></devtools-button>` : Lit.nothing}
388
+ : Lit.nothing}
384
389
  </div>
385
390
  <div class="chat-input-actions-right">
386
391
  <div class="chat-input-disclaimer-container">
@@ -488,7 +493,8 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
488
493
  blockedByCrossOrigin = false;
489
494
  isTextInputDisabled = false;
490
495
  inputPlaceholder = '' as Platform.UIString.LocalizedString;
491
- selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null = null;
496
+ context: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null = null;
497
+ isContextSelected = false;
492
498
  inspectElementToggled = false;
493
499
  disclaimerText = '';
494
500
  conversationType = AiAssistanceModel.AiHistoryStorage.ConversationType.STYLING;
@@ -675,7 +681,8 @@ export class ChatInput extends UI.Widget.Widget implements SDK.TargetManager.Obs
675
681
  isLoading: this.isLoading,
676
682
  blockedByCrossOrigin: this.blockedByCrossOrigin,
677
683
  isTextInputDisabled: this.isTextInputDisabled,
678
- selectedContext: this.selectedContext,
684
+ context: this.context,
685
+ isContextSelected: this.isContextSelected,
679
686
  inspectElementToggled: this.inspectElementToggled,
680
687
  isTextInputEmpty: this.#isTextInputEmpty(),
681
688
  disclaimerText: this.disclaimerText,
@@ -65,7 +65,8 @@ export interface Props {
65
65
  changeManager: AiAssistanceModel.ChangeManager.ChangeManager;
66
66
  inspectElementToggled: boolean;
67
67
  messages: Message[];
68
- selectedContext: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null;
68
+ context: AiAssistanceModel.AiAgent.ConversationContext<unknown>|null;
69
+ isContextSelected: boolean;
69
70
  isLoading: boolean;
70
71
  canShowFeedbackForm: boolean;
71
72
  userInfo: Pick<Host.InspectorFrontendHostAPI.SyncInformation, 'accountImage'|'accountGivenName'>;
@@ -178,7 +179,8 @@ const DEFAULT_VIEW: View = (input, output, target) => {
178
179
  isTextInputDisabled: input.isTextInputDisabled,
179
180
  inputPlaceholder: input.inputPlaceholder,
180
181
  disclaimerText: input.disclaimerText,
181
- selectedContext: input.selectedContext,
182
+ context: input.context,
183
+ isContextSelected: input.isContextSelected,
182
184
  inspectElementToggled: input.inspectElementToggled,
183
185
  multimodalInputEnabled: input.multimodalInputEnabled ?? false,
184
186
  conversationType: input.conversationType,
@@ -239,12 +239,15 @@
239
239
 
240
240
  & .title {
241
241
  vertical-align: middle;
242
+ /* Fixed italic text getting cut off */
243
+ padding-right: var(--sys-size-2);
242
244
  font: var(--sys-typescale-body5-regular);
243
245
  overflow: hidden;
244
246
  text-overflow: ellipsis;
245
247
  }
246
248
 
247
- & .remove-context {
249
+ & .remove-context,
250
+ & .add-context {
248
251
  vertical-align: middle;
249
252
  }
250
253
 
@@ -260,6 +263,28 @@
260
263
  min-height: var(--sys-size-7);
261
264
  }
262
265
 
266
+ &.disabled {
267
+ border-style: dashed;
268
+ border-color: var(--sys-color-neutral-outline);
269
+ color: var(--sys-color-on-surface-light);
270
+
271
+ devtools-icon,
272
+ devtools-file-source-icon {
273
+ /* Override devtools-file-source-icon */
274
+ --override-file-source-icon-color: var(
275
+ --sys-color-on-surface-light-graphics
276
+ );
277
+ /* Some icons set their style attribute and we need to override it */
278
+ /* stylelint-disable-next-line declaration-no-important */
279
+ color: var(--sys-color-on-surface-light-graphics) !important;
280
+ }
281
+
282
+ .title {
283
+ color: var(--sys-color-on-surface-light);
284
+ font-style: italic;
285
+ }
286
+ }
287
+
263
288
  /*
264
289
  CSS styling for `network-override-marker` is similar to
265
290
  https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/network/networkLogView.css;l=379.
@@ -510,8 +510,14 @@ export class StorageView extends UI.Widget.VBox {
510
510
  const quotaAsString = i18n.ByteUtilities.bytesToString(response.quota);
511
511
  const usageAsString = i18n.ByteUtilities.bytesToString(response.usage);
512
512
  const formattedQuotaAsString = i18nString(UIStrings.storageWithCustomMarker, {PH1: quotaAsString});
513
- const quota =
514
- quotaOverridden ? UI.Fragment.Fragment.build`<b>${formattedQuotaAsString}</b>`.element() : quotaAsString;
513
+
514
+ let quota: string|HTMLElement = quotaAsString;
515
+ if (quotaOverridden) {
516
+ const element = document.createElement('b');
517
+ element.textContent = formattedQuotaAsString;
518
+ quota = element;
519
+ }
520
+
515
521
  const element = uiI18n.getFormatLocalizedString(str_, UIStrings.storageQuotaUsed, {PH1: usageAsString, PH2: quota});
516
522
  this.quotaRow.appendChild(element);
517
523
  UI.Tooltip.Tooltip.install(