chrome-devtools-frontend 1.0.1650035 → 1.0.1650232
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.
- package/front_end/core/host/UserMetrics.ts +0 -15
- package/front_end/core/sdk/CSSMetadata.ts +91 -1
- package/front_end/generated/SupportedCSSProperties.js +342 -114
- package/front_end/models/ai_assistance/AiConversation.ts +2 -1
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +10 -57
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +13 -4
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -7
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
- package/front_end/models/ai_assistance/contexts/AccessibilityContext.snapshot.txt +26 -0
- package/front_end/models/ai_assistance/contexts/AccessibilityContext.ts +63 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +3 -2
- package/front_end/models/stack_trace/DetailedErrorStackParser.ts +18 -0
- package/front_end/models/stack_trace/stack_trace.ts +0 -4
- package/front_end/panels/accessibility/ARIAAttributesView.ts +1 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
- package/front_end/panels/ai_assistance/components/ChatInput.ts +1 -1
- package/front_end/panels/network/RequestConditionsDrawer.ts +236 -198
- package/front_end/panels/network/requestConditionsDrawer.css +3 -0
- package/front_end/panels/whats_new/ReleaseNoteText.ts +12 -6
- package/front_end/panels/whats_new/resources/WNDT.md +8 -7
- package/front_end/third_party/third-party-web/lib/nostats-subset.js +21 -15
- package/front_end/third_party/third-party-web/package/README.md +619 -582
- package/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -1
- package/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -1
- package/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -1
- package/front_end/third_party/third-party-web/package/dist/entities.json +1 -1
- package/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +27 -15
- package/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +14 -0
- package/front_end/third_party/third-party-web/package/lib/entities.test.js +10 -0
- package/front_end/third_party/third-party-web/package/lib/index.test.js +6 -6
- package/front_end/third_party/third-party-web/package/lib/markdown/template.md +1 -3
- package/front_end/third_party/third-party-web/package/package.json +7 -3
- package/front_end/third_party/third-party-web/package.json +1 -1
- package/front_end/ui/components/buttons/floatingButton.css +3 -3
- package/front_end/ui/components/lists/list.css +2 -0
- package/front_end/ui/legacy/ListWidget.ts +8 -5
- package/front_end/ui/legacy/TextPrompt.ts +5 -2
- package/front_end/ui/legacy/components/utils/Linkifier.ts +12 -6
- package/front_end/ui/legacy/textPrompt.css +1 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/package.json +1 -1
- package/front_end/models/stack_trace/ErrorStackParser.ts +0 -174
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
// Copyright 2015 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
5
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
6
4
|
|
|
7
|
-
import '../../ui/
|
|
5
|
+
import '../../ui/components/lists/lists.js';
|
|
8
6
|
import '../../ui/components/tooltips/tooltips.js';
|
|
7
|
+
import '../../ui/legacy/legacy.js';
|
|
9
8
|
|
|
10
9
|
import type * as Common from '../../core/common/common.js';
|
|
11
10
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
@@ -14,7 +13,6 @@ import * as SDK from '../../core/sdk/sdk.js';
|
|
|
14
13
|
import * as Logs from '../../models/logs/logs.js';
|
|
15
14
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
16
15
|
import * as uiI18n from '../../ui/i18n/i18n.js';
|
|
17
|
-
import {Link} from '../../ui/kit/kit.js';
|
|
18
16
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
19
17
|
import {Directives, html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
|
|
20
18
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
@@ -23,7 +21,7 @@ import * as PanelUtils from '../utils/utils.js';
|
|
|
23
21
|
|
|
24
22
|
import requestConditionsDrawerStyles from './requestConditionsDrawer.css.js';
|
|
25
23
|
|
|
26
|
-
const {ref, live} = Directives;
|
|
24
|
+
const {ref, live, ifDefined} = Directives;
|
|
27
25
|
const {widget} = UI.Widget;
|
|
28
26
|
|
|
29
27
|
const UIStrings = {
|
|
@@ -87,10 +85,6 @@ const UIStrings = {
|
|
|
87
85
|
* @description Message to be announced for a when list item is removed from list widget
|
|
88
86
|
*/
|
|
89
87
|
learnMore: 'Learn more',
|
|
90
|
-
/**
|
|
91
|
-
* @description Accessibility label on a `Learn more` link
|
|
92
|
-
*/
|
|
93
|
-
learnMoreLabel: 'Learn more about URL pattern syntax',
|
|
94
88
|
/**
|
|
95
89
|
* @description Tooltip on a button moving an entry up
|
|
96
90
|
* @example {*://example.com} PH1
|
|
@@ -118,38 +112,42 @@ const UIStrings = {
|
|
|
118
112
|
* @description Aria announcemenet when a pattern was moved down
|
|
119
113
|
*/
|
|
120
114
|
patternMovedDown: 'URL pattern was moved down',
|
|
121
|
-
/**
|
|
122
|
-
* @description Text on a button to start editing text
|
|
123
|
-
* @example {*://example.com} PH1
|
|
124
|
-
*/
|
|
125
|
-
editPattern: 'Edit {PH1}',
|
|
126
|
-
/**
|
|
127
|
-
* @description Label for an item to remove something
|
|
128
|
-
* @example {*://example.com} PH1
|
|
129
|
-
*/
|
|
130
|
-
removePattern: 'Remove {PH1}',
|
|
131
115
|
} as const;
|
|
132
116
|
const str_ = i18n.i18n.registerUIStrings('panels/network/RequestConditionsDrawer.ts', UIStrings);
|
|
133
117
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
134
118
|
|
|
135
119
|
const NETWORK_REQUEST_BLOCKING_EXPLANATION_URL =
|
|
136
120
|
'https://developer.chrome.com/docs/devtools/network-request-blocking' as Platform.DevToolsPath.UrlString;
|
|
137
|
-
const PATTERN_API_DOCS_URL =
|
|
138
|
-
'https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API' as Platform.DevToolsPath.UrlString;
|
|
139
121
|
|
|
140
122
|
const {bindToAction} = UI.UIUtils;
|
|
141
123
|
|
|
142
124
|
interface ViewInput {
|
|
143
|
-
|
|
125
|
+
conditions: SDK.NetworkManager.RequestCondition[];
|
|
126
|
+
editingCondition?: SDK.NetworkManager.RequestCondition;
|
|
144
127
|
enabled: boolean;
|
|
145
128
|
toggleEnabled: () => void;
|
|
146
129
|
addPattern: () => void;
|
|
130
|
+
onToggle: (condition: SDK.NetworkManager.RequestCondition) => void;
|
|
131
|
+
onConditionsChanged: (condition: SDK.NetworkManager.RequestCondition,
|
|
132
|
+
conditions: SDK.NetworkManager.ThrottlingConditions) => void;
|
|
133
|
+
onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void;
|
|
134
|
+
onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void;
|
|
135
|
+
onCommit: (condition: SDK.NetworkManager.RequestCondition, value: string) => void;
|
|
136
|
+
onCancel: (condition: SDK.NetworkManager.RequestCondition) => void;
|
|
137
|
+
onBeginEdit: (condition: SDK.NetworkManager.RequestCondition) => void;
|
|
138
|
+
onRemove: (condition: SDK.NetworkManager.RequestCondition) => void;
|
|
139
|
+
validator: (condition: SDK.NetworkManager.RequestCondition, value: string) => Common.UIString.LocalizedString | null;
|
|
140
|
+
lookUpRequestCount: (condition: SDK.NetworkManager.RequestCondition) => number;
|
|
141
|
+
}
|
|
142
|
+
interface ViewOutput {
|
|
143
|
+
itemRefs: Map<SDK.NetworkManager.RequestCondition, HTMLElement|undefined>;
|
|
147
144
|
}
|
|
148
|
-
type View = (input: ViewInput, output:
|
|
145
|
+
type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
|
|
149
146
|
export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
150
147
|
render(
|
|
151
148
|
// clang-format off
|
|
152
149
|
html`
|
|
150
|
+
<style>${requestConditionsDrawerStyles}</style>
|
|
153
151
|
<devtools-toolbar jslog=${VisualLogging.toolbar()}>
|
|
154
152
|
<devtools-checkbox
|
|
155
153
|
?checked=${input.enabled}
|
|
@@ -161,7 +159,9 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
161
159
|
<devtools-button ${bindToAction('network.add-network-request-blocking-pattern')}></devtools-button>
|
|
162
160
|
<devtools-button ${bindToAction('network.remove-all-network-request-blocking-patterns')}></devtools-button>
|
|
163
161
|
</devtools-toolbar>
|
|
164
|
-
|
|
162
|
+
${input.conditions.length === 0 ? html`
|
|
163
|
+
<div class="list">
|
|
164
|
+
<div class=empty-state>
|
|
165
165
|
<span class=empty-state-header>${i18nString(UIStrings.noPattern)}</span>
|
|
166
166
|
<div class=empty-state-description>
|
|
167
167
|
${uiI18n.getFormatLocalizedStringTemplate(str_, UIStrings.noThrottlingOrBlockingPattern, {PH1: learnMore()})}
|
|
@@ -175,22 +175,71 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
175
175
|
${i18nString(UIStrings.addRule)}
|
|
176
176
|
</devtools-button>
|
|
177
177
|
</div>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
</div>
|
|
179
|
+
` : html`
|
|
180
|
+
<devtools-list
|
|
181
|
+
class="blocked-urls list square-corners"
|
|
182
|
+
?deletable=${input.enabled}
|
|
183
|
+
@edit=${(e: CustomEvent<{index: number}>) => input.onBeginEdit(input.conditions[e.detail.index])}
|
|
184
|
+
@delete=${(e: CustomEvent<{index: number}>) => input.onRemove(input.conditions[e.detail.index])}>
|
|
185
|
+
${input.conditions.map((condition, index) => html`
|
|
186
|
+
<div class="blocked-url" ${ref(e => {
|
|
187
|
+
output.itemRefs.set(condition, e as HTMLElement | undefined);
|
|
188
|
+
})}>
|
|
189
|
+
${renderItem({
|
|
190
|
+
condition,
|
|
191
|
+
editing: input.editingCondition === condition,
|
|
192
|
+
editable: input.enabled,
|
|
193
|
+
index,
|
|
194
|
+
onToggle: input.onToggle,
|
|
195
|
+
onConditionsChanged: input.onConditionsChanged,
|
|
196
|
+
onIncreasePriority: input.onIncreasePriority,
|
|
197
|
+
onDecreasePriority: input.onDecreasePriority,
|
|
198
|
+
onCommit: input.onCommit,
|
|
199
|
+
onCancel: input.onCancel,
|
|
200
|
+
onBeginEdit: input.onBeginEdit,
|
|
201
|
+
validator: val => input.validator(condition, val),
|
|
202
|
+
lookUpRequestCount: input.lookUpRequestCount
|
|
203
|
+
})}
|
|
204
|
+
</div>
|
|
205
|
+
`)}
|
|
206
|
+
</devtools-list>
|
|
207
|
+
`}
|
|
181
208
|
`,
|
|
182
209
|
// clang-format on
|
|
183
|
-
target);
|
|
210
|
+
target, {container: {classes: (!input.enabled && input.conditions.length > 0) ? ['blocking-disabled'] : []}});
|
|
184
211
|
};
|
|
185
212
|
|
|
186
|
-
function renderItem(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
213
|
+
function renderItem({
|
|
214
|
+
condition,
|
|
215
|
+
editing,
|
|
216
|
+
editable,
|
|
217
|
+
index,
|
|
218
|
+
onToggle,
|
|
219
|
+
onConditionsChanged,
|
|
220
|
+
onIncreasePriority,
|
|
221
|
+
onDecreasePriority,
|
|
222
|
+
onCommit,
|
|
223
|
+
onCancel,
|
|
224
|
+
onBeginEdit,
|
|
225
|
+
validator,
|
|
226
|
+
lookUpRequestCount
|
|
227
|
+
}: {
|
|
228
|
+
condition: SDK.NetworkManager.RequestCondition,
|
|
229
|
+
editing: boolean,
|
|
230
|
+
editable: boolean,
|
|
231
|
+
index: number,
|
|
232
|
+
onToggle: (condition: SDK.NetworkManager.RequestCondition) => void,
|
|
233
|
+
onConditionsChanged:
|
|
234
|
+
(condition: SDK.NetworkManager.RequestCondition, conditions: SDK.NetworkManager.ThrottlingConditions) => void,
|
|
235
|
+
onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void,
|
|
236
|
+
onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void,
|
|
237
|
+
onCommit: (condition: SDK.NetworkManager.RequestCondition, value: string) => void,
|
|
238
|
+
onCancel: (condition: SDK.NetworkManager.RequestCondition) => void,
|
|
239
|
+
onBeginEdit: (condition: SDK.NetworkManager.RequestCondition) => void,
|
|
240
|
+
validator: (value: string) => Common.UIString.LocalizedString | null,
|
|
241
|
+
lookUpRequestCount: (condition: SDK.NetworkManager.RequestCondition) => number,
|
|
242
|
+
}): LitTemplate {
|
|
194
243
|
const {enabled, originalOrUpgradedURLPattern, constructorStringOrWildcardURL, wildcardURL} = condition;
|
|
195
244
|
const toggle = (e: Event): void => {
|
|
196
245
|
e.consume(true);
|
|
@@ -207,6 +256,25 @@ function renderItem(
|
|
|
207
256
|
onDecreasePriority(condition);
|
|
208
257
|
};
|
|
209
258
|
|
|
259
|
+
const onPromptActivate = (e: Event): void => {
|
|
260
|
+
if (!editable || editing) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
onBeginEdit(condition);
|
|
264
|
+
e.consume(true);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const promptKeyDown = (e: Event): void => {
|
|
268
|
+
if (!editable || editing) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const keyboardEvent = e as KeyboardEvent;
|
|
272
|
+
if (keyboardEvent.key === 'Enter') {
|
|
273
|
+
onBeginEdit(condition);
|
|
274
|
+
e.consume(true);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
210
278
|
// clang-format off
|
|
211
279
|
return html`
|
|
212
280
|
<input class=blocked-url-checkbox
|
|
@@ -231,7 +299,7 @@ function renderItem(
|
|
|
231
299
|
.jslogContext=${'increase-priority'}
|
|
232
300
|
?disabled=${!editable || !originalOrUpgradedURLPattern}
|
|
233
301
|
@click=${moveDown}></devtools-button>
|
|
234
|
-
${originalOrUpgradedURLPattern ? html`
|
|
302
|
+
${!editing && originalOrUpgradedURLPattern ? html`
|
|
235
303
|
<devtools-tooltip variant=rich jslogcontext=url-pattern id=url-pattern-${index}>
|
|
236
304
|
<div>hash: ${originalOrUpgradedURLPattern.hash}</div>
|
|
237
305
|
<div>hostname: ${originalOrUpgradedURLPattern.hostname}</div>
|
|
@@ -244,14 +312,14 @@ function renderItem(
|
|
|
244
312
|
<hr />
|
|
245
313
|
${learnMore()}
|
|
246
314
|
</devtools-tooltip>` : nothing}
|
|
247
|
-
${wildcardURL ? html`
|
|
315
|
+
${!editing && wildcardURL ? html`
|
|
248
316
|
<devtools-icon name=warning-filled class="small warning" aria-details=url-pattern-warning-${index}>
|
|
249
317
|
</devtools-icon>
|
|
250
318
|
<devtools-tooltip variant=rich jslogcontext=url-pattern-warning id=url-pattern-warning-${index}>
|
|
251
319
|
${i18nString(UIStrings.patternWasUpgraded, {PH1: wildcardURL})}
|
|
252
320
|
</devtools-tooltip>
|
|
253
321
|
`: nothing}
|
|
254
|
-
${!originalOrUpgradedURLPattern ? html`
|
|
322
|
+
${!editing && !originalOrUpgradedURLPattern ? html`
|
|
255
323
|
<devtools-icon name=cross-circle-filled class=small aria-details=url-pattern-error-${index}>
|
|
256
324
|
</devtools-icon>
|
|
257
325
|
<devtools-tooltip variant=rich jslogcontext=url-pattern-warning id=url-pattern-error-${index}>
|
|
@@ -261,13 +329,22 @@ function renderItem(
|
|
|
261
329
|
: i18nString(UIStrings.patternFailedToParse)}
|
|
262
330
|
${learnMore()}
|
|
263
331
|
</devtools-tooltip>`: nothing}
|
|
264
|
-
<
|
|
265
|
-
@click=${
|
|
266
|
-
|
|
332
|
+
<devtools-prompt
|
|
333
|
+
@click=${onPromptActivate}
|
|
334
|
+
@keydown=${promptKeyDown}
|
|
335
|
+
@focus=${onPromptActivate}
|
|
336
|
+
tabindex=${ifDefined(editing ? undefined : 0)}
|
|
337
|
+
@commit=${(e: UI.TextPrompt.TextPromptElement.CommitEvent) => onCommit(condition, e.detail)}
|
|
338
|
+
@cancel=${() => onCancel(condition)}
|
|
339
|
+
?disabled=${!editable}
|
|
340
|
+
placeholder=${i18nString(UIStrings.textEditPattern)}
|
|
341
|
+
value=${constructorStringOrWildcardURL}
|
|
342
|
+
?editing=${editable && editing}
|
|
343
|
+
.validator=${validator}
|
|
267
344
|
class=blocked-url-label
|
|
268
345
|
aria-details=url-pattern-${index}>
|
|
269
346
|
${constructorStringOrWildcardURL}
|
|
270
|
-
</
|
|
347
|
+
</devtools-prompt>
|
|
271
348
|
<select
|
|
272
349
|
class=conditions-selector
|
|
273
350
|
title=${i18nString(UIStrings.requestConditionsLabel)}
|
|
@@ -293,9 +370,8 @@ interface AffectedCountViewInput {
|
|
|
293
370
|
}
|
|
294
371
|
type AffectedCountView = (input: AffectedCountViewInput, output: object, target: HTMLElement) => void;
|
|
295
372
|
export const AFFECTED_COUNT_DEFAULT_VIEW: AffectedCountView = (input, output, target) => {
|
|
296
|
-
render(
|
|
297
|
-
|
|
298
|
-
{container: {classes: ['blocked-url-count']}});
|
|
373
|
+
render(html`${i18nString(UIStrings.dAffected, {PH1: input.count})}`, target,
|
|
374
|
+
{container: {classes: ['blocked-url-count']}});
|
|
299
375
|
};
|
|
300
376
|
|
|
301
377
|
function matchesUrl(conditions: SDK.NetworkManager.RequestCondition, url: string): boolean {
|
|
@@ -338,9 +414,9 @@ export class AffectedCountWidget extends UI.Widget.Widget {
|
|
|
338
414
|
}
|
|
339
415
|
|
|
340
416
|
override wasShown(): void {
|
|
341
|
-
SDK.TargetManager.TargetManager.instance().addModelListener(
|
|
342
|
-
|
|
343
|
-
|
|
417
|
+
SDK.TargetManager.TargetManager.instance().addModelListener(SDK.NetworkManager.NetworkManager,
|
|
418
|
+
SDK.NetworkManager.Events.RequestFinished,
|
|
419
|
+
this.#onRequestFinished, this, {scoped: true});
|
|
344
420
|
Logs.NetworkLog.NetworkLog.instance().addEventListener(Logs.NetworkLog.Events.Reset, this.requestUpdate, this);
|
|
345
421
|
super.wasShown();
|
|
346
422
|
}
|
|
@@ -375,15 +451,13 @@ function learnMore(): LitTemplate {
|
|
|
375
451
|
</devtools-link>`;
|
|
376
452
|
}
|
|
377
453
|
|
|
378
|
-
export class RequestConditionsDrawer extends UI.Widget.VBox
|
|
379
|
-
UI.ListWidget.Delegate<SDK.NetworkManager.RequestCondition> {
|
|
454
|
+
export class RequestConditionsDrawer extends UI.Widget.VBox {
|
|
380
455
|
private manager: SDK.NetworkManager.MultitargetNetworkManager;
|
|
381
|
-
private readonly list: UI.ListWidget.ListWidget<SDK.NetworkManager.RequestCondition>;
|
|
382
|
-
private editor: UI.ListWidget.Editor<SDK.NetworkManager.RequestCondition>|null;
|
|
383
456
|
private blockedCountForUrl: Map<Platform.DevToolsPath.UrlString, number>;
|
|
384
457
|
#throttledCount = new Map<string, number>();
|
|
385
458
|
#view: View;
|
|
386
|
-
#
|
|
459
|
+
#viewOutput: ViewOutput = {itemRefs: new Map()};
|
|
460
|
+
#editingCondition?: SDK.NetworkManager.RequestCondition;
|
|
387
461
|
|
|
388
462
|
constructor(target?: HTMLElement, view = DEFAULT_VIEW) {
|
|
389
463
|
super(target, {
|
|
@@ -393,187 +467,147 @@ export class RequestConditionsDrawer extends UI.Widget.VBox implements
|
|
|
393
467
|
this.#view = view;
|
|
394
468
|
|
|
395
469
|
this.manager = SDK.NetworkManager.MultitargetNetworkManager.instance();
|
|
396
|
-
this.manager.addEventListener(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
this.list = new UI.ListWidget.ListWidget(this);
|
|
400
|
-
this.list.registerRequiredCSS(requestConditionsDrawerStyles);
|
|
401
|
-
this.list.element.classList.add('blocked-urls');
|
|
402
|
-
|
|
403
|
-
this.editor = null;
|
|
470
|
+
this.manager.addEventListener(SDK.NetworkManager.MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED,
|
|
471
|
+
this.requestUpdate, this);
|
|
404
472
|
|
|
405
473
|
this.blockedCountForUrl = new Map();
|
|
406
|
-
SDK.TargetManager.TargetManager.instance().addModelListener(
|
|
407
|
-
|
|
408
|
-
|
|
474
|
+
SDK.TargetManager.TargetManager.instance().addModelListener(SDK.NetworkManager.NetworkManager,
|
|
475
|
+
SDK.NetworkManager.Events.RequestFinished,
|
|
476
|
+
this.onRequestFinished, this, {scoped: true});
|
|
409
477
|
|
|
410
|
-
this.
|
|
478
|
+
this.requestUpdate();
|
|
411
479
|
Logs.NetworkLog.NetworkLog.instance().addEventListener(Logs.NetworkLog.Events.Reset, this.onNetworkLogReset, this);
|
|
412
480
|
}
|
|
413
481
|
|
|
414
482
|
override performUpdate(): void {
|
|
483
|
+
this.#viewOutput.itemRefs.clear();
|
|
415
484
|
const enabled = this.manager.requestConditions.conditionsEnabled;
|
|
416
|
-
|
|
485
|
+
const conditions = Array.from(this.manager.requestConditions.conditions);
|
|
486
|
+
if (this.#editingCondition && !conditions.includes(this.#editingCondition)) {
|
|
487
|
+
conditions.unshift(this.#editingCondition);
|
|
488
|
+
}
|
|
417
489
|
|
|
418
490
|
const input: ViewInput = {
|
|
419
491
|
addPattern: this.addPattern.bind(this),
|
|
420
492
|
toggleEnabled: this.toggleEnabled.bind(this),
|
|
421
493
|
enabled,
|
|
422
|
-
|
|
494
|
+
conditions,
|
|
495
|
+
editingCondition: this.#editingCondition,
|
|
496
|
+
onToggle: (condition: SDK.NetworkManager.RequestCondition) => {
|
|
497
|
+
if (enabled) {
|
|
498
|
+
condition.enabled = !condition.enabled;
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
onConditionsChanged:
|
|
502
|
+
(condition: SDK.NetworkManager.RequestCondition, conditions: SDK.NetworkManager.ThrottlingConditions) => {
|
|
503
|
+
if (enabled) {
|
|
504
|
+
condition.conditions = conditions;
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => {
|
|
508
|
+
if (enabled) {
|
|
509
|
+
UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedUp));
|
|
510
|
+
this.manager.requestConditions.increasePriority(condition);
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => {
|
|
514
|
+
if (enabled) {
|
|
515
|
+
UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedDown));
|
|
516
|
+
this.manager.requestConditions.decreasePriority(condition);
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
onBeginEdit: (condition: SDK.NetworkManager.RequestCondition) => {
|
|
520
|
+
if (this.#editingCondition) {
|
|
521
|
+
this.#cancelEdit(this.#editingCondition);
|
|
522
|
+
}
|
|
523
|
+
this.#editingCondition = condition;
|
|
524
|
+
this.requestUpdate();
|
|
525
|
+
},
|
|
526
|
+
onRemove: (condition: SDK.NetworkManager.RequestCondition) => {
|
|
527
|
+
this.manager.requestConditions.delete(condition);
|
|
528
|
+
UI.ARIAUtils.LiveAnnouncer.alert(UIStrings.itemDeleted);
|
|
529
|
+
},
|
|
530
|
+
onCommit: this.#commitEdit.bind(this),
|
|
531
|
+
onCancel: this.#cancelEdit.bind(this),
|
|
532
|
+
validator: this.#validator.bind(this),
|
|
533
|
+
lookUpRequestCount: this.#getRequestCount.bind(this),
|
|
423
534
|
};
|
|
424
|
-
this.#view(input,
|
|
535
|
+
this.#view(input, this.#viewOutput, this.contentElement);
|
|
425
536
|
}
|
|
426
537
|
|
|
427
538
|
addPattern(): void {
|
|
428
539
|
this.manager.requestConditions.conditionsEnabled = true;
|
|
429
|
-
this
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
540
|
+
if (this.#editingCondition) {
|
|
541
|
+
this.#cancelEdit(this.#editingCondition);
|
|
542
|
+
}
|
|
543
|
+
const condition = SDK.NetworkManager.RequestCondition.createFromSetting(
|
|
544
|
+
{url: Platform.DevToolsPath.EmptyUrlString, enabled: true});
|
|
545
|
+
this.#editingCondition = condition;
|
|
546
|
+
this.requestUpdate();
|
|
433
547
|
}
|
|
434
548
|
|
|
435
549
|
removeAllPatterns(): void {
|
|
436
550
|
this.manager.requestConditions.clear();
|
|
437
551
|
}
|
|
438
552
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
if (editable) {
|
|
459
|
-
condition.conditions = conditions;
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
const onIncreasePriority = (condition: SDK.NetworkManager.RequestCondition): void => {
|
|
464
|
-
if (this.manager.requestConditions.conditionsEnabled) {
|
|
465
|
-
UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedUp));
|
|
466
|
-
this.manager.requestConditions.increasePriority(condition);
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
|
|
470
|
-
const onDecreasePriority = (condition: SDK.NetworkManager.RequestCondition): void => {
|
|
471
|
-
if (this.manager.requestConditions.conditionsEnabled) {
|
|
472
|
-
UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedDown));
|
|
473
|
-
this.manager.requestConditions.decreasePriority(condition);
|
|
474
|
-
}
|
|
475
|
-
};
|
|
476
|
-
|
|
477
|
-
render(
|
|
478
|
-
renderItem(
|
|
479
|
-
condition, editable, index, onToggle, onConditionsChanged, onIncreasePriority, onDecreasePriority,
|
|
480
|
-
this.#getRequestCount.bind(this)),
|
|
481
|
-
element);
|
|
553
|
+
#validator(condition: SDK.NetworkManager.RequestCondition, value: string): Common.UIString.LocalizedString|null {
|
|
554
|
+
if (!value) {
|
|
555
|
+
return i18nString(UIStrings.patternInputCannotBeEmpty);
|
|
556
|
+
}
|
|
557
|
+
const parsedPattern =
|
|
558
|
+
SDK.NetworkManager.RequestURLPattern.create(value as SDK.NetworkManager.URLPatternConstructorString);
|
|
559
|
+
const stringToCheck = parsedPattern ? parsedPattern.constructorString : value;
|
|
560
|
+
const existingCondition = this.manager.requestConditions.findCondition(stringToCheck);
|
|
561
|
+
if (existingCondition && existingCondition !== condition) {
|
|
562
|
+
return i18nString(UIStrings.patternAlreadyExists);
|
|
563
|
+
}
|
|
564
|
+
const isValid = SDK.NetworkManager.RequestURLPattern.isValidPattern(value);
|
|
565
|
+
switch (isValid) {
|
|
566
|
+
case SDK.NetworkManager.RequestURLPatternValidity.FAILED_TO_PARSE:
|
|
567
|
+
return i18nString(UIStrings.patternFailedToParse);
|
|
568
|
+
case SDK.NetworkManager.RequestURLPatternValidity.HAS_REGEXP_GROUPS:
|
|
569
|
+
return i18nString(UIStrings.patternFailedWithRegExpGroups);
|
|
570
|
+
}
|
|
571
|
+
return null;
|
|
482
572
|
}
|
|
483
573
|
|
|
484
574
|
private toggleEnabled(): void {
|
|
485
575
|
this.manager.requestConditions.conditionsEnabled = !this.manager.requestConditions.conditionsEnabled;
|
|
486
|
-
this.
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
removeItemRequested(condition: SDK.NetworkManager.RequestCondition): void {
|
|
490
|
-
this.manager.requestConditions.delete(condition);
|
|
491
|
-
UI.ARIAUtils.LiveAnnouncer.alert(UIStrings.itemDeleted);
|
|
576
|
+
this.requestUpdate();
|
|
492
577
|
}
|
|
493
578
|
|
|
494
|
-
|
|
495
|
-
this
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
}
|
|
579
|
+
#commitEdit(condition: SDK.NetworkManager.RequestCondition, value: string): void {
|
|
580
|
+
if (this.#editingCondition !== condition) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
499
583
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
584
|
+
if (condition.constructorStringOrWildcardURL === value &&
|
|
585
|
+
Array.from(this.manager.requestConditions.conditions).includes(condition)) {
|
|
586
|
+
this.#editingCondition = undefined;
|
|
587
|
+
this.requestUpdate();
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
const constructorString = value as SDK.NetworkManager.URLPatternConstructorString;
|
|
504
591
|
const pattern = SDK.NetworkManager.RequestURLPattern.create(constructorString);
|
|
505
592
|
if (!pattern) {
|
|
506
|
-
|
|
507
|
-
}
|
|
508
|
-
item.pattern = pattern;
|
|
509
|
-
if (isNew) {
|
|
510
|
-
this.manager.requestConditions.add(item);
|
|
593
|
+
return;
|
|
511
594
|
}
|
|
512
|
-
|
|
595
|
+
condition.pattern = pattern;
|
|
513
596
|
|
|
514
|
-
|
|
515
|
-
if (this.
|
|
516
|
-
|
|
597
|
+
// If it's a new item, it isn't in the manager yet. Add it.
|
|
598
|
+
if (!Array.from(this.manager.requestConditions.conditions).includes(condition)) {
|
|
599
|
+
this.manager.requestConditions.add(condition);
|
|
517
600
|
}
|
|
518
601
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
const titles = content.createChild('div', 'blocked-url-edit-row');
|
|
522
|
-
const label = titles.createChild('label');
|
|
523
|
-
const learnMore = Link.create(PATTERN_API_DOCS_URL, i18nString(UIStrings.learnMore), undefined, 'learn-more');
|
|
524
|
-
learnMore.title = i18nString(UIStrings.learnMoreLabel);
|
|
525
|
-
titles.append('\xA0', learnMore);
|
|
526
|
-
label.textContent = i18nString(UIStrings.textEditPattern);
|
|
527
|
-
const fields = content.createChild('div', 'blocked-url-edit-row');
|
|
528
|
-
const validator =
|
|
529
|
-
(_item: SDK.NetworkManager.RequestCondition, _index: number, input: UI.ListWidget.EditorControl): {
|
|
530
|
-
valid: boolean,
|
|
531
|
-
errorMessage?: Common.UIString.LocalizedString,
|
|
532
|
-
} => {
|
|
533
|
-
if (!input.value) {
|
|
534
|
-
return {errorMessage: i18nString(UIStrings.patternInputCannotBeEmpty), valid: false};
|
|
535
|
-
}
|
|
536
|
-
if (this.manager.requestConditions.has(input.value)) {
|
|
537
|
-
return {errorMessage: i18nString(UIStrings.patternAlreadyExists), valid: false};
|
|
538
|
-
}
|
|
539
|
-
const isValid = SDK.NetworkManager.RequestURLPattern.isValidPattern(input.value);
|
|
540
|
-
switch (isValid) {
|
|
541
|
-
case SDK.NetworkManager.RequestURLPatternValidity.FAILED_TO_PARSE:
|
|
542
|
-
return {errorMessage: i18nString(UIStrings.patternFailedToParse), valid: false};
|
|
543
|
-
case SDK.NetworkManager.RequestURLPatternValidity.HAS_REGEXP_GROUPS:
|
|
544
|
-
return {errorMessage: i18nString(UIStrings.patternFailedWithRegExpGroups), valid: false};
|
|
545
|
-
}
|
|
546
|
-
return {valid: true};
|
|
547
|
-
};
|
|
548
|
-
const urlInput = editor.createInput('url', 'text', '', validator);
|
|
549
|
-
label.htmlFor = urlInput.id = 'editor-url-input';
|
|
550
|
-
fields.createChild('div', 'blocked-url-edit-value').appendChild(urlInput);
|
|
551
|
-
return editor;
|
|
602
|
+
this.#editingCondition = undefined;
|
|
603
|
+
this.requestUpdate();
|
|
552
604
|
}
|
|
553
605
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
let oldIndex = 0;
|
|
559
|
-
for (; oldIndex < newItems.length; ++oldIndex) {
|
|
560
|
-
const pattern = newItems[oldIndex];
|
|
561
|
-
this.list.updateItem(
|
|
562
|
-
oldIndex,
|
|
563
|
-
pattern,
|
|
564
|
-
enabled,
|
|
565
|
-
/* focusable=*/ false,
|
|
566
|
-
{
|
|
567
|
-
edit: i18nString(UIStrings.editPattern, {PH1: pattern.constructorStringOrWildcardURL}),
|
|
568
|
-
delete: i18nString(UIStrings.removePattern, {PH1: pattern.constructorStringOrWildcardURL})
|
|
569
|
-
},
|
|
570
|
-
);
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
while (oldIndex < this.list.items.length) {
|
|
574
|
-
this.list.removeItem(oldIndex);
|
|
606
|
+
#cancelEdit(condition: SDK.NetworkManager.RequestCondition): void {
|
|
607
|
+
if (this.#editingCondition === condition) {
|
|
608
|
+
this.#editingCondition = undefined;
|
|
609
|
+
this.requestUpdate();
|
|
575
610
|
}
|
|
576
|
-
this.requestUpdate();
|
|
577
611
|
}
|
|
578
612
|
|
|
579
613
|
#getRequestCount(condition: SDK.NetworkManager.RequestCondition): number {
|
|
@@ -628,11 +662,15 @@ export class RequestConditionsDrawer extends UI.Widget.VBox implements
|
|
|
628
662
|
console.assert(!!drawer, 'Drawer not initialized');
|
|
629
663
|
return;
|
|
630
664
|
}
|
|
631
|
-
const
|
|
665
|
+
const condition = drawer.manager.requestConditions.conditions.find(
|
|
632
666
|
condition => condition.ruleIds.has(appliedConditions.appliedNetworkConditionsId) &&
|
|
633
667
|
condition.constructorString && condition.constructorString === appliedConditions.urlPattern);
|
|
634
|
-
|
|
635
|
-
|
|
668
|
+
if (condition) {
|
|
669
|
+
const element = drawer.#viewOutput.itemRefs.get(condition);
|
|
670
|
+
if (element) {
|
|
671
|
+
PanelUtils.PanelUtils.highlightElement(element);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
636
674
|
}
|
|
637
675
|
}
|
|
638
676
|
|
|
@@ -40,8 +40,8 @@ export function getReleaseNote(): ReleaseNote {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
let releaseNote: ReleaseNote = {
|
|
43
|
-
version:
|
|
44
|
-
header: 'What’s new in DevTools
|
|
43
|
+
version: 150,
|
|
44
|
+
header: 'What’s new in DevTools 150',
|
|
45
45
|
markdownLinks: [
|
|
46
46
|
{
|
|
47
47
|
key: 'devtools-for-agents',
|
|
@@ -52,10 +52,16 @@ let releaseNote: ReleaseNote = {
|
|
|
52
52
|
link: 'https://developer.chrome.com/blog/new-in-devtools-149/#ai-assistance',
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
key: 'css-
|
|
56
|
-
link: 'https://developer.chrome.com/blog/new-in-devtools-149/#css-
|
|
55
|
+
key: 'css-container-function',
|
|
56
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-149/#css-container-function',
|
|
57
57
|
}
|
|
58
58
|
],
|
|
59
|
-
videoLinks: [
|
|
60
|
-
|
|
59
|
+
videoLinks: [
|
|
60
|
+
{
|
|
61
|
+
description: 'See all highlights from Chrome 148-150',
|
|
62
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-150' as Platform.DevToolsPath.UrlString,
|
|
63
|
+
type: VideoType.WHATS_NEW,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-150/',
|
|
61
67
|
};
|