chrome-devtools-frontend 1.0.1529904 → 1.0.1531367

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 (131) hide show
  1. package/eslint.config.mjs +1 -1
  2. package/front_end/core/common/Worker.ts +10 -2
  3. package/front_end/core/host/AidaClient.ts +3 -3
  4. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -2
  5. package/front_end/core/sdk/NetworkManager.ts +180 -42
  6. package/front_end/core/sdk/SourceMap.ts +6 -1
  7. package/front_end/core/sdk/SourceMapScopesInfo.ts +73 -7
  8. package/front_end/entrypoints/main/main-meta.ts +2 -0
  9. package/front_end/entrypoints/trace_app/trace_app.ts +1 -0
  10. package/front_end/generated/SupportedCSSProperties.js +7 -0
  11. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatterBounds.snapshot.txt +4 -0
  12. package/front_end/models/ai_assistance/performance/AICallTree.ts +2 -3
  13. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +3 -3
  14. package/front_end/models/bindings/CompilerScriptMapping.ts +16 -14
  15. package/front_end/models/formatter/FormatterWorkerPool.ts +17 -1
  16. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -2
  17. package/front_end/models/trace/ModelImpl.ts +8 -3
  18. package/front_end/models/trace/handlers/MetaHandler.ts +9 -1
  19. package/front_end/models/trace/types/Configuration.ts +1 -0
  20. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
  21. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +2 -1
  22. package/front_end/panels/changes/CombinedDiffView.ts +1 -2
  23. package/front_end/panels/console/ConsoleInsightTeaser.ts +120 -59
  24. package/front_end/panels/console/ConsolePrompt.ts +1 -1
  25. package/front_end/panels/console/ConsoleSidebar.ts +3 -3
  26. package/front_end/panels/console/ConsoleViewMessage.ts +7 -5
  27. package/front_end/panels/console/consoleInsightTeaser.css +0 -4
  28. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -2
  29. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +137 -37
  30. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +1 -1
  31. package/front_end/panels/network/BlockedURLsPane.ts +30 -6
  32. package/front_end/panels/network/NetworkLogView.ts +135 -33
  33. package/front_end/panels/network/blockedURLsPane.css +5 -0
  34. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +1 -1
  35. package/front_end/panels/sources/SourcesPanel.ts +5 -0
  36. package/front_end/panels/sources/sources-meta.ts +14 -12
  37. package/front_end/panels/sources/sourcesView.css +1 -0
  38. package/front_end/panels/timeline/TimelinePanel.ts +1 -0
  39. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +1 -2
  40. package/front_end/panels/timeline/TimelineTreeView.ts +3 -3
  41. package/front_end/panels/timeline/TimelineUIUtils.ts +16 -16
  42. package/front_end/services/tracing/FreshRecording.ts +4 -0
  43. package/front_end/third_party/chromium/README.chromium +1 -1
  44. package/front_end/third_party/puppeteer/README.chromium +2 -2
  45. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  46. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +16 -0
  47. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  48. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +2 -2
  49. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  50. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +9 -4
  51. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  52. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  53. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js +2 -2
  54. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
  55. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +7 -0
  56. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  57. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js +1 -1
  58. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js.map +1 -1
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +12 -5
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +1 -1
  64. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  65. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  66. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  67. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  69. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +7 -0
  70. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts.map +1 -0
  71. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +13 -0
  72. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js.map +1 -0
  73. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +7 -0
  74. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +40 -14
  75. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +16 -0
  76. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  77. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +2 -2
  78. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  79. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +9 -4
  80. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  81. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js +2 -2
  83. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +7 -0
  85. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  86. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js.map +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +12 -5
  90. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  94. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  95. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +7 -0
  97. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts.map +1 -0
  98. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +10 -0
  99. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js.map +1 -0
  100. package/front_end/third_party/puppeteer/package/lib/types.d.ts +7 -0
  101. package/front_end/third_party/puppeteer/package/package.json +4 -4
  102. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +18 -0
  103. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +9 -1
  104. package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +2 -0
  105. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +8 -0
  106. package/front_end/third_party/puppeteer/package/src/common/util.ts +1 -1
  107. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +16 -5
  108. package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +1 -1
  109. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  110. package/front_end/third_party/puppeteer/package/src/util/version.ts +10 -0
  111. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -1
  112. package/front_end/ui/components/icon_button/Icon.docs.ts +78 -0
  113. package/front_end/ui/components/markdown_view/CodeBlock.ts +2 -2
  114. package/front_end/ui/components/text_editor/config.ts +3 -3
  115. package/front_end/ui/components/tooltips/Tooltip.ts +9 -4
  116. package/front_end/ui/legacy/UIUtils.ts +12 -0
  117. package/front_end/ui/visual_logging/KnownContextValues.ts +6 -0
  118. package/package.json +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +0 -5
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts.map +0 -1
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +0 -8
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js.map +0 -1
  123. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +0 -5
  124. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts.map +0 -1
  125. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +0 -5
  126. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js.map +0 -1
  127. package/front_end/third_party/puppeteer/package/src/generated/version.ts +0 -4
  128. package/front_end/ui/components/copy_to_clipboard/copyToClipboard.ts +0 -19
  129. package/front_end/ui/components/copy_to_clipboard/copy_to_clipboard.ts +0 -5
  130. package/front_end/ui/components/docs/icon_component/basic.html +0 -40
  131. package/front_end/ui/components/docs/icon_component/basic.ts +0 -68
package/eslint.config.mjs CHANGED
@@ -810,7 +810,7 @@ export default defineConfig([
810
810
  },
811
811
  {
812
812
  name: 'Front-end component docs',
813
- files: ['front_end/ui/components/docs/**/*.ts'],
813
+ files: ['front_end/ui/components/docs/**/*.ts', '**/*.docs.ts'],
814
814
  rules: {
815
815
  // This makes the component doc examples very verbose and doesn't add
816
816
  // anything, so we leave return types to the developer within the
@@ -5,10 +5,15 @@
5
5
  export class WorkerWrapper {
6
6
  readonly #workerPromise: Promise<Worker>;
7
7
  #disposed?: boolean;
8
+ #rejectWorkerPromise?: (error: Error) => void;
8
9
 
9
10
  private constructor(workerLocation: URL) {
10
- this.#workerPromise = new Promise(fulfill => {
11
+ this.#workerPromise = new Promise((fulfill, reject) => {
12
+ this.#rejectWorkerPromise = reject;
11
13
  const worker = new Worker(workerLocation, {type: 'module'});
14
+ worker.onerror = event => {
15
+ console.error(`Failed to load worker for ${workerLocation.href}:`, event);
16
+ };
12
17
  worker.onmessage = (event: MessageEvent<unknown>) => {
13
18
  console.assert(event.data === 'workerReady');
14
19
  worker.onmessage = null;
@@ -34,7 +39,10 @@ export class WorkerWrapper {
34
39
  void this.#workerPromise.then(worker => worker.terminate());
35
40
  }
36
41
 
37
- terminate(): void {
42
+ terminate(immediately = false): void {
43
+ if (immediately) {
44
+ this.#rejectWorkerPromise?.(new Error('Worker terminated'));
45
+ }
38
46
  this.dispose();
39
47
  }
40
48
 
@@ -279,7 +279,7 @@ export interface DoConversationClientEvent {
279
279
 
280
280
  export interface UserImpression {
281
281
  sample: {
282
- sample_id: number,
282
+ sample_id?: number,
283
283
  };
284
284
  latency: {
285
285
  duration: {
@@ -291,7 +291,7 @@ export interface UserImpression {
291
291
 
292
292
  export interface UserAcceptance {
293
293
  sample: {
294
- sample_id: number,
294
+ sample_id?: number,
295
295
  };
296
296
  }
297
297
 
@@ -366,7 +366,7 @@ export interface CompletionResponse {
366
366
  export interface GenerationSample {
367
367
  generationString: string;
368
368
  score: number;
369
- sampleId: number;
369
+ sampleId?: number;
370
370
  attributionMetadata?: AttributionMetadata;
371
371
  }
372
372
 
@@ -346,8 +346,7 @@ export interface InspectorFrontendHostAPI {
346
346
  closeWindow(): void;
347
347
 
348
348
  /**
349
- * Don't use directly - use {@link CopyToClipboard.copyTextToClipboard} instead.
350
- * @deprecated Marked to restrict usage.
349
+ * If you need to alert to the user after copying use {@link UIUtils.copyTextToClipboard}.
351
350
  */
352
351
  copyText(text: string|null|undefined): void;
353
352
 
@@ -67,6 +67,10 @@ const UIStrings = {
67
67
  * @description Text in Network Manager representing the "Fast 4G" throttling preset
68
68
  */
69
69
  fast4G: 'Fast 4G',
70
+ /**
71
+ * @description Text in Network Manager representing the "Blocking" throttling preset
72
+ */
73
+ block: 'Block',
70
74
  /**
71
75
  * @description Text in Network Manager
72
76
  * @example {https://example.com} PH1
@@ -459,6 +463,12 @@ export interface EventTypes {
459
463
  * @see https://crbug.com/342406608#comment10 for context around the addition of 4G presets in June 2024.
460
464
  */
461
465
 
466
+ export const BlockingConditions: ThrottlingConditions = {
467
+ key: PredefinedThrottlingConditionKey.BLOCKING,
468
+ block: true,
469
+ title: i18nLazyString(UIStrings.block),
470
+ };
471
+
462
472
  export const NoThrottlingConditions: Conditions = {
463
473
  key: PredefinedThrottlingConditionKey.NO_THROTTLING,
464
474
  title: i18nLazyString(UIStrings.noThrottling),
@@ -521,7 +531,7 @@ export const Fast4GConditions: Conditions = {
521
531
  targetLatency: fast4GTargetLatency,
522
532
  };
523
533
 
524
- const MAX_EAGER_POST_REQUEST_BODY_LENGTH = 64 * 1024; // bytes
534
+ const MAX_EAGER_POST_REQUEST_BODY_LENGTH = 64 * 1024; // bytes
525
535
  const MAX_RESPONSE_BODY_TOTAL_BUFFER_LENGTH = 250 * 1024 * 1024; // bytes
526
536
 
527
537
  export class FetchDispatcher implements ProtocolProxyApi.FetchDispatcher {
@@ -1556,11 +1566,12 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
1556
1566
  }
1557
1567
  }
1558
1568
 
1559
- type RequestConditionsSetting = {
1569
+ export type RequestConditionsSetting = {
1560
1570
  url: string,
1561
1571
  enabled: boolean,
1562
1572
  }|{
1563
1573
  urlPattern: URLPatternConstructorString,
1574
+ conditions: ThrottlingConditionKey,
1564
1575
  enabled: boolean,
1565
1576
  };
1566
1577
 
@@ -1638,21 +1649,40 @@ export class RequestURLPattern {
1638
1649
  export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<RequestCondition.EventTypes> {
1639
1650
  #pattern: RequestURLPattern|{wildcardURL: string, upgradedPattern?: RequestURLPattern};
1640
1651
  #enabled: boolean;
1652
+ #conditions: ThrottlingConditions;
1641
1653
 
1642
- constructor(setting: RequestConditionsSetting) {
1643
- super();
1654
+ static createFromSetting(setting: RequestConditionsSetting): RequestCondition {
1644
1655
  if ('urlPattern' in setting) {
1645
- this.#pattern = RequestURLPattern.create(setting.urlPattern) ?? {
1656
+ const pattern = RequestURLPattern.create(setting.urlPattern) ?? {
1646
1657
  wildcardURL: setting.urlPattern,
1647
1658
  upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.urlPattern) ?? undefined,
1648
1659
  };
1649
- } else {
1650
- this.#pattern = {
1651
- wildcardURL: setting.url,
1652
- upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.url) ?? undefined
1653
- };
1660
+
1661
+ const conditions = getPredefinedOrBlockingCondition(setting.conditions) ??
1662
+ customUserNetworkConditionsSetting().get().find(condition => condition.key === setting.conditions) ??
1663
+ NoThrottlingConditions;
1664
+
1665
+ return new this(pattern, setting.enabled, conditions);
1654
1666
  }
1655
- this.#enabled = setting.enabled;
1667
+
1668
+ const pattern = {
1669
+ wildcardURL: setting.url,
1670
+ upgradedPattern: RequestURLPattern.upgradeFromWildcard(setting.url) ?? undefined
1671
+ };
1672
+ return new this(pattern, setting.enabled, BlockingConditions);
1673
+ }
1674
+
1675
+ static create(pattern: RequestURLPattern, conditions: ThrottlingConditions): RequestCondition {
1676
+ return new this(pattern, /* enabled=*/ true, conditions);
1677
+ }
1678
+
1679
+ private constructor(
1680
+ pattern: RequestURLPattern|{wildcardURL: string, upgradedPattern?: RequestURLPattern}, enabled: boolean,
1681
+ conditions: ThrottlingConditions) {
1682
+ super();
1683
+ this.#pattern = pattern;
1684
+ this.#enabled = enabled;
1685
+ this.#conditions = conditions;
1656
1686
  }
1657
1687
 
1658
1688
  get constructorString(): string|undefined {
@@ -1695,10 +1725,24 @@ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<Request
1695
1725
  this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1696
1726
  }
1697
1727
 
1728
+ get conditions(): ThrottlingConditions {
1729
+ return this.#conditions;
1730
+ }
1731
+
1732
+ set conditions(conditions: ThrottlingConditions) {
1733
+ this.#conditions = conditions;
1734
+ this.dispatchEventToListeners(RequestCondition.Events.REQUEST_CONDITION_CHANGED);
1735
+ }
1736
+
1698
1737
  toSetting(): RequestConditionsSetting {
1699
1738
  const enabled = this.enabled;
1700
- return this.#pattern instanceof RequestURLPattern ? {enabled, urlPattern: this.#pattern.constructorString} :
1701
- {enabled, url: this.#pattern.wildcardURL};
1739
+ if (this.#pattern instanceof RequestURLPattern) {
1740
+ return {enabled, urlPattern: this.#pattern.constructorString, conditions: this.#conditions.key};
1741
+ }
1742
+ if (this.#conditions !== BlockingConditions && this.#pattern.upgradedPattern) {
1743
+ return {enabled, urlPattern: this.#pattern.upgradedPattern.constructorString, conditions: this.#conditions.key};
1744
+ }
1745
+ return {enabled, url: this.#pattern.wildcardURL};
1702
1746
  }
1703
1747
 
1704
1748
  get originalOrUpgradedURLPattern(): URLPattern|undefined {
@@ -1719,20 +1763,41 @@ export namespace RequestCondition {
1719
1763
  export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<RequestConditions.EventTypes> {
1720
1764
  readonly #setting =
1721
1765
  Common.Settings.Settings.instance().createSetting<RequestConditionsSetting[]>('network-blocked-patterns', []);
1722
- readonly #conditions: RequestCondition[];
1766
+ readonly #conditionsEnabledSetting =
1767
+ Common.Settings.Settings.instance().moduleSetting<boolean>('request-blocking-enabled');
1768
+ readonly #conditions: RequestCondition[] = [];
1723
1769
 
1724
1770
  constructor() {
1725
1771
  super();
1726
- this.#conditions = this.#setting.get().map(condition => new RequestCondition(condition));
1772
+ for (const condition of this.#setting.get()) {
1773
+ try {
1774
+ this.#conditions.push(RequestCondition.createFromSetting(condition));
1775
+ } catch (e) {
1776
+ console.error('Error loading throttling settings: ', e);
1777
+ }
1778
+ }
1727
1779
  for (const condition of this.#conditions) {
1728
1780
  condition.addEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1729
1781
  }
1782
+ this.#conditionsEnabledSetting.addChangeListener(
1783
+ () => this.dispatchEventToListeners(RequestConditions.Events.REQUEST_CONDITIONS_CHANGED));
1730
1784
  }
1731
1785
 
1732
1786
  get count(): number {
1733
1787
  return this.#conditions.length;
1734
1788
  }
1735
1789
 
1790
+ get conditionsEnabled(): boolean {
1791
+ return this.#conditionsEnabledSetting.get();
1792
+ }
1793
+
1794
+ set conditionsEnabled(enabled: boolean) {
1795
+ if (this.#conditionsEnabledSetting.get() === enabled) {
1796
+ return;
1797
+ }
1798
+ this.#conditionsEnabledSetting.set(enabled);
1799
+ }
1800
+
1736
1801
  findCondition(pattern: string): RequestCondition|undefined {
1737
1802
  if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1738
1803
  return this.#conditions.find(condition => condition.constructorString === pattern);
@@ -1746,6 +1811,9 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1746
1811
 
1747
1812
  add(...conditions: RequestCondition[]): void {
1748
1813
  this.#conditions.push(...conditions);
1814
+ for (const condition of conditions) {
1815
+ condition.addEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1816
+ }
1749
1817
  this.#conditionsChanged();
1750
1818
  }
1751
1819
 
@@ -1755,7 +1823,7 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1755
1823
  return;
1756
1824
  }
1757
1825
  condition.removeEventListener(RequestCondition.Events.REQUEST_CONDITION_CHANGED, this.#conditionsChanged, this);
1758
- this.#conditions.splice(index);
1826
+ this.#conditions.splice(index, 1);
1759
1827
  this.#conditionsChanged();
1760
1828
  }
1761
1829
 
@@ -1776,18 +1844,69 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1776
1844
  return this.#conditions.values();
1777
1845
  }
1778
1846
 
1779
- applyConditions(...agents: ProtocolProxyApi.NetworkApi[]): boolean {
1847
+ applyConditions(offline: boolean, globalConditions: Conditions|null, ...agents: ProtocolProxyApi.NetworkApi[]):
1848
+ boolean {
1849
+ function isNonBlockingCondition(condition: ThrottlingConditions): condition is Conditions {
1850
+ return !('block' in condition);
1851
+ }
1780
1852
  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}));
1853
+ const urlPatterns: Protocol.Network.BlockPattern[] = [];
1854
+ const matchedNetworkConditions: Protocol.Network.NetworkConditions[] = [];
1855
+ if (this.conditionsEnabled) {
1856
+ for (const condition of this.#conditions) {
1857
+ const urlPattern = condition.constructorString;
1858
+ const conditions = condition.conditions;
1859
+ if (!condition.enabled || !urlPattern || conditions === NoThrottlingConditions) {
1860
+ continue;
1861
+ }
1862
+ const block = !isNonBlockingCondition(conditions);
1863
+ urlPatterns.push({urlPattern, block});
1864
+ if (!block) {
1865
+ matchedNetworkConditions.push({
1866
+ urlPattern,
1867
+ latency: conditions.latency,
1868
+ downloadThroughput: conditions.download < 0 ? 0 : conditions.download,
1869
+ uploadThroughput: conditions.upload < 0 ? 0 : conditions.upload,
1870
+ packetLoss: (conditions.packetLoss ?? 0) < 0 ? 0 : conditions.packetLoss,
1871
+ packetQueueLength: conditions.packetQueueLength,
1872
+ packetReordering: conditions.packetReordering,
1873
+ connectionType: NetworkManager.connectionType(conditions),
1874
+ });
1875
+ }
1876
+ }
1877
+
1878
+ if (globalConditions) {
1879
+ matchedNetworkConditions.push({
1880
+ urlPattern: '',
1881
+ latency: globalConditions.latency,
1882
+ downloadThroughput: globalConditions.download < 0 ? 0 : globalConditions.download,
1883
+ uploadThroughput: globalConditions.upload < 0 ? 0 : globalConditions.upload,
1884
+ packetLoss: (globalConditions.packetLoss ?? 0) < 0 ? 0 : globalConditions.packetLoss,
1885
+ packetQueueLength: globalConditions.packetQueueLength,
1886
+ packetReordering: globalConditions.packetReordering,
1887
+ connectionType: NetworkManager.connectionType(globalConditions),
1888
+ });
1889
+ }
1890
+ }
1783
1891
 
1784
1892
  for (const agent of agents) {
1785
1893
  void agent.invoke_setBlockedURLs({urlPatterns});
1894
+ void agent.invoke_emulateNetworkConditionsByRule({offline, matchedNetworkConditions});
1895
+ void agent.invoke_overrideNetworkState({
1896
+ offline,
1897
+ latency: globalConditions?.latency ?? 0,
1898
+ downloadThroughput: !globalConditions || globalConditions.download < 0 ? 0 : globalConditions.download,
1899
+ uploadThroughput: !globalConditions || globalConditions.upload < 0 ? 0 : globalConditions.upload,
1900
+ });
1786
1901
  }
1787
1902
  return urlPatterns.length > 0;
1788
1903
  }
1789
- const urls = this.#conditions.filter(condition => condition.enabled && condition.wildcardURL)
1790
- .map(condition => condition.wildcardURL as string);
1904
+
1905
+ const urls = this.conditionsEnabled ?
1906
+ this.#conditions.filter(condition => condition.enabled && condition.wildcardURL)
1907
+ .map(condition => condition.wildcardURL as string) :
1908
+ [];
1909
+
1791
1910
  for (const agent of agents) {
1792
1911
  void agent.invoke_setBlockedURLs({urls});
1793
1912
  }
@@ -1816,8 +1935,6 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1816
1935
  readonly inflightMainResourceRequests = new Map<string, NetworkRequest>();
1817
1936
  #networkConditions: Conditions = NoThrottlingConditions;
1818
1937
  #updatingInterceptionPatternsPromise: Promise<void>|null = null;
1819
- readonly #blockingEnabledSetting =
1820
- Common.Settings.Settings.instance().moduleSetting<boolean>('request-blocking-enabled');
1821
1938
  readonly #requestConditions = new RequestConditions();
1822
1939
  readonly #urlsForRequestInterceptor:
1823
1940
  Platform.MapUtilities.Multimap<(arg0: InterceptedRequest) => Promise<void>, InterceptionPattern> =
@@ -1834,7 +1951,6 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1834
1951
  this.updateBlockedPatterns();
1835
1952
  this.dispatchEventToListeners(MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED);
1836
1953
  };
1837
- this.#blockingEnabledSetting.addChangeListener(blockedPatternChanged);
1838
1954
  this.#requestConditions.addEventListener(
1839
1955
  RequestConditions.Events.REQUEST_CONDITIONS_CHANGED, blockedPatternChanged);
1840
1956
  this.updateBlockedPatterns();
@@ -1904,7 +2020,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1904
2020
  void networkAgent.invoke_setUserAgentOverride(
1905
2021
  {userAgent: this.currentUserAgent(), userAgentMetadata: this.#userAgentMetadataOverride || undefined});
1906
2022
  }
1907
- this.#requestConditions.applyConditions(networkAgent);
2023
+ this.#requestConditions.applyConditions(
2024
+ this.isOffline(), this.isThrottling() ? this.#networkConditions : null, networkAgent);
1908
2025
  if (this.isIntercepting()) {
1909
2026
  void fetchAgent.invoke_enable({patterns: this.#urlsForRequestInterceptor.valuesArray()});
1910
2027
  }
@@ -1915,7 +2032,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1915
2032
  }
1916
2033
  this.#networkAgents.add(networkAgent);
1917
2034
  this.#fetchAgents.add(fetchAgent);
1918
- if (this.isThrottling()) {
2035
+ if (this.isThrottling() && !Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1919
2036
  this.updateNetworkConditions(networkAgent);
1920
2037
  }
1921
2038
  }
@@ -1943,8 +2060,13 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1943
2060
 
1944
2061
  setNetworkConditions(conditions: Conditions): void {
1945
2062
  this.#networkConditions = conditions;
1946
- for (const agent of this.#networkAgents) {
1947
- this.updateNetworkConditions(agent);
2063
+ if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
2064
+ this.#requestConditions.applyConditions(
2065
+ this.isOffline(), this.isThrottling() ? this.#networkConditions : null, ...this.#networkAgents);
2066
+ } else {
2067
+ for (const agent of this.#networkAgents) {
2068
+ this.updateNetworkConditions(agent);
2069
+ }
1948
2070
  }
1949
2071
  this.dispatchEventToListeners(MultitargetNetworkManager.Events.CONDITIONS_CHANGED);
1950
2072
  }
@@ -2048,12 +2170,16 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
2048
2170
  return this.#requestConditions;
2049
2171
  }
2050
2172
 
2051
- blockingEnabled(): boolean {
2052
- return this.#blockingEnabledSetting.get();
2173
+ isBlocking(): boolean {
2174
+ return this.#isBlocking && this.requestConditions.conditionsEnabled;
2053
2175
  }
2054
2176
 
2055
- isBlocking(): boolean {
2056
- return this.#isBlocking && this.blockingEnabled();
2177
+ /**
2178
+ * @deprecated Kept for layout tests
2179
+ * TODO(pfaffe) remove
2180
+ */
2181
+ private setBlockingEnabled(enabled: boolean): void {
2182
+ this.requestConditions.conditionsEnabled = enabled;
2057
2183
  }
2058
2184
 
2059
2185
  /**
@@ -2062,18 +2188,12 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
2062
2188
  */
2063
2189
  private setBlockedPatterns(patterns: Array<{url: string, enabled: boolean}>): void {
2064
2190
  this.requestConditions.clear();
2065
- this.requestConditions.add(...patterns.map(pattern => new RequestCondition(pattern)));
2066
- }
2067
-
2068
- setBlockingEnabled(enabled: boolean): void {
2069
- if (this.#blockingEnabledSetting.get() === enabled) {
2070
- return;
2071
- }
2072
- this.#blockingEnabledSetting.set(enabled);
2191
+ this.requestConditions.add(...patterns.map(pattern => RequestCondition.createFromSetting(pattern)));
2073
2192
  }
2074
2193
 
2075
2194
  private updateBlockedPatterns(): void {
2076
- this.#isBlocking = this.#requestConditions.applyConditions(...this.#networkAgents);
2195
+ this.#isBlocking = this.#requestConditions.applyConditions(
2196
+ this.isOffline(), this.isThrottling() ? this.#networkConditions : null, ...this.#networkAgents);
2077
2197
  }
2078
2198
 
2079
2199
  isIntercepting(): boolean {
@@ -2466,7 +2586,15 @@ class ExtraInfoBuilder {
2466
2586
 
2467
2587
  SDKModel.register(NetworkManager, {capabilities: Capability.NETWORK, autostart: true});
2468
2588
 
2469
- export function networkConditionsEqual(first: Conditions, second: Conditions): boolean {
2589
+ export function networkConditionsEqual(first: ThrottlingConditions, second: ThrottlingConditions): boolean {
2590
+ if ('block' in first || 'block' in second) {
2591
+ if ('block' in first && 'block' in second) {
2592
+ const firstTitle = (typeof first.title === 'function' ? first.title() : first.title);
2593
+ const secondTitle = (typeof second.title === 'function' ? second.title() : second.title);
2594
+ return firstTitle === secondTitle && first.block === second.block;
2595
+ }
2596
+ return false;
2597
+ }
2470
2598
  // Caution: titles might be different function instances, which produce
2471
2599
  // the same value.
2472
2600
  // We prefer to use the i18nTitleKey to prevent against locale changes or
@@ -2493,6 +2621,7 @@ export function networkConditionsEqual(first: Conditions, second: Conditions): b
2493
2621
  * please talk to jacktfranklin@ first.
2494
2622
  */
2495
2623
  export const enum PredefinedThrottlingConditionKey {
2624
+ BLOCKING = 'BLOCKING',
2496
2625
  NO_THROTTLING = 'NO_THROTTLING',
2497
2626
  OFFLINE = 'OFFLINE',
2498
2627
  SPEED_3G = 'SPEED_3G',
@@ -2525,6 +2654,15 @@ export function getPredefinedCondition(key: ThrottlingConditionKey): Conditions|
2525
2654
  return THROTTLING_CONDITIONS_LOOKUP.get(key) ?? null;
2526
2655
  }
2527
2656
 
2657
+ export function getPredefinedOrBlockingCondition(key: ThrottlingConditionKey): ThrottlingConditions|null {
2658
+ return key === PredefinedThrottlingConditionKey.BLOCKING ? BlockingConditions : getPredefinedCondition(key);
2659
+ }
2660
+
2661
+ export type ThrottlingConditions = Conditions|{
2662
+ readonly key: ThrottlingConditionKey,
2663
+ block: true,
2664
+ title: string | (() => string),
2665
+ };
2528
2666
  export interface Conditions {
2529
2667
  readonly key: ThrottlingConditionKey;
2530
2668
  download: number;
@@ -12,7 +12,7 @@ import type {CallFrame, ScopeChainEntry} from './DebuggerModel.js';
12
12
  import {scopeTreeForScript} from './ScopeTreeCache.js';
13
13
  import type {Script} from './Script.js';
14
14
  import {buildOriginalScopes, decodePastaRanges, type NamedFunctionRange} from './SourceMapFunctionRanges.js';
15
- import {SourceMapScopesInfo} from './SourceMapScopesInfo.js';
15
+ import {SourceMapScopesInfo, type TranslatedFrame} from './SourceMapScopesInfo.js';
16
16
 
17
17
  /**
18
18
  * Type of the base source map JSON object, which contains the sources and the mappings at the very least, plus
@@ -789,6 +789,11 @@ export class SourceMap {
789
789
  this.#ensureSourceMapProcessed();
790
790
  return this.#scopesInfo?.hasInlinedFrames(generatedLine, generatedColumn) ?? false;
791
791
  }
792
+
793
+ translateCallSite(generatedLine: number, generatedColumn: number): TranslatedFrame[] {
794
+ this.#ensureSourceMapProcessed();
795
+ return this.#scopesInfo?.translateCallSite(generatedLine, generatedColumn) ?? [];
796
+ }
792
797
  }
793
798
 
794
799
  const VLQ_BASE_SHIFT = 5;
@@ -113,6 +113,10 @@ export class SourceMapScopesInfo {
113
113
  */
114
114
  isOutlinedFrame(generatedLine: number, generatedColumn: number): boolean {
115
115
  const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
116
+ return this.#isOutlinedFrame(rangeChain);
117
+ }
118
+
119
+ #isOutlinedFrame(rangeChain: ScopesCodec.GeneratedRange[]): boolean {
116
120
  for (let i = rangeChain.length - 1; i >= 0; --i) {
117
121
  if (rangeChain[i].isStackFrame) {
118
122
  return rangeChain[i].isHidden;
@@ -372,13 +376,7 @@ export class SourceMapScopesInfo {
372
376
  .at(-1);
373
377
  }
374
378
 
375
- // Walk the original scope chain outwards until we find a function.
376
- for (let originalScope = originalInnerMostScope; originalScope; originalScope = originalScope.parent) {
377
- if (originalScope.isStackFrame) {
378
- return originalScope.name ?? '';
379
- }
380
- }
381
- return null;
379
+ return this.#findFunctionNameInOriginalScopeChain(originalInnerMostScope) ?? null;
382
380
  }
383
381
 
384
382
  /**
@@ -404,6 +402,74 @@ export class SourceMapScopesInfo {
404
402
 
405
403
  return result;
406
404
  }
405
+
406
+ #findFunctionNameInOriginalScopeChain(innerOriginalScope: ScopesCodec.OriginalScope|undefined): string|null {
407
+ for (let originalScope = innerOriginalScope; originalScope; originalScope = originalScope.parent) {
408
+ if (originalScope.isStackFrame) {
409
+ return originalScope.name ?? '';
410
+ }
411
+ }
412
+ return null;
413
+ }
414
+
415
+ /**
416
+ * Returns one or more original stack frames for this single "raw frame" or call-site.
417
+ *
418
+ * @returns An empty array if no mapping at the call-site was found, or the resulting frames
419
+ * in top-to-bottom order in case of inlining.
420
+ * @throws If this range is marked "hidden". Outlining needs to be handled externally as
421
+ * outlined function segments in stack traces can span across bundles.
422
+ */
423
+ translateCallSite(generatedLine: number, generatedColumn: number): TranslatedFrame[] {
424
+ const rangeChain = this.#findGeneratedRangeChain(generatedLine, generatedColumn);
425
+ if (this.#isOutlinedFrame(rangeChain)) {
426
+ throw new Error('SourceMapScopesInfo is unable to translate an outlined function by itself');
427
+ }
428
+
429
+ const mapping = this.#sourceMap.findEntry(generatedLine, generatedColumn);
430
+ if (mapping?.sourceIndex === undefined) {
431
+ return [];
432
+ }
433
+
434
+ // The top-most frame is translated the same even if we have inlined functions.
435
+ const result: TranslatedFrame[] = [{
436
+ line: mapping.sourceLineNumber,
437
+ column: mapping.sourceColumnNumber,
438
+ name: this.findOriginalFunctionName({line: generatedLine, column: generatedColumn}) ?? undefined,
439
+ url: mapping.sourceURL,
440
+ }];
441
+
442
+ // Walk the range chain inside out until we find a generated function and for each inlined function add a frame.
443
+ for (let i = rangeChain.length - 1; i >= 0 && !rangeChain[i].isStackFrame; --i) {
444
+ const range = rangeChain[i];
445
+ if (!range.callSite) {
446
+ continue;
447
+ }
448
+
449
+ const originalScopeChain = this.#findOriginalScopeChain(range.callSite);
450
+ result.push({
451
+ line: range.callSite.line,
452
+ column: range.callSite.column,
453
+ name: this.#findFunctionNameInOriginalScopeChain(originalScopeChain.at(-1)) ?? undefined,
454
+ url: this.#sourceMap.sourceURLForSourceIndex(range.callSite.sourceIndex),
455
+ });
456
+ }
457
+
458
+ return result;
459
+ }
460
+ }
461
+
462
+ /**
463
+ * Represents a stack frame in original terms. It closely aligns with StackTrace.StackTrace.Frame,
464
+ * but since we can't import that type here we mirror it here somewhat.
465
+ *
466
+ * Equivalent to Pick<StackTrace.StackTrace.Frame, 'line'|'column'|'name'|'url'>.
467
+ */
468
+ export interface TranslatedFrame {
469
+ line: number;
470
+ column: number;
471
+ name?: string;
472
+ url?: Platform.DevToolsPath.UrlString;
407
473
  }
408
474
 
409
475
  /**
@@ -6,6 +6,7 @@ import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
7
  import * as i18n from '../../core/i18n/i18n.js';
8
8
  import type * as Platform from '../../core/platform/platform.js';
9
+ import * as Root from '../../core/root/root.js';
9
10
  import * as SDK from '../../core/sdk/sdk.js';
10
11
  import * as Workspace from '../../models/workspace/workspace.js';
11
12
  import * as Components from '../../ui/legacy/components/utils/utils.js';
@@ -935,6 +936,7 @@ UI.Toolbar.registerToolbarItem({
935
936
  });
936
937
 
937
938
  UI.Toolbar.registerToolbarItem({
939
+ condition: () => !Root.Runtime.Runtime.isTraceApp(),
938
940
  async loadItem() {
939
941
  const Main = await loadMainModule();
940
942
  return Main.MainImpl.MainMenuItem.instance();
@@ -18,6 +18,7 @@ import '../../panels/sources/sources-meta.js';
18
18
  // sdk/emulation depends on panels/sensors: crbug.com/1376652
19
19
  import '../../panels/sensors/sensors-meta.js';
20
20
  import '../../panels/timeline/timeline-meta.js';
21
+ import '../../panels/ai_assistance/ai_assistance-meta.js';
21
22
  import '../../ui/legacy/components/perf_ui/perf_ui-meta.js';
22
23
  import '../../ui/legacy/components/quick_open/quick_open-meta.js';
23
24
  import '../../ui/legacy/components/source_frame/source_frame-meta.js';
@@ -3773,6 +3773,13 @@ export const generatedProperties = [
3773
3773
  ],
3774
3774
  "name": "rule-color"
3775
3775
  },
3776
+ {
3777
+ "longhands": [
3778
+ "row-rule-outset",
3779
+ "column-rule-outset"
3780
+ ],
3781
+ "name": "rule-outset"
3782
+ },
3776
3783
  {
3777
3784
  "longhands": [
3778
3785
  "column-rule-style",
@@ -0,0 +1,4 @@
1
+ Title: PerformanceTraceFormatter serializeBounds works
2
+ Content:
3
+ {min: 1, max: 2}
4
+ === end content
@@ -2,7 +2,6 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Root from '../../../core/root/root.js';
6
5
  import * as Trace from '../../../models/trace/trace.js';
7
6
  import * as SourceMapsResolver from '../../../models/trace_source_maps_resolver/trace_source_maps_resolver.js';
8
7
 
@@ -144,7 +143,7 @@ export class AICallTree {
144
143
  return null;
145
144
  }
146
145
 
147
- const allEventsEnabled = Root.Runtime.experiments.isEnabled('timeline-show-all-events');
146
+ const showAllEvents = parsedTrace.data.Meta.config.showAllEvents;
148
147
  const {startTime, endTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(selectedEvent);
149
148
  const selectedEventBounds = Trace.Helpers.Timing.traceWindowFromMicroSeconds(
150
149
  Trace.Helpers.Timing.milliToMicro(startTime), Trace.Helpers.Timing.milliToMicro(endTime));
@@ -166,7 +165,7 @@ export class AICallTree {
166
165
  // If the "Show all events" experiment is on, we don't filter out any
167
166
  // events here, otherwise the generated call tree will not match what the
168
167
  // user is seeing.
169
- if (!allEventsEnabled) {
168
+ if (!showAllEvents) {
170
169
  filters.push(new Trace.Extras.TraceFilter.VisibleEventsFilter(Trace.Styles.visibleTypes()));
171
170
  }
172
171