chrome-devtools-frontend 1.0.1032471 → 1.0.1033423

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 (23) hide show
  1. package/config/gni/devtools_grd_files.gni +2 -0
  2. package/front_end/core/i18n/locales/en-US.json +6 -0
  3. package/front_end/core/i18n/locales/en-XL.json +6 -0
  4. package/front_end/core/sdk/CSSMetadata.ts +1 -0
  5. package/front_end/generated/InspectorBackendCommands.js +2 -2
  6. package/front_end/generated/SupportedCSSProperties.js +6 -6
  7. package/front_end/generated/protocol.ts +8 -0
  8. package/front_end/models/extensions/RecorderPluginManager.ts +16 -1
  9. package/front_end/models/extensions/extensions.ts +2 -0
  10. package/front_end/models/javascript_metadata/NativeFunctions.js +11 -3
  11. package/front_end/models/timeline_model/TimelineModel.ts +25 -12
  12. package/front_end/panels/console/ConsoleFormat.ts +8 -2
  13. package/front_end/panels/network/RequestHTMLView.ts +1 -1
  14. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  15. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -3
  16. package/front_end/third_party/codemirror.next/package.json +1 -1
  17. package/front_end/ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts +129 -0
  18. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +16 -2
  19. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +10 -3
  20. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +11 -6
  21. package/front_end/ui/components/linear_memory_inspector/linearMemoryHighlightChipList.css +92 -0
  22. package/front_end/ui/components/linear_memory_inspector/linear_memory_inspector.ts +2 -0
  23. package/package.json +1 -1
@@ -2525,10 +2525,11 @@ declare class EditorView {
2525
2525
  */
2526
2526
  get compositionStarted(): boolean;
2527
2527
  private _dispatch;
2528
+ private _root;
2528
2529
  /**
2529
2530
  The document or shadow root that the view lives in.
2530
2531
  */
2531
- readonly root: DocumentOrShadowRoot;
2532
+ get root(): DocumentOrShadowRoot;
2532
2533
  /**
2533
2534
  The DOM element that wraps the entire editor view.
2534
2535
  */
@@ -2630,13 +2631,14 @@ declare class EditorView {
2630
2631
  /**
2631
2632
  Find the text line or block widget at the given vertical
2632
2633
  position (which is interpreted as relative to the [top of the
2633
- document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)
2634
+ document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop)).
2634
2635
  */
2635
2636
  elementAtHeight(height: number): BlockInfo;
2636
2637
  /**
2637
2638
  Find the line block (see
2638
2639
  [`lineBlockAt`](https://codemirror.net/6/docs/ref/#view.EditorView.lineBlockAt) at the given
2639
- height.
2640
+ height, again interpreted relative to the [top of the
2641
+ document](https://codemirror.net/6/docs/ref/#view.EditorView.documentTop).
2640
2642
  */
2641
2643
  lineBlockAtHeight(height: number): BlockInfo;
2642
2644
  /**
@@ -2799,6 +2801,11 @@ declare class EditorView {
2799
2801
  */
2800
2802
  focus(): void;
2801
2803
  /**
2804
+ Update the [root](https://codemirror.net/6/docs/ref/##view.EditorViewConfig.root) in which the editor lives. This is only
2805
+ necessary when moving the editor's existing DOM to a new window or shadow root.
2806
+ */
2807
+ setRoot(root: Document | ShadowRoot): void;
2808
+ /**
2802
2809
  Clean up this editor view, removing its element from the
2803
2810
  document, unregistering event handlers, and notifying
2804
2811
  plugins. The view instance can no longer be used after
@@ -20,7 +20,7 @@
20
20
  "@codemirror/legacy-modes": "6.1.0",
21
21
  "@codemirror/search": "6.0.1",
22
22
  "@codemirror/state": "6.1.1",
23
- "@codemirror/view": "6.1.4",
23
+ "@codemirror/view": "6.2.0",
24
24
  "@lezer/common": "1.0.0",
25
25
  "@lezer/highlight": "1.0.0",
26
26
  "@lezer/lr": "1.2.1",
@@ -0,0 +1,129 @@
1
+ // Copyright (c) 2022 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as i18n from '../../../core/i18n/i18n.js';
6
+ import * as LitHtml from '../../lit-html/lit-html.js';
7
+ import * as ComponentHelpers from '../helpers/helpers.js';
8
+ import {type HighlightInfo} from './LinearMemoryViewerUtils.js';
9
+ import * as IconButton from '../icon_button/icon_button.js';
10
+
11
+ import linearMemoryHighlightChipListStyles from './linearMemoryHighlightChipList.css.js';
12
+
13
+ const UIStrings = {
14
+ /**
15
+ *@description Tooltip text that appears when hovering over a 'jump-to-highlight-button' button that is on the left side of a 'highlight-chip' chip.
16
+ */
17
+ jumpToAddress: 'Jump to highlighted memory',
18
+ /**
19
+ *@description Tooltip text that appears when hovering over a 'remove-highlight-button' button that is on the right end of a 'highlight-chip' chip.
20
+ */
21
+ deleteHighlight: 'Delete memory highlight',
22
+ };
23
+ const str_ =
24
+ i18n.i18n.registerUIStrings('ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts', UIStrings);
25
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
26
+ const {render, html} = LitHtml;
27
+
28
+ export interface LinearMemoryHighlightChipListData {
29
+ highlightInfos: Array<HighlightInfo>;
30
+ }
31
+
32
+ export class DeleteMemoryHighlightEvent extends Event {
33
+ static readonly eventName = 'deletememoryhighlight';
34
+ data: HighlightInfo;
35
+
36
+ constructor(highlightInfo: HighlightInfo) {
37
+ super(DeleteMemoryHighlightEvent.eventName, {bubbles: true, composed: true});
38
+ this.data = highlightInfo;
39
+ }
40
+ }
41
+
42
+ export class JumpToHighlightedMemoryEvent extends Event {
43
+ static readonly eventName = 'jumptohighlightedmemory';
44
+ data: number;
45
+
46
+ constructor(address: number) {
47
+ super(JumpToHighlightedMemoryEvent.eventName);
48
+ this.data = address;
49
+ }
50
+ }
51
+
52
+ export class LinearMemoryHighlightChipList extends HTMLElement {
53
+ static readonly litTagName = LitHtml.literal`devtools-linear-memory-highlight-chip-list`;
54
+
55
+ readonly #shadow = this.attachShadow({mode: 'open'});
56
+ #highlightedAreas: HighlightInfo[] = [];
57
+
58
+ connectedCallback(): void {
59
+ this.#shadow.adoptedStyleSheets = [linearMemoryHighlightChipListStyles];
60
+ }
61
+
62
+ set data(data: LinearMemoryHighlightChipListData) {
63
+ this.#highlightedAreas = data.highlightInfos;
64
+ this.#render();
65
+ }
66
+
67
+ #render(): void {
68
+ // Disabled until https://crbug.com/1079231 is fixed.
69
+ // clang-format off
70
+ const chips = [];
71
+ for (const highlightInfo of this.#highlightedAreas) {
72
+ chips.push(this.#createChip(highlightInfo));
73
+ }
74
+ const result = html`
75
+ <div class="highlight-chip-list">
76
+ ${chips}
77
+ </div>
78
+ `;
79
+ render(result, this.#shadow, { host: this });
80
+ // clang-format on
81
+ }
82
+
83
+ #createChip(highlightInfo: HighlightInfo): LitHtml.TemplateResult {
84
+ const expressionName = highlightInfo.name || '<anonymous>';
85
+ const expressionType = highlightInfo.type;
86
+
87
+ // Disabled until https://crbug.com/1079231 is fixed.
88
+ // clang-format off
89
+ return html`
90
+ <div class="highlight-chip">
91
+ <button class="jump-to-highlight-button" title=${
92
+ i18nString(UIStrings.jumpToAddress)}
93
+ @click=${():void => this.#onJumpToHighlightClick(highlightInfo.startAddress)}>
94
+ <span class="source-code">
95
+ <span class="value">${expressionName}</span><span class="separator">: </span><span>${expressionType}</span>
96
+ </span>
97
+ </button>
98
+ <button class="delete-highlight-button" title=${
99
+ i18nString(UIStrings.deleteHighlight)} @click=${():void => this.#onDeleteHighlightClick(highlightInfo)}>
100
+ <${IconButton.Icon.Icon.litTagName} .data=${{
101
+ iconName: 'close-icon',
102
+ color: 'black',
103
+ width: '7px',
104
+ } as IconButton.Icon.IconData}>
105
+ </${IconButton.Icon.Icon.litTagName}>
106
+ </button>
107
+ </div>
108
+ `;
109
+ // clang-format off
110
+ }
111
+
112
+ #onJumpToHighlightClick(startAddress: number): void {
113
+ this.dispatchEvent(new JumpToHighlightedMemoryEvent(startAddress));
114
+ }
115
+
116
+ #onDeleteHighlightClick(highlight:HighlightInfo): void {
117
+ this.dispatchEvent(new DeleteMemoryHighlightEvent(highlight));
118
+ }
119
+ }
120
+
121
+ ComponentHelpers.CustomElements.defineComponent(
122
+ 'devtools-linear-memory-highlight-chip-list', LinearMemoryHighlightChipList);
123
+
124
+ declare global {
125
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
126
+ interface HTMLElementTagNameMap {
127
+ 'devtools-linear-memory-highlight-chip-list': LinearMemoryHighlightChipList;
128
+ }
129
+ }
@@ -41,6 +41,12 @@ import {
41
41
  type LinearMemoryViewerData,
42
42
  type ResizeEvent,
43
43
  } from './LinearMemoryViewer.js';
44
+ import {
45
+ LinearMemoryHighlightChipList,
46
+ type LinearMemoryHighlightChipListData,
47
+ type DeleteMemoryHighlightEvent,
48
+ type JumpToHighlightedMemoryEvent,
49
+ } from './LinearMemoryHighlightChipList.js';
44
50
  import {type HighlightInfo} from './LinearMemoryViewerUtils.js';
45
51
 
46
52
  import * as i18n from '../../../core/i18n/i18n.js';
@@ -195,6 +201,8 @@ export class LinearMemoryInspector extends HTMLElement {
195
201
 
196
202
  const canGoBackInHistory = this.#history.canRollback();
197
203
  const canGoForwardInHistory = this.#history.canRollover();
204
+
205
+ const highlightedMemoryAreas = this.#highlightInfo ? [this.#highlightInfo] : [];
198
206
  // Disabled until https://crbug.com/1079231 is fixed.
199
207
  // clang-format off
200
208
  render(html`
@@ -205,6 +213,11 @@ export class LinearMemoryInspector extends HTMLElement {
205
213
  @addressinputchanged=${this.#onAddressChange}
206
214
  @pagenavigation=${this.#navigatePage}
207
215
  @historynavigation=${this.#navigateHistory}></${LinearMemoryNavigator.litTagName}>
216
+ <${LinearMemoryHighlightChipList.litTagName}
217
+ .data=${{highlightInfos: highlightedMemoryAreas} as LinearMemoryHighlightChipListData}
218
+ @jumptohighlightedmemory=${this.#onJumpToAddress}
219
+ @>
220
+ </${LinearMemoryHighlightChipList.litTagName}>
208
221
  <${LinearMemoryViewer.litTagName}
209
222
  .data=${{
210
223
  memory: this.#memory.slice(start - this.#memoryOffset,
@@ -227,7 +240,7 @@ export class LinearMemoryInspector extends HTMLElement {
227
240
  @valuetypetoggled=${this.#onValueTypeToggled}
228
241
  @valuetypemodechanged=${this.#onValueTypeModeChanged}
229
242
  @endiannesschanged=${this.#onEndiannessChanged}
230
- @jumptopointeraddress=${this.#onJumpToPointerAddress}
243
+ @jumptopointeraddress=${this.#onJumpToAddress}
231
244
  >
232
245
  </${LinearMemoryValueInterpreter.litTagName}/>
233
246
  </div>
@@ -237,7 +250,7 @@ export class LinearMemoryInspector extends HTMLElement {
237
250
  // clang-format on
238
251
  }
239
252
 
240
- #onJumpToPointerAddress(e: JumpToPointerAddressEvent): void {
253
+ #onJumpToAddress(e: JumpToPointerAddressEvent|JumpToHighlightedMemoryEvent): void {
241
254
  // Stop event from bubbling up, since no element further up needs the event.
242
255
  e.stopPropagation();
243
256
  this.#currentNavigatorMode = Mode.Submitted;
@@ -375,5 +388,6 @@ declare global {
375
388
  'memoryrequest': MemoryRequestEvent;
376
389
  'addresschanged': AddressChangedEvent;
377
390
  'settingschanged': SettingsChangedEvent;
391
+ 'deletememoryhighlight': DeleteMemoryHighlightEvent;
378
392
  }
379
393
  }
@@ -198,7 +198,14 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
198
198
  return this.#bufferIdToHighlightInfo.get(bufferId);
199
199
  }
200
200
 
201
- #setHighlightInfo(bufferId: string, highlightInfo: HighlightInfo): void {
201
+ removeHighlight(bufferId: string, highlightInfo: HighlightInfo): void {
202
+ const currentHighlight = this.getHighlightInfo(bufferId);
203
+ if (currentHighlight === highlightInfo) {
204
+ this.#bufferIdToHighlightInfo.delete(bufferId);
205
+ }
206
+ }
207
+
208
+ setHighlightInfo(bufferId: string, highlightInfo: HighlightInfo): void {
202
209
  this.#bufferIdToHighlightInfo.set(bufferId, highlightInfo);
203
210
  }
204
211
 
@@ -333,7 +340,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
333
340
  const memory = memoryProperty?.value;
334
341
  const highlightInfo = LinearMemoryInspectorController.extractHighlightInfo(obj, expression);
335
342
  if (highlightInfo) {
336
- this.#setHighlightInfo(id, highlightInfo);
343
+ this.setHighlightInfo(id, highlightInfo);
337
344
  } else {
338
345
  this.#resetHighlightInfo(id);
339
346
  }
@@ -428,7 +435,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
428
435
  if (!newHighlightInfo || !this.#pointToSameMemoryObject(newHighlightInfo, oldHighlightInfo)) {
429
436
  this.#resetHighlightInfo(bufferId);
430
437
  } else {
431
- this.#setHighlightInfo(bufferId, newHighlightInfo);
438
+ this.setHighlightInfo(bufferId, newHighlightInfo);
432
439
  }
433
440
  }
434
441
 
@@ -7,15 +7,16 @@ import * as i18n from '../../../core/i18n/i18n.js';
7
7
  import * as UI from '../../legacy/legacy.js';
8
8
 
9
9
  import {
10
+ AddressChangedEvent,
10
11
  LinearMemoryInspector,
11
- type AddressChangedEvent,
12
- type MemoryRequestEvent,
12
+ MemoryRequestEvent,
13
+ SettingsChangedEvent,
13
14
  type Settings,
14
- type SettingsChangedEvent,
15
15
  } from './LinearMemoryInspector.js';
16
16
 
17
17
  import {LinearMemoryInspectorController, type LazyUint8Array} from './LinearMemoryInspectorController.js';
18
18
  import {type HighlightInfo} from './LinearMemoryViewerUtils.js';
19
+ import {DeleteMemoryHighlightEvent} from './LinearMemoryHighlightChipList.js';
19
20
 
20
21
  const UIStrings = {
21
22
  /**
@@ -147,17 +148,21 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
147
148
  this.#address = address;
148
149
  this.#tabId = tabId;
149
150
  this.#inspector = new LinearMemoryInspector();
150
- this.#inspector.addEventListener('memoryrequest', (event: MemoryRequestEvent) => {
151
+ this.#inspector.addEventListener(MemoryRequestEvent.eventName, (event: MemoryRequestEvent) => {
151
152
  this.#memoryRequested(event);
152
153
  });
153
- this.#inspector.addEventListener('addresschanged', (event: AddressChangedEvent) => {
154
+ this.#inspector.addEventListener(AddressChangedEvent.eventName, (event: AddressChangedEvent) => {
154
155
  this.updateAddress(event.data);
155
156
  });
156
- this.#inspector.addEventListener('settingschanged', (event: SettingsChangedEvent) => {
157
+ this.#inspector.addEventListener(SettingsChangedEvent.eventName, (event: SettingsChangedEvent) => {
157
158
  // Stop event from bubbling up, since no element further up needs the event.
158
159
  event.stopPropagation();
159
160
  this.saveSettings(event.data);
160
161
  });
162
+ this.#inspector.addEventListener(DeleteMemoryHighlightEvent.eventName, (event: DeleteMemoryHighlightEvent) => {
163
+ LinearMemoryInspectorController.instance().removeHighlight(this.#tabId, event.data);
164
+ this.refreshData();
165
+ });
161
166
  this.contentElement.appendChild(this.#inspector);
162
167
  this.firstTimeOpen = true;
163
168
  }
@@ -0,0 +1,92 @@
1
+ /*
2
+ * Copyright 2022 The Chromium Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ .highlight-chip-list {
8
+ min-height: 24px;
9
+ display: flex;
10
+ flex-wrap: wrap;
11
+ justify-content: left;
12
+ align-items: center;
13
+ background-color: var(--color-background);
14
+ color: var(--color-text-primary);
15
+ }
16
+
17
+ .highlight-chip {
18
+ background: transparent;
19
+ color: var(--color-text-primary);
20
+ border: 1px solid var(--color-background-elevation-2);
21
+ height: 15px;
22
+ margin-right: 5px;
23
+ padding: 1px;
24
+ border-radius: 4px;
25
+ margin-bottom: 1px;
26
+ display: flex;
27
+ }
28
+
29
+ .highlight-chip:hover {
30
+ background-color: var(--color-background-elevation-1);
31
+ }
32
+
33
+ .delete-highlight-button {
34
+ width: 15px;
35
+ height: 15px;
36
+ border: none;
37
+ padding: 0;
38
+ cursor: pointer;
39
+ background: none;
40
+ border-radius: 50%;
41
+ display: flex;
42
+ justify-content: center;
43
+ align-items: center;
44
+ margin: 0 2px;
45
+ }
46
+
47
+ .delete-highlight-button:hover {
48
+ background-color: var(--color-details-hairline);
49
+ }
50
+
51
+ .highlight-chip > .delete-highlight-button {
52
+ visibility: hidden;
53
+ }
54
+
55
+ .highlight-chip:hover > .delete-highlight-button {
56
+ visibility: visible;
57
+ }
58
+
59
+ .jump-to-highlight-button {
60
+ cursor: pointer;
61
+ padding: 0 0 0 4px;
62
+ border: none;
63
+ background: none;
64
+ display: flex;
65
+ align-items: center;
66
+ }
67
+
68
+ .jump-to-highlight-button:hover {
69
+ color: var(--color-text-primary);
70
+ }
71
+
72
+ .delete-highlight-button devtools-icon {
73
+ --icon-color: var(--color-text-primary);
74
+ }
75
+
76
+ .source-code {
77
+ font-family: var(--source-code-font-family);
78
+ font-size: var(--source-code-font-size);
79
+ max-width: 250px;
80
+ overflow: hidden;
81
+ text-overflow: ellipsis;
82
+ white-space: nowrap;
83
+ }
84
+
85
+ .value {
86
+ color: var(--color-syntax-2);
87
+ }
88
+
89
+ .separator {
90
+ white-space: pre;
91
+ flex-shrink: 0;
92
+ }
@@ -2,6 +2,7 @@
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
 
5
+ import * as LinearMemoryHighlightChipList from './LinearMemoryHighlightChipList.js';
5
6
  import * as LinearMemoryInspector from './LinearMemoryInspector.js';
6
7
  import * as LinearMemoryInspectorController from './LinearMemoryInspectorController.js';
7
8
  import * as LinearMemoryInspectorPane from './LinearMemoryInspectorPane.js';
@@ -15,6 +16,7 @@ import * as ValueInterpreterDisplayUtils from './ValueInterpreterDisplayUtils.js
15
16
  import * as ValueInterpreterSettings from './ValueInterpreterSettings.js';
16
17
 
17
18
  export {
19
+ LinearMemoryHighlightChipList,
18
20
  LinearMemoryInspector,
19
21
  LinearMemoryInspectorController,
20
22
  LinearMemoryInspectorPane,
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.1032471"
59
+ "version": "1.0.1033423"
60
60
  }