chrome-devtools-frontend 1.0.1528866 → 1.0.1529186

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 (38) hide show
  1. package/front_end/core/host/UserMetrics.ts +2 -1
  2. package/front_end/core/root/Runtime.ts +10 -0
  3. package/front_end/core/sdk/NetworkManager.ts +85 -35
  4. package/front_end/core/sdk/SourceMap.ts +4 -0
  5. package/front_end/core/sdk/SourceMapScopesInfo.ts +32 -2
  6. package/front_end/entrypoints/main/MainImpl.ts +23 -4
  7. package/front_end/generated/SupportedCSSProperties.js +2 -0
  8. package/front_end/models/ai_assistance/BuiltInAi.ts +1 -1
  9. package/front_end/models/ai_assistance/ConversationHandler.ts +15 -14
  10. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
  11. package/front_end/models/persistence/NetworkPersistenceManager.ts +3 -5
  12. package/front_end/models/persistence/PersistenceImpl.ts +0 -5
  13. package/front_end/models/persistence/persistence-meta.ts +0 -31
  14. package/front_end/models/persistence/persistence.ts +0 -6
  15. package/front_end/{models/persistence → panels/common}/PersistenceUtils.ts +15 -17
  16. package/front_end/panels/common/common.ts +1 -0
  17. package/front_end/panels/console/ConsoleInsightTeaser.ts +285 -22
  18. package/front_end/panels/console/ConsoleViewMessage.ts +18 -1
  19. package/front_end/panels/console/console-meta.ts +14 -0
  20. package/front_end/panels/console/consoleInsightTeaser.css +28 -0
  21. package/front_end/panels/explain/ActionDelegate.ts +3 -0
  22. package/front_end/panels/explain/explain-meta.ts +7 -0
  23. package/front_end/panels/network/BlockedURLsPane.ts +139 -36
  24. package/front_end/panels/network/NetworkLogView.ts +1 -1
  25. package/front_end/{models/persistence → panels/settings}/EditFileSystemView.ts +2 -6
  26. package/front_end/panels/settings/WorkspaceSettingsTab.ts +2 -1
  27. package/front_end/panels/settings/settings.ts +2 -0
  28. package/front_end/{models/persistence → panels/sources}/PersistenceActions.ts +8 -12
  29. package/front_end/panels/sources/TabbedEditorContainer.ts +2 -1
  30. package/front_end/panels/sources/sources-meta.ts +15 -0
  31. package/front_end/panels/sources/sources.ts +2 -0
  32. package/front_end/panels/utils/utils.ts +2 -1
  33. package/front_end/third_party/chromium/README.chromium +1 -1
  34. package/front_end/third_party/diff/diff_match_patch.js +1 -1
  35. package/front_end/ui/legacy/ListWidget.ts +2 -2
  36. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
  37. package/package.json +1 -1
  38. /package/front_end/{models/persistence → panels/settings}/editFileSystemView.css +0 -0
@@ -514,7 +514,8 @@ export enum Action {
514
514
  AiCodeCompletionSuggestionAccepted = 187,
515
515
  AiCodeCompletionError = 188,
516
516
  AttributeLinkClicked = 189,
517
- MAX_VALUE = 190,
517
+ InsightRequestedViaTeaser = 190,
518
+ MAX_VALUE = 191,
518
519
  /* eslint-enable @typescript-eslint/naming-convention */
519
520
  }
520
521
 
@@ -527,6 +527,14 @@ interface AiPromptApi {
527
527
  enabled: boolean;
528
528
  }
529
529
 
530
+ interface DevToolsIndividualRequestThrottling {
531
+ enabled: boolean;
532
+ }
533
+
534
+ export interface DevToolsEnableDurableMessages {
535
+ enabled: boolean;
536
+ }
537
+
530
538
  /**
531
539
  * The host configuration that we expect from the DevTools back-end.
532
540
  *
@@ -554,6 +562,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
554
562
  devToolsVeLogging: HostConfigVeLogging,
555
563
  devToolsWellKnown: HostConfigWellKnown,
556
564
  devToolsPrivacyUI: HostConfigPrivacyUI,
565
+ devToolsIndividualRequestThrottling: DevToolsIndividualRequestThrottling,
557
566
  devToolsIpProtectionPanelInDevTools: HostConfigIPProtection,
558
567
  /**
559
568
  * OffTheRecord here indicates that the user's profile is either incognito,
@@ -574,6 +583,7 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
574
583
  devToolsFlexibleLayout: DevToolsFlexibleLayout,
575
584
  devToolsStartingStyleDebugging: DevToolsStartingStyleDebugging,
576
585
  devToolsAiPromptApi: AiPromptApi,
586
+ devToolsEnableDurableMessages: DevToolsEnableDurableMessages,
577
587
  }>;
578
588
 
579
589
  /**
@@ -165,6 +165,8 @@ export class NetworkManager extends SDKModel<EventTypes> {
165
165
 
166
166
  void this.#networkAgent.invoke_enable({
167
167
  maxPostDataSize: MAX_EAGER_POST_REQUEST_BODY_LENGTH,
168
+ enableDurableMessages: Root.Runtime.hostConfig.devToolsEnableDurableMessages?.enabled,
169
+ maxTotalBufferSize: MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH,
168
170
  reportDirectSocketTraffic: true,
169
171
  });
170
172
  void this.#networkAgent.invoke_setAttachDebugStack({enabled: true});
@@ -520,6 +522,7 @@ export const Fast4GConditions: Conditions = {
520
522
  };
521
523
 
522
524
  const MAX_EAGER_POST_REQUEST_BODY_LENGTH = 64 * 1024; // bytes
525
+ const MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH = 250 * 1024 * 1024; // bytes
523
526
 
524
527
  export class FetchDispatcher implements ProtocolProxyApi.FetchDispatcher {
525
528
  readonly #fetchAgent: ProtocolProxyApi.FetchApi;
@@ -1553,10 +1556,13 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
1553
1556
  }
1554
1557
  }
1555
1558
 
1556
- interface RequestConditionsSetting {
1557
- url: string;
1558
- enabled: boolean;
1559
- }
1559
+ type RequestConditionsSetting = {
1560
+ url: string,
1561
+ enabled: boolean,
1562
+ }|{
1563
+ urlPattern: URLPatternConstructorString,
1564
+ enabled: boolean,
1565
+ };
1560
1566
 
1561
1567
  declare global {
1562
1568
  // TS typedefs are not up to date
@@ -1621,34 +1627,62 @@ export class RequestURLPattern {
1621
1627
 
1622
1628
  return tryCreate(pattern) // try as is
1623
1629
  ??
1624
- // Try upgrade paths for patterns created from the network panel, which either blocks the full url (sans
1630
+ // Try to upgrade patterns created from the network panel, which either blocks the full url (sans
1625
1631
  // protocol) or just the domain name. In both cases the wildcard patterns had implicit wildcards at the end.
1626
- // The first case is the full url option, which we detect by the presence of '/'. the second case is the
1627
- // domain name only option.
1628
- (pattern.includes('/') // If the pattern includes a '/' we consider this the full-url case
1629
- ?
1630
- tryCreate(`*://${pattern}*`) // Append a wildcard, since the pathname will be parsed from the pattern.
1631
- :
1632
- tryCreate(`*://${pattern}`)); // The pathname is empty, which automatically makes it a wildcard.
1632
+ // We explicitly add that here, which will match both domain names without path (implicitly setting pathname
1633
+ // to '*') and urls with path (appending * to the pathname).
1634
+ tryCreate(`*://${pattern}*`);
1633
1635
  }
1634
1636
  }
1635
1637
 
1636
1638
  export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<RequestCondition.EventTypes> {
1637
- #url: string;
1639
+ #pattern: RequestURLPattern|{wildcardURL: string, upgradedPattern?: RequestURLPattern};
1638
1640
  #enabled: boolean;
1639
1641
 
1640
1642
  constructor(setting: RequestConditionsSetting) {
1641
1643
  super();
1642
- this.#url = setting.url;
1644
+ if ('urlPattern' in setting) {
1645
+ this.#pattern = RequestURLPattern.create(setting.urlPattern) ?? {
1646
+ wildcardURL: setting.urlPattern,
1647
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.urlPattern) ?? undefined,
1648
+ };
1649
+ } else {
1650
+ this.#pattern = {
1651
+ wildcardURL: setting.url,
1652
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.url) ?? undefined
1653
+ };
1654
+ }
1643
1655
  this.#enabled = setting.enabled;
1644
1656
  }
1645
1657
 
1646
- get url(): string {
1647
- return this.#url;
1658
+ get constructorString(): string|undefined {
1659
+ return this.#pattern instanceof RequestURLPattern ? this.#pattern.constructorString :
1660
+ this.#pattern.upgradedPattern?.constructorString;
1661
+ }
1662
+
1663
+ get wildcardURL(): string|undefined {
1664
+ return 'wildcardURL' in this.#pattern ? this.#pattern.wildcardURL : undefined;
1665
+ }
1666
+
1667
+ get constructorStringOrWildcardURL(): string {
1668
+ return this.#pattern instanceof RequestURLPattern ?
1669
+ this.#pattern.constructorString :
1670
+ (this.#pattern.upgradedPattern?.constructorString ?? this.#pattern.wildcardURL);
1648
1671
  }
1649
1672
 
1650
- set url(url: string) {
1651
- this.#url = url;
1673
+ set pattern(pattern: RequestURLPattern|string) {
1674
+ if (typeof pattern === 'string') {
1675
+ // TODO(pfaffe) Remove once the feature flag is no longer required
1676
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1677
+ throw new Error('Should not use wildcard urls');
1678
+ }
1679
+ this.#pattern = {
1680
+ wildcardURL: pattern,
1681
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(pattern) ?? undefined
1682
+ };
1683
+ } else {
1684
+ this.#pattern = pattern;
1685
+ }
1652
1686
  this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1653
1687
  }
1654
1688
 
@@ -1662,8 +1696,13 @@ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<Request
1662
1696
  }
1663
1697
 
1664
1698
  toSetting(): RequestConditionsSetting {
1665
- const {url, enabled} = this;
1666
- return {url, enabled};
1699
+ const enabled = this.enabled;
1700
+ return this.#pattern instanceof RequestURLPattern ? {enabled, urlPattern: this.#pattern.constructorString} :
1701
+ {enabled, url: this.#pattern.wildcardURL};
1702
+ }
1703
+
1704
+ get originalOrUpgradedURLPattern(): URLPattern|undefined {
1705
+ return this.#pattern instanceof RequestURLPattern ? this.#pattern.pattern : this.#pattern.upgradedPattern?.pattern;
1667
1706
  }
1668
1707
  }
1669
1708
 
@@ -1671,6 +1710,7 @@ export namespace RequestCondition {
1671
1710
  export const enum Events {
1672
1711
  REQUEST_CONDITION_CHANGED = 'request-condition-changed',
1673
1712
  }
1713
+
1674
1714
  export interface EventTypes {
1675
1715
  [Events.REQUEST_CONDITION_CHANGED]: void;
1676
1716
  }
@@ -1693,8 +1733,15 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1693
1733
  return this.#conditions.length;
1694
1734
  }
1695
1735
 
1736
+ findCondition(pattern: string): RequestCondition|undefined {
1737
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1738
+ return this.#conditions.find(condition => condition.constructorString === pattern);
1739
+ }
1740
+ return this.#conditions.find(condition => condition.wildcardURL === pattern);
1741
+ }
1742
+
1696
1743
  has(url: string): boolean {
1697
- return Boolean(this.#conditions.find(condition => condition.url === url));
1744
+ return Boolean(this.findCondition(url));
1698
1745
  }
1699
1746
 
1700
1747
  add(...conditions: RequestCondition[]): void {
@@ -1729,12 +1776,22 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1729
1776
  return this.#conditions.values();
1730
1777
  }
1731
1778
 
1732
- * blockedURLPatterns(): Generator<string> {
1733
- for (const condition of this.#conditions) {
1734
- if (condition.enabled) {
1735
- yield condition.url;
1779
+ applyConditions(...agents: ProtocolProxyApi.NetworkApi[]): boolean {
1780
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1781
+ const urlPatterns = this.#conditions.filter(condition => condition.enabled && condition.constructorString)
1782
+ .map(condition => ({urlPattern: condition.constructorString as string, block: true}));
1783
+
1784
+ for (const agent of agents) {
1785
+ void agent.invoke_setBlockedURLs({urlPatterns});
1736
1786
  }
1787
+ return urlPatterns.length > 0;
1788
+ }
1789
+ const urls = this.#conditions.filter(condition => condition.enabled && condition.wildcardURL)
1790
+ .map(condition => condition.wildcardURL as string);
1791
+ for (const agent of agents) {
1792
+ void agent.invoke_setBlockedURLs({urls});
1737
1793
  }
1794
+ return urls.length > 0;
1738
1795
  }
1739
1796
  }
1740
1797
 
@@ -1847,10 +1904,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1847
1904
  void networkAgent.invoke_setUserAgentOverride(
1848
1905
  {userAgent: this.currentUserAgent(), userAgentMetadata: this.#userAgentMetadataOverride || undefined});
1849
1906
  }
1850
- const blockedURLs = this.#requestConditions.blockedURLPatterns().toArray();
1851
- if (blockedURLs.length) {
1852
- void networkAgent.invoke_setBlockedURLs({urls: blockedURLs});
1853
- }
1907
+ this.#requestConditions.applyConditions(networkAgent);
1854
1908
  if (this.isIntercepting()) {
1855
1909
  void fetchAgent.invoke_enable({patterns: this.#urlsForRequestInterceptor.valuesArray()});
1856
1910
  }
@@ -2006,7 +2060,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
2006
2060
  * @deprecated Kept for layout tests
2007
2061
  * TODO(pfaffe) remove
2008
2062
  */
2009
- setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
2063
+ private setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
2010
2064
  this.requestConditions.clear();
2011
2065
  this.requestConditions.add(...patterns.map(pattern => new RequestCondition(pattern)));
2012
2066
  }
@@ -2019,11 +2073,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
2019
2073
  }
2020
2074
 
2021
2075
  private updateBlockedPatterns(): void {
2022
- const urls = this.#requestConditions.blockedURLPatterns().toArray();
2023
- this.#isBlocking = urls.length > 0;
2024
- for (const agent of this.#networkAgents) {
2025
- void agent.invoke_setBlockedURLs({urls});
2026
- }
2076
+ this.#isBlocking = this.#requestConditions.applyConditions(...this.#networkAgents);
2027
2077
  }
2028
2078
 
2029
2079
  isIntercepting(): boolean {
@@ -205,6 +205,10 @@ export class SourceMap {
205
205
  return this.#debugId ?? null;
206
206
  }
207
207
 
208
+ sourceURLForSourceIndex(index: number): Platform.DevToolsPath.UrlString|undefined {
209
+ return this.#sourceInfos[index]?.sourceURL;
210
+ }
211
+
208
212
  sourceURLs(): Platform.DevToolsPath.UrlString[] {
209
213
  return [...this.#sourceInfoByURL.keys()];
210
214
  }
@@ -6,6 +6,7 @@ import * as Protocol from '../../generated/protocol.js';
6
6
  import * as Formatter from '../../models/formatter/formatter.js';
7
7
  import type * as TextUtils from '../../models/text_utils/text_utils.js';
8
8
  import type * as ScopesCodec from '../../third_party/source-map-scopes-codec/source-map-scopes-codec.js';
9
+ import type * as Platform from '../platform/platform.js';
9
10
 
10
11
  import type {CallFrame, ScopeChainEntry} from './DebuggerModel.js';
11
12
  import type {SourceMap} from './SourceMap.js';
@@ -120,6 +121,24 @@ export class SourceMapScopesInfo {
120
121
  return false;
121
122
  }
122
123
 
124
+ /**
125
+ * @returns true, iff the range surrounding the provided position contains multiple
126
+ * inlined original functions.
127
+ */
128
+ hasInlinedFrames(generatedLine: number, generatedColumn: number): boolean {
129
+ const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
130
+ for (let i = rangeChain.length - 1; i >= 0; --i) {
131
+ if (rangeChain[i].isStackFrame) {
132
+ // We stop looking for inlined original functions once we reach the current frame.
133
+ return false;
134
+ }
135
+ if (rangeChain[i].callSite) {
136
+ return true;
137
+ }
138
+ }
139
+ return false;
140
+ }
141
+
123
142
  /**
124
143
  * Given a generated position, returns the original name of the surrounding function as well as
125
144
  * all the original function names that got inlined into the surrounding generated function and their
@@ -142,7 +161,10 @@ export class SourceMapScopesInfo {
142
161
 
143
162
  if (range.callSite) {
144
163
  // Record the name and call-site if the range corresponds to an inlined function.
145
- result.inlinedFunctions.push({name: range.originalScope?.name ?? '', callsite: range.callSite});
164
+ result.inlinedFunctions.push({
165
+ name: range.originalScope?.name ?? '',
166
+ callsite: {...range.callSite, sourceURL: this.#sourceMap.sourceURLForSourceIndex(range.callSite.sourceIndex)}
167
+ });
146
168
  }
147
169
  if (range.isStackFrame) {
148
170
  // We arrived at an actual generated JS function, don't go further.
@@ -394,7 +416,15 @@ export class SourceMapScopesInfo {
394
416
  * The inlined functions are sorted from inner to outer (or top to bottom on the stack).
395
417
  */
396
418
  export interface InlineInfo {
397
- inlinedFunctions: Array<{name: string, callsite: ScopesCodec.OriginalPosition}>;
419
+ inlinedFunctions: Array<{
420
+ name: string,
421
+ callsite: {
422
+ line: number,
423
+ column: number,
424
+ sourceIndex: number,
425
+ sourceURL?: Platform.DevToolsPath.UrlString,
426
+ },
427
+ }>;
398
428
  originalFunctionName: string;
399
429
  }
400
430
 
@@ -54,7 +54,7 @@ import * as Logs from '../../models/logs/logs.js';
54
54
  import * as Persistence from '../../models/persistence/persistence.js';
55
55
  import * as ProjectSettings from '../../models/project_settings/project_settings.js';
56
56
  import * as Workspace from '../../models/workspace/workspace.js';
57
- import type * as PanelCommon from '../../panels/common/common.js';
57
+ import * as PanelCommon from '../../panels/common/common.js';
58
58
  import * as Snippets from '../../panels/snippets/snippets.js';
59
59
  import * as Buttons from '../../ui/components/buttons/buttons.js';
60
60
  import * as Snackbar from '../../ui/components/snackbars/snackbars.js';
@@ -120,6 +120,10 @@ const UIStrings = {
120
120
  * @description Text describing how to navigate the dock side menu
121
121
  */
122
122
  dockSideNavigation: 'Use left and right arrow keys to navigate the options',
123
+ /**
124
+ * @description Notification shown to the user whenever DevTools receives an external request.
125
+ */
126
+ externalRequestReceived: '`DevTools` received an external request',
123
127
  } as const;
124
128
  const str_ = i18n.i18n.registerUIStrings('entrypoints/main/MainImpl.ts', UIStrings);
125
129
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -476,11 +480,13 @@ export class MainImpl {
476
480
  isolatedFileSystemManager.addPlatformFileSystem(
477
481
  'snippet://' as Platform.DevToolsPath.UrlString, new Snippets.ScriptSnippetFileSystem.SnippetFileSystem());
478
482
 
479
- Persistence.Persistence.PersistenceImpl.instance({
483
+ const persistenceImpl = Persistence.Persistence.PersistenceImpl.instance({
480
484
  forceNew: true,
481
485
  workspace: Workspace.Workspace.WorkspaceImpl.instance(),
482
486
  breakpointManager: Breakpoints.BreakpointManager.BreakpointManager.instance(),
483
487
  });
488
+ const linkDecorator = new PanelCommon.PersistenceUtils.LinkDecorator(persistenceImpl);
489
+ Components.Linkifier.Linkifier.setLinkDecorator(linkDecorator);
484
490
  Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance(
485
491
  {forceNew: true, workspace: Workspace.Workspace.WorkspaceImpl.instance()});
486
492
 
@@ -541,6 +547,14 @@ export class MainImpl {
541
547
  });
542
548
  }
543
549
 
550
+ const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
551
+ conversationHandler.addEventListener(
552
+ AiAssistanceModel.ConversationHandler.ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED,
553
+ () => Snackbar.Snackbar.Snackbar.show({message: i18nString(UIStrings.externalRequestReceived)}));
554
+ conversationHandler.addEventListener(
555
+ AiAssistanceModel.ConversationHandler.ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED,
556
+ event => void VisualLogging.logFunctionCall(`start-conversation-${event.data}`, 'external'));
557
+
544
558
  MainImpl.timeEnd('Main._createAppUI');
545
559
 
546
560
  const appProvider = Common.AppProvider.getRegisteredAppProviders()[0];
@@ -570,7 +584,12 @@ export class MainImpl {
570
584
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
571
585
  Host.InspectorFrontendHostAPI.Events.RevealSourceLine, this.#revealSourceLine, this);
572
586
 
573
- await UI.InspectorView.InspectorView.instance().createToolbars();
587
+ const inspectorView = UI.InspectorView.InspectorView.instance();
588
+ Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance().addEventListener(
589
+ Persistence.NetworkPersistenceManager.Events.LOCAL_OVERRIDES_REQUESTED, event => {
590
+ inspectorView.displaySelectOverrideFolderInfobar(event.data);
591
+ });
592
+ await inspectorView.createToolbars();
574
593
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.loadCompleted();
575
594
 
576
595
  // Initialize elements for the live announcer functionality for a11y.
@@ -1100,7 +1119,7 @@ export async function handleExternalRequestGenerator(input: ExternalRequestInput
1100
1119
  }
1101
1120
  case 'NETWORK_DEBUGGER': {
1102
1121
  const AiAssistanceModel = await import('../../models/ai_assistance/ai_assistance.js');
1103
- const conversationHandler = await AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
1122
+ const conversationHandler = AiAssistanceModel.ConversationHandler.ConversationHandler.instance();
1104
1123
  return await conversationHandler.handleExternalRequest({
1105
1124
  conversationType: AiAssistanceModel.AiHistoryStorage.ConversationType.NETWORK,
1106
1125
  prompt: input.args.prompt,
@@ -4375,6 +4375,7 @@ export const generatedProperties = [
4375
4375
  "capitalize",
4376
4376
  "uppercase",
4377
4377
  "lowercase",
4378
+ "full-width",
4378
4379
  "none",
4379
4380
  "math-auto"
4380
4381
  ],
@@ -6803,6 +6804,7 @@ export const generatedPropertyValues = {
6803
6804
  "capitalize",
6804
6805
  "uppercase",
6805
6806
  "lowercase",
6807
+ "full-width",
6806
6808
  "none",
6807
6809
  "math-auto"
6808
6810
  ]
@@ -22,7 +22,7 @@ const RESPONSE_SCHEMA = {
22
22
  additionalProperties: false,
23
23
  };
24
24
 
25
- interface LanguageModel {
25
+ export interface LanguageModel {
26
26
  promptStreaming: (arg0: string, opts?: {
27
27
  responseConstraint: Object,
28
28
  signal?: AbortSignal,
@@ -8,8 +8,6 @@ import * as i18n from '../../core/i18n/i18n.js';
8
8
  import * as Platform from '../../core/platform/platform.js';
9
9
  import * as Root from '../../core/root/root.js';
10
10
  import * as SDK from '../../core/sdk/sdk.js';
11
- import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
12
- import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
13
11
  import * as NetworkTimeCalculator from '../network_time_calculator/network_time_calculator.js';
14
12
 
15
13
  import {
@@ -55,13 +53,6 @@ export interface ExternalPerformanceRequestParameters {
55
53
  data: ExternalPerformanceAIConversationData;
56
54
  }
57
55
 
58
- const UIStrings = {
59
- /**
60
- * @description Notification shown to the user whenever DevTools receives an external request.
61
- */
62
- externalRequestReceived: '`DevTools` received an external request',
63
- } as const;
64
-
65
56
  /*
66
57
  * Strings that don't need to be translated at this time.
67
58
  */
@@ -72,8 +63,6 @@ const UIStringsNotTranslate = {
72
63
  enableInSettings: 'For AI features to be available, you need to enable AI assistance in DevTools settings.',
73
64
  } as const;
74
65
 
75
- const str_ = i18n.i18n.registerUIStrings('models/ai_assistance/ConversationHandler.ts', UIStrings);
76
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
77
66
  const lockedString = i18n.i18n.lockedString;
78
67
 
79
68
  function isAiAssistanceServerSideLoggingEnabled(): boolean {
@@ -124,13 +113,14 @@ async function inspectNetworkRequestByUrl(selector: string): Promise<SDK.Network
124
113
 
125
114
  let conversationHandlerInstance: ConversationHandler|undefined;
126
115
 
127
- export class ConversationHandler {
116
+ export class ConversationHandler extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
128
117
  #aiAssistanceEnabledSetting: Common.Settings.Setting<boolean>|undefined;
129
118
  #aidaClient: Host.AidaClient.AidaClient;
130
119
  #aidaAvailability?: Host.AidaClient.AidaAccessPreconditions;
131
120
 
132
121
  private constructor(
133
122
  aidaClient: Host.AidaClient.AidaClient, aidaAvailability?: Host.AidaClient.AidaAccessPreconditions) {
123
+ super();
134
124
  this.#aidaClient = aidaClient;
135
125
  if (aidaAvailability) {
136
126
  this.#aidaAvailability = aidaAvailability;
@@ -186,7 +176,7 @@ export class ConversationHandler {
186
176
  ExternalPerformanceRequestParameters,
187
177
  ): Promise<AsyncGenerator<ExternalRequestResponse, ExternalRequestResponse>> {
188
178
  try {
189
- Snackbars.Snackbar.Snackbar.show({message: i18nString(UIStrings.externalRequestReceived)});
179
+ this.dispatchEventToListeners(ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED);
190
180
  const disabledReasons = await this.#getDisabledReasons();
191
181
  const aiAssistanceSetting = this.#aiAssistanceEnabledSetting?.getIfNotDisabled();
192
182
  if (!aiAssistanceSetting) {
@@ -196,7 +186,8 @@ export class ConversationHandler {
196
186
  return this.#generateErrorResponse(disabledReasons.join(' '));
197
187
  }
198
188
 
199
- void VisualLogging.logFunctionCall(`start-conversation-${parameters.conversationType}`, 'external');
189
+ this.dispatchEventToListeners(
190
+ ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED, parameters.conversationType);
200
191
  switch (parameters.conversationType) {
201
192
  case ConversationType.STYLING: {
202
193
  return await this.#handleExternalStylingConversation(parameters.prompt, parameters.selector);
@@ -356,3 +347,13 @@ export class ConversationHandler {
356
347
  return agent;
357
348
  }
358
349
  }
350
+
351
+ export const enum ConversationHandlerEvents {
352
+ EXTERNAL_REQUEST_RECEIVED = 'ExternalRequestReceived',
353
+ EXTERNAL_CONVERSATION_STARTED = 'ExternalConversationStarted',
354
+ }
355
+
356
+ export interface EventTypes {
357
+ [ConversationHandlerEvents.EXTERNAL_REQUEST_RECEIVED]: void;
358
+ [ConversationHandlerEvents.EXTERNAL_CONVERSATION_STARTED]: ConversationType;
359
+ }
@@ -8439,6 +8439,14 @@ export const NativeFunctions = [
8439
8439
  name: "sendPackets",
8440
8440
  signatures: [["packets"]]
8441
8441
  },
8442
+ {
8443
+ name: "addRemoteCandidate",
8444
+ signatures: [["candidate"]]
8445
+ },
8446
+ {
8447
+ name: "setRemoteDtlsParameters",
8448
+ signatures: [["params"]]
8449
+ },
8442
8450
  {
8443
8451
  name: "revoke",
8444
8452
  signatures: [["permission"]]
@@ -7,9 +7,6 @@ import * as Host from '../../core/host/host.js';
7
7
  import * as Platform from '../../core/platform/platform.js';
8
8
  import * as SDK from '../../core/sdk/sdk.js';
9
9
  import * as Protocol from '../../generated/protocol.js';
10
- // TODO(crbug.com/442509324): remove UI dependency
11
- // eslint-disable-next-line rulesdir/no-imports-in-directory
12
- import * as UI from '../../ui/legacy/legacy.js';
13
10
  import * as Breakpoints from '../breakpoints/breakpoints.js';
14
11
  import * as TextUtils from '../text_utils/text_utils.js';
15
12
  import * as Workspace from '../workspace/workspace.js';
@@ -400,8 +397,7 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
400
397
  // No overrides folder, set it up
401
398
  if (this.#shouldPromptSaveForOverridesDialog(uiSourceCode)) {
402
399
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.OverrideContentContextMenuSetup);
403
- await new Promise<void>(
404
- resolve => UI.InspectorView.InspectorView.instance().displaySelectOverrideFolderInfobar(resolve));
400
+ await new Promise<void>(resolve => this.dispatchEventToListeners(Events.LOCAL_OVERRIDES_REQUESTED, resolve));
405
401
  await IsolatedFileSystemManager.instance().addFileSystem('overrides');
406
402
  }
407
403
 
@@ -980,12 +976,14 @@ export const enum Events {
980
976
  PROJECT_CHANGED = 'ProjectChanged',
981
977
  REQUEST_FOR_HEADER_OVERRIDES_FILE_CHANGED = 'RequestsForHeaderOverridesFileChanged',
982
978
  LOCAL_OVERRIDES_PROJECT_UPDATED = 'LocalOverridesProjectUpdated',
979
+ LOCAL_OVERRIDES_REQUESTED = 'LocalOverridesRequested',
983
980
  }
984
981
 
985
982
  export interface EventTypes {
986
983
  [Events.PROJECT_CHANGED]: Workspace.Workspace.Project|null;
987
984
  [Events.REQUEST_FOR_HEADER_OVERRIDES_FILE_CHANGED]: Workspace.UISourceCode.UISourceCode;
988
985
  [Events.LOCAL_OVERRIDES_PROJECT_UPDATED]: boolean;
986
+ [Events.LOCAL_OVERRIDES_REQUESTED]: () => void;
989
987
  }
990
988
 
991
989
  export interface HeaderOverride {
@@ -6,14 +6,12 @@ import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
7
  import * as Platform from '../../core/platform/platform.js';
8
8
  import * as SDK from '../../core/sdk/sdk.js';
9
- import * as Components from '../../ui/legacy/components/utils/utils.js';
10
9
  import * as Bindings from '../bindings/bindings.js';
11
10
  import * as BreakpointManager from '../breakpoints/breakpoints.js';
12
11
  import * as TextUtils from '../text_utils/text_utils.js';
13
12
  import * as Workspace from '../workspace/workspace.js';
14
13
 
15
14
  import {Automapping, type AutomappingStatus} from './Automapping.js';
16
- import {LinkDecorator} from './PersistenceUtils.js';
17
15
 
18
16
  let persistenceInstance: PersistenceImpl;
19
17
 
@@ -33,9 +31,6 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
33
31
  this.#breakpointManager = breakpointManager;
34
32
  this.#breakpointManager.addUpdateBindingsCallback(this.#setupBindings.bind(this));
35
33
 
36
- const linkDecorator = new LinkDecorator(this);
37
- Components.Linkifier.Linkifier.setLinkDecorator(linkDecorator);
38
-
39
34
  this.#mapping = new Automapping(this.#workspace, this.onStatusAdded.bind(this), this.onStatusRemoved.bind(this));
40
35
  }
41
36
 
@@ -4,13 +4,6 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as i18n from '../../core/i18n/i18n.js';
7
- import * as SDK from '../../core/sdk/sdk.js';
8
- import * as Workspace from '../../models/workspace/workspace.js';
9
- // TODO(crbug.com/442509324): remove UI dependency
10
- // eslint-disable-next-line rulesdir/no-imports-in-directory
11
- import * as UI from '../../ui/legacy/legacy.js';
12
-
13
- import type * as Persistence from './persistence.js';
14
7
 
15
8
  const UIStrings = {
16
9
  /**
@@ -50,15 +43,6 @@ const UIStrings = {
50
43
  const str_ = i18n.i18n.registerUIStrings('models/persistence/persistence-meta.ts', UIStrings);
51
44
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
52
45
 
53
- let loadedPersistenceModule: (typeof Persistence|undefined);
54
-
55
- async function loadPersistenceModule(): Promise<typeof Persistence> {
56
- if (!loadedPersistenceModule) {
57
- loadedPersistenceModule = await import('./persistence.js');
58
- }
59
- return loadedPersistenceModule;
60
- }
61
-
62
46
  Common.Settings.registerSettingExtension({
63
47
  category: Common.Settings.SettingCategory.PERSISTENCE,
64
48
  title: i18nLazyString(UIStrings.enableLocalOverrides),
@@ -83,18 +67,3 @@ Common.Settings.registerSettingExtension({
83
67
  },
84
68
  ],
85
69
  });
86
-
87
- UI.ContextMenu.registerProvider({
88
- contextTypes() {
89
- return [
90
- Workspace.UISourceCode.UISourceCode,
91
- SDK.Resource.Resource,
92
- SDK.NetworkRequest.NetworkRequest,
93
- ];
94
- },
95
- async loadProvider() {
96
- const Persistence = await loadPersistenceModule();
97
- return new Persistence.PersistenceActions.ContextMenuProvider();
98
- },
99
- experiment: undefined,
100
- });
@@ -5,27 +5,21 @@
5
5
  import * as Automapping from './Automapping.js';
6
6
  import * as AutomaticFileSystemManager from './AutomaticFileSystemManager.js';
7
7
  import * as AutomaticFileSystemWorkspaceBinding from './AutomaticFileSystemWorkspaceBinding.js';
8
- import * as EditFileSystemView from './EditFileSystemView.js';
9
8
  import * as FileSystemWorkspaceBinding from './FileSystemWorkspaceBinding.js';
10
9
  import * as IsolatedFileSystem from './IsolatedFileSystem.js';
11
10
  import * as IsolatedFileSystemManager from './IsolatedFileSystemManager.js';
12
11
  import * as NetworkPersistenceManager from './NetworkPersistenceManager.js';
13
- import * as PersistenceActions from './PersistenceActions.js';
14
12
  import * as Persistence from './PersistenceImpl.js';
15
- import * as PersistenceUtils from './PersistenceUtils.js';
16
13
  import * as PlatformFileSystem from './PlatformFileSystem.js';
17
14
 
18
15
  export {
19
16
  Automapping,
20
17
  AutomaticFileSystemManager,
21
18
  AutomaticFileSystemWorkspaceBinding,
22
- EditFileSystemView,
23
19
  FileSystemWorkspaceBinding,
24
20
  IsolatedFileSystem,
25
21
  IsolatedFileSystemManager,
26
22
  NetworkPersistenceManager,
27
23
  Persistence,
28
- PersistenceActions,
29
- PersistenceUtils,
30
24
  PlatformFileSystem,
31
25
  };