chrome-devtools-mcp 0.1.0 → 0.2.1
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/README.md +33 -11
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Progress.js +60 -53
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Settings.js +3 -32
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/GdpClient.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/UserMetrics.js +5 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/i18n/i18n.js +35 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js +2 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/root/Runtime.js +4 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMatchedStyles.js +11 -10
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParserMatchers.js +24 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DebuggerModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EnhancedTracesParser.js +29 -24
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkManager.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkRequest.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RehydratingConnection.js +9 -15
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RemoteObject.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ResourceTreeModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RuntimeModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServiceWorkerManager.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMap.js +4 -31
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TraceObject.js +5 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/InspectorBackendCommands.js +4 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/SupportedCSSProperties.js +12 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js +259 -179
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js +366 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/UnitFormatters.js +10 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AICallTree.js +366 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js +75 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIQueries.js +105 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CSSWorkspaceBinding.js +243 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CompilerScriptMapping.js +407 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ContentProviderBasedProject.js +130 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerLanguagePlugins.js +992 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerWorkspaceBinding.js +574 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DefaultScriptMapping.js +112 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/FileUtils.js +186 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/LiveLocation.js +60 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/NetworkProject.js +107 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/PresentationConsoleMessageHelper.js +244 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceMapping.js +473 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceScriptMapping.js +399 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceUtils.js +87 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/SASSSourceMapping.js +181 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/StylesSourceMapping.js +268 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/TempFile.js +55 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/bindings.js +20 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/crux-manager/CrUXManager.js +283 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/crux-manager/crux-manager.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/DeviceModeModel.js +775 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/EmulatedDevices.js +1706 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/emulation/emulation.js +6 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/FormatterWorkerPool.js +131 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/ScriptFormatter.js +77 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/formatter.js +6 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/geometry/GeometryImpl.js +347 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/geometry/geometry.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/NamesResolver.js +626 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/ScopeChainModel.js +59 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/ScopeTreeCache.js +32 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/source_map_scopes.js +7 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTrace.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceImpl.js +67 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceModel.js +97 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/Trie.js +113 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/stack_trace.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/stack_trace_impl.js +7 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/text_utils/TextUtils.js +23 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/ModelImpl.js +4 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Processor.js +16 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/AuctionWorkletsHandler.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/FramesHandler.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LayoutShiftsHandler.js +3 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js +10 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ScreenshotsHandler.js +0 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ScriptsHandler.js +4 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/UserInteractionsHandler.js +2 -10
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/UserTimingsHandler.js +3 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/SamplesIntegrator.js +8 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Trace.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/CLSCulprits.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DocumentLatency.js +5 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DuplicatedJavaScript.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/INPBreakdown.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ImageDelivery.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ModernHTTP.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/NetworkDependencyTree.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js +21 -21
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace_source_maps_resolver/SourceMapsResolver.js +201 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace_source_maps_resolver/trace_source_maps_resolver.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/FileManager.js +64 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/IgnoreListManager.js +511 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/SearchConfig.js +113 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/UISourceCode.js +563 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/WorkspaceImpl.js +204 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/workspace.js +9 -0
- package/build/src/McpContext.js +84 -19
- package/build/src/McpResponse.js +8 -7
- package/build/src/WaitForHelper.js +123 -0
- package/build/src/browser.js +15 -10
- package/build/src/index.js +4 -6
- package/build/src/logger.js +1 -0
- package/build/src/tools/input.js +12 -13
- package/build/src/tools/pages.js +2 -3
- package/build/src/tools/performance.js +31 -4
- package/build/src/tools/screenshot.js +1 -1
- package/build/src/tools/script.js +40 -15
- package/build/src/trace-processing/parse.js +26 -22
- package/package.json +15 -12
- package/build/src/waitForHelpers.js +0 -109
package/README.md
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
# Chrome DevTools MCP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
[](https://npmjs.org/package/chrome-devtools-mcp)
|
|
4
|
+
|
|
5
|
+
`chrome-devtools-mcp` lets your coding agent (such as Gemini, Claude, Cursor or Copilot)
|
|
6
|
+
control and inspect a live Chrome browser. It acts as a Model-Context-Protocol
|
|
7
|
+
(MCP) server, giving your AI coding assistant access to the full power of
|
|
8
|
+
Chrome DevTools for reliable automation, in-depth debugging, and performance analysis.
|
|
6
9
|
|
|
7
10
|
## Key features
|
|
8
11
|
|
|
9
12
|
- **Get performance insights**: Uses [Chrome
|
|
10
13
|
DevTools](https://github.com/ChromeDevTools/devtools-frontend) to record
|
|
11
|
-
traces and extract performance insights.
|
|
14
|
+
traces and extract actionable performance insights.
|
|
12
15
|
- **Advanced browser debugging**: Analyze network requests, take screenshots and
|
|
13
16
|
check the browser console.
|
|
14
17
|
- **Reliable automation**. Uses
|
|
@@ -46,7 +49,7 @@ Add the following config to your MCP client:
|
|
|
46
49
|
> [!NOTE]
|
|
47
50
|
> Using `chrome-devtools-mcp@latest` ensures that your MCP client will always use the latest version of the Chrome DevTools MCP server.
|
|
48
51
|
|
|
49
|
-
### MCP Client
|
|
52
|
+
### MCP Client configuration
|
|
50
53
|
|
|
51
54
|
<details>
|
|
52
55
|
<summary>Claude Code</summary>
|
|
@@ -75,7 +78,15 @@ claude mcp add chrome-devtools npx chrome-devtools-mcp@latest
|
|
|
75
78
|
|
|
76
79
|
<details>
|
|
77
80
|
<summary>Cursor</summary>
|
|
78
|
-
|
|
81
|
+
|
|
82
|
+
**Click the button to install:**
|
|
83
|
+
|
|
84
|
+
[<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/en/install-mcp?name=chrome-devtools&config=eyJjb21tYW5kIjoibnB4IGNocm9tZS1kZXZ0b29scy1tY3BAbGF0ZXN0In0%3D)
|
|
85
|
+
|
|
86
|
+
**Or install manually:**
|
|
87
|
+
|
|
88
|
+
Go to `Cursor Settings` -> `MCP` -> `New MCP Server`. Use the config provided above.
|
|
89
|
+
|
|
79
90
|
</details>
|
|
80
91
|
|
|
81
92
|
<details>
|
|
@@ -114,7 +125,8 @@ claude mcp add chrome-devtools npx chrome-devtools-mcp@latest
|
|
|
114
125
|
- [`emulate_cpu`](docs/tool-reference.md#emulate_cpu)
|
|
115
126
|
- [`emulate_network`](docs/tool-reference.md#emulate_network)
|
|
116
127
|
- [`resize_page`](docs/tool-reference.md#resize_page)
|
|
117
|
-
- **Performance** (
|
|
128
|
+
- **Performance** (3 tools)
|
|
129
|
+
- [`performance_analyze_insight`](docs/tool-reference.md#performance_analyze_insight)
|
|
118
130
|
- [`performance_start_trace`](docs/tool-reference.md#performance_start_trace)
|
|
119
131
|
- [`performance_stop_trace`](docs/tool-reference.md#performance_stop_trace)
|
|
120
132
|
- **Network** (2 tools)
|
|
@@ -153,10 +165,9 @@ The Chrome DevTools MCP server supports the following configuration option:
|
|
|
153
165
|
- **Default:** `false`
|
|
154
166
|
|
|
155
167
|
- **`--channel`**
|
|
156
|
-
Specify a different Chrome channel that should be used.
|
|
168
|
+
Specify a different Chrome channel that should be used. The default is the stable channel version.
|
|
157
169
|
- **Type:** string
|
|
158
170
|
- **Choices:** `stable`, `canary`, `beta`, `dev`
|
|
159
|
-
- **Default:** `stable`
|
|
160
171
|
|
|
161
172
|
<!-- END AUTO GENERATED OPTIONS -->
|
|
162
173
|
|
|
@@ -187,10 +198,21 @@ You can also run `npx chrome-devtools-mcp@latest --help` to see all available co
|
|
|
187
198
|
`chrome-devtools-mcp` starts a Chrome's stable channel instance using the following user
|
|
188
199
|
data directory:
|
|
189
200
|
|
|
190
|
-
- Linux / MacOS: `$HOME/.cache/chrome-devtools-mcp/
|
|
191
|
-
- Window: `%HOMEPATH%/.cache/chrome-devtools-mcp/
|
|
201
|
+
- Linux / MacOS: `$HOME/.cache/chrome-devtools-mcp/chrome-profile-$CHANNEL`
|
|
202
|
+
- Window: `%HOMEPATH%/.cache/chrome-devtools-mcp/chrome-profile-$CHANNEL`
|
|
192
203
|
|
|
193
204
|
The user data directory is not cleared between runs and shared across
|
|
194
205
|
all instances of `chrome-devtools-mcp`. Set the `isolated` option to `true`
|
|
195
206
|
to use a temporary user data dir instead which will be cleared automatically after
|
|
196
207
|
the browser is closed.
|
|
208
|
+
|
|
209
|
+
## Known limitations
|
|
210
|
+
|
|
211
|
+
### Operating system sandboxes
|
|
212
|
+
|
|
213
|
+
Some MCP clients allow sandboxing the MCP server using macOS Seatbelt or Linux
|
|
214
|
+
containers. If sandboxes are enabled, `chrome-devtools-mcp` is not able to start
|
|
215
|
+
Chrome that requires permissions to create its own sandboxes. As a workaround,
|
|
216
|
+
either disable sandboxing for `chrome-devtools-mcp` in your MCP client or use
|
|
217
|
+
`--connect-url` to connect to a Chrome instance that you start manually outside
|
|
218
|
+
of the MCP client sandbox.
|
|
@@ -2,19 +2,11 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
export class Progress {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
incrementWorked(_worked) {
|
|
12
|
-
}
|
|
13
|
-
done() {
|
|
14
|
-
}
|
|
15
|
-
isCanceled() {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
5
|
+
totalWork = 0;
|
|
6
|
+
worked = 0;
|
|
7
|
+
title = undefined;
|
|
8
|
+
canceled = false;
|
|
9
|
+
done = false;
|
|
18
10
|
}
|
|
19
11
|
export class CompositeProgress {
|
|
20
12
|
parent;
|
|
@@ -24,14 +16,14 @@ export class CompositeProgress {
|
|
|
24
16
|
this.parent = parent;
|
|
25
17
|
this.#children = [];
|
|
26
18
|
this.#childrenDone = 0;
|
|
27
|
-
this.parent.
|
|
28
|
-
this.parent.
|
|
19
|
+
this.parent.totalWork = 1;
|
|
20
|
+
this.parent.worked = 0;
|
|
29
21
|
}
|
|
30
22
|
childDone() {
|
|
31
23
|
if (++this.#childrenDone !== this.#children.length) {
|
|
32
24
|
return;
|
|
33
25
|
}
|
|
34
|
-
this.parent.done
|
|
26
|
+
this.parent.done = true;
|
|
35
27
|
}
|
|
36
28
|
createSubProgress(weight) {
|
|
37
29
|
const child = new SubProgress(this, weight);
|
|
@@ -43,12 +35,12 @@ export class CompositeProgress {
|
|
|
43
35
|
let done = 0;
|
|
44
36
|
for (let i = 0; i < this.#children.length; ++i) {
|
|
45
37
|
const child = this.#children[i];
|
|
46
|
-
if (child.
|
|
47
|
-
done += child.
|
|
38
|
+
if (child.totalWork) {
|
|
39
|
+
done += child.weight * child.worked / child.totalWork;
|
|
48
40
|
}
|
|
49
|
-
totalWeights += child.
|
|
41
|
+
totalWeights += child.weight;
|
|
50
42
|
}
|
|
51
|
-
this.parent.
|
|
43
|
+
this.parent.worked = done / totalWeights;
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
46
|
export class SubProgress {
|
|
@@ -62,76 +54,91 @@ export class SubProgress {
|
|
|
62
54
|
this.#worked = 0;
|
|
63
55
|
this.#totalWork = 0;
|
|
64
56
|
}
|
|
65
|
-
|
|
66
|
-
return this.#composite.parent.
|
|
57
|
+
get canceled() {
|
|
58
|
+
return this.#composite.parent.canceled;
|
|
67
59
|
}
|
|
68
|
-
|
|
69
|
-
this.#composite.parent.
|
|
60
|
+
set title(title) {
|
|
61
|
+
this.#composite.parent.title = title;
|
|
70
62
|
}
|
|
71
|
-
done() {
|
|
72
|
-
|
|
63
|
+
set done(done) {
|
|
64
|
+
if (!done) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.worked = this.#totalWork;
|
|
73
68
|
this.#composite.childDone();
|
|
74
69
|
}
|
|
75
|
-
|
|
70
|
+
set totalWork(totalWork) {
|
|
76
71
|
this.#totalWork = totalWork;
|
|
77
72
|
this.#composite.update();
|
|
78
73
|
}
|
|
79
|
-
|
|
74
|
+
set worked(worked) {
|
|
80
75
|
this.#worked = worked;
|
|
81
|
-
if (typeof title !== 'undefined') {
|
|
82
|
-
this.setTitle(title);
|
|
83
|
-
}
|
|
84
76
|
this.#composite.update();
|
|
85
77
|
}
|
|
86
|
-
|
|
87
|
-
this.setWorked(this.#worked + (worked || 1));
|
|
88
|
-
}
|
|
89
|
-
getWeight() {
|
|
78
|
+
get weight() {
|
|
90
79
|
return this.#weight;
|
|
91
80
|
}
|
|
92
|
-
|
|
81
|
+
get worked() {
|
|
93
82
|
return this.#worked;
|
|
94
83
|
}
|
|
95
|
-
|
|
84
|
+
get totalWork() {
|
|
96
85
|
return this.#totalWork;
|
|
97
86
|
}
|
|
98
87
|
}
|
|
99
88
|
export class ProgressProxy {
|
|
100
89
|
#delegate;
|
|
101
90
|
#doneCallback;
|
|
102
|
-
|
|
91
|
+
#updateCallback;
|
|
92
|
+
constructor(delegate, doneCallback, updateCallback) {
|
|
103
93
|
this.#delegate = delegate;
|
|
104
94
|
this.#doneCallback = doneCallback;
|
|
95
|
+
this.#updateCallback = updateCallback;
|
|
105
96
|
}
|
|
106
|
-
|
|
107
|
-
return this.#delegate ? this.#delegate.
|
|
97
|
+
get canceled() {
|
|
98
|
+
return this.#delegate ? this.#delegate.canceled : false;
|
|
108
99
|
}
|
|
109
|
-
|
|
100
|
+
set title(title) {
|
|
110
101
|
if (this.#delegate) {
|
|
111
|
-
this.#delegate.
|
|
102
|
+
this.#delegate.title = title;
|
|
103
|
+
}
|
|
104
|
+
if (this.#updateCallback) {
|
|
105
|
+
this.#updateCallback();
|
|
112
106
|
}
|
|
113
107
|
}
|
|
114
|
-
|
|
108
|
+
get title() {
|
|
109
|
+
return this.#delegate?.title ?? '';
|
|
110
|
+
}
|
|
111
|
+
set done(done) {
|
|
115
112
|
if (this.#delegate) {
|
|
116
|
-
this.#delegate.done
|
|
113
|
+
this.#delegate.done = done;
|
|
117
114
|
}
|
|
118
|
-
if (this.#doneCallback) {
|
|
115
|
+
if (done && this.#doneCallback) {
|
|
119
116
|
this.#doneCallback();
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.#delegate.setTotalWork(totalWork);
|
|
125
|
-
}
|
|
119
|
+
get done() {
|
|
120
|
+
return this.#delegate ? this.#delegate.done : false;
|
|
126
121
|
}
|
|
127
|
-
|
|
122
|
+
set totalWork(totalWork) {
|
|
128
123
|
if (this.#delegate) {
|
|
129
|
-
this.#delegate.
|
|
124
|
+
this.#delegate.totalWork = totalWork;
|
|
130
125
|
}
|
|
126
|
+
if (this.#updateCallback) {
|
|
127
|
+
this.#updateCallback();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
get totalWork() {
|
|
131
|
+
return this.#delegate ? this.#delegate.totalWork : 0;
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
+
set worked(worked) {
|
|
133
134
|
if (this.#delegate) {
|
|
134
|
-
this.#delegate.
|
|
135
|
+
this.#delegate.worked = worked;
|
|
135
136
|
}
|
|
137
|
+
if (this.#updateCallback) {
|
|
138
|
+
this.#updateCallback?.();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
get worked() {
|
|
142
|
+
return this.#delegate ? this.#delegate.worked : 0;
|
|
136
143
|
}
|
|
137
144
|
}
|
|
@@ -95,7 +95,6 @@ export class Settings {
|
|
|
95
95
|
* If you are creating a setting that you expect the user to control, and
|
|
96
96
|
* sync, prefer {@see createSetting}
|
|
97
97
|
*/
|
|
98
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
99
98
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
99
|
moduleSetting(settingName) {
|
|
101
100
|
const setting = this.moduleSettings.get(settingName);
|
|
@@ -493,7 +492,6 @@ export class Setting {
|
|
|
493
492
|
this.storage.dumpSizes();
|
|
494
493
|
}
|
|
495
494
|
}
|
|
496
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
497
495
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
496
|
export class RegExpSetting extends Setting {
|
|
499
497
|
#regexFlags;
|
|
@@ -539,6 +537,9 @@ export class RegExpSetting extends Setting {
|
|
|
539
537
|
return this.#regex;
|
|
540
538
|
}
|
|
541
539
|
}
|
|
540
|
+
// The VersionController does a lot of mapping and restructuring which often need
|
|
541
|
+
// typecasting to any, allow it in there
|
|
542
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
542
543
|
export class VersionController {
|
|
543
544
|
static GLOBAL_VERSION_SETTING_NAME = 'inspectorVersion';
|
|
544
545
|
static SYNCED_VERSION_SETTING_NAME = 'syncedInspectorVersion';
|
|
@@ -673,16 +674,12 @@ export class VersionController {
|
|
|
673
674
|
const showMode = hidden ? 'OnlyMain' : 'Both';
|
|
674
675
|
const newSetting = Settings.instance().createSetting(newName, {});
|
|
675
676
|
const newValue = newSetting.get() || {};
|
|
676
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
677
677
|
// @ts-expect-error
|
|
678
678
|
newValue.vertical = newValue.vertical || {};
|
|
679
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
680
679
|
// @ts-expect-error
|
|
681
680
|
newValue.vertical.showMode = showMode;
|
|
682
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
683
681
|
// @ts-expect-error
|
|
684
682
|
newValue.horizontal = newValue.horizontal || {};
|
|
685
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
686
683
|
// @ts-expect-error
|
|
687
684
|
newValue.horizontal.showMode = showMode;
|
|
688
685
|
newSetting.set(newValue);
|
|
@@ -755,7 +752,6 @@ export class VersionController {
|
|
|
755
752
|
const newList = [];
|
|
756
753
|
for (let i = 0; i < list.length; ++i) {
|
|
757
754
|
const value = list[i];
|
|
758
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
759
755
|
const device = {};
|
|
760
756
|
device['title'] = value['title'];
|
|
761
757
|
device['type'] = 'unknown';
|
|
@@ -793,8 +789,6 @@ export class VersionController {
|
|
|
793
789
|
Settings.instance().createSetting('networkConditions', defaultValue).set(defaultValue);
|
|
794
790
|
}
|
|
795
791
|
updateVersionFrom14To15() {
|
|
796
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
797
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
798
792
|
const setting = Settings.instance().createLocalSetting('workspaceExcludedFolders', {});
|
|
799
793
|
const oldValue = setting.get();
|
|
800
794
|
const newValue = {};
|
|
@@ -807,8 +801,6 @@ export class VersionController {
|
|
|
807
801
|
setting.set(newValue);
|
|
808
802
|
}
|
|
809
803
|
updateVersionFrom15To16() {
|
|
810
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
811
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
812
804
|
const setting = Settings.instance().createSetting('InspectorView.panelOrder', {});
|
|
813
805
|
const tabOrders = setting.get();
|
|
814
806
|
for (const key of Object.keys(tabOrders)) {
|
|
@@ -817,8 +809,6 @@ export class VersionController {
|
|
|
817
809
|
setting.set(tabOrders);
|
|
818
810
|
}
|
|
819
811
|
updateVersionFrom16To17() {
|
|
820
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
821
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
822
812
|
const setting = Settings.instance().createSetting('networkConditionsCustomProfiles', []);
|
|
823
813
|
const oldValue = setting.get();
|
|
824
814
|
const newValue = [];
|
|
@@ -836,8 +826,6 @@ export class VersionController {
|
|
|
836
826
|
setting.set(newValue);
|
|
837
827
|
}
|
|
838
828
|
updateVersionFrom17To18() {
|
|
839
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
840
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
841
829
|
const setting = Settings.instance().createLocalSetting('workspaceExcludedFolders', {});
|
|
842
830
|
const oldValue = setting.get();
|
|
843
831
|
const newValue = {};
|
|
@@ -857,8 +845,6 @@ export class VersionController {
|
|
|
857
845
|
}
|
|
858
846
|
updateVersionFrom18To19() {
|
|
859
847
|
const defaultColumns = { status: true, type: true, initiator: true, size: true, time: true };
|
|
860
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
861
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
862
848
|
const visibleColumnSettings = Settings.instance().createSetting('networkLogColumnsVisibility', defaultColumns);
|
|
863
849
|
const visibleColumns = visibleColumnSettings.get();
|
|
864
850
|
visibleColumns.name = true;
|
|
@@ -888,8 +874,6 @@ export class VersionController {
|
|
|
888
874
|
networkColumns.set(columns);
|
|
889
875
|
}
|
|
890
876
|
updateVersionFrom21To22() {
|
|
891
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
892
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
893
877
|
const breakpointsSetting = Settings.instance().createLocalSetting('breakpoints', []);
|
|
894
878
|
const breakpoints = breakpointsSetting.get();
|
|
895
879
|
for (const breakpoint of breakpoints) {
|
|
@@ -909,8 +893,6 @@ export class VersionController {
|
|
|
909
893
|
}
|
|
910
894
|
updateVersionFrom24To25() {
|
|
911
895
|
const defaultColumns = { status: true, type: true, initiator: true, size: true, time: true };
|
|
912
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
913
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
914
896
|
const networkLogColumnsSetting = Settings.instance().createSetting('networkLogColumns', defaultColumns);
|
|
915
897
|
const columns = networkLogColumnsSetting.get();
|
|
916
898
|
delete columns.product;
|
|
@@ -921,8 +903,6 @@ export class VersionController {
|
|
|
921
903
|
const urls = Object.keys(oldSetting.get());
|
|
922
904
|
const textFilter = urls.map(url => `-url:${url}`).join(' ');
|
|
923
905
|
if (textFilter) {
|
|
924
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
925
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
926
906
|
const textFilterSetting = Settings.instance().createSetting('console.textFilter', '');
|
|
927
907
|
const suffix = textFilterSetting.get() ? ` ${textFilterSetting.get()}` : '';
|
|
928
908
|
textFilterSetting.set(`${textFilter}${suffix}`);
|
|
@@ -931,8 +911,6 @@ export class VersionController {
|
|
|
931
911
|
}
|
|
932
912
|
updateVersionFrom26To27() {
|
|
933
913
|
function renameKeyInObjectSetting(settingName, from, to) {
|
|
934
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
935
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
936
914
|
const setting = Settings.instance().createSetting(settingName, {});
|
|
937
915
|
const value = setting.get();
|
|
938
916
|
if (from in value) {
|
|
@@ -960,8 +938,6 @@ export class VersionController {
|
|
|
960
938
|
}
|
|
961
939
|
updateVersionFrom28To29() {
|
|
962
940
|
function renameKeyInObjectSetting(settingName, from, to) {
|
|
963
|
-
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
964
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
965
941
|
const setting = Settings.instance().createSetting(settingName, {});
|
|
966
942
|
const value = setting.get();
|
|
967
943
|
if (from in value) {
|
|
@@ -1007,7 +983,6 @@ export class VersionController {
|
|
|
1007
983
|
// this change we synchronized the breakpoint only by URL, but since we don't
|
|
1008
984
|
// know on which resource type the given breakpoint was set, we just assume
|
|
1009
985
|
// 'script' here to keep things simple.
|
|
1010
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1011
986
|
const breakpointsSetting = Settings.instance().createLocalSetting('breakpoints', []);
|
|
1012
987
|
const breakpoints = breakpointsSetting.get();
|
|
1013
988
|
for (const breakpoint of breakpoints) {
|
|
@@ -1016,11 +991,9 @@ export class VersionController {
|
|
|
1016
991
|
breakpointsSetting.set(breakpoints);
|
|
1017
992
|
}
|
|
1018
993
|
updateVersionFrom32To33() {
|
|
1019
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1020
994
|
const previouslyViewedFilesSetting = Settings.instance().createLocalSetting('previouslyViewedFiles', []);
|
|
1021
995
|
let previouslyViewedFiles = previouslyViewedFilesSetting.get();
|
|
1022
996
|
// Discard old 'previouslyViewedFiles' items that don't have a 'url' property.
|
|
1023
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1024
997
|
previouslyViewedFiles = previouslyViewedFiles.filter((previouslyViewedFile) => 'url' in previouslyViewedFile);
|
|
1025
998
|
// Introduce the new 'resourceTypeName' property on previously viewed files.
|
|
1026
999
|
// Prior to this change we only keyed them based on the URL, but since we
|
|
@@ -1042,7 +1015,6 @@ export class VersionController {
|
|
|
1042
1015
|
// the future.
|
|
1043
1016
|
const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
|
|
1044
1017
|
const logpointSuffix = ')';
|
|
1045
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1046
1018
|
const breakpointsSetting = Settings.instance().createLocalSetting('breakpoints', []);
|
|
1047
1019
|
const breakpoints = breakpointsSetting.get();
|
|
1048
1020
|
for (const breakpoint of breakpoints) {
|
|
@@ -1059,7 +1031,6 @@ export class VersionController {
|
|
|
1059
1031
|
// the future.
|
|
1060
1032
|
const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
|
|
1061
1033
|
const logpointSuffix = ')';
|
|
1062
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1063
1034
|
const breakpointsSetting = Settings.instance().createLocalSetting('breakpoints', []);
|
|
1064
1035
|
const breakpoints = breakpointsSetting.get();
|
|
1065
1036
|
for (const breakpoint of breakpoints) {
|
|
@@ -39,7 +39,7 @@ function normalizeBadgeName(name) {
|
|
|
39
39
|
}
|
|
40
40
|
export const GOOGLE_DEVELOPER_PROGRAM_PROFILE_LINK = 'https://developers.google.com/profile/u/me';
|
|
41
41
|
async function makeHttpRequest(request) {
|
|
42
|
-
if (!Root.Runtime.hostConfig.devToolsGdpProfiles?.enabled) {
|
|
42
|
+
if (!Root.Runtime.hostConfig.devToolsGdpProfiles?.enabled || Root.Runtime.hostConfig.isOffTheRecord) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
const response = await new Promise(resolve => {
|
|
@@ -418,7 +418,11 @@ export var Action;
|
|
|
418
418
|
Action[Action["AiAssistanceOpenedFromPerformanceInsight"] = 182] = "AiAssistanceOpenedFromPerformanceInsight";
|
|
419
419
|
Action[Action["AiAssistanceOpenedFromPerformanceFullButton"] = 183] = "AiAssistanceOpenedFromPerformanceFullButton";
|
|
420
420
|
Action[Action["AiCodeCompletionResponseServedFromCache"] = 184] = "AiCodeCompletionResponseServedFromCache";
|
|
421
|
-
Action[Action["
|
|
421
|
+
Action[Action["AiCodeCompletionRequestTriggered"] = 185] = "AiCodeCompletionRequestTriggered";
|
|
422
|
+
Action[Action["AiCodeCompletionSuggestionDisplayed"] = 186] = "AiCodeCompletionSuggestionDisplayed";
|
|
423
|
+
Action[Action["AiCodeCompletionSuggestionAccepted"] = 187] = "AiCodeCompletionSuggestionAccepted";
|
|
424
|
+
Action[Action["AiCodeCompletionError"] = 188] = "AiCodeCompletionError";
|
|
425
|
+
Action[Action["MAX_VALUE"] = 189] = "MAX_VALUE";
|
|
422
426
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
423
427
|
})(Action || (Action = {}));
|
|
424
428
|
export var PanelCodes;
|
|
@@ -694,7 +698,6 @@ export var DevtoolsExperiments;
|
|
|
694
698
|
DevtoolsExperiments[DevtoolsExperiments["just-my-code"] = 65] = "just-my-code";
|
|
695
699
|
DevtoolsExperiments[DevtoolsExperiments["use-source-map-scopes"] = 76] = "use-source-map-scopes";
|
|
696
700
|
DevtoolsExperiments[DevtoolsExperiments["timeline-show-postmessage-events"] = 86] = "timeline-show-postmessage-events";
|
|
697
|
-
DevtoolsExperiments[DevtoolsExperiments["timeline-save-as-gz"] = 108] = "timeline-save-as-gz";
|
|
698
701
|
DevtoolsExperiments[DevtoolsExperiments["timeline-enhanced-traces"] = 90] = "timeline-enhanced-traces";
|
|
699
702
|
DevtoolsExperiments[DevtoolsExperiments["timeline-compiled-sources"] = 91] = "timeline-compiled-sources";
|
|
700
703
|
DevtoolsExperiments[DevtoolsExperiments["timeline-debug-mode"] = 93] = "timeline-debug-mode";
|
|
@@ -1,9 +1,36 @@
|
|
|
1
|
+
|
|
1
2
|
export const i18n = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
registerUIStrings: () => {},
|
|
4
|
+
getLocalizedString: (_, str) => {
|
|
5
|
+
// So that the string passed in gets output verbatim.
|
|
6
|
+
return str;
|
|
7
|
+
},
|
|
8
|
+
lockedLazyString: () => {},
|
|
9
|
+
getLazilyComputedLocalizedString: () => {},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// TODO(jacktfranklin): once the DocumentLatency insight does not depend on
|
|
13
|
+
// this method, we can remove this stub.
|
|
14
|
+
export const TimeUtilities = {
|
|
15
|
+
millisToString(x) {
|
|
16
|
+
const separator = ' ';
|
|
17
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
18
|
+
style: 'unit',
|
|
19
|
+
unitDisplay: 'narrow',
|
|
20
|
+
minimumFractionDigits: 0,
|
|
21
|
+
maximumFractionDigits: 1,
|
|
22
|
+
unit: 'millisecond',
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const parts = formatter.formatToParts(x);
|
|
26
|
+
for (const part of parts) {
|
|
27
|
+
if (part.type === 'literal') {
|
|
28
|
+
if (part.value === ' ') {
|
|
29
|
+
part.value = separator;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return parts.map(part => part.value).join('');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -81,10 +81,12 @@ export class InspectorBackend {
|
|
|
81
81
|
}
|
|
82
82
|
let connectionFactory;
|
|
83
83
|
export class Connection {
|
|
84
|
+
// on message from browser
|
|
84
85
|
setOnMessage(_onMessage) {
|
|
85
86
|
}
|
|
86
87
|
setOnDisconnect(_onDisconnect) {
|
|
87
88
|
}
|
|
89
|
+
// send raw CDP message to browser
|
|
88
90
|
sendRawMessage(_message) {
|
|
89
91
|
}
|
|
90
92
|
disconnect() {
|
|
@@ -5,7 +5,7 @@ import * as Platform from '../platform/platform.js';
|
|
|
5
5
|
import { CSSMetadata, cssMetadata } from './CSSMetadata.js';
|
|
6
6
|
import { CSSProperty } from './CSSProperty.js';
|
|
7
7
|
import * as PropertyParser from './CSSPropertyParser.js';
|
|
8
|
-
import { AnchorFunctionMatcher, AngleMatcher, AttributeMatcher, AutoBaseMatcher, BaseVariableMatcher, BezierMatcher, BinOpMatcher, ColorMatcher, ColorMixMatcher, defaultValueForCSSType, EnvFunctionMatcher, FlexGridMatcher, GridTemplateMatcher, LengthMatcher, LightDarkColorMatcher, LinearGradientMatcher, LinkableNameMatcher, localEvalCSS, MathFunctionMatcher, PositionAnchorMatcher, PositionTryMatcher, RelativeColorChannelMatcher, ShadowMatcher, StringMatcher, URLMatcher, VariableMatcher } from './CSSPropertyParserMatchers.js';
|
|
8
|
+
import { AnchorFunctionMatcher, AngleMatcher, AttributeMatcher, AutoBaseMatcher, BaseVariableMatcher, BezierMatcher, BinOpMatcher, ColorMatcher, ColorMixMatcher, CustomFunctionMatcher, defaultValueForCSSType, EnvFunctionMatcher, FlexGridMatcher, GridTemplateMatcher, LengthMatcher, LightDarkColorMatcher, LinearGradientMatcher, LinkableNameMatcher, localEvalCSS, MathFunctionMatcher, PositionAnchorMatcher, PositionTryMatcher, RelativeColorChannelMatcher, ShadowMatcher, StringMatcher, URLMatcher, VariableMatcher } from './CSSPropertyParserMatchers.js';
|
|
9
9
|
import { CSSFontPaletteValuesRule, CSSFunctionRule, CSSKeyframeRule, CSSKeyframesRule, CSSPositionTryRule, CSSPropertyRule, CSSStyleRule, } from './CSSRule.js';
|
|
10
10
|
import { CSSStyleDeclaration, Type } from './CSSStyleDeclaration.js';
|
|
11
11
|
function containsStyle(styles, query) {
|
|
@@ -713,6 +713,7 @@ export class CSSMatchedStyles {
|
|
|
713
713
|
new PositionTryMatcher(),
|
|
714
714
|
new LengthMatcher(),
|
|
715
715
|
new MathFunctionMatcher(),
|
|
716
|
+
new CustomFunctionMatcher(),
|
|
716
717
|
new AutoBaseMatcher(),
|
|
717
718
|
new BinOpMatcher(),
|
|
718
719
|
new RelativeColorChannelMatcher(),
|
|
@@ -997,9 +998,9 @@ class DOMInheritanceCascade {
|
|
|
997
998
|
if (!nodeCascade) {
|
|
998
999
|
return null;
|
|
999
1000
|
}
|
|
1000
|
-
return this
|
|
1001
|
+
return this.#computeCSSVariable(nodeCascade, variableName);
|
|
1001
1002
|
}
|
|
1002
|
-
|
|
1003
|
+
#computeCSSVariable(nodeCascade, variableName, sccRecord = new SCCRecord()) {
|
|
1003
1004
|
const availableCSSVariables = this.#availableCSSVariables.get(nodeCascade);
|
|
1004
1005
|
const computedCSSVariables = this.#computedCSSVariables.get(nodeCascade);
|
|
1005
1006
|
if (!computedCSSVariables || !availableCSSVariables?.has(variableName)) {
|
|
@@ -1029,7 +1030,7 @@ class DOMInheritanceCascade {
|
|
|
1029
1030
|
if (!ast) {
|
|
1030
1031
|
return null;
|
|
1031
1032
|
}
|
|
1032
|
-
return this
|
|
1033
|
+
return this.#walkTree(nodeCascade, ast, definedValue.declaration.style, variableName, sccRecord, definedValue.declaration);
|
|
1033
1034
|
}
|
|
1034
1035
|
computeAttribute(style, attributeName, type) {
|
|
1035
1036
|
this.ensureInitialized();
|
|
@@ -1037,7 +1038,7 @@ class DOMInheritanceCascade {
|
|
|
1037
1038
|
if (!nodeCascade) {
|
|
1038
1039
|
return null;
|
|
1039
1040
|
}
|
|
1040
|
-
return this
|
|
1041
|
+
return this.#computeAttribute(nodeCascade, style, attributeName, type, new SCCRecord());
|
|
1041
1042
|
}
|
|
1042
1043
|
attributeValueAsType(style, attributeName, type) {
|
|
1043
1044
|
const rawValue = this.#matchedStyles.rawAttributeValueFromStyle(style, attributeName);
|
|
@@ -1055,9 +1056,9 @@ class DOMInheritanceCascade {
|
|
|
1055
1056
|
if (!ast) {
|
|
1056
1057
|
return null;
|
|
1057
1058
|
}
|
|
1058
|
-
return this
|
|
1059
|
+
return this.#walkTree(nodeCascade, ast, style, `attr(${attributeName})`, sccRecord)?.value ?? null;
|
|
1059
1060
|
}
|
|
1060
|
-
|
|
1061
|
+
#computeAttribute(nodeCascade, style, attributeName, type, sccRecord = new SCCRecord()) {
|
|
1061
1062
|
if (type.isCSSTokens) {
|
|
1062
1063
|
const value = this.attributeValueWithSubstitutions(nodeCascade, style, attributeName, sccRecord);
|
|
1063
1064
|
if (value !== null && localEvalCSS(value, type.type) !== null) {
|
|
@@ -1067,7 +1068,7 @@ class DOMInheritanceCascade {
|
|
|
1067
1068
|
}
|
|
1068
1069
|
return this.attributeValueAsType(style, attributeName, type.type);
|
|
1069
1070
|
}
|
|
1070
|
-
|
|
1071
|
+
#walkTree(outerNodeCascade, ast, parentStyle, substitutionName, sccRecord, declaration) {
|
|
1071
1072
|
const record = sccRecord.add(outerNodeCascade, substitutionName);
|
|
1072
1073
|
const computedCSSVariablesMap = this.#computedCSSVariables;
|
|
1073
1074
|
const innerNodeCascade = this.#styleToNodeCascade.get(parentStyle);
|
|
@@ -1081,7 +1082,7 @@ class DOMInheritanceCascade {
|
|
|
1081
1082
|
// bubbling up the minimum discovery time whenever we close a cycle.
|
|
1082
1083
|
const matching = PropertyParser.BottomUpTreeMatching.walk(ast, [
|
|
1083
1084
|
new BaseVariableMatcher(match => {
|
|
1084
|
-
const { value, mayFallback } = recurseWithCycleDetection(match.name, nodeCascade => this
|
|
1085
|
+
const { value, mayFallback } = recurseWithCycleDetection(match.name, nodeCascade => this.#computeCSSVariable(nodeCascade, match.name, sccRecord)?.value ?? null);
|
|
1085
1086
|
if (!mayFallback || value !== null) {
|
|
1086
1087
|
return value;
|
|
1087
1088
|
}
|
|
@@ -1268,7 +1269,7 @@ class DOMInheritanceCascade {
|
|
|
1268
1269
|
for (const variableName of variableNames) {
|
|
1269
1270
|
const prevValue = accumulatedCSSVariables.get(variableName);
|
|
1270
1271
|
accumulatedCSSVariables.delete(variableName);
|
|
1271
|
-
const computedValue = this
|
|
1272
|
+
const computedValue = this.#computeCSSVariable(nodeCascade, variableName);
|
|
1272
1273
|
if (prevValue && computedValue?.value === prevValue.value) {
|
|
1273
1274
|
computedValue.declaration = prevValue.declaration;
|
|
1274
1275
|
}
|