chrome-devtools-frontend 1.0.1646286 → 1.0.1649421

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/SECURITY.md +1 -1
  2. package/extension-api/ExtensionAPI.d.ts +26 -0
  3. package/front_end/core/common/Debouncer.ts +9 -1
  4. package/front_end/core/sdk/CSSMatchedStyles.ts +3 -1
  5. package/front_end/core/sdk/CSSMetadata.ts +1 -0
  6. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +65 -0
  7. package/front_end/generated/InspectorBackendCommands.ts +2 -1
  8. package/front_end/generated/SupportedCSSProperties.js +739 -21
  9. package/front_end/generated/protocol.ts +26 -0
  10. package/front_end/models/ai_assistance/AiAgent2.ts +14 -9
  11. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -3
  12. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +7 -0
  13. package/front_end/models/ai_assistance/agents/StorageAgent.ts +45 -0
  14. package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
  15. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  16. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
  17. package/front_end/models/ai_assistance/skills/network.md +16 -0
  18. package/front_end/models/ai_assistance/skills/styling.md +1 -1
  19. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +118 -0
  20. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +124 -0
  21. package/front_end/models/ai_assistance/tools/Tool.ts +2 -0
  22. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +4 -0
  23. package/front_end/models/emulation/EmulatedDevices.ts +430 -12
  24. package/front_end/models/extensions/ExtensionAPI.ts +47 -21
  25. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
  26. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +40 -1
  27. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -0
  28. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +228 -0
  29. package/front_end/panels/ai_assistance/components/ChatMessage.ts +39 -2
  30. package/front_end/panels/application/ApplicationPanelSidebar.ts +4 -0
  31. package/front_end/panels/application/CookieItemsView.ts +55 -6
  32. package/front_end/panels/application/DOMStorageItemsView.ts +43 -8
  33. package/front_end/panels/application/KeyValueStorageItemsView.ts +17 -9
  34. package/front_end/panels/application/WebMCPTreeElement.ts +8 -0
  35. package/front_end/panels/elements/StylePropertyTreeElement.ts +73 -16
  36. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +9 -1
  37. package/front_end/panels/elements/StylesSidebarPane.ts +22 -8
  38. package/front_end/panels/layer_viewer/PaintProfilerView.ts +309 -182
  39. package/front_end/panels/layer_viewer/paintProfiler.css +27 -23
  40. package/front_end/panels/layers/LayerPaintProfilerView.ts +86 -29
  41. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +210 -356
  42. package/front_end/panels/sources/watchExpressionsSidebarPane.css +7 -0
  43. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +5 -5
  44. package/front_end/panels/timeline/components/NetworkTrackWidget.ts +122 -0
  45. package/front_end/panels/timeline/components/components.ts +2 -0
  46. package/front_end/panels/timeline/components/networkTrackWidget.css +31 -0
  47. package/front_end/panels/timeline/timeline.ts +2 -0
  48. package/front_end/third_party/chromium/README.chromium +1 -1
  49. package/front_end/ui/components/buttons/FloatingButton.ts +17 -2
  50. package/front_end/ui/components/buttons/floatingButton.css +2 -2
  51. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +1 -1
  52. package/front_end/ui/legacy/TextPrompt.ts +24 -18
  53. package/front_end/ui/legacy/Treeoutline.ts +31 -4
  54. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +50 -24
  55. package/front_end/ui/legacy/components/utils/Linkifier.ts +10 -0
  56. package/front_end/ui/visual_logging/KnownContextValues.ts +13 -0
  57. package/package.json +1 -1
package/SECURITY.md CHANGED
@@ -18,7 +18,7 @@ Chrome DevTools is a privileged web app running in a sandboxed renderer process,
18
18
  * Triggering Chrome memory corruption exploits.
19
19
 
20
20
  ### Outside Threat Model
21
- * **Social Engineering:** Convincing developers to paste payloads into the Console or connect to malicious remote debugging ports.
21
+ * **Social Engineering:** Convincing developers to paste payloads into the Console, download and open a compromised file, or connect to malicious remote debugging ports, etc.
22
22
  * **Legitimate Data Exposure:** Displaying local user data, cookies, tokens, or auth headers within UI panels.
23
23
  * **Local Data Persistence:** Saving user-initiated traces, heaps, profiles, or logs to disk.
24
24
  * **Correctness & Availability:** Stale, misleading, or missing UI information (classified as functional bugs).
@@ -178,6 +178,20 @@ export namespace Chrome {
178
178
  }
179
179
 
180
180
  export interface Request {
181
+ /**
182
+ * Retrieves the content of the request.
183
+ *
184
+ * If a `callback` is provided, it is invoked with the content and encoding
185
+ * and the method returns `void`. If no `callback` is provided, the method
186
+ * returns a `Promise`.
187
+ *
188
+ * @param callback Optional callback to be invoked with the content and
189
+ * encoding.
190
+ * @returns A Promise that resolves to an object containing the content and
191
+ * encoding if no callback is provided, otherwise void. Rejects with an
192
+ * error object on failure.
193
+ */
194
+ getContent(): Promise<{content: string, encoding: string}>;
181
195
  getContent(callback: (content: string, encoding: string) => unknown): void;
182
196
  }
183
197
 
@@ -185,6 +199,18 @@ export namespace Chrome {
185
199
  onNavigated: EventSink<(url: string) => unknown>;
186
200
  onRequestFinished: EventSink<(request: Request) => unknown>;
187
201
 
202
+ /**
203
+ * Retrieves the HAR log that contains all network requests.
204
+ *
205
+ * If a `callback` is provided, it is invoked with the HAR log object
206
+ * and the method returns `void`. If no `callback` is provided, the method
207
+ * returns a `Promise`.
208
+ *
209
+ * @param callback Optional callback to be invoked with the HAR log.
210
+ * @returns A Promise that resolves to the HAR log if no callback is
211
+ * provided, otherwise void. Rejects with an error object on failure.
212
+ */
213
+ getHAR(): Promise<object>;
188
214
  getHAR(callback: (harLog: object) => unknown): void;
189
215
  }
190
216
 
@@ -5,12 +5,20 @@
5
5
  /**
6
6
  * Debounce utility function, ensures that the function passed in is only called once the function stops being called and the delay has expired.
7
7
  */
8
- export const debounce = function(func: (...args: any[]) => void, delay: number): (...args: any[]) => void {
8
+ export const debounce = function(
9
+ func: (...args: any[]) => void,
10
+ delay: number,
11
+ ): ((...args: any[]) => void)&{
12
+ cancel: () => void,
13
+ } {
9
14
  let timer: ReturnType<typeof setTimeout>;
10
15
  const debounced = (...args: any[]): void => {
11
16
  clearTimeout(timer);
12
17
  timer = setTimeout(() => func(...args), testDebounceOverride ? 0 : delay);
13
18
  };
19
+ debounced.cancel = () => {
20
+ clearTimeout(timer);
21
+ };
14
22
  return debounced;
15
23
  };
16
24
 
@@ -39,7 +39,8 @@ import {
39
39
  ShadowMatcher,
40
40
  StringMatcher,
41
41
  URLMatcher,
42
- VariableMatcher
42
+ VariableMatcher,
43
+ VariableNameMatcher
43
44
  } from './CSSPropertyParserMatchers.js';
44
45
  import {
45
46
  CSSAtRule,
@@ -979,6 +980,7 @@ export class CSSMatchedStyles {
979
980
  propertyMatchers(style: CSSStyleDeclaration, computedStyles: Map<string, string>|null): Array<Matcher<Match>> {
980
981
  return [
981
982
  new VariableMatcher(this, style),
983
+ new VariableNameMatcher(this, style),
982
984
  new ColorMatcher(() => computedStyles?.get('color') ?? null),
983
985
  new ColorMixMatcher(),
984
986
  new ContrastColorMatcher(),
@@ -1409,6 +1409,7 @@ const extraPropertyValues = new Map<string, Set<string>>([
1409
1409
  'superellipse(infinity)',
1410
1410
  ]),
1411
1411
  ],
1412
+ ['outline-style', new Set(['auto'])],
1412
1413
  ]);
1413
1414
 
1414
1415
  // Weight of CSS properties based on their usage from https://www.chromestatus.com/metrics/css/popularity
@@ -130,6 +130,71 @@ export class VariableMatcher extends matcherBase(VariableMatch) {
130
130
  }
131
131
  }
132
132
 
133
+ export class VariableNameMatch implements Match {
134
+ constructor(
135
+ readonly node: CodeMirror.SyntaxNode,
136
+ readonly text: string,
137
+ readonly matchedStyles: CSSMatchedStyles,
138
+ readonly style: CSSStyleDeclaration,
139
+ ) {
140
+ }
141
+
142
+ resolveVariable(): CSSVariableValue|null {
143
+ return this.matchedStyles.computeCSSVariable(this.style, this.text);
144
+ }
145
+ }
146
+
147
+ // clang-format off
148
+ export class VariableNameMatcher extends matcherBase(VariableNameMatch) {
149
+ // clang-format on
150
+ constructor(readonly matchedStyles: CSSMatchedStyles, readonly style: CSSStyleDeclaration) {
151
+ super();
152
+ }
153
+
154
+ override accepts(): boolean {
155
+ return true;
156
+ }
157
+
158
+ override matches(node: CodeMirror.SyntaxNode, matching: BottomUpTreeMatching): VariableNameMatch|null {
159
+ if (node.name !== 'VariableName' && node.name !== 'FeatureName' && node.name !== 'KeywordQuery') {
160
+ // TODO(b/484268589): The result shouldn't be KeywordQuery, but currently
161
+ // sometimes Lezer parses it that way. Fix this when Lezer is fixed.
162
+ return null;
163
+ }
164
+ const rawText = matching.ast.text(node);
165
+ if (!rawText.startsWith('--')) {
166
+ return null;
167
+ }
168
+
169
+ let cur: CodeMirror.SyntaxNode|null = node.parent;
170
+ let foundStyleCall: CodeMirror.SyntaxNode|null = null;
171
+ while (cur) {
172
+ if (cur.name === 'CallExpression') {
173
+ return null;
174
+ }
175
+ if (cur.name === 'CallQuery') {
176
+ const callee = cur.getChild('QueryCallee');
177
+ if (callee && matching.ast.text(callee) === 'style') {
178
+ foundStyleCall = cur;
179
+ break;
180
+ }
181
+ return null;
182
+ }
183
+ cur = cur.parent;
184
+ }
185
+
186
+ if (!foundStyleCall) {
187
+ return null;
188
+ }
189
+
190
+ // When parsing style(--foo > 10px), Lezer thinks it is a KeywordQuery and
191
+ // includes the > in the token with --foo. We need to strip it.
192
+ const text = node.name === 'KeywordQuery' ? rawText.split(/\s|[>!=<:]/)[0] : rawText;
193
+
194
+ return new VariableNameMatch(node, text, this.matchedStyles, this.style);
195
+ }
196
+ }
197
+
133
198
  export class AttributeMatch extends BaseVariableMatch {
134
199
  constructor(
135
200
  text: string,
@@ -291,7 +291,8 @@ inspectorBackend.registerType("CSS.InheritedAnimatedStyleEntry", [{"name": "anim
291
291
  inspectorBackend.registerType("CSS.InheritedPseudoElementMatches", [{"name": "pseudoElements", "type": "array", "optional": false, "description": "Matches of pseudo styles from the pseudos of an ancestor node.", "typeRef": "CSS.PseudoElementMatches"}]);
292
292
  inspectorBackend.registerType("CSS.RuleMatch", [{"name": "rule", "type": "object", "optional": false, "description": "CSS rule in the match.", "typeRef": "CSS.CSSRule"}, {"name": "matchingSelectors", "type": "array", "optional": false, "description": "Matching selector indices in the rule's selectorList selectors (0-based).", "typeRef": "integer"}]);
293
293
  inspectorBackend.registerType("CSS.Value", [{"name": "text", "type": "string", "optional": false, "description": "Value text.", "typeRef": null}, {"name": "range", "type": "object", "optional": true, "description": "Value range in the underlying resource (if available).", "typeRef": "CSS.SourceRange"}, {"name": "specificity", "type": "object", "optional": true, "description": "Specificity of the selector.", "typeRef": "CSS.Specificity"}]);
294
- inspectorBackend.registerType("CSS.Specificity", [{"name": "a", "type": "number", "optional": false, "description": "The a component, which represents the number of ID selectors.", "typeRef": null}, {"name": "b", "type": "number", "optional": false, "description": "The b component, which represents the number of class selectors, attributes selectors, and pseudo-classes.", "typeRef": null}, {"name": "c", "type": "number", "optional": false, "description": "The c component, which represents the number of type selectors and pseudo-elements.", "typeRef": null}]);
294
+ inspectorBackend.registerType("CSS.SpecificityComponent", [{"name": "text", "type": "string", "optional": false, "description": "The simple selector text that contributes to specificity.", "typeRef": null}, {"name": "a", "type": "number", "optional": false, "description": "The a component contribution.", "typeRef": null}, {"name": "b", "type": "number", "optional": false, "description": "The b component contribution.", "typeRef": null}, {"name": "c", "type": "number", "optional": false, "description": "The c component contribution.", "typeRef": null}]);
295
+ inspectorBackend.registerType("CSS.Specificity", [{"name": "a", "type": "number", "optional": false, "description": "The a component, which represents the number of ID selectors.", "typeRef": null}, {"name": "b", "type": "number", "optional": false, "description": "The b component, which represents the number of class selectors, attributes selectors, and pseudo-classes.", "typeRef": null}, {"name": "c", "type": "number", "optional": false, "description": "The c component, which represents the number of type selectors and pseudo-elements.", "typeRef": null}, {"name": "components", "type": "array", "optional": true, "description": "Per-simple-selector contributions used to explain this specificity.", "typeRef": "CSS.SpecificityComponent"}]);
295
296
  inspectorBackend.registerType("CSS.SelectorList", [{"name": "selectors", "type": "array", "optional": false, "description": "Selectors in the list.", "typeRef": "CSS.Value"}, {"name": "text", "type": "string", "optional": false, "description": "Rule selector text.", "typeRef": null}]);
296
297
  inspectorBackend.registerType("CSS.CSSStyleSheetHeader", [{"name": "styleSheetId", "type": "string", "optional": false, "description": "The stylesheet identifier.", "typeRef": "DOM.StyleSheetId"}, {"name": "frameId", "type": "string", "optional": false, "description": "Owner frame identifier.", "typeRef": "Page.FrameId"}, {"name": "sourceURL", "type": "string", "optional": false, "description": "Stylesheet resource URL. Empty if this is a constructed stylesheet created using new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported as a CSS module script).", "typeRef": null}, {"name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with the stylesheet (if any).", "typeRef": null}, {"name": "origin", "type": "string", "optional": false, "description": "Stylesheet origin.", "typeRef": "CSS.StyleSheetOrigin"}, {"name": "title", "type": "string", "optional": false, "description": "Stylesheet title.", "typeRef": null}, {"name": "ownerNode", "type": "number", "optional": true, "description": "The backend id for the owner node of the stylesheet.", "typeRef": "DOM.BackendNodeId"}, {"name": "disabled", "type": "boolean", "optional": false, "description": "Denotes whether the stylesheet is disabled.", "typeRef": null}, {"name": "hasSourceURL", "type": "boolean", "optional": true, "description": "Whether the sourceURL field value comes from the sourceURL comment.", "typeRef": null}, {"name": "isInline", "type": "boolean", "optional": false, "description": "Whether this stylesheet is created for STYLE tag by parser. This flag is not set for document.written STYLE tags.", "typeRef": null}, {"name": "isMutable", "type": "boolean", "optional": false, "description": "Whether this stylesheet is mutable. Inline stylesheets become mutable after they have been modified via CSSOM API. `<link>` element's stylesheets become mutable only if DevTools modifies them. Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.", "typeRef": null}, {"name": "isConstructed", "type": "boolean", "optional": false, "description": "True if this stylesheet is created through new CSSStyleSheet() or imported as a CSS module script.", "typeRef": null}, {"name": "startLine", "type": "number", "optional": false, "description": "Line offset of the stylesheet within the resource (zero based).", "typeRef": null}, {"name": "startColumn", "type": "number", "optional": false, "description": "Column offset of the stylesheet within the resource (zero based).", "typeRef": null}, {"name": "length", "type": "number", "optional": false, "description": "Size of the content (in characters).", "typeRef": null}, {"name": "endLine", "type": "number", "optional": false, "description": "Line offset of the end of the stylesheet within the resource (zero based).", "typeRef": null}, {"name": "endColumn", "type": "number", "optional": false, "description": "Column offset of the end of the stylesheet within the resource (zero based).", "typeRef": null}, {"name": "loadingFailed", "type": "boolean", "optional": true, "description": "If the style sheet was loaded from a network resource, this indicates when the resource failed to load", "typeRef": null}]);
297
298
  inspectorBackend.registerType("CSS.CSSRule", [{"name": "styleSheetId", "type": "string", "optional": true, "description": "The css style sheet identifier (absent for user agent stylesheet and user-specified stylesheet rules) this rule came from.", "typeRef": "DOM.StyleSheetId"}, {"name": "selectorList", "type": "object", "optional": false, "description": "Rule selector data.", "typeRef": "CSS.SelectorList"}, {"name": "nestingSelectors", "type": "array", "optional": true, "description": "Array of selectors from ancestor style rules, sorted by distance from the current rule.", "typeRef": "string"}, {"name": "origin", "type": "string", "optional": false, "description": "Parent stylesheet's origin.", "typeRef": "CSS.StyleSheetOrigin"}, {"name": "style", "type": "object", "optional": false, "description": "Associated style declaration.", "typeRef": "CSS.CSSStyle"}, {"name": "originTreeScopeNodeId", "type": "number", "optional": true, "description": "The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.", "typeRef": "DOM.BackendNodeId"}, {"name": "media", "type": "array", "optional": true, "description": "Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards.", "typeRef": "CSS.CSSMedia"}, {"name": "containerQueries", "type": "array", "optional": true, "description": "Container query list array (for rules involving container queries). The array enumerates container queries starting with the innermost one, going outwards.", "typeRef": "CSS.CSSContainerQuery"}, {"name": "supports", "type": "array", "optional": true, "description": "@supports CSS at-rule array. The array enumerates @supports at-rules starting with the innermost one, going outwards.", "typeRef": "CSS.CSSSupports"}, {"name": "layers", "type": "array", "optional": true, "description": "Cascade layer array. Contains the layer hierarchy that this rule belongs to starting with the innermost layer and going outwards.", "typeRef": "CSS.CSSLayer"}, {"name": "scopes", "type": "array", "optional": true, "description": "@scope CSS at-rule array. The array enumerates @scope at-rules starting with the innermost one, going outwards.", "typeRef": "CSS.CSSScope"}, {"name": "ruleTypes", "type": "array", "optional": true, "description": "The array keeps the types of ancestor CSSRules from the innermost going outwards.", "typeRef": "CSS.CSSRuleType"}, {"name": "startingStyles", "type": "array", "optional": true, "description": "@starting-style CSS at-rule array. The array enumerates @starting-style at-rules starting with the innermost one, going outwards.", "typeRef": "CSS.CSSStartingStyle"}, {"name": "navigations", "type": "array", "optional": true, "description": "@navigation CSS at-rule array. The array enumerates @navigation at-rules starting with the innermost one, going outwards.", "typeRef": "CSS.CSSNavigation"}]);