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
@@ -6,14 +6,14 @@ import * as Common from '../../core/common/common.js';
6
6
  import * as i18n from '../../core/i18n/i18n.js';
7
7
  import * as Platform from '../../core/platform/platform.js';
8
8
  import * as SDK from '../../core/sdk/sdk.js';
9
- import * as Badges from '../../models/badges/badges.js';
9
+ import * as UI from '../../ui/legacy/legacy.js';
10
10
  import * as Lit from '../../ui/lit/lit.js';
11
11
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
12
12
 
13
13
  import {ThrottlingManager} from './ThrottlingManager.js';
14
- import {type NetworkThrottlingConditionsGroup, ThrottlingPresets} from './ThrottlingPresets.js';
14
+ import type {NetworkThrottlingConditionsGroup} from './ThrottlingPresets.js';
15
15
 
16
- const {render, html, Directives} = Lit;
16
+ const {render, html, Directives, nothing} = Lit;
17
17
 
18
18
  const UIStrings = {
19
19
  /**
@@ -28,6 +28,10 @@ const UIStrings = {
28
28
  * @description Text in Network Throttling Selector of the Network panel
29
29
  */
30
30
  custom: 'Custom',
31
+ /**
32
+ * @description Title for a network throttling group containing the request blocking option
33
+ */
34
+ blockingGroup: 'Blocking',
31
35
  /**
32
36
  *@description Text with two placeholders separated by a colon
33
37
  *@example {Node removed} PH1
@@ -54,26 +58,28 @@ const str_ = i18n.i18n.registerUIStrings('panels/mobile_throttling/NetworkThrott
54
58
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
55
59
 
56
60
  interface ViewInput {
57
- recommendedConditions: SDK.NetworkManager.Conditions|null;
58
- selectedConditions: SDK.NetworkManager.Conditions;
61
+ recommendedConditions: SDK.NetworkManager.ThrottlingConditions|null;
62
+ selectedConditions: SDK.NetworkManager.ThrottlingConditions|undefined;
59
63
  throttlingGroups: NetworkThrottlingConditionsGroup[];
60
64
  customConditionsGroup: NetworkThrottlingConditionsGroup;
61
- jslogContext: string;
62
- title: string;
63
- onSelect: (conditions: SDK.NetworkManager.Conditions) => void;
65
+ jslogContext: string|undefined;
66
+ title: string|undefined;
67
+ onSelect: (conditions: SDK.NetworkManager.ThrottlingConditions) => void;
64
68
  onAddCustomConditions: () => void;
65
69
  }
66
70
  export type ViewFunction = (input: ViewInput, output: object, target: HTMLElement) => void;
67
71
 
68
72
  export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
69
73
  // The title is usually an i18nLazyString except for custom values that are stored in the local storage in the form of a string.
70
- const title = (conditions: SDK.NetworkManager.Conditions): string =>
74
+ const title = (conditions: SDK.NetworkManager.ThrottlingConditions): string =>
71
75
  typeof conditions.title === 'function' ? conditions.title() : conditions.title;
72
- const jslog = (group: NetworkThrottlingConditionsGroup, condition: SDK.NetworkManager.Conditions): string =>
73
- `${VisualLogging.item(Platform.StringUtilities.toKebabCase(condition.i18nTitleKey || title(condition))).track({
74
- click: true
75
- })}`;
76
- const optionsMap = new WeakMap<HTMLOptionElement, SDK.NetworkManager.Conditions>();
76
+ const jslog = (group: NetworkThrottlingConditionsGroup, condition: SDK.NetworkManager.ThrottlingConditions): string =>
77
+ `${
78
+ VisualLogging
79
+ .item(Platform.StringUtilities.toKebabCase(
80
+ ('i18nTitleKey' in condition && condition.i18nTitleKey) || title(condition)))
81
+ .track({click: true})}`;
82
+ const optionsMap = new WeakMap<HTMLOptionElement, SDK.NetworkManager.ThrottlingConditions>();
77
83
  let selectedConditions = input.selectedConditions;
78
84
  function onSelect(event: Event): void {
79
85
  const element = (event.target as HTMLSelectElement | null);
@@ -87,7 +93,9 @@ export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
87
93
  if (option === element.options[element.options.length - 1]) {
88
94
  input.onAddCustomConditions();
89
95
  event.consume(true);
90
- element.value = title(selectedConditions);
96
+ if (selectedConditions) {
97
+ element.value = title(selectedConditions);
98
+ }
91
99
  } else {
92
100
  const conditions = optionsMap.get(option);
93
101
  if (conditions) {
@@ -96,10 +104,11 @@ export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
96
104
  }
97
105
  }
98
106
  }
107
+
99
108
  render(
100
109
  // clang-format off
101
110
  html`<select
102
- aria-label=${input.title}
111
+ aria-label=${input.title ?? nothing}
103
112
  jslog=${VisualLogging.dropDown().track({change: true}).context(input.jslogContext)}
104
113
  @change=${onSelect}>
105
114
  ${input.throttlingGroups.map(
@@ -108,7 +117,9 @@ export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
108
117
  label=${group.title}>
109
118
  ${group.items.map(condition => html`<option
110
119
  ${Directives.ref(option => option && optionsMap.set(option as HTMLOptionElement, condition))}
111
- ?selected=${SDK.NetworkManager.networkConditionsEqual(condition, selectedConditions)}
120
+ ?selected=${selectedConditions ?
121
+ SDK.NetworkManager.networkConditionsEqual(condition, selectedConditions) :
122
+ (group === input.throttlingGroups[0])}
112
123
  value=${title(condition)}
113
124
  aria-label=${i18nString(UIStrings.sS, {PH1: group.title, PH2: title(condition)})}
114
125
  jslog=${jslog(group, condition)}>
@@ -120,7 +131,7 @@ export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
120
131
  <optgroup label=${input.customConditionsGroup.title}>
121
132
  ${input.customConditionsGroup.items.map(condition => html`<option
122
133
  ${Directives.ref(option => option && optionsMap.set(option as HTMLOptionElement, condition))}
123
- ?selected=${SDK.NetworkManager.networkConditionsEqual(condition, selectedConditions)}
134
+ ?selected=${selectedConditions && SDK.NetworkManager.networkConditionsEqual(condition, selectedConditions)}
124
135
  value=${title(condition)}
125
136
  aria-label=${i18nString(UIStrings.sS, {PH1: input.customConditionsGroup.title, PH2: title(condition)})}
126
137
  jslog=${VisualLogging.item('custom-network-throttling-item').track({click: true})}>
@@ -144,25 +155,29 @@ export const enum Events {
144
155
  }
145
156
 
146
157
  export interface EventTypes {
147
- [Events.CONDITIONS_CHANGED]: SDK.NetworkManager.Conditions;
158
+ [Events.CONDITIONS_CHANGED]: SDK.NetworkManager.ThrottlingConditions;
148
159
  }
149
160
 
150
161
  export class NetworkThrottlingSelect extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
151
162
  #recommendedConditions: SDK.NetworkManager.Conditions|null = null;
152
163
  readonly #element: HTMLElement;
153
- readonly #jslogContext: string;
154
- #currentConditions: SDK.NetworkManager.Conditions;
155
- readonly #title: string;
164
+ #jslogContext?: string;
165
+ #currentConditions: SDK.NetworkManager.ThrottlingConditions|undefined;
166
+ readonly #title?: string;
156
167
  readonly #view: ViewFunction;
168
+ #variant: NetworkThrottlingSelect.Variant = NetworkThrottlingSelect.Variant.GLOBAL_CONDITIONS;
157
169
 
158
170
  static createForGlobalConditions(element: HTMLElement, title: string): NetworkThrottlingSelect {
159
171
  ThrottlingManager.instance(); // Instantiate the throttling manager to connect network manager with the setting
160
- const select = new NetworkThrottlingSelect(
161
- element, title, SDK.NetworkManager.activeNetworkThrottlingKeySetting().name,
162
- SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions());
172
+ const select = new NetworkThrottlingSelect(element, {
173
+ title,
174
+ jslogContext: SDK.NetworkManager.activeNetworkThrottlingKeySetting().name,
175
+ currentConditions: SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions()
176
+ });
163
177
  select.addEventListener(
164
178
  Events.CONDITIONS_CHANGED,
165
- ev => SDK.NetworkManager.MultitargetNetworkManager.instance().setNetworkConditions(ev.data));
179
+ ev => !('block' in ev.data) &&
180
+ SDK.NetworkManager.MultitargetNetworkManager.instance().setNetworkConditions(ev.data));
166
181
  SDK.NetworkManager.MultitargetNetworkManager.instance().addEventListener(
167
182
  SDK.NetworkManager.MultitargetNetworkManager.Events.CONDITIONS_CHANGED, () => {
168
183
  select.currentConditions = SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions();
@@ -171,29 +186,57 @@ export class NetworkThrottlingSelect extends Common.ObjectWrapper.ObjectWrapper<
171
186
  }
172
187
 
173
188
  constructor(
174
- element: HTMLElement, title: string, jslogContext: string, currentConditions: SDK.NetworkManager.Conditions,
189
+ element: HTMLElement, options: {
190
+ title?: string,
191
+ jslogContext?: string,
192
+ currentConditions?: SDK.NetworkManager.Conditions,
193
+ includeBlocking?: true,
194
+ } = {},
175
195
  view = DEFAULT_VIEW) {
176
196
  super();
177
197
  SDK.NetworkManager.customUserNetworkConditionsSetting().addChangeListener(this.#performUpdate, this);
178
198
  this.#element = element;
179
- this.#jslogContext = jslogContext;
180
- this.#currentConditions = currentConditions;
181
- this.#title = title;
199
+ this.#jslogContext = options.jslogContext;
200
+ this.#currentConditions = options.currentConditions;
201
+ this.#title = options.title;
182
202
  this.#view = view;
183
203
 
184
204
  this.#performUpdate();
185
205
  }
186
206
 
207
+ get recommendedConditions(): SDK.NetworkManager.Conditions|null {
208
+ return this.#recommendedConditions;
209
+ }
187
210
  set recommendedConditions(recommendedConditions: SDK.NetworkManager.Conditions|null) {
188
211
  this.#recommendedConditions = recommendedConditions;
189
212
  this.#performUpdate();
190
213
  }
191
214
 
192
- set currentConditions(currentConditions: SDK.NetworkManager.Conditions) {
215
+ get currentConditions(): SDK.NetworkManager.ThrottlingConditions|undefined {
216
+ return this.#currentConditions;
217
+ }
218
+ set currentConditions(currentConditions: SDK.NetworkManager.ThrottlingConditions|undefined) {
193
219
  this.#currentConditions = currentConditions;
194
220
  this.#performUpdate();
195
221
  }
196
222
 
223
+ get jslogContext(): string|undefined {
224
+ return this.#jslogContext;
225
+ }
226
+ set jslogContext(jslogContext: string|undefined) {
227
+ this.#jslogContext = jslogContext;
228
+ this.#performUpdate();
229
+ }
230
+
231
+ get variant(): NetworkThrottlingSelect.Variant {
232
+ return this.#variant;
233
+ }
234
+ set variant(variant: NetworkThrottlingSelect.Variant) {
235
+ this.#variant = variant;
236
+ this.#performUpdate();
237
+ }
238
+
239
+ // FIXME Should use requestUpdate once we merge this with the widget
197
240
  #performUpdate(): void {
198
241
  const customNetworkConditionsSetting = SDK.NetworkManager.customUserNetworkConditionsSetting();
199
242
  const customNetworkConditions = customNetworkConditionsSetting.get();
@@ -201,16 +244,41 @@ export class NetworkThrottlingSelect extends Common.ObjectWrapper.ObjectWrapper<
201
244
  void Common.Revealer.reveal(SDK.NetworkManager.customUserNetworkConditionsSetting());
202
245
  };
203
246
 
204
- const onSelect = (conditions: SDK.NetworkManager.Conditions): void => {
247
+ const onSelect = (conditions: SDK.NetworkManager.ThrottlingConditions): void => {
205
248
  this.dispatchEventToListeners(Events.CONDITIONS_CHANGED, conditions);
206
- Badges.UserBadges.instance().recordAction(Badges.BadgeAction.NETWORK_SPEED_THROTTLED);
207
249
  };
208
250
 
209
- const throttlingGroups = [
210
- {title: i18nString(UIStrings.disabled), items: [SDK.NetworkManager.NoThrottlingConditions]},
211
- {title: i18nString(UIStrings.presets), items: ThrottlingPresets.networkPresets},
212
- ];
251
+ const throttlingGroups: NetworkThrottlingConditionsGroup[] = [];
252
+
253
+ switch (this.#variant) {
254
+ case NetworkThrottlingSelect.Variant.GLOBAL_CONDITIONS:
255
+ throttlingGroups.push(
256
+ {title: i18nString(UIStrings.disabled), items: [SDK.NetworkManager.NoThrottlingConditions]}, {
257
+ title: i18nString(UIStrings.presets),
258
+ items: [
259
+ SDK.NetworkManager.Fast4GConditions,
260
+ SDK.NetworkManager.Slow4GConditions,
261
+ SDK.NetworkManager.Slow3GConditions,
262
+ SDK.NetworkManager.OfflineConditions,
263
+ ]
264
+ });
265
+ break;
266
+ case NetworkThrottlingSelect.Variant.INDIVIDUAL_REQUEST_CONDITIONS:
267
+ throttlingGroups.push(
268
+ {title: i18nString(UIStrings.blockingGroup), items: [SDK.NetworkManager.BlockingConditions]},
269
+ {
270
+ title: i18nString(UIStrings.presets),
271
+ items: [
272
+ SDK.NetworkManager.Fast4GConditions,
273
+ SDK.NetworkManager.Slow4GConditions,
274
+ SDK.NetworkManager.Slow3GConditions,
275
+ ]
276
+ },
277
+ );
278
+ break;
279
+ }
213
280
  const customConditionsGroup = {title: i18nString(UIStrings.custom), items: customNetworkConditions};
281
+
214
282
  const viewInput: ViewInput = {
215
283
  recommendedConditions: this.#recommendedConditions,
216
284
  selectedConditions: this.#currentConditions,
@@ -224,3 +292,35 @@ export class NetworkThrottlingSelect extends Common.ObjectWrapper.ObjectWrapper<
224
292
  this.#view(viewInput, {}, this.#element);
225
293
  }
226
294
  }
295
+ export namespace NetworkThrottlingSelect {
296
+ export const enum Variant {
297
+ GLOBAL_CONDITIONS = 'global-conditions',
298
+ INDIVIDUAL_REQUEST_CONDITIONS = 'individual-request-conditions',
299
+ }
300
+ }
301
+
302
+ export class NetworkThrottlingSelectorWidget extends UI.Widget.VBox {
303
+ #select: NetworkThrottlingSelect;
304
+ #conditionsChangedHandler?: ((conditions: SDK.NetworkManager.ThrottlingConditions) => void);
305
+ constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
306
+ super(element, {useShadowDom: true});
307
+ this.#select = new NetworkThrottlingSelect(this.contentElement, {}, view);
308
+ this.#select.addEventListener(Events.CONDITIONS_CHANGED, ({data}) => this.#conditionsChangedHandler?.(data));
309
+ }
310
+
311
+ set variant(variant: NetworkThrottlingSelect.Variant) {
312
+ this.#select.variant = variant;
313
+ }
314
+
315
+ set jslogContext(context: string) {
316
+ this.#select.jslogContext = context;
317
+ }
318
+
319
+ set currentConditions(currentConditions: SDK.NetworkManager.ThrottlingConditions|undefined) {
320
+ this.#select.currentConditions = currentConditions;
321
+ }
322
+
323
+ set onConditionsChanged(handler: (conditions: SDK.NetworkManager.ThrottlingConditions) => void) {
324
+ this.#conditionsChangedHandler = handler;
325
+ }
326
+ }
@@ -167,7 +167,7 @@ export interface Conditions {
167
167
 
168
168
  export interface NetworkThrottlingConditionsGroup {
169
169
  title: string;
170
- items: SDK.NetworkManager.Conditions[];
170
+ items: SDK.NetworkManager.ThrottlingConditions[];
171
171
  }
172
172
 
173
173
  export interface MobileThrottlingConditionsGroup {
@@ -17,6 +17,7 @@ import * as Buttons from '../../ui/components/buttons/buttons.js';
17
17
  import * as UI from '../../ui/legacy/legacy.js';
18
18
  import {Directives, html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
19
19
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
20
+ import * as MobileThrottling from '../mobile_throttling/mobile_throttling.js';
20
21
 
21
22
  import blockedURLsPaneStyles from './blockedURLsPane.css.js';
22
23
 
@@ -192,7 +193,7 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
192
193
  }
193
194
 
194
195
  override performUpdate(): void {
195
- const enabled = this.manager.blockingEnabled();
196
+ const enabled = this.manager.requestConditions.conditionsEnabled;
196
197
  this.list.element.classList.toggle('blocking-disabled', !enabled && Boolean(this.manager.requestConditions.count));
197
198
 
198
199
  const input: ViewInput = {
@@ -205,9 +206,11 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
205
206
  }
206
207
 
207
208
  addPattern(): void {
208
- this.manager.setBlockingEnabled(true);
209
+ this.manager.requestConditions.conditionsEnabled = true;
209
210
  this.list.addNewItem(
210
- 0, new SDK.NetworkManager.RequestCondition({url: Platform.DevToolsPath.EmptyUrlString, enabled: true}));
211
+ 0,
212
+ SDK.NetworkManager.RequestCondition.createFromSetting(
213
+ {url: Platform.DevToolsPath.EmptyUrlString, enabled: true}));
211
214
  }
212
215
 
213
216
  removeAllPatterns(): void {
@@ -224,6 +227,11 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
224
227
  condition.enabled = !condition.enabled;
225
228
  }
226
229
  };
230
+ const onConditionsChanged = (conditions: SDK.NetworkManager.ThrottlingConditions): void => {
231
+ if (editable) {
232
+ condition.conditions = conditions;
233
+ }
234
+ };
227
235
 
228
236
  const {enabled, originalOrUpgradedURLPattern, constructorStringOrWildcardURL, wildcardURL} = condition;
229
237
 
@@ -237,6 +245,17 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
237
245
  ?checked=${enabled}
238
246
  ?disabled=${!editable || !originalOrUpgradedURLPattern}
239
247
  .jslog=${VisualLogging.toggle().track({ change: true })}>
248
+ <devtools-widget
249
+ class=conditions-selector
250
+ ?disabled=${!editable}
251
+ .widgetConfig=${UI.Widget.widgetConfig(
252
+ MobileThrottling.NetworkThrottlingSelector.NetworkThrottlingSelectorWidget, {
253
+ variant:
254
+ MobileThrottling.NetworkThrottlingSelector.NetworkThrottlingSelect.Variant.INDIVIDUAL_REQUEST_CONDITIONS,
255
+ jslogContext: 'request-conditions',
256
+ onConditionsChanged,
257
+ currentConditions: condition.conditions,
258
+ })}></devtools-widget>
240
259
  ${originalOrUpgradedURLPattern ? html`
241
260
  <devtools-tooltip variant=rich jslogcontext=url-pattern id=url-pattern-${index}>
242
261
  <div>hash: ${originalOrUpgradedURLPattern.hash}</div>
@@ -267,7 +286,12 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
267
286
  : i18nString(UIStrings.patternFailedToParse)}
268
287
  ${learnMore()}
269
288
  </devtools-tooltip>`: nothing}
270
- <div @click=${toggle} class=blocked-url-label aria-details=url-pattern-${index}>${constructorStringOrWildcardURL}</div>
289
+ <div
290
+ @click=${toggle}
291
+ class=blocked-url-label
292
+ aria-details=url-pattern-${index}>
293
+ ${constructorStringOrWildcardURL}
294
+ </div>
271
295
  <div class=blocked-url-count>${i18nString(UIStrings.dBlocked, {PH1: count})}</div>`,
272
296
  // clang-format on
273
297
  element);
@@ -290,7 +314,7 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
290
314
  }
291
315
 
292
316
  private toggleEnabled(): void {
293
- this.manager.setBlockingEnabled(!this.manager.blockingEnabled());
317
+ this.manager.requestConditions.conditionsEnabled = !this.manager.requestConditions.conditionsEnabled;
294
318
  this.update();
295
319
  }
296
320
 
@@ -368,7 +392,7 @@ export class BlockedURLsPane extends UI.Widget.VBox implements
368
392
  }
369
393
 
370
394
  update(): void {
371
- const enabled = this.manager.blockingEnabled();
395
+ const enabled = this.manager.requestConditions.conditionsEnabled;
372
396
  this.list.clear();
373
397
  for (const pattern of this.manager.requestConditions.conditions) {
374
398
  if (Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled || pattern.wildcardURL) {
@@ -432,6 +432,27 @@ const UIStrings = {
432
432
  * @description A context menu item in the Network Log View of the Network panel
433
433
  */
434
434
  clearBrowserCookies: 'Clear browser cookies',
435
+ /**
436
+ * @description A context menu item in the Network Log View of the Network panel
437
+ */
438
+ throttleRequests: 'Throttle requests',
439
+ /**
440
+ * @description A context menu item in the Network Log View of the Network panel
441
+ */
442
+ throttleRequestUrl: 'Throttle request URL',
443
+ /**
444
+ * @description A context menu item in the Network Log View of the Network panel
445
+ * @example {example.com} PH1
446
+ */
447
+ unthrottleS: 'Stop throttling {PH1}',
448
+ /**
449
+ * @description A context menu item in the Network Log View of the Network panel
450
+ */
451
+ throttleRequestDomain: 'Throttle request domain',
452
+ /**
453
+ * @description A context menu item in the Network Log View of the Network panel
454
+ */
455
+ blockRequests: 'Block requests',
435
456
  /**
436
457
  * @description A context menu item in the Network Log View of the Network panel
437
458
  */
@@ -1849,43 +1870,124 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
1849
1870
  const maxBlockedURLLength = 20;
1850
1871
  const manager = SDK.NetworkManager.MultitargetNetworkManager.instance();
1851
1872
 
1852
- function addBlockedURL(url: string): void {
1853
- manager.requestConditions.add(
1854
- new SDK.NetworkManager.RequestCondition({enabled: true, url: url as Platform.DevToolsPath.UrlString}));
1855
- manager.setBlockingEnabled(true);
1856
- void UI.ViewManager.ViewManager.instance().showView('network.blocked-urls');
1857
- }
1873
+ if (!Root.Runtime.hostConfig.devToolsIndividualRequestThrottling?.enabled) {
1874
+ function addBlockedURL(url: string): void {
1875
+ manager.requestConditions.add(SDK.NetworkManager.RequestCondition.createFromSetting(
1876
+ {enabled: true, url: url as Platform.DevToolsPath.UrlString}));
1877
+ manager.requestConditions.conditionsEnabled = true;
1878
+ void UI.ViewManager.ViewManager.instance().showView('network.blocked-urls');
1879
+ }
1858
1880
 
1859
- function removeBlockedURL(url: string): void {
1860
- const entry = manager.requestConditions.findCondition(url);
1861
- if (entry) {
1862
- manager.requestConditions.delete(entry);
1881
+ function removeBlockedURL(url: string): void {
1882
+ const entry = manager.requestConditions.findCondition(url);
1883
+ if (entry) {
1884
+ manager.requestConditions.delete(entry);
1885
+ }
1886
+ void UI.ViewManager.ViewManager.instance().showView('network.blocked-urls');
1863
1887
  }
1864
- void UI.ViewManager.ViewManager.instance().showView('network.blocked-urls');
1865
- }
1866
1888
 
1867
- const urlWithoutScheme = request.parsedURL.urlWithoutScheme();
1868
- if (urlWithoutScheme && !manager.requestConditions.has(urlWithoutScheme)) {
1869
- contextMenu.debugSection().appendItem(
1870
- i18nString(UIStrings.blockRequestUrl), addBlockedURL.bind(null, urlWithoutScheme),
1871
- {jslogContext: 'block-request-url'});
1872
- } else if (urlWithoutScheme) {
1873
- const croppedURL = Platform.StringUtilities.trimMiddle(urlWithoutScheme, maxBlockedURLLength);
1874
- contextMenu.debugSection().appendItem(
1875
- i18nString(UIStrings.unblockS, {PH1: croppedURL}), removeBlockedURL.bind(null, urlWithoutScheme),
1876
- {jslogContext: 'unblock'});
1877
- }
1889
+ const urlWithoutScheme = request.parsedURL.urlWithoutScheme();
1890
+ if (urlWithoutScheme && !manager.requestConditions.has(urlWithoutScheme)) {
1891
+ contextMenu.debugSection().appendItem(
1892
+ i18nString(UIStrings.blockRequestUrl), addBlockedURL.bind(null, urlWithoutScheme),
1893
+ {jslogContext: 'block-request-url'});
1894
+ } else if (urlWithoutScheme) {
1895
+ const croppedURL = Platform.StringUtilities.trimMiddle(urlWithoutScheme, maxBlockedURLLength);
1896
+ contextMenu.debugSection().appendItem(
1897
+ i18nString(UIStrings.unblockS, {PH1: croppedURL}), removeBlockedURL.bind(null, urlWithoutScheme),
1898
+ {jslogContext: 'unblock'});
1899
+ }
1878
1900
 
1879
- const domain = request.parsedURL.domain();
1880
- if (domain && !manager.requestConditions.has(domain)) {
1881
- contextMenu.debugSection().appendItem(
1882
- i18nString(UIStrings.blockRequestDomain), addBlockedURL.bind(null, domain),
1883
- {jslogContext: 'block-request-domain'});
1884
- } else if (domain) {
1885
- const croppedDomain = Platform.StringUtilities.trimMiddle(domain, maxBlockedURLLength);
1886
- contextMenu.debugSection().appendItem(
1887
- i18nString(UIStrings.unblockS, {PH1: croppedDomain}), removeBlockedURL.bind(null, domain),
1888
- {jslogContext: 'unblock'});
1901
+ const domain = request.parsedURL.domain();
1902
+ if (domain && !manager.requestConditions.has(domain)) {
1903
+ contextMenu.debugSection().appendItem(
1904
+ i18nString(UIStrings.blockRequestDomain), addBlockedURL.bind(null, domain),
1905
+ {jslogContext: 'block-request-domain'});
1906
+ } else if (domain) {
1907
+ const croppedDomain = Platform.StringUtilities.trimMiddle(domain, maxBlockedURLLength);
1908
+ contextMenu.debugSection().appendItem(
1909
+ i18nString(UIStrings.unblockS, {PH1: croppedDomain}), removeBlockedURL.bind(null, domain),
1910
+ {jslogContext: 'unblock'});
1911
+ }
1912
+ } else {
1913
+ function removeRequestCondition(pattern: SDK.NetworkManager.RequestURLPattern): void {
1914
+ const entry = manager.requestConditions.findCondition(pattern.constructorString);
1915
+ if (entry) {
1916
+ manager.requestConditions.delete(entry);
1917
+ void UI.ViewManager.ViewManager.instance().showView('network.blocked-urls');
1918
+ }
1919
+ }
1920
+
1921
+ function addRequestCondition(
1922
+ pattern: SDK.NetworkManager.RequestURLPattern,
1923
+ conditions: SDK.NetworkManager.ThrottlingConditions,
1924
+ ): void {
1925
+ const entry = manager.requestConditions.findCondition(pattern.constructorString);
1926
+ if (entry) {
1927
+ entry.conditions = conditions;
1928
+ } else {
1929
+ manager.requestConditions.add(SDK.NetworkManager.RequestCondition.create(pattern, conditions));
1930
+ }
1931
+ manager.requestConditions.conditionsEnabled = true;
1932
+ void UI.ViewManager.ViewManager.instance().showView('network.blocked-urls');
1933
+ }
1934
+
1935
+ const blockingMenu =
1936
+ contextMenu.debugSection().appendSubMenuItem(i18nString(UIStrings.blockRequests), /* disabled=*/ true);
1937
+ const throttlingMenu =
1938
+ contextMenu.debugSection().appendSubMenuItem(i18nString(UIStrings.throttleRequests), /* disabled=*/ true);
1939
+
1940
+ const urlWithoutScheme = request.parsedURL.urlWithoutScheme();
1941
+ const urlPattern = urlWithoutScheme &&
1942
+ SDK.NetworkManager.RequestURLPattern.create(
1943
+ `*://${urlWithoutScheme}` as SDK.NetworkManager.URLPatternConstructorString);
1944
+ if (urlPattern) {
1945
+ throttlingMenu.setEnabled(true);
1946
+ blockingMenu.setEnabled(true);
1947
+ const existingConditions = manager.requestConditions.findCondition(urlPattern.constructorString);
1948
+ const isBlocking = existingConditions?.conditions === SDK.NetworkManager.BlockingConditions;
1949
+ const isThrottling = existingConditions &&
1950
+ existingConditions.conditions !== SDK.NetworkManager.BlockingConditions &&
1951
+ existingConditions.conditions !== SDK.NetworkManager.NoThrottlingConditions;
1952
+ blockingMenu.debugSection().appendItem(
1953
+ isBlocking ? i18nString(UIStrings.unblockS, {PH1: urlPattern.constructorString}) :
1954
+ i18nString(UIStrings.blockRequestUrl),
1955
+ () => isBlocking ? removeRequestCondition(urlPattern) :
1956
+ addRequestCondition(urlPattern, SDK.NetworkManager.BlockingConditions),
1957
+ {jslogContext: 'block-request-url'});
1958
+ throttlingMenu.debugSection().appendItem(
1959
+ isThrottling ? i18nString(UIStrings.unthrottleS, {PH1: urlPattern.constructorString}) :
1960
+ i18nString(UIStrings.throttleRequestUrl),
1961
+ () => isThrottling ? removeRequestCondition(urlPattern) :
1962
+ addRequestCondition(urlPattern, SDK.NetworkManager.Slow3GConditions),
1963
+ {jslogContext: 'throttle-request-url'});
1964
+ }
1965
+
1966
+ const domain = request.parsedURL.domain();
1967
+ const domainPattern = domain &&
1968
+ SDK.NetworkManager.RequestURLPattern.create(
1969
+ `*://${domain}` as SDK.NetworkManager.URLPatternConstructorString);
1970
+ if (domainPattern) {
1971
+ throttlingMenu.setEnabled(true);
1972
+ blockingMenu.setEnabled(true);
1973
+ const existingConditions = manager.requestConditions.findCondition(domainPattern.constructorString);
1974
+ const isBlocking = existingConditions?.conditions === SDK.NetworkManager.BlockingConditions;
1975
+ const isThrottling = existingConditions &&
1976
+ existingConditions.conditions !== SDK.NetworkManager.BlockingConditions &&
1977
+ existingConditions.conditions !== SDK.NetworkManager.NoThrottlingConditions;
1978
+ blockingMenu.debugSection().appendItem(
1979
+ isBlocking ? i18nString(UIStrings.unblockS, {PH1: domainPattern.constructorString}) :
1980
+ i18nString(UIStrings.blockRequestDomain),
1981
+ () => isBlocking ? removeRequestCondition(domainPattern) :
1982
+ addRequestCondition(domainPattern, SDK.NetworkManager.BlockingConditions),
1983
+ {jslogContext: 'block-request-domain'});
1984
+ throttlingMenu.debugSection().appendItem(
1985
+ isThrottling ? i18nString(UIStrings.unthrottleS, {PH1: domainPattern.constructorString}) :
1986
+ i18nString(UIStrings.throttleRequestDomain),
1987
+ () => isThrottling ? removeRequestCondition(domainPattern) :
1988
+ addRequestCondition(domainPattern, SDK.NetworkManager.Slow3GConditions),
1989
+ {jslogContext: 'throttle-request-domain'});
1990
+ }
1889
1991
  }
1890
1992
 
1891
1993
  if (SDK.NetworkManager.NetworkManager.canReplayRequest(request)) {
@@ -74,3 +74,8 @@
74
74
  text-align: inherit;
75
75
  height: 22px;
76
76
  }
77
+
78
+ .conditions-selector {
79
+ max-width: 120px;
80
+ margin: var(--sys-size-3);
81
+ }
@@ -154,7 +154,7 @@ export class AiCodeCompletionPlugin extends Plugin {
154
154
  if (this.#aiCodeCompletion && this.#editor && TextEditor.Config.hasActiveAiSuggestion(this.#editor.state)) {
155
155
  const {accepted, suggestion} = TextEditor.Config.acceptAiAutoCompleteSuggestion(this.#editor.editor);
156
156
  if (accepted) {
157
- if (suggestion?.rpcGlobalId && suggestion?.sampleId) {
157
+ if (suggestion?.rpcGlobalId) {
158
158
  this.#aiCodeCompletion?.registerUserAcceptance(suggestion.rpcGlobalId, suggestion.sampleId);
159
159
  }
160
160
  this.#onAiCodeCompletionSuggestionAccepted();
@@ -1212,6 +1212,11 @@ export class SourcesPanel extends UI.Panel.Panel implements
1212
1212
  this.sidebarPaneView.detach();
1213
1213
  }
1214
1214
 
1215
+ if (Root.Runtime.Runtime.isTraceApp()) {
1216
+ this.splitWidget.hideSidebar();
1217
+ return;
1218
+ }
1219
+
1215
1220
  this.splitWidget.setVertical(!vertically);
1216
1221
  this.splitWidget.element.classList.toggle('sources-split-view-vertical', vertically);
1217
1222