chrome-devtools-frontend 1.0.1033423 → 1.0.1034802

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 (29) hide show
  1. package/config/gni/devtools_grd_files.gni +5 -0
  2. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
  3. package/front_end/core/host/UserMetrics.ts +23 -0
  4. package/front_end/core/root/Runtime.ts +11 -1
  5. package/front_end/core/sdk/NetworkManager.ts +19 -5
  6. package/front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.ts +19 -8
  7. package/front_end/entrypoints/main/MainImpl.ts +5 -1
  8. package/front_end/models/issues_manager/AttributionReportingIssue.ts +30 -4
  9. package/front_end/models/issues_manager/CookieIssue.ts +14 -0
  10. package/front_end/models/issues_manager/descriptions/arSourceAndTriggerHeaders.md +9 -0
  11. package/front_end/models/issues_manager/descriptions/arSourceIgnored.md +13 -0
  12. package/front_end/models/issues_manager/descriptions/arTriggerIgnored.md +12 -0
  13. package/front_end/models/issues_manager/descriptions/cookieExcludeDomainNonAscii.md +11 -0
  14. package/front_end/models/issues_manager/descriptions/cookieWarnDomainNonAscii.md +11 -0
  15. package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -2
  16. package/front_end/panels/console/ConsolePinPane.ts +2 -2
  17. package/front_end/panels/elements/CSSRuleValidator.ts +169 -101
  18. package/front_end/panels/elements/CSSRuleValidatorHelper.ts +13 -7
  19. package/front_end/panels/elements/StylePropertiesSection.ts +8 -0
  20. package/front_end/panels/elements/StylePropertyTreeElement.ts +35 -31
  21. package/front_end/panels/elements/StylesSidebarPane.ts +24 -0
  22. package/front_end/panels/elements/components/CSSHintDetailsView.ts +5 -5
  23. package/front_end/panels/elements/components/LayoutPane.ts +1 -1
  24. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +10 -0
  25. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +9 -6
  26. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +17 -1
  27. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +1 -0
  28. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +2 -2
  29. package/package.json +1 -1
@@ -218,6 +218,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
218
218
  #urlToChangeTracker: Map<Platform.DevToolsPath.UrlString, ChangeTracker> = new Map();
219
219
  #copyChangesButton?: UI.Toolbar.ToolbarButton;
220
220
  #updateAbortController?: AbortController;
221
+ #updateComputedStylesAbortController?: AbortController;
221
222
 
222
223
  static instance(): StylesSidebarPane {
223
224
  if (!stylesSidebarPaneInstance) {
@@ -753,10 +754,12 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
753
754
  for (const section of this.allSections()) {
754
755
  section.styleSheetEdited(edit);
755
756
  }
757
+ void this.refreshComputedStyles();
756
758
  return;
757
759
  }
758
760
 
759
761
  if (this.userOperation || this.isEditingStyle) {
762
+ void this.refreshComputedStyles();
760
763
  return;
761
764
  }
762
765
 
@@ -764,6 +767,27 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
764
767
  this.update();
765
768
  }
766
769
 
770
+ async refreshComputedStyles(): Promise<void> {
771
+ this.#updateComputedStylesAbortController?.abort();
772
+ this.#updateAbortController = new AbortController();
773
+ const signal = this.#updateAbortController.signal;
774
+ const matchedStyles = await this.fetchMatchedCascade();
775
+ const nodeId = this.node()?.id;
776
+ const parentNodeId = matchedStyles?.getParentLayoutNodeId();
777
+
778
+ const [computedStyles, parentsComputedStyles] =
779
+ await Promise.all([this.fetchComputedStylesFor(nodeId), this.fetchComputedStylesFor(parentNodeId)]);
780
+
781
+ if (signal.aborted) {
782
+ return;
783
+ }
784
+
785
+ for (const section of this.allSections()) {
786
+ section.setComputedStyles(computedStyles);
787
+ section.setParentsComputedStyles(parentsComputedStyles);
788
+ }
789
+ }
790
+
767
791
  focusedSectionIndex(): number {
768
792
  let index = 0;
769
793
  for (const block of this.sectionBlocks) {
@@ -20,10 +20,10 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
20
  const {render, html, Directives} = LitHtml;
21
21
 
22
22
  interface Hint {
23
- getHintPrefix(): string;
24
- getHintMessage(): string;
25
- getPossibleFixMessage(): string|null;
26
- getLearnMoreLink(): string|undefined;
23
+ getPrefix(): string;
24
+ getMessage(): string;
25
+ getPossibleFixMessage(): string|null;
26
+ getLearnMoreLink(): string|undefined;
27
27
  }
28
28
 
29
29
  export class CSSHintDetailsView extends HTMLElement {
@@ -44,7 +44,7 @@ export class CSSHintDetailsView extends HTMLElement {
44
44
  render(html`
45
45
  <div class="hint-popup-wrapper">
46
46
  <div class="hint-popup-reason">
47
- <strong>${this.#authoringHint.getHintPrefix()}:</strong> ${Directives.unsafeHTML(this.#authoringHint.getHintMessage())}
47
+ <strong>${this.#authoringHint.getPrefix()}:</strong> ${Directives.unsafeHTML(this.#authoringHint.getMessage())}
48
48
  </div>
49
49
  ${this.#authoringHint.getPossibleFixMessage() ? html`
50
50
  <div class="hint-popup-possible-fix">
@@ -267,7 +267,7 @@ export class LayoutPane extends HTMLElement {
267
267
  } as NodeText.NodeText.NodeTextData}></${NodeText.NodeText.NodeText.litTagName}>
268
268
  </span>
269
269
  </label>
270
- <label @keyup=${onColorLabelKeyUp} @keydown=${onColorLabelKeyDown} tabindex="0" title=${i18nString(UIStrings.chooseElementOverlayColor)} class="color-picker-label" style="background: ${element.color};">
270
+ <label @keyup=${onColorLabelKeyUp} @keydown=${onColorLabelKeyDown} tabindex="0" title=${i18nString(UIStrings.chooseElementOverlayColor)} aria-label=${i18nString(UIStrings.chooseElementOverlayColor)} class="color-picker-label" style="background: ${element.color};">
271
271
  <input @change=${onColorChange} @input=${onColorChange} tabindex="-1" class="color-picker" type="color" value=${element.color} />
272
272
  </label>
273
273
  <button tabindex="0" @click=${onElementClick} title=${i18nString(UIStrings.showElementInTheElementsPanel)} class="show-element"></button>
@@ -62,6 +62,8 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
62
62
  case IssuesManager.AttributionReportingIssue.IssueCode.InvalidRegisterSourceHeader:
63
63
  case IssuesManager.AttributionReportingIssue.IssueCode.InvalidRegisterTriggerHeader:
64
64
  case IssuesManager.AttributionReportingIssue.IssueCode.InvalidEligibleHeader:
65
+ case IssuesManager.AttributionReportingIssue.IssueCode.SourceIgnored:
66
+ case IssuesManager.AttributionReportingIssue.IssueCode.TriggerIgnored:
65
67
  this.appendColumnTitle(header, i18nString(UIStrings.request));
66
68
  this.appendColumnTitle(header, i18nString(UIStrings.invalidHeaderValue));
67
69
  break;
@@ -79,6 +81,9 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
79
81
  this.appendColumnTitle(header, i18nString(UIStrings.element));
80
82
  this.appendColumnTitle(header, i18nString(UIStrings.maximumConcurrentRegistrations));
81
83
  break;
84
+ case IssuesManager.AttributionReportingIssue.IssueCode.SourceAndTriggerHeaders:
85
+ this.appendColumnTitle(header, i18nString(UIStrings.request));
86
+ break;
82
87
  }
83
88
 
84
89
  this.affectedResources.appendChild(header);
@@ -102,6 +107,8 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
102
107
  case IssuesManager.AttributionReportingIssue.IssueCode.InvalidRegisterSourceHeader:
103
108
  case IssuesManager.AttributionReportingIssue.IssueCode.InvalidRegisterTriggerHeader:
104
109
  case IssuesManager.AttributionReportingIssue.IssueCode.InvalidEligibleHeader:
110
+ case IssuesManager.AttributionReportingIssue.IssueCode.SourceIgnored:
111
+ case IssuesManager.AttributionReportingIssue.IssueCode.TriggerIgnored:
105
112
  this.#appendRequestOrEmptyCell(element, details.request);
106
113
  this.appendIssueDetailCell(element, details.invalidParameter || '');
107
114
  break;
@@ -119,6 +126,9 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
119
126
  await this.#appendElementOrEmptyCell(element, issue);
120
127
  this.appendIssueDetailCell(element, details.invalidParameter || '');
121
128
  break;
129
+ case IssuesManager.AttributionReportingIssue.IssueCode.SourceAndTriggerHeaders:
130
+ this.#appendRequestOrEmptyCell(element, details.request);
131
+ break;
122
132
  }
123
133
 
124
134
  this.affectedResources.appendChild(element);
@@ -63,6 +63,7 @@ export class ProtocolService {
63
63
  private parallelConnection?: ProtocolClient.InspectorBackend.Connection;
64
64
  private lighthouseWorkerPromise?: Promise<Worker>;
65
65
  private lighthouseMessageUpdateCallback?: ((arg0: string) => void);
66
+ private configForTesting?: Object;
66
67
 
67
68
  async attach(): Promise<void> {
68
69
  await SDK.TargetManager.TargetManager.instance().suspendAllTargets();
@@ -113,6 +114,7 @@ export class ProtocolService {
113
114
  url: inspectedURL,
114
115
  categoryIDs,
115
116
  flags,
117
+ config: this.configForTesting,
116
118
  locales: this.getLocales(),
117
119
  target: this.targetInfo,
118
120
  });
@@ -134,6 +136,7 @@ export class ProtocolService {
134
136
  url: inspectedURL,
135
137
  categoryIDs,
136
138
  flags,
139
+ config: this.configForTesting,
137
140
  locales: this.getLocales(),
138
141
  target: this.targetInfo,
139
142
  });
@@ -178,7 +181,7 @@ export class ProtocolService {
178
181
  method?: string,
179
182
  };
180
183
  if (protocolMessage.sessionId || (protocolMessage.method && protocolMessage.method.startsWith('Target'))) {
181
- void this.send('dispatchProtocolMessage', {message: JSON.stringify(message)});
184
+ void this.send('dispatchProtocolMessage', {message});
182
185
  }
183
186
  }
184
187
 
@@ -215,7 +218,7 @@ export class ProtocolService {
215
218
  }
216
219
 
217
220
  private onWorkerMessage(event: MessageEvent): void {
218
- const lighthouseMessage = JSON.parse(event.data);
221
+ const lighthouseMessage = event.data;
219
222
 
220
223
  if (lighthouseMessage.action === 'statusUpdate') {
221
224
  if (this.lighthouseMessageUpdateCallback && lighthouseMessage.args && 'message' in lighthouseMessage.args) {
@@ -237,17 +240,17 @@ export class ProtocolService {
237
240
  private async send(action: string, args: {[x: string]: string|string[]|Object} = {}): Promise<void> {
238
241
  const worker = await this.ensureWorkerExists();
239
242
  const messageId = lastId++;
240
- worker.postMessage(JSON.stringify({id: messageId, action, args: {...args, id: messageId}}));
243
+ worker.postMessage({id: messageId, action, args: {...args, id: messageId}});
241
244
  }
242
245
 
243
246
  /** sendWithResponse currently only handles the original startLighthouse request and LHR-filled response. */
244
- private async sendWithResponse(action: string, args: {[x: string]: string|string[]|Object} = {}):
247
+ private async sendWithResponse(action: string, args: {[x: string]: string|string[]|Object|undefined} = {}):
245
248
  Promise<ReportRenderer.RunnerResult> {
246
249
  const worker = await this.ensureWorkerExists();
247
250
  const messageId = lastId++;
248
251
  const messageResult = new Promise<ReportRenderer.RunnerResult>(resolve => {
249
252
  const workerListener = (event: MessageEvent): void => {
250
- const lighthouseMessage = JSON.parse(event.data);
253
+ const lighthouseMessage = event.data;
251
254
 
252
255
  if (lighthouseMessage.id === messageId) {
253
256
  worker.removeEventListener('message', workerListener);
@@ -256,7 +259,7 @@ export class ProtocolService {
256
259
  };
257
260
  worker.addEventListener('message', workerListener);
258
261
  });
259
- worker.postMessage(JSON.stringify({id: messageId, action, args: {...args, id: messageId}}));
262
+ worker.postMessage({id: messageId, action, args: {...args, id: messageId}});
260
263
 
261
264
  return messageResult;
262
265
  }
@@ -307,6 +307,22 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
307
307
  return objType.slice(0, objType.length - 1);
308
308
  }
309
309
 
310
+ // When inspecting a pointer variable, we indicate that we display the pointed-to object in the viewer
311
+ // by prepending an asterisk to the pointer expression's name (mimicking C++ dereferencing).
312
+ // If the object isn't a pointer, we return the expression unchanged.
313
+ //
314
+ // Examples:
315
+ // (int *) myNumber -> (int) *myNumber
316
+ // (int[]) numbers -> (int[]) numbers
317
+ static extractObjectName(obj: Bindings.DebuggerLanguagePlugins.ValueNode, expression: string): string {
318
+ const lastChar = obj.description?.charAt(obj.description.length - 1);
319
+ const isPointerType = lastChar === '*';
320
+ if (isPointerType) {
321
+ return '*' + expression;
322
+ }
323
+ return expression;
324
+ }
325
+
310
326
  async openInspectorView(obj: SDK.RemoteObject.RemoteObject, address?: number, expression?: string): Promise<void> {
311
327
  const response = await LinearMemoryInspectorController.retrieveDWARFMemoryObjectAndAddress(obj);
312
328
  let memoryObj = obj;
@@ -368,7 +384,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
368
384
  highlightInfo = {
369
385
  startAddress: obj.inspectableAddress || 0,
370
386
  size: LinearMemoryInspectorController.extractObjectSize(obj),
371
- name: expression,
387
+ name: expression ? LinearMemoryInspectorController.extractObjectName(obj, expression) : expression,
372
388
  type: LinearMemoryInspectorController.extractObjectTypeDescription(obj),
373
389
  };
374
390
  } catch (err) {
@@ -27,6 +27,7 @@ export const markdownLinks = new Map<string, string>([
27
27
  ],
28
28
  ['issueQuirksModeDoctype', 'https://web.dev/doctype/'],
29
29
  ['sameSiteAndSameOrigin', 'https://web.dev/same-site-same-origin/'],
30
+ ['punycodeReference', 'https://wikipedia.org/wiki/Punycode'],
30
31
  // Link URLs for deprecation issues (see blink::Deprecation)
31
32
  ['https://xhr.spec.whatwg.org/', 'https://xhr.spec.whatwg.org/'],
32
33
  ['https://goo.gle/chrome-insecure-origins', 'https://goo.gle/chrome-insecure-origins'],
@@ -36,7 +36,7 @@ export class JavaScriptREPL {
36
36
 
37
37
  static async evaluateAndBuildPreview(
38
38
  text: string, throwOnSideEffect: boolean, replMode: boolean, timeout?: number, allowErrors?: boolean,
39
- objectGroup?: string, awaitPromise: boolean = false): Promise<{
39
+ objectGroup?: string, awaitPromise: boolean = false, silent: boolean = false): Promise<{
40
40
  preview: DocumentFragment,
41
41
  result: SDK.RuntimeModel.EvaluationResult|null,
42
42
  }> {
@@ -56,7 +56,7 @@ export class JavaScriptREPL {
56
56
  objectGroup: objectGroup,
57
57
  disableBreaks: true,
58
58
  replMode: replMode,
59
- silent: undefined,
59
+ silent: silent,
60
60
  returnByValue: undefined,
61
61
  allowUnsafeEvalBlockedByCSP: undefined,
62
62
  };
package/package.json CHANGED
@@ -56,5 +56,5 @@
56
56
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
57
57
  "watch": "vpython third_party/node/node.py --output scripts/watch_build.js"
58
58
  },
59
- "version": "1.0.1033423"
59
+ "version": "1.0.1034802"
60
60
  }