chrome-devtools-frontend 1.0.1035409 → 1.0.1036726

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 (36) hide show
  1. package/AUTHORS +1 -0
  2. package/config/gni/devtools_grd_files.gni +2 -0
  3. package/docs/workflows.md +4 -5
  4. package/front_end/core/i18n/locales/en-US.json +21 -6
  5. package/front_end/core/i18n/locales/en-XL.json +21 -6
  6. package/front_end/core/root/Runtime.ts +8 -3
  7. package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
  8. package/front_end/core/sdk/NetworkManager.ts +21 -5
  9. package/front_end/core/sdk/NetworkRequest.ts +10 -0
  10. package/front_end/entrypoints/main/MainImpl.ts +6 -5
  11. package/front_end/generated/InspectorBackendCommands.js +2 -2
  12. package/front_end/generated/SupportedCSSProperties.js +8 -4
  13. package/front_end/generated/protocol.ts +7 -1
  14. package/front_end/models/persistence/NetworkPersistenceManager.ts +25 -14
  15. package/front_end/panels/application/components/Prerender2.ts +5 -7
  16. package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
  17. package/front_end/panels/elements/ElementsTreeOutline.ts +3 -3
  18. package/front_end/panels/elements/StylePropertiesSection.ts +12 -0
  19. package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
  20. package/front_end/panels/elements/StylesSidebarPane.ts +1 -0
  21. package/front_end/panels/elements/TopLayerContainer.ts +14 -13
  22. package/front_end/panels/network/NetworkLogView.ts +13 -5
  23. package/front_end/panels/settings/SettingsScreen.ts +12 -0
  24. package/front_end/panels/settings/settingsScreen.css +6 -0
  25. package/front_end/panels/sources/NavigatorView.ts +8 -10
  26. package/front_end/panels/sources/ScopeChainSidebarPane.ts +4 -3
  27. package/front_end/panels/sources/SourcesNavigator.ts +0 -37
  28. package/front_end/panels/sources/SourcesPanel.ts +34 -22
  29. package/front_end/panels/sources/components/BreakpointsView.ts +206 -0
  30. package/front_end/panels/sources/components/HeadersView.ts +8 -41
  31. package/front_end/panels/sources/components/breakpointsView.css +95 -0
  32. package/front_end/panels/sources/components/components.ts +2 -0
  33. package/front_end/ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts +11 -9
  34. package/front_end/ui/components/linear_memory_inspector/linearMemoryHighlightChipList.css +48 -30
  35. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -2
  36. package/package.json +1 -1
@@ -9,6 +9,7 @@ import * as Buttons from '../../../ui/components/buttons/buttons.js';
9
9
  import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
10
10
  import * as UI from '../../../ui/legacy/legacy.js';
11
11
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
12
+ import type * as Protocol from '../../../generated/protocol.js';
12
13
 
13
14
  import HeadersViewStyles from './HeadersView.css.js';
14
15
 
@@ -81,23 +82,8 @@ export class HeadersView extends UI.View.SimpleView {
81
82
  parsingError = true;
82
83
  }
83
84
 
84
- // Header overrides are stored as the key-value pairs of a JSON object on
85
- // disk. For the editor we want them as an array instead, so that we can
86
- // access/add/remove entries by their index.
87
- const arrayOfHeaderOverrideArrays: HeaderOverride[] = headerOverrides.map(headerOverride => {
88
- return {
89
- applyTo: headerOverride.applyTo,
90
- headers: Object.entries(headerOverride.headers).map(([headerName, headerValue]) => {
91
- return {
92
- name: headerName,
93
- value: headerValue,
94
- };
95
- }),
96
- };
97
- });
98
-
99
85
  this.#headersViewComponent.data = {
100
- headerOverrides: arrayOfHeaderOverrideArrays,
86
+ headerOverrides,
101
87
  uiSourceCode: this.#uiSourceCode,
102
88
  parsingError,
103
89
  };
@@ -128,18 +114,8 @@ export class HeadersView extends UI.View.SimpleView {
128
114
  }
129
115
  }
130
116
 
131
- type Header = {
132
- name: string,
133
- value: string,
134
- };
135
-
136
- type HeaderOverride = {
137
- applyTo: string,
138
- headers: Header[],
139
- };
140
-
141
117
  export interface HeadersViewComponentData {
142
- headerOverrides: HeaderOverride[];
118
+ headerOverrides: Persistence.NetworkPersistenceManager.HeaderOverride[];
143
119
  uiSourceCode: Workspace.UISourceCode.UISourceCode;
144
120
  parsingError: boolean;
145
121
  }
@@ -148,7 +124,7 @@ export class HeadersViewComponent extends HTMLElement {
148
124
  static readonly litTagName = LitHtml.literal`devtools-sources-headers-view`;
149
125
  readonly #shadow = this.attachShadow({mode: 'open'});
150
126
  readonly #boundRender = this.#render.bind(this);
151
- #headerOverrides: HeaderOverride[] = [];
127
+ #headerOverrides: Persistence.NetworkPersistenceManager.HeaderOverride[] = [];
152
128
  #uiSourceCode: Workspace.UISourceCode.UISourceCode|null = null;
153
129
  #parsingError = false;
154
130
  #focusElement: {blockIndex: number, headerIndex?: number}|null = null;
@@ -213,7 +189,7 @@ export class HeadersViewComponent extends HTMLElement {
213
189
  selection?.removeAllRanges();
214
190
  }
215
191
 
216
- #generateNextHeaderName(headers: Header[]): string {
192
+ #generateNextHeaderName(headers: Protocol.Fetch.HeaderEntry[]): string {
217
193
  const takenNames = new Set<string>(headers.map(header => header.name));
218
194
  let idx = 1;
219
195
  while (takenNames.has('headerName' + idx)) {
@@ -270,17 +246,7 @@ export class HeadersViewComponent extends HTMLElement {
270
246
  }
271
247
 
272
248
  #onHeadersChanged(): void {
273
- // In the editor header overrides are represented by items in an array, so
274
- // that we can access/add/remove entries by their index. On disk, they are
275
- // stored as key-value pairs of a JSON object instead.
276
- const arrayOfHeaderOverrideObjects: Persistence.NetworkPersistenceManager.HeaderOverride[] =
277
- this.#headerOverrides.map(headerOverride => {
278
- return {
279
- applyTo: headerOverride.applyTo,
280
- headers: headerOverride.headers.reduce((a, v) => ({...a, [v.name]: v.value}), {}),
281
- };
282
- });
283
- this.#uiSourceCode?.setWorkingCopy(JSON.stringify(arrayOfHeaderOverrideObjects, null, 2));
249
+ this.#uiSourceCode?.setWorkingCopy(JSON.stringify(this.#headerOverrides, null, 2));
284
250
  }
285
251
 
286
252
  #render(): void {
@@ -355,7 +321,8 @@ export class HeadersViewComponent extends HTMLElement {
355
321
  // clang-format on
356
322
  }
357
323
 
358
- #renderHeaderRow(header: Header, blockIndex: number, headerIndex: number): LitHtml.TemplateResult {
324
+ #renderHeaderRow(header: Protocol.Fetch.HeaderEntry, blockIndex: number, headerIndex: number):
325
+ LitHtml.TemplateResult {
359
326
  // clang-format off
360
327
  return LitHtml.html`
361
328
  <div class="row padded" data-block-index=${blockIndex} data-header-index=${headerIndex}>
@@ -0,0 +1,95 @@
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
+ :host {
8
+ flex: auto;
9
+ display: flex;
10
+ flex-direction: column;
11
+ }
12
+
13
+ .divider {
14
+ height: 1px;
15
+ width: inherit;
16
+ background-color: var(--color-details-hairline);
17
+ }
18
+
19
+ .code-snippet {
20
+ width: 100%;
21
+ padding-left: 6px;
22
+ font-family: var(--source-code-font-family);
23
+ font-size: var(--source-code-font-size);
24
+ color: var(--color-text-secondary);
25
+ text-overflow: ellipsis;
26
+ overflow: hidden;
27
+ white-space: nowrap;
28
+ flex-shrink: 100;
29
+ }
30
+
31
+ input {
32
+ height: 12px;
33
+ width: 12px;
34
+ flex-shrink: 0;
35
+ margin: 3px 0;
36
+ }
37
+
38
+ .triangle {
39
+ margin-left: 6px;
40
+ margin-right: 4px;
41
+ display: inline-block;
42
+ -webkit-mask-image: var(--image-file-treeoutlineTriangles);
43
+ -webkit-mask-size: 32px 24px;
44
+ -webkit-mask-position: 0 0;
45
+ background-color: var(--color-text-primary);
46
+ height: 12px;
47
+ width: 8px;
48
+ }
49
+
50
+ .group-header {
51
+ display: flex;
52
+ align-items: center;
53
+ height: 18px;
54
+ }
55
+
56
+ .expanded > .group-header > .triangle {
57
+ -webkit-mask-position: -16px 0;
58
+ }
59
+
60
+ .group-header-title {
61
+ margin-left: 4px;
62
+ font-weight: 500;
63
+ font-size: var(--source-code-font-size);
64
+ text-overflow: ellipsis;
65
+ overflow: hidden;
66
+ white-space: nowrap;
67
+ }
68
+
69
+ .breakpoint-item {
70
+ display: flex;
71
+ align-items: center;
72
+ line-height: 13px;
73
+ height: 18px;
74
+ }
75
+
76
+ .breakpoint-item:hover {
77
+ background-color: var(--color-background-elevation-1);
78
+ }
79
+
80
+ .breakpoint-item.hit {
81
+ --override-breakpoint-hit-background: rgb(255 255 194);
82
+
83
+ background-color: var(--override-breakpoint-hit-background);
84
+ }
85
+
86
+ .checkbox-label {
87
+ padding-left: 24px;
88
+ display: flex;
89
+ align-items: center;
90
+ }
91
+
92
+ .location {
93
+ line-height: 14px;
94
+ margin: 0 8px;
95
+ }
@@ -2,8 +2,10 @@
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 BreakpointsView from './BreakpointsView.js';
5
6
  import * as HeadersView from './HeadersView.js';
6
7
 
7
8
  export {
9
+ BreakpointsView,
8
10
  HeadersView,
9
11
  };
@@ -95,15 +95,17 @@ export class LinearMemoryHighlightChipList extends HTMLElement {
95
95
  <span class="value">${expressionName}</span><span class="separator">: </span><span>${expressionType}</span>
96
96
  </span>
97
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>
98
+ <div class="delete-highlight-container">
99
+ <button class="delete-highlight-button" title=${
100
+ i18nString(UIStrings.deleteHighlight)} @click=${():void => this.#onDeleteHighlightClick(highlightInfo)}>
101
+ <${IconButton.Icon.Icon.litTagName} .data=${{
102
+ iconName: 'close-icon',
103
+ color: 'var(--color-text-primary)',
104
+ width: '7px',
105
+ } as IconButton.Icon.IconData}>
106
+ </${IconButton.Icon.Icon.litTagName}>
107
+ </button>
108
+ </div>
107
109
  </div>
108
110
  `;
109
111
  // clang-format off
@@ -5,81 +5,99 @@
5
5
  */
6
6
 
7
7
  .highlight-chip-list {
8
- min-height: 24px;
8
+ min-height: 20px;
9
9
  display: flex;
10
10
  flex-wrap: wrap;
11
11
  justify-content: left;
12
12
  align-items: center;
13
13
  background-color: var(--color-background);
14
- color: var(--color-text-primary);
14
+ margin: 8px 0;
15
+ gap: 8px;
16
+ row-gap: 6px;
15
17
  }
16
18
 
17
19
  .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;
20
+ background: var(--color-background);
21
+ border: 1px solid var(--color-button-secondary-border);
22
+ height: 18px;
24
23
  border-radius: 4px;
25
- margin-bottom: 1px;
26
- display: flex;
24
+ flex: 0 0 auto;
25
+ max-width: 250px;
26
+ position: relative;
27
+ padding: 0 6px;
27
28
  }
28
29
 
29
30
  .highlight-chip:hover {
30
31
  background-color: var(--color-background-elevation-1);
31
32
  }
32
33
 
34
+ .delete-highlight-container {
35
+ display: none;
36
+ height: 100%;
37
+ position: absolute;
38
+ right: 0;
39
+ top: 0;
40
+ border-radius: 4px;
41
+ width: 24px;
42
+ align-items: center;
43
+ justify-content: center;
44
+ }
45
+
33
46
  .delete-highlight-button {
34
- width: 15px;
35
- height: 15px;
36
- border: none;
37
- padding: 0;
38
47
  cursor: pointer;
39
- background: none;
40
- border-radius: 50%;
48
+ width: 13px;
49
+ height: 13px;
50
+ border: none;
51
+ background-color: transparent;
41
52
  display: flex;
42
- justify-content: center;
43
53
  align-items: center;
44
- margin: 0 2px;
54
+ justify-content: center;
45
55
  }
46
56
 
47
57
  .delete-highlight-button:hover {
48
58
  background-color: var(--color-details-hairline);
59
+ border-radius: 50%;
49
60
  }
50
61
 
51
- .highlight-chip > .delete-highlight-button {
52
- visibility: hidden;
62
+ .highlight-chip:hover > .delete-highlight-container {
63
+ display: flex;
64
+ /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
65
+ background: linear-gradient(90deg, transparent 0%, rgb(241 243 244) 25%); /* stylelint-disable-line plugin/use_theme_colors */
53
66
  }
54
67
 
55
- .highlight-chip:hover > .delete-highlight-button {
56
- visibility: visible;
68
+ :host-context(.-theme-with-dark-background) .highlight-chip:hover > .delete-highlight-container {
69
+ display: flex;
70
+ /* To avoid issues with stacking semi-transparent colors, we use a hardcoded solid color here. */
71
+ background: linear-gradient(90deg, transparent 0%, rgb(41 42 45) 25%); /* stylelint-disable-line plugin/use_theme_colors */
57
72
  }
58
73
 
59
74
  .jump-to-highlight-button {
60
75
  cursor: pointer;
61
- padding: 0 0 0 4px;
76
+ padding: 0;
62
77
  border: none;
63
78
  background: none;
64
- display: flex;
79
+ height: 100%;
65
80
  align-items: center;
66
- }
67
-
68
- .jump-to-highlight-button:hover {
69
- color: var(--color-text-primary);
81
+ max-width: 100%;
82
+ overflow: hidden;
70
83
  }
71
84
 
72
85
  .delete-highlight-button devtools-icon {
73
- --icon-color: var(--color-text-primary);
86
+ width: 13px;
87
+ height: 13px;
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: center;
91
+ border-radius: 50%;
74
92
  }
75
93
 
76
94
  .source-code {
77
95
  font-family: var(--source-code-font-family);
78
96
  font-size: var(--source-code-font-size);
79
- max-width: 250px;
80
97
  overflow: hidden;
81
98
  text-overflow: ellipsis;
82
99
  white-space: nowrap;
100
+ color: var(--color-text-primary);
83
101
  }
84
102
 
85
103
  .value {
@@ -396,7 +396,7 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
396
396
  value, wasThrown, showPreview, parentElement, linkifier, variableName);
397
397
  }
398
398
 
399
- static appendMemoryIcon(element: Element, obj: SDK.RemoteObject.RemoteObject, variableName?: string): void {
399
+ static appendMemoryIcon(element: Element, obj: SDK.RemoteObject.RemoteObject, expression?: string): void {
400
400
  // We show the memory icon only on ArrayBuffer, WebAssembly.Memory and DWARF memory instances.
401
401
  // TypedArrays DataViews are also supported, but showing the icon next to their
402
402
  // previews is quite a significant visual overhead, and users can easily get to
@@ -419,7 +419,7 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
419
419
  const controller =
420
420
  LinearMemoryInspector.LinearMemoryInspectorController.LinearMemoryInspectorController.instance();
421
421
  Host.userMetrics.linearMemoryInspectorRevealedFrom(Host.UserMetrics.LinearMemoryInspectorRevealedFrom.MemoryIcon);
422
- void controller.openInspectorView(obj, undefined /* address */, variableName);
422
+ void controller.openInspectorView(obj, /* address */ undefined, expression);
423
423
  };
424
424
 
425
425
  UI.Tooltip.Tooltip.install(memoryIcon, 'Reveal in Memory Inspector panel');
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.1035409"
59
+ "version": "1.0.1036726"
60
60
  }