chrome-devtools-frontend 1.0.1533544 → 1.0.1534717
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/docs/contributing/infrastructure.md +32 -0
- package/front_end/Images/src/justify-content-stretch.svg +4 -0
- package/front_end/core/host/InspectorFrontendHost.ts +1 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +33 -29
- package/front_end/core/host/UserMetrics.ts +26 -1
- package/front_end/core/protocol_client/CDPConnection.ts +39 -0
- package/front_end/core/protocol_client/InspectorBackend.ts +0 -98
- package/front_end/core/root/Runtime.ts +1 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +18 -8
- package/front_end/core/sdk/NetworkManager.ts +0 -16
- package/front_end/core/sdk/RehydratingConnection.ts +1 -1
- package/front_end/devtools_compatibility.js +202 -7
- package/front_end/generated/protocol-mapping.d.ts +3 -0
- package/front_end/models/ai_assistance/BuiltInAi.ts +141 -56
- package/front_end/panels/common/BadgeNotification.ts +1 -3
- package/front_end/panels/console/ConsoleInsightTeaser.ts +76 -60
- package/front_end/panels/console/ConsoleViewMessage.ts +4 -2
- package/front_end/panels/console/consoleInsightTeaser.css +4 -0
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/elements/StylePropertyTreeElement.ts +46 -8
- package/front_end/panels/elements/components/CSSPropertyIconResolver.ts +1 -0
- package/front_end/panels/elements/components/StylePropertyEditor.ts +65 -0
- package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js +4 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +10 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js +4 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +4 -0
- package/front_end/third_party/puppeteer/package/package.json +1 -1
- package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/api/Frame.ts +4 -4
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +8 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +7 -17
- package/front_end/ui/components/docs/style_property_editor/masonry.html +21 -0
- package/front_end/ui/components/docs/style_property_editor/masonry.ts +50 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +2 -3
- package/front_end/ui/components/text_editor/config.ts +1 -3
- package/front_end/ui/legacy/UIUtils.ts +5 -0
- package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +2 -2
- package/front_end/ui/legacy/components/perf_ui/Font.ts +1 -14
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/inspector_overlay/testing/InspectorOverlayHelpers.ts +2 -10
- package/package.json +1 -1
- package/front_end/services/window_bounds/WindowBoundsService.ts +0 -27
- package/front_end/services/window_bounds/window_bounds.ts +0 -9
|
@@ -68,6 +68,27 @@ https://chromium.googlesource.com/chromium/tools/build/+/refs/heads/main/recipes
|
|
|
68
68
|
and upload a CL for
|
|
69
69
|
[`chromium/tools/build`](https://chromium.googlesource.com/chromium/tools/build/+/refs/heads/main).
|
|
70
70
|
|
|
71
|
+
It's good practice to also manually test your recipes. You can test your recipe
|
|
72
|
+
changes against a build that was performed with the same recipes. To do so
|
|
73
|
+
follow these steps:
|
|
74
|
+
- authenticate with `led auth-login`
|
|
75
|
+
- select a particular build that ran with your target recipe ([example](https://ci.chromium.org/ui/p/devtools-frontend/builders/try/dtf_linux_dbg/14161))
|
|
76
|
+
- got to Infra tab and collect the Buildbucket id (8700153319150087425 for the example above)
|
|
77
|
+
- run `led get-build --real-build 8700153319150087425 | led edit-recipe-bundle | led edit-system -p 25 | led launch` while in your local recipe checkout
|
|
78
|
+
- collect the output link to your test build and verify that you got the expected result
|
|
79
|
+
|
|
80
|
+
## Pin older version of DevTools recipes to a branch
|
|
81
|
+
|
|
82
|
+
Updating a recipe that depends on DevTools repo recent changes can break the
|
|
83
|
+
build in beta/stable/extended branches. If those changes cannot be back-merged
|
|
84
|
+
into the branches you can pin the older version of the recipe to the branches in
|
|
85
|
+
infra/config.
|
|
86
|
+
|
|
87
|
+
To do so update the `legacy_recipe` config in `definitions.star` with the number
|
|
88
|
+
of the last branch you need the old version of the recipe to run on and with the
|
|
89
|
+
revision hash of that version. Branches with number higher than the one you
|
|
90
|
+
configured will run ToT recipe version. [Example](https://crrev.com/c/7003685)
|
|
91
|
+
|
|
71
92
|
## Updating test commands in the infrastructure
|
|
72
93
|
|
|
73
94
|
The DevTools recipes are defined in
|
|
@@ -228,6 +249,17 @@ Below is a detailed description of what happens in such a build:
|
|
|
228
249
|
- fail the builder if tests failed in the deflaking phase
|
|
229
250
|
- otherwise report build as passing
|
|
230
251
|
|
|
252
|
+
## Skip flake detection
|
|
253
|
+
|
|
254
|
+
Test that are already flaky can end up being updated in CLs that do not deal
|
|
255
|
+
with the original flakiness nor can be blamed for introducing or increasing the
|
|
256
|
+
flakiness of the test. However CQ builder will fail in Flake Detection steps
|
|
257
|
+
because they picked up the test as it was being touched.
|
|
258
|
+
|
|
259
|
+
You can skip Flake Detection for your tests by adding the `Skip-Flake-Detection`
|
|
260
|
+
CL footer (see example [CL](https://crrev.com/c/6994031)). Make sure you use the
|
|
261
|
+
full path to your test.
|
|
262
|
+
|
|
231
263
|
### Common build failures
|
|
232
264
|
|
|
233
265
|
The first place where a build usually fails is on `bot_update` and this usually
|
|
@@ -569,7 +569,7 @@ class InspectorFrontendAPIImpl {
|
|
|
569
569
|
constructor() {
|
|
570
570
|
for (const descriptor of EventDescriptors) {
|
|
571
571
|
// @ts-expect-error Dispatcher magic
|
|
572
|
-
this[descriptor[
|
|
572
|
+
this[descriptor[0]] = this.dispatch.bind(this, descriptor[0], descriptor[1], descriptor[2]);
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
|
|
@@ -6,6 +6,9 @@ import type * as Platform from '../../core/platform/platform.js';
|
|
|
6
6
|
import type * as Common from '../common/common.js';
|
|
7
7
|
import type * as Root from '../root/root.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* This values should match the one getting called from Chromium
|
|
11
|
+
*/
|
|
9
12
|
export enum Events {
|
|
10
13
|
/* eslint-disable @typescript-eslint/naming-convention -- Accessed from web_tests */
|
|
11
14
|
AppendedToURL = 'appendedToURL',
|
|
@@ -24,7 +27,7 @@ export enum Events {
|
|
|
24
27
|
FileSystemsLoaded = 'fileSystemsLoaded',
|
|
25
28
|
FileSystemRemoved = 'fileSystemRemoved',
|
|
26
29
|
FileSystemAdded = 'fileSystemAdded',
|
|
27
|
-
FileSystemFilesChangedAddedRemoved = '
|
|
30
|
+
FileSystemFilesChangedAddedRemoved = 'fileSystemFilesChangedAddedRemoved',
|
|
28
31
|
IndexingTotalWorkCalculated = 'indexingTotalWorkCalculated',
|
|
29
32
|
IndexingWorked = 'indexingWorked',
|
|
30
33
|
IndexingDone = 'indexingDone',
|
|
@@ -40,34 +43,34 @@ export enum Events {
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
export const EventDescriptors = [
|
|
43
|
-
[Events.AppendedToURL,
|
|
44
|
-
[Events.CanceledSaveURL,
|
|
45
|
-
[Events.ColorThemeChanged,
|
|
46
|
-
[Events.ContextMenuCleared,
|
|
47
|
-
[Events.ContextMenuItemSelected,
|
|
48
|
-
[Events.DeviceCountUpdated,
|
|
49
|
-
[Events.DevicesDiscoveryConfigChanged,
|
|
50
|
-
[Events.DevicesPortForwardingStatusChanged,
|
|
51
|
-
[Events.DevicesUpdated,
|
|
52
|
-
[Events.DispatchMessage,
|
|
53
|
-
[Events.DispatchMessageChunk,
|
|
54
|
-
[Events.EnterInspectElementMode,
|
|
55
|
-
[Events.EyeDropperPickedColor,
|
|
56
|
-
[Events.FileSystemsLoaded,
|
|
57
|
-
[Events.FileSystemRemoved,
|
|
58
|
-
[Events.FileSystemAdded,
|
|
59
|
-
[Events.FileSystemFilesChangedAddedRemoved,
|
|
60
|
-
[Events.IndexingTotalWorkCalculated,
|
|
61
|
-
[Events.IndexingWorked,
|
|
62
|
-
[Events.IndexingDone,
|
|
63
|
-
[Events.KeyEventUnhandled,
|
|
64
|
-
[Events.ReloadInspectedPage,
|
|
65
|
-
[Events.RevealSourceLine,
|
|
66
|
-
[Events.SavedURL,
|
|
67
|
-
[Events.SearchCompleted,
|
|
68
|
-
[Events.SetInspectedTabId,
|
|
69
|
-
[Events.SetUseSoftMenu,
|
|
70
|
-
[Events.ShowPanel,
|
|
46
|
+
[Events.AppendedToURL, ['url']],
|
|
47
|
+
[Events.CanceledSaveURL, ['url']],
|
|
48
|
+
[Events.ColorThemeChanged, []],
|
|
49
|
+
[Events.ContextMenuCleared, []],
|
|
50
|
+
[Events.ContextMenuItemSelected, ['id']],
|
|
51
|
+
[Events.DeviceCountUpdated, ['count']],
|
|
52
|
+
[Events.DevicesDiscoveryConfigChanged, ['config']],
|
|
53
|
+
[Events.DevicesPortForwardingStatusChanged, ['status']],
|
|
54
|
+
[Events.DevicesUpdated, ['devices']],
|
|
55
|
+
[Events.DispatchMessage, ['messageObject']],
|
|
56
|
+
[Events.DispatchMessageChunk, ['messageChunk', 'messageSize']],
|
|
57
|
+
[Events.EnterInspectElementMode, []],
|
|
58
|
+
[Events.EyeDropperPickedColor, ['color']],
|
|
59
|
+
[Events.FileSystemsLoaded, ['fileSystems']],
|
|
60
|
+
[Events.FileSystemRemoved, ['fileSystemPath']],
|
|
61
|
+
[Events.FileSystemAdded, ['errorMessage', 'fileSystem']],
|
|
62
|
+
[Events.FileSystemFilesChangedAddedRemoved, ['changed', 'added', 'removed']],
|
|
63
|
+
[Events.IndexingTotalWorkCalculated, , ['requestId', 'fileSystemPath', 'totalWork']],
|
|
64
|
+
[Events.IndexingWorked, ['requestId', 'fileSystemPath', 'worked']],
|
|
65
|
+
[Events.IndexingDone, ['requestId', 'fileSystemPath']],
|
|
66
|
+
[Events.KeyEventUnhandled, ['event']],
|
|
67
|
+
[Events.ReloadInspectedPage, ['hard']],
|
|
68
|
+
[Events.RevealSourceLine, ['url', 'lineNumber', 'columnNumber']],
|
|
69
|
+
[Events.SavedURL, ['url', 'fileSystemPath']],
|
|
70
|
+
[Events.SearchCompleted, ['requestId', 'fileSystemPath', 'files']],
|
|
71
|
+
[Events.SetInspectedTabId, ['tabId']],
|
|
72
|
+
[Events.SetUseSoftMenu, ['useSoftMenu']],
|
|
73
|
+
[Events.ShowPanel, ['panelName']],
|
|
71
74
|
] as const;
|
|
72
75
|
|
|
73
76
|
export interface DispatchMessageChunkEvent {
|
|
@@ -547,5 +550,6 @@ export const enum EnumeratedHistogram {
|
|
|
547
550
|
LighthouseCategoryUsed = 'DevTools.LighthouseCategoryUsed',
|
|
548
551
|
SwatchActivated = 'DevTools.SwatchActivated',
|
|
549
552
|
AnimationPlaybackRateChanged = 'DevTools.AnimationPlaybackRateChanged',
|
|
553
|
+
BuiltInAiAvailability = 'DevTools.BuiltInAiAvailability',
|
|
550
554
|
// LINT.ThenChange(/front_end/devtools_compatibility.js:EnumeratedHistogram)
|
|
551
555
|
}
|
|
@@ -307,6 +307,16 @@ export class UserMetrics {
|
|
|
307
307
|
InspectorFrontendHostInstance.recordCountHistogram(
|
|
308
308
|
'DevTools.PerformanceAI.MainThreadActivityResponseSize', bytes, 0, 100_000, 100);
|
|
309
309
|
}
|
|
310
|
+
|
|
311
|
+
builtInAiAvailability(availability: BuiltInAiAvailability): void {
|
|
312
|
+
InspectorFrontendHostInstance.recordEnumeratedHistogram(
|
|
313
|
+
EnumeratedHistogram.BuiltInAiAvailability, availability, BuiltInAiAvailability.MAX_VALUE);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
consoleInsightTeaserGenerated(timeInMilliseconds: number): void {
|
|
317
|
+
InspectorFrontendHostInstance.recordPerformanceHistogram(
|
|
318
|
+
'DevTools.Insights.TeaserGenerationTime', timeInMilliseconds);
|
|
319
|
+
}
|
|
310
320
|
}
|
|
311
321
|
|
|
312
322
|
/**
|
|
@@ -1195,7 +1205,8 @@ export const enum SwatchType {
|
|
|
1195
1205
|
LENGTH = 8,
|
|
1196
1206
|
POSITION_TRY_LINK = 10,
|
|
1197
1207
|
ATTR_LINK = 11,
|
|
1198
|
-
|
|
1208
|
+
MASONRY = 12,
|
|
1209
|
+
MAX_VALUE = 13,
|
|
1199
1210
|
}
|
|
1200
1211
|
|
|
1201
1212
|
export const enum BadgeType {
|
|
@@ -1228,3 +1239,17 @@ export const enum TimelineNavigationSetting {
|
|
|
1228
1239
|
SWITCHED_TO_MODERN = 3,
|
|
1229
1240
|
MAX_VALUE = 4,
|
|
1230
1241
|
}
|
|
1242
|
+
|
|
1243
|
+
export const enum BuiltInAiAvailability {
|
|
1244
|
+
UNAVAILABLE_HAS_GPU = 0,
|
|
1245
|
+
DOWNLOADABLE_HAS_GPU = 1,
|
|
1246
|
+
DOWNLOADING_HAS_GPU = 2,
|
|
1247
|
+
AVAILABLE_HAS_GPU = 3,
|
|
1248
|
+
DISABLED_HAS_GPU = 4,
|
|
1249
|
+
UNAVAILABLE_NO_GPU = 5,
|
|
1250
|
+
DOWNLOADABLE_NO_GPU = 6,
|
|
1251
|
+
DOWNLOADING_NO_GPU = 7,
|
|
1252
|
+
AVAILABLE_NO_GPU = 8,
|
|
1253
|
+
DISABLED_NO_GPU = 9,
|
|
1254
|
+
MAX_VALUE = 10,
|
|
1255
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2025 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type {ProtocolMapping} from '../../generated/protocol-mapping.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Allows the sending and receiving of CDP commands and the notification of CDP events to observers.
|
|
9
|
+
*
|
|
10
|
+
* An instance of a CDPConnection "owns" the full transport channel and no other CDP traffic must
|
|
11
|
+
* be proxied over it. This is because each implementation needs to manage "message IDs", which
|
|
12
|
+
* would conflict with any other shared traffic.
|
|
13
|
+
*/
|
|
14
|
+
export interface CDPConnection {
|
|
15
|
+
send<T extends keyof ProtocolMapping.Commands>(
|
|
16
|
+
method: T, params: ProtocolMapping.Commands[T]['paramsType'][0],
|
|
17
|
+
sessionId: string|undefined): Promise<ProtocolMapping.Commands[T]['returnType']|{getError(): string}>;
|
|
18
|
+
|
|
19
|
+
observe(observer: CDPConnectionObserver): void;
|
|
20
|
+
unobserve(observer: CDPConnectionObserver): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface CDPConnectionObserver {
|
|
24
|
+
onEvent<T extends keyof ProtocolMapping.Events>(event: ProtocolMapping.Events[T]): void;
|
|
25
|
+
onDisconnect(reason: string): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The protocol monitor and test harness require inspection of raw CDP message traffic.
|
|
30
|
+
*/
|
|
31
|
+
export interface DebuggableCDPConnection extends CDPConnection {
|
|
32
|
+
observeMessages(observer: RawMessageObserver): void;
|
|
33
|
+
unobserveMessages(observer: RawMessageObserver): void;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface RawMessageObserver {
|
|
37
|
+
onMessageReceived(message: unknown): void;
|
|
38
|
+
onMessageSent(message: unknown): void;
|
|
39
|
+
}
|
|
@@ -75,7 +75,6 @@ interface CallbackWithDebugInfo {
|
|
|
75
75
|
|
|
76
76
|
export class InspectorBackend {
|
|
77
77
|
readonly agentPrototypes = new Map<ProtocolDomainName, AgentPrototype>();
|
|
78
|
-
#initialized = false;
|
|
79
78
|
#eventParameterNamesForDomain = new Map<ProtocolDomainName, EventParameterNames>();
|
|
80
79
|
readonly typeMap = new Map<QualifiedName, CommandParameter[]>();
|
|
81
80
|
readonly enumMap = new Map<QualifiedName, Record<string, string>>();
|
|
@@ -114,10 +113,6 @@ export class InspectorBackend {
|
|
|
114
113
|
console.warn(error + ': ' + JSON.stringify(messageObject));
|
|
115
114
|
}
|
|
116
115
|
|
|
117
|
-
isInitialized(): boolean {
|
|
118
|
-
return this.#initialized;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
116
|
private agentPrototype(domain: ProtocolDomainName): AgentPrototype {
|
|
122
117
|
let prototype = this.agentPrototypes.get(domain);
|
|
123
118
|
if (!prototype) {
|
|
@@ -131,7 +126,6 @@ export class InspectorBackend {
|
|
|
131
126
|
void {
|
|
132
127
|
const [domain, command] = splitQualifiedName(method);
|
|
133
128
|
this.agentPrototype(domain as ProtocolDomainName).registerCommand(command, parameters, replyArgs, description);
|
|
134
|
-
this.#initialized = true;
|
|
135
129
|
}
|
|
136
130
|
|
|
137
131
|
registerEnum(type: QualifiedName, values: Record<string, string>): void {
|
|
@@ -145,19 +139,16 @@ export class InspectorBackend {
|
|
|
145
139
|
// @ts-expect-error globalThis global namespace pollution
|
|
146
140
|
globalThis.Protocol[domain][name] = values;
|
|
147
141
|
this.enumMap.set(type, values);
|
|
148
|
-
this.#initialized = true;
|
|
149
142
|
}
|
|
150
143
|
|
|
151
144
|
registerType(method: QualifiedName, parameters: CommandParameter[]): void {
|
|
152
145
|
this.typeMap.set(method, parameters);
|
|
153
|
-
this.#initialized = true;
|
|
154
146
|
}
|
|
155
147
|
|
|
156
148
|
registerEvent(eventName: QualifiedName, params: string[]): void {
|
|
157
149
|
const domain = eventName.split('.')[0];
|
|
158
150
|
const eventParameterNames = this.getOrCreateEventParameterNamesForDomain(domain as ProtocolDomainName);
|
|
159
151
|
eventParameterNames.set(eventName, params);
|
|
160
|
-
this.#initialized = true;
|
|
161
152
|
}
|
|
162
153
|
}
|
|
163
154
|
|
|
@@ -864,13 +855,11 @@ export class TargetBase {
|
|
|
864
855
|
* of the invoke_enable, etc. methods that the front-end uses.
|
|
865
856
|
*/
|
|
866
857
|
class AgentPrototype {
|
|
867
|
-
replyArgs: Record<string, string[]>;
|
|
868
858
|
description = '';
|
|
869
859
|
metadata: Record<string, {parameters: CommandParameter[], description: string, replyArgs: string[]}>;
|
|
870
860
|
readonly domain: string;
|
|
871
861
|
target!: TargetBase;
|
|
872
862
|
constructor(domain: string) {
|
|
873
|
-
this.replyArgs = {};
|
|
874
863
|
this.domain = domain;
|
|
875
864
|
this.metadata = {};
|
|
876
865
|
}
|
|
@@ -878,11 +867,6 @@ class AgentPrototype {
|
|
|
878
867
|
registerCommand(
|
|
879
868
|
methodName: UnqualifiedName, parameters: CommandParameter[], replyArgs: string[], description: string): void {
|
|
880
869
|
const domainAndMethod = qualifyName(this.domain, methodName);
|
|
881
|
-
function sendMessagePromise(this: AgentPrototype, ...args: unknown[]): Promise<unknown> {
|
|
882
|
-
return AgentPrototype.prototype.sendMessageToBackendPromise.call(this, domainAndMethod, parameters, args);
|
|
883
|
-
}
|
|
884
|
-
// @ts-expect-error Method code generation
|
|
885
|
-
this[methodName] = sendMessagePromise;
|
|
886
870
|
this.metadata[domainAndMethod] = {parameters, description, replyArgs};
|
|
887
871
|
|
|
888
872
|
function invoke(this: AgentPrototype, request: Object|undefined = {}): Promise<Protocol.ProtocolResponseWithError> {
|
|
@@ -891,88 +875,6 @@ class AgentPrototype {
|
|
|
891
875
|
|
|
892
876
|
// @ts-expect-error Method code generation
|
|
893
877
|
this['invoke_' + methodName] = invoke;
|
|
894
|
-
this.replyArgs[domainAndMethod] = replyArgs;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
private prepareParameters(
|
|
898
|
-
method: string, parameters: CommandParameter[], args: unknown[], errorCallback: (arg0: string) => void): Object
|
|
899
|
-
|null {
|
|
900
|
-
const params: Record<string, unknown> = {};
|
|
901
|
-
let hasParams = false;
|
|
902
|
-
|
|
903
|
-
for (const param of parameters) {
|
|
904
|
-
const paramName = param.name;
|
|
905
|
-
const typeName = param.type;
|
|
906
|
-
const optionalFlag = param.optional;
|
|
907
|
-
|
|
908
|
-
if (!args.length && !optionalFlag) {
|
|
909
|
-
errorCallback(
|
|
910
|
-
`Protocol Error: Invalid number of arguments for method '${method}' call. ` +
|
|
911
|
-
`It must have the following arguments ${JSON.stringify(parameters)}'.`);
|
|
912
|
-
return null;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
const value = args.shift();
|
|
916
|
-
if (optionalFlag && typeof value === 'undefined') {
|
|
917
|
-
continue;
|
|
918
|
-
}
|
|
919
|
-
const expectedJSType = typeName === 'array' ? 'object' : typeName;
|
|
920
|
-
if (typeof value !== expectedJSType) {
|
|
921
|
-
errorCallback(
|
|
922
|
-
`Protocol Error: Invalid type of argument '${paramName}' for method '${method}' call. ` +
|
|
923
|
-
`It must be '${typeName}' but it is '${typeof value}'.`);
|
|
924
|
-
return null;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
params[paramName] = value;
|
|
928
|
-
hasParams = true;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
if (args.length) {
|
|
932
|
-
errorCallback(`Protocol Error: Extra ${args.length} arguments in a call to method '${method}'.`);
|
|
933
|
-
return null;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
return hasParams ? params : null;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
private sendMessageToBackendPromise(method: QualifiedName, parameters: CommandParameter[], args: unknown[]):
|
|
940
|
-
Promise<unknown> {
|
|
941
|
-
let errorMessage;
|
|
942
|
-
function onError(message: string): void {
|
|
943
|
-
console.error(message);
|
|
944
|
-
errorMessage = message;
|
|
945
|
-
}
|
|
946
|
-
const params = this.prepareParameters(method, parameters, args, onError);
|
|
947
|
-
if (errorMessage) {
|
|
948
|
-
return Promise.resolve(null);
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
return new Promise(resolve => {
|
|
952
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
953
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
954
|
-
const callback: Callback = (error: MessageError|null, result: any|null): void => {
|
|
955
|
-
if (error) {
|
|
956
|
-
if (!test.suppressRequestErrors && error.code !== DevToolsStubErrorCode && error.code !== GenericErrorCode &&
|
|
957
|
-
error.code !== ConnectionClosedErrorCode) {
|
|
958
|
-
console.error('Request ' + method + ' failed. ' + JSON.stringify(error));
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
resolve(null);
|
|
962
|
-
return;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
const args = this.replyArgs[method];
|
|
966
|
-
resolve(result && args.length ? result[args[0]] : undefined);
|
|
967
|
-
};
|
|
968
|
-
|
|
969
|
-
const router = this.target.router();
|
|
970
|
-
if (!router) {
|
|
971
|
-
SessionRouter.dispatchConnectionError(callback, method);
|
|
972
|
-
} else {
|
|
973
|
-
router.sendMessage(this.target.sessionId, this.domain, method, params, callback);
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
878
|
}
|
|
977
879
|
|
|
978
880
|
private invoke(method: QualifiedName, request: Object|null): Promise<Protocol.ProtocolResponseWithError> {
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
CustomFunctionMatcher,
|
|
25
25
|
defaultValueForCSSType,
|
|
26
26
|
EnvFunctionMatcher,
|
|
27
|
-
|
|
27
|
+
FlexGridMasonryMatcher,
|
|
28
28
|
GridTemplateMatcher,
|
|
29
29
|
LengthMatcher,
|
|
30
30
|
LightDarkColorMatcher,
|
|
@@ -939,7 +939,7 @@ export class CSSMatchedStyles {
|
|
|
939
939
|
new LinearGradientMatcher(),
|
|
940
940
|
new AnchorFunctionMatcher(),
|
|
941
941
|
new PositionAnchorMatcher(),
|
|
942
|
-
new
|
|
942
|
+
new FlexGridMasonryMatcher(),
|
|
943
943
|
new PositionTryMatcher(),
|
|
944
944
|
new LengthMatcher(),
|
|
945
945
|
new MathFunctionMatcher(),
|
|
@@ -1072,21 +1072,28 @@ export class CustomFunctionMatcher extends matcherBase(CustomFunctionMatch) {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
-
export
|
|
1076
|
-
|
|
1075
|
+
export const enum LayoutType {
|
|
1076
|
+
FLEX = 'flex',
|
|
1077
|
+
GRID = 'grid',
|
|
1078
|
+
MASONRY = 'masonry'
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
export class FlexGridMasonryMatch implements Match {
|
|
1082
|
+
constructor(readonly text: string, readonly node: CodeMirror.SyntaxNode, readonly layoutType: LayoutType) {
|
|
1077
1083
|
}
|
|
1078
1084
|
}
|
|
1079
1085
|
|
|
1080
1086
|
// clang-format off
|
|
1081
|
-
export class
|
|
1087
|
+
export class FlexGridMasonryMatcher extends matcherBase(FlexGridMasonryMatch) {
|
|
1082
1088
|
// clang-format on
|
|
1083
1089
|
static readonly FLEX = ['flex', 'inline-flex', 'block flex', 'inline flex'];
|
|
1084
1090
|
static readonly GRID = ['grid', 'inline-grid', 'block grid', 'inline grid'];
|
|
1091
|
+
static readonly MASONRY = ['masonry', 'inline-masonry', 'block masonry', 'inline masonry'];
|
|
1085
1092
|
override accepts(propertyName: string): boolean {
|
|
1086
1093
|
return propertyName === 'display';
|
|
1087
1094
|
}
|
|
1088
1095
|
|
|
1089
|
-
override matches(node: CodeMirror.SyntaxNode, matching: BottomUpTreeMatching):
|
|
1096
|
+
override matches(node: CodeMirror.SyntaxNode, matching: BottomUpTreeMatching): FlexGridMasonryMatch|null {
|
|
1090
1097
|
if (node.name !== 'Declaration') {
|
|
1091
1098
|
return null;
|
|
1092
1099
|
}
|
|
@@ -1098,11 +1105,14 @@ export class FlexGridMatcher extends matcherBase(FlexGridMatch) {
|
|
|
1098
1105
|
.map(node => matching.getComputedText(node).trim())
|
|
1099
1106
|
.filter(value => value);
|
|
1100
1107
|
const text = values.join(' ');
|
|
1101
|
-
if (
|
|
1102
|
-
return new
|
|
1108
|
+
if (FlexGridMasonryMatcher.FLEX.includes(text)) {
|
|
1109
|
+
return new FlexGridMasonryMatch(matching.ast.text(node), node, LayoutType.FLEX);
|
|
1110
|
+
}
|
|
1111
|
+
if (FlexGridMasonryMatcher.GRID.includes(text)) {
|
|
1112
|
+
return new FlexGridMasonryMatch(matching.ast.text(node), node, LayoutType.GRID);
|
|
1103
1113
|
}
|
|
1104
|
-
if (
|
|
1105
|
-
return new
|
|
1114
|
+
if (FlexGridMasonryMatcher.MASONRY.includes(text)) {
|
|
1115
|
+
return new FlexGridMasonryMatch(matching.ast.text(node), node, LayoutType.MASONRY);
|
|
1106
1116
|
}
|
|
1107
1117
|
return null;
|
|
1108
1118
|
}
|
|
@@ -1520,22 +1520,6 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
|
1520
1520
|
request.setTrustTokenOperationDoneEvent(event);
|
|
1521
1521
|
}
|
|
1522
1522
|
|
|
1523
|
-
subresourceWebBundleMetadataReceived(): void {
|
|
1524
|
-
// TODO: remove implementation after deleting this methods from definition in Network.pdl
|
|
1525
|
-
}
|
|
1526
|
-
|
|
1527
|
-
subresourceWebBundleMetadataError(): void {
|
|
1528
|
-
// TODO: remove implementation after deleting this methods from definition in Network.pdl
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
subresourceWebBundleInnerResponseParsed(): void {
|
|
1532
|
-
// TODO: remove implementation after deleting this methods from definition in Network.pdl
|
|
1533
|
-
}
|
|
1534
|
-
|
|
1535
|
-
subresourceWebBundleInnerResponseError(): void {
|
|
1536
|
-
// TODO: remove implementation after deleting this methods from definition in Network.pdl
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
1523
|
reportingApiReportAdded(data: Protocol.Network.ReportingApiReportAddedEvent): void {
|
|
1540
1524
|
this.#manager.dispatchEventToListeners(Events.ReportingApiReportAdded, data.report);
|
|
1541
1525
|
}
|
|
@@ -109,7 +109,7 @@ export class RehydratingConnection implements ProtocolClient.ConnectionTransport
|
|
|
109
109
|
if (this.#rehydratingWindow.opener) {
|
|
110
110
|
this.#rehydratingWindow.opener.postMessage({type: 'REHYDRATING_WINDOW_READY'});
|
|
111
111
|
} else if (this.#rehydratingWindow !== window.top) {
|
|
112
|
-
this.#rehydratingWindow.parent.postMessage({type: 'REHYDRATING_IFRAME_READY'});
|
|
112
|
+
this.#rehydratingWindow.parent.postMessage({type: 'REHYDRATING_IFRAME_READY'}, '*');
|
|
113
113
|
} else {
|
|
114
114
|
this.#onConnectionLost(i18nString(UIStrings.noHostWindow));
|
|
115
115
|
}
|