chrome-devtools-frontend 1.0.1028626 → 1.0.1029795

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 (38) hide show
  1. package/config/gni/devtools_grd_files.gni +6 -5
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/clear-warning_icon.svg +99 -0
  4. package/front_end/core/common/WasmDisassembly.ts +6 -1
  5. package/front_end/core/host/ResourceLoader.ts +17 -3
  6. package/front_end/core/i18n/locales/en-US.json +9 -3
  7. package/front_end/core/i18n/locales/en-XL.json +9 -3
  8. package/front_end/core/sdk/NetworkManager.ts +3 -1
  9. package/front_end/core/sdk/Script.ts +39 -13
  10. package/front_end/generated/InspectorBackendCommands.js +6 -6
  11. package/front_end/generated/SupportedCSSProperties.js +2 -4
  12. package/front_end/generated/protocol.ts +29 -10
  13. package/front_end/models/bindings/ContentProviderBasedProject.ts +7 -1
  14. package/front_end/models/issues_manager/AttributionReportingIssue.ts +26 -40
  15. package/front_end/models/issues_manager/DeprecationIssue.ts +17 -2
  16. package/front_end/models/issues_manager/descriptions/arInsecureContext.md +7 -0
  17. package/front_end/models/issues_manager/descriptions/arInvalidEligibleHeader.md +19 -0
  18. package/front_end/models/issues_manager/descriptions/arInvalidRegisterSourceHeader.md +5 -0
  19. package/front_end/models/issues_manager/descriptions/arInvalidRegisterTriggerHeader.md +5 -0
  20. package/front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md +7 -4
  21. package/front_end/models/issues_manager/descriptions/arUntrustworthyReportingOrigin.md +10 -0
  22. package/front_end/models/text_utils/ContentProvider.ts +9 -1
  23. package/front_end/panels/elements/StylePropertyTreeElement.ts +3 -23
  24. package/front_end/panels/elements/StylesSidebarPane.ts +31 -1
  25. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +13 -42
  26. package/front_end/panels/network/components/RequestHeadersView.ts +58 -28
  27. package/front_end/panels/network/network-meta.ts +16 -0
  28. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +80 -22
  29. package/front_end/panels/timeline/TimelineLoader.ts +2 -1
  30. package/front_end/ui/legacy/SplitWidget.ts +2 -0
  31. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  32. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +9 -51
  33. package/package.json +1 -1
  34. package/front_end/models/issues_manager/descriptions/arAttributionSourceUntrustworthyFrameOrigin.md +0 -4
  35. package/front_end/models/issues_manager/descriptions/arAttributionSourceUntrustworthyOrigin.md +0 -5
  36. package/front_end/models/issues_manager/descriptions/arAttributionUntrustworthyFrameOrigin.md +0 -4
  37. package/front_end/models/issues_manager/descriptions/arAttributionUntrustworthyOrigin.md +0 -4
  38. package/front_end/models/issues_manager/descriptions/arInvalidHeader.md +0 -3
@@ -82,6 +82,11 @@ const UIStrings = {
82
82
  *@description A placeholder for an input in Protocol Monitor. The input accepts commands that are sent to the backend on Enter. CDP stands for Chrome DevTools Protocol.
83
83
  */
84
84
  sendRawCDPCommand: 'Send a raw `CDP` command',
85
+ /**
86
+ * @description A tooltip text for the input in the Protocol Monitor panel. The tooltip describes what format is expected.
87
+ */
88
+ sendRawCDPCommandExplanation:
89
+ 'Format: `\'Domain.commandName\'` for a command without parameters, or `\'{"command":"Domain.commandName", "parameters": {...}}\'` as a JSON object for a command with parameters. `\'cmd\'`/`\'method\'` and `\'args\'`/`\'params\'`/`\'arguments\'` are also supported as alternative keys for the `JSON` object.',
85
90
  };
86
91
  const str_ = i18n.i18n.registerUIStrings('panels/protocol_monitor/ProtocolMonitor.ts', UIStrings);
87
92
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -120,6 +125,8 @@ export class ProtocolMonitorImpl extends UI.Widget.VBox {
120
125
  private messages: LogMessage[] = [];
121
126
  private isRecording: boolean = false;
122
127
 
128
+ #historyAutocompleteDataProvider = new HistoryAutocompleteDataProvider();
129
+
123
130
  constructor() {
124
131
  super(true);
125
132
  this.started = false;
@@ -287,31 +294,35 @@ export class ProtocolMonitorImpl extends UI.Widget.VBox {
287
294
  });
288
295
  topToolbar.appendToolbarItem(this.textFilterUI);
289
296
 
290
- const onSend = (): void => {
291
- const value = input.value();
292
- // If input cannot be parsed as json, we assume it's the command name
293
- // for a command without parameters. Otherwise, we expect an object
294
- // with "command" and "parameters" attributes.
295
- let json = null;
296
- try {
297
- json = JSON.parse(value);
298
- } catch (err) {
299
- }
300
- const command = json ? json.command : value;
301
- const parameters = json ? json.parameters : null;
302
- const test = ProtocolClient.InspectorBackend.test;
303
- // TODO: TS thinks that properties are read-only because
304
- // in TS test is defined as a namespace.
305
- // @ts-ignore
306
- test.sendRawMessage(command, parameters, () => {});
307
- };
308
- const input = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.sendRawCDPCommand), '', 1, .2, '', undefined, false);
309
- input.addEventListener(UI.Toolbar.ToolbarInput.Event.EnterPressed, onSend);
310
297
  const bottomToolbar = new UI.Toolbar.Toolbar('protocol-monitor-bottom-toolbar', this.contentElement);
311
- bottomToolbar.appendToolbarItem(input);
298
+ bottomToolbar.appendToolbarItem(this.#createCommandInput());
312
299
  }
313
300
 
314
- static instance(opts = {forceNew: null}): ProtocolMonitorImpl {
301
+ #createCommandInput(): UI.Toolbar.ToolbarInput {
302
+ const placeholder = i18nString(UIStrings.sendRawCDPCommand);
303
+ const accessiblePlaceholder = placeholder;
304
+ const growFactor = 1;
305
+ const shrinkFactor = 0.2;
306
+ const tooltip = i18nString(UIStrings.sendRawCDPCommandExplanation);
307
+ const input = new UI.Toolbar.ToolbarInput(
308
+ placeholder, accessiblePlaceholder, growFactor, shrinkFactor, tooltip,
309
+ this.#historyAutocompleteDataProvider.buildTextPromptCompletions, false);
310
+ input.addEventListener(UI.Toolbar.ToolbarInput.Event.EnterPressed, () => this.#onCommandSend(input));
311
+ return input;
312
+ }
313
+
314
+ #onCommandSend(input: UI.Toolbar.ToolbarInput): void {
315
+ const value = input.value();
316
+ const {command, parameters} = parseCommandInput(value);
317
+ const test = ProtocolClient.InspectorBackend.test;
318
+ // TODO: TS thinks that properties are read-only because
319
+ // in TS test is defined as a namespace.
320
+ // @ts-ignore
321
+ test.sendRawMessage(command, parameters, () => {});
322
+ this.#historyAutocompleteDataProvider.addEntry(value);
323
+ }
324
+
325
+ static instance(opts: {forceNew: null|boolean} = {forceNew: null}): ProtocolMonitorImpl {
315
326
  const {forceNew} = opts;
316
327
  if (!protocolMonitorImplInstance || forceNew) {
317
328
  protocolMonitorImplInstance = new ProtocolMonitorImpl();
@@ -481,6 +492,39 @@ export class ProtocolMonitorImpl extends UI.Widget.VBox {
481
492
  }
482
493
  }
483
494
 
495
+ export class HistoryAutocompleteDataProvider {
496
+ #maxHistorySize = 200;
497
+ #commandHistory = new Set<string>();
498
+
499
+ constructor(maxHistorySize?: number) {
500
+ if (maxHistorySize !== undefined) {
501
+ this.#maxHistorySize = maxHistorySize;
502
+ }
503
+ }
504
+
505
+ buildTextPromptCompletions =
506
+ async(expression: string, prefix: string, force?: boolean): Promise<UI.SuggestBox.Suggestions> => {
507
+ if (!prefix && !force && expression) {
508
+ return [];
509
+ }
510
+ const newestToOldest = [...this.#commandHistory].reverse();
511
+ return newestToOldest.filter(cmd => cmd.startsWith(prefix)).map(text => ({
512
+ text,
513
+ }));
514
+ };
515
+
516
+ addEntry(value: string): void {
517
+ if (this.#commandHistory.has(value)) {
518
+ this.#commandHistory.delete(value);
519
+ }
520
+ this.#commandHistory.add(value);
521
+ if (this.#commandHistory.size > this.#maxHistorySize) {
522
+ const earliestEntry = this.#commandHistory.values().next().value;
523
+ this.#commandHistory.delete(earliestEntry);
524
+ }
525
+ }
526
+ }
527
+
484
528
  export class InfoWidget extends UI.Widget.VBox {
485
529
  private readonly tabbedPane: UI.TabbedPane.TabbedPane;
486
530
  constructor() {
@@ -518,3 +562,17 @@ export class InfoWidget extends UI.Widget.VBox {
518
562
  this.tabbedPane.changeTabView('response', SourceFrame.JSONView.JSONView.createViewSync(responseParsed));
519
563
  }
520
564
  }
565
+
566
+ export function parseCommandInput(input: string): {command: string, parameters: unknown} {
567
+ // If input cannot be parsed as json, we assume it's the command name
568
+ // for a command without parameters. Otherwise, we expect an object
569
+ // with "command"/"method"/"cmd" and "parameters"/"params"/"args"/"arguments" attributes.
570
+ let json = null;
571
+ try {
572
+ json = JSON.parse(input);
573
+ } catch (err) {
574
+ }
575
+ const command = json ? json.command || json.method || json.cmd : input;
576
+ const parameters = json ? json.parameters || json.params || json.args || json.arguments : null;
577
+ return {command, parameters};
578
+ }
@@ -98,7 +98,8 @@ export class TimelineLoader implements Common.StringOutputStream.OutputStream {
98
98
 
99
99
  static loadFromURL(url: Platform.DevToolsPath.UrlString, client: Client): TimelineLoader {
100
100
  const loader = new TimelineLoader(client);
101
- Host.ResourceLoader.loadAsStream(url, null, loader);
101
+ const allowFileUNCPaths = Common.Settings.Settings.instance().moduleSetting('network.enable-unc-loading').get();
102
+ Host.ResourceLoader.loadAsStream(url, null, loader, undefined, allowFileUNCPaths);
102
103
  return loader;
103
104
  }
104
105
 
@@ -532,6 +532,7 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
532
532
  // This order of things is important.
533
533
  // 1. Resize main element early and force layout.
534
534
  this.contentElement.style.setProperty(animatedMarginPropertyName, marginFrom);
535
+ this.contentElement.style.setProperty('overflow', 'hidden');
535
536
  if (!reverse) {
536
537
  suppressUnused(this.mainElement.offsetWidth);
537
538
  suppressUnused(this.sidebarElementInternal.offsetWidth);
@@ -579,6 +580,7 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
579
580
  this.contentElement.style.removeProperty('margin-bottom');
580
581
  this.contentElement.style.removeProperty('margin-left');
581
582
  this.contentElement.style.removeProperty('transition');
583
+ this.contentElement.style.removeProperty('overflow');
582
584
 
583
585
  if (this.animationFrameHandle) {
584
586
  this.contentElement.window().cancelAnimationFrame(this.animationFrameHandle);
@@ -89,7 +89,7 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
89
89
  }
90
90
 
91
91
  initialize(
92
- completions: (this: null, arg1: string, arg2: string, arg3?: boolean|undefined) => Promise<Suggestion[]>,
92
+ completions: (this: null, expression: string, filter: string, force?: boolean|undefined) => Promise<Suggestion[]>,
93
93
  stopCharacters?: string, usesSuggestionBuilder?: boolean): void {
94
94
  this.loadCompletions = completions;
95
95
  this.completionStopCharacters = stopCharacters || ' =:[({;,!+-*/&|^<>.';
@@ -437,6 +437,8 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
437
437
  progressIndicator.setTotalWork(100);
438
438
  this.progressToolbarItem.element.appendChild(progressIndicator.element);
439
439
 
440
+ progressIndicator.setWorked(1);
441
+
440
442
  const deferredContent = await this.lazyContent();
441
443
  let error, content;
442
444
  if (deferredContent.content === null) {
@@ -448,57 +450,13 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
448
450
  const view = new DataView(Common.Base64.decode(deferredContent.content));
449
451
  const decoder = new TextDecoder();
450
452
  this.rawContent = decoder.decode(view, {stream: true});
453
+ } else if ('wasmDisassemblyInfo' in deferredContent && deferredContent.wasmDisassemblyInfo) {
454
+ const {wasmDisassemblyInfo} = deferredContent;
455
+ this.rawContent = CodeMirror.Text.of(wasmDisassemblyInfo.lines);
456
+ this.wasmDisassemblyInternal = wasmDisassemblyInfo;
451
457
  } else {
452
- this.rawContent = deferredContent.content;
453
- }
454
- }
455
-
456
- progressIndicator.setWorked(1);
457
-
458
- if (!error && this.contentType === 'application/wasm') {
459
- const worker = Common.Worker.WorkerWrapper.fromURL(
460
- new URL('../../../../entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.js', import.meta.url));
461
- const promise = new Promise<{
462
- lines: string[],
463
- offsets: number[],
464
- functionBodyOffsets: {
465
- start: number,
466
- end: number,
467
- }[],
468
- }>((resolve, reject) => {
469
- worker.onmessage =
470
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
471
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
472
- ({data}: MessageEvent<any>): void => {
473
- if ('event' in data) {
474
- switch (data.event) {
475
- case 'progress':
476
- progressIndicator.setWorked(data.params.percentage);
477
- break;
478
- }
479
- } else if ('method' in data) {
480
- switch (data.method) {
481
- case 'disassemble':
482
- if ('error' in data) {
483
- reject(data.error);
484
- } else if ('result' in data) {
485
- resolve(data.result);
486
- }
487
- break;
488
- }
489
- }
490
- };
491
- worker.onerror = reject;
492
- });
493
- worker.postMessage({method: 'disassemble', params: {content}});
494
- try {
495
- const {lines, offsets, functionBodyOffsets} = await promise;
496
- this.rawContent = content = CodeMirror.Text.of(lines);
497
- this.wasmDisassemblyInternal = new Common.WasmDisassembly.WasmDisassembly(offsets, functionBodyOffsets);
498
- } catch (e) {
499
- this.rawContent = content = error = e.message;
500
- } finally {
501
- worker.terminate();
458
+ this.rawContent = content;
459
+ this.wasmDisassemblyInternal = null;
502
460
  }
503
461
  }
504
462
 
@@ -514,7 +472,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
514
472
  this.textEditor.editor.setState(this.placeholderEditorState(error));
515
473
  this.prettyToggle.setEnabled(false);
516
474
  } else {
517
- if (this.shouldAutoPrettyPrint && TextUtils.TextUtils.isMinified(content)) {
475
+ if (this.shouldAutoPrettyPrint && TextUtils.TextUtils.isMinified(content || '')) {
518
476
  await this.setPretty(true);
519
477
  } else {
520
478
  await this.setContent(this.rawContent || '');
package/package.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
56
56
  "watch": "vpython third_party/node/node.py --output scripts/watch_build.js"
57
57
  },
58
- "version": "1.0.1028626"
58
+ "version": "1.0.1029795"
59
59
  }
@@ -1,4 +0,0 @@
1
- # Ensure an attribution source triggers in a secure context
2
-
3
- An attribution source event was not recorded because the frame that triggered the event (or the main frame if they
4
- are different) is not trustworthy.
@@ -1,5 +0,0 @@
1
- # Ensure the origins provided in an attribution source are trustworthy
2
-
3
- An attribution source event was not recorded because an untrustworthy origin was specified.
4
- Both, the `attributiondestination` and the `attributionreportto` origins must be
5
- trustworthy.
@@ -1,4 +0,0 @@
1
- # Ensure an attribution triggers in a secure context
2
-
3
- An attribution was not recorded because the frame that triggered the attribution (or the main frame if they
4
- are different) is not trustworthy.
@@ -1,4 +0,0 @@
1
- # Ensure the origin of an attribution-registration request is trustworthy
2
-
3
- An attribution source or trigger was not registered because the origin of the
4
- request was not trustworthy.
@@ -1,3 +0,0 @@
1
- # Ensure that Attribution Reporting API response headers are valid
2
-
3
- This page tries to use the Attribution Reporting API but failed because a response header was invalid.