chrome-devtools-frontend 1.0.1014853 → 1.0.1015723

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 (113) hide show
  1. package/config/gni/devtools_grd_files.gni +4 -2
  2. package/front_end/core/common/JavaScriptMetaData.ts +20 -0
  3. package/front_end/core/i18n/locales/af.json +195 -93
  4. package/front_end/core/i18n/locales/am.json +191 -89
  5. package/front_end/core/i18n/locales/ar.json +193 -91
  6. package/front_end/core/i18n/locales/as.json +192 -90
  7. package/front_end/core/i18n/locales/az.json +191 -89
  8. package/front_end/core/i18n/locales/be.json +191 -89
  9. package/front_end/core/i18n/locales/bg.json +190 -88
  10. package/front_end/core/i18n/locales/bn.json +191 -89
  11. package/front_end/core/i18n/locales/bs.json +193 -91
  12. package/front_end/core/i18n/locales/ca.json +189 -87
  13. package/front_end/core/i18n/locales/cs.json +191 -89
  14. package/front_end/core/i18n/locales/cy.json +191 -89
  15. package/front_end/core/i18n/locales/da.json +191 -89
  16. package/front_end/core/i18n/locales/de.json +193 -91
  17. package/front_end/core/i18n/locales/el.json +174 -72
  18. package/front_end/core/i18n/locales/en-GB.json +132 -30
  19. package/front_end/core/i18n/locales/en-US.json +3 -3
  20. package/front_end/core/i18n/locales/en-XL.json +3 -3
  21. package/front_end/core/i18n/locales/es-419.json +192 -90
  22. package/front_end/core/i18n/locales/es.json +200 -98
  23. package/front_end/core/i18n/locales/et.json +190 -88
  24. package/front_end/core/i18n/locales/eu.json +197 -95
  25. package/front_end/core/i18n/locales/fa.json +192 -90
  26. package/front_end/core/i18n/locales/fi.json +192 -90
  27. package/front_end/core/i18n/locales/fil.json +190 -88
  28. package/front_end/core/i18n/locales/fr-CA.json +191 -89
  29. package/front_end/core/i18n/locales/fr.json +192 -90
  30. package/front_end/core/i18n/locales/gl.json +173 -71
  31. package/front_end/core/i18n/locales/gu.json +192 -90
  32. package/front_end/core/i18n/locales/he.json +191 -89
  33. package/front_end/core/i18n/locales/hi.json +172 -70
  34. package/front_end/core/i18n/locales/hr.json +180 -78
  35. package/front_end/core/i18n/locales/hu.json +191 -89
  36. package/front_end/core/i18n/locales/hy.json +192 -90
  37. package/front_end/core/i18n/locales/id.json +192 -90
  38. package/front_end/core/i18n/locales/is.json +176 -74
  39. package/front_end/core/i18n/locales/it.json +192 -90
  40. package/front_end/core/i18n/locales/ja.json +190 -88
  41. package/front_end/core/i18n/locales/ka.json +190 -88
  42. package/front_end/core/i18n/locales/kk.json +198 -96
  43. package/front_end/core/i18n/locales/km.json +195 -93
  44. package/front_end/core/i18n/locales/kn.json +193 -91
  45. package/front_end/core/i18n/locales/ko.json +190 -88
  46. package/front_end/core/i18n/locales/ky.json +193 -91
  47. package/front_end/core/i18n/locales/lo.json +192 -90
  48. package/front_end/core/i18n/locales/lt.json +193 -91
  49. package/front_end/core/i18n/locales/lv.json +175 -73
  50. package/front_end/core/i18n/locales/mk.json +193 -91
  51. package/front_end/core/i18n/locales/ml.json +193 -91
  52. package/front_end/core/i18n/locales/mn.json +190 -88
  53. package/front_end/core/i18n/locales/mr.json +191 -89
  54. package/front_end/core/i18n/locales/ms.json +190 -88
  55. package/front_end/core/i18n/locales/my.json +191 -89
  56. package/front_end/core/i18n/locales/ne.json +172 -70
  57. package/front_end/core/i18n/locales/nl.json +191 -89
  58. package/front_end/core/i18n/locales/no.json +191 -89
  59. package/front_end/core/i18n/locales/or.json +196 -94
  60. package/front_end/core/i18n/locales/pa.json +191 -89
  61. package/front_end/core/i18n/locales/pl.json +191 -89
  62. package/front_end/core/i18n/locales/pt-PT.json +199 -97
  63. package/front_end/core/i18n/locales/pt.json +191 -89
  64. package/front_end/core/i18n/locales/ro.json +193 -91
  65. package/front_end/core/i18n/locales/ru.json +193 -91
  66. package/front_end/core/i18n/locales/si.json +191 -89
  67. package/front_end/core/i18n/locales/sk.json +192 -90
  68. package/front_end/core/i18n/locales/sl.json +191 -89
  69. package/front_end/core/i18n/locales/sq.json +193 -91
  70. package/front_end/core/i18n/locales/sr-Latn.json +190 -88
  71. package/front_end/core/i18n/locales/sr.json +190 -88
  72. package/front_end/core/i18n/locales/sv.json +191 -89
  73. package/front_end/core/i18n/locales/sw.json +192 -90
  74. package/front_end/core/i18n/locales/ta.json +193 -91
  75. package/front_end/core/i18n/locales/te.json +134 -32
  76. package/front_end/core/i18n/locales/th.json +190 -88
  77. package/front_end/core/i18n/locales/tr.json +193 -91
  78. package/front_end/core/i18n/locales/uk.json +193 -91
  79. package/front_end/core/i18n/locales/ur.json +191 -89
  80. package/front_end/core/i18n/locales/uz.json +190 -88
  81. package/front_end/core/i18n/locales/vi.json +190 -88
  82. package/front_end/core/i18n/locales/zh-HK.json +192 -90
  83. package/front_end/core/i18n/locales/zh-TW.json +195 -93
  84. package/front_end/core/i18n/locales/zh.json +191 -89
  85. package/front_end/core/i18n/locales/zu.json +192 -90
  86. package/front_end/core/sdk/DOMModel.ts +9 -0
  87. package/front_end/core/sdk/DebuggerModel.ts +0 -28
  88. package/front_end/core/sdk/Script.ts +5 -14
  89. package/front_end/generated/InspectorBackendCommands.js +7 -3
  90. package/front_end/generated/protocol-mapping.d.ts +16 -0
  91. package/front_end/generated/protocol-proxy-api.d.ts +18 -0
  92. package/front_end/generated/protocol.ts +31 -5
  93. package/front_end/models/bindings/ResourceScriptMapping.ts +1 -2
  94. package/front_end/models/emulation/EmulatedDevices.ts +0 -13
  95. package/front_end/models/javascript_metadata/DOMPinnedProperties.ts +784 -3251
  96. package/front_end/models/javascript_metadata/JavaScriptMetadata.ts +3 -0
  97. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -4
  98. package/front_end/models/javascript_metadata/javascript_metadata.ts +3 -0
  99. package/front_end/models/source_map_scopes/NamesResolver.ts +11 -4
  100. package/front_end/panels/elements/ElementsTreeElement.ts +7 -3
  101. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +3 -4
  102. package/front_end/panels/elements/components/LayoutPane.ts +3 -4
  103. package/front_end/panels/elements/components/QueryContainer.ts +3 -4
  104. package/front_end/panels/elements/components/components.ts +0 -2
  105. package/front_end/panels/lighthouse/lighthouseStartView.css +3 -1
  106. package/front_end/panels/sources/ScopeChainSidebarPane.ts +4 -42
  107. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +64 -8
  108. package/front_end/{panels/elements/components → ui/components/node_text}/NodeText.ts +2 -1
  109. package/front_end/{panels/elements/components → ui/components/node_text}/nodeText.css +0 -0
  110. package/front_end/ui/components/node_text/node_text.ts +9 -0
  111. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +8 -5
  112. package/front_end/ui/legacy/components/object_ui/objectValue.css +1 -4
  113. package/package.json +1 -1
@@ -5,10 +5,13 @@
5
5
  import type * as Common from '../../core/common/common.js';
6
6
 
7
7
  import {NativeFunctions} from './NativeFunctions.js';
8
+ import * as DOMPinnedProperties from './DOMPinnedProperties.js';
8
9
 
9
10
  let javaScriptMetadataInstance: JavaScriptMetadataImpl;
10
11
 
11
12
  export class JavaScriptMetadataImpl implements Common.JavaScriptMetaData.JavaScriptMetaData {
13
+ static readonly domPinnedProperties = DOMPinnedProperties;
14
+
12
15
  private readonly uniqueFunctions: Map<string, string[][]>;
13
16
  private readonly receiverMethods: Map<string, Map<string, string[][]>>;
14
17
  static instance(opts: {
@@ -5475,6 +5475,10 @@ export const NativeFunctions = [
5475
5475
  name: 'ScrollTimeline',
5476
5476
  signatures: [['?options']]
5477
5477
  },
5478
+ {
5479
+ name: 'ViewTimeline',
5480
+ signatures: [['?options']]
5481
+ },
5478
5482
  {
5479
5483
  name: 'AccessibleNodeList',
5480
5484
  signatures: [['?nodes']]
@@ -7532,10 +7536,6 @@ export const NativeFunctions = [
7532
7536
  name: 'FetchEvent',
7533
7537
  signatures: [['type','eventInitDict']]
7534
7538
  },
7535
- {
7536
- name: 'addPerformanceEntry',
7537
- signatures: [['entry']]
7538
- },
7539
7539
  {
7540
7540
  name: 'InstallEvent',
7541
7541
  signatures: [['type','?eventInitDict']]
@@ -3,12 +3,15 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import './NativeFunctions.js';
6
+ import './DOMPinnedProperties.js';
6
7
  import './JavaScriptMetadata.js';
7
8
 
9
+ import * as DOMPinnedProperties from './DOMPinnedProperties.js';
8
10
  import * as JavaScriptMetadata from './JavaScriptMetadata.js';
9
11
  import * as NativeFunctions from './NativeFunctions.js';
10
12
 
11
13
  export {
14
+ DOMPinnedProperties,
12
15
  JavaScriptMetadata,
13
16
  NativeFunctions,
14
17
  };
@@ -54,12 +54,19 @@ const computeScopeTree = async function(functionScope: SDK.DebuggerModel.ScopeCh
54
54
  functionEndLocation.columnNumber);
55
55
  const scopeText = text.extract(scopeRange);
56
56
  const scopeStart = text.toSourceRange(scopeRange).offset;
57
- let prefix = 'function fui';
58
- let scopeTree = await Formatter.FormatterWorkerPool.formatterWorkerPool().javaScriptScopeTree(prefix + scopeText);
57
+ // We wrap the scope in a class constructor. This handles the case where the
58
+ // scope is a (non-arrow) function and the case where it is a constructor
59
+ // (so that parsing 'super' calls succeeds).
60
+ let prefix = 'class DummyClass extends DummyBase { constructor';
61
+ let suffix = '}';
62
+ let scopeTree =
63
+ await Formatter.FormatterWorkerPool.formatterWorkerPool().javaScriptScopeTree(prefix + scopeText + suffix);
59
64
  if (!scopeTree) {
60
65
  // Try to parse the function as an arrow function.
61
- prefix = 'let fui = ';
62
- scopeTree = await Formatter.FormatterWorkerPool.formatterWorkerPool().javaScriptScopeTree(prefix + scopeText);
66
+ prefix = '';
67
+ suffix = '';
68
+ scopeTree =
69
+ await Formatter.FormatterWorkerPool.formatterWorkerPool().javaScriptScopeTree(prefix + scopeText + suffix);
63
70
  }
64
71
  if (!scopeTree) {
65
72
  return null;
@@ -1706,9 +1706,13 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
1706
1706
  break;
1707
1707
 
1708
1708
  case Node.ELEMENT_NODE: {
1709
- const pseudoType = node.pseudoType();
1710
- if (pseudoType) {
1711
- this.buildPseudoElementDOM(titleDOM, pseudoType);
1709
+ let pseudoElementName = node.pseudoType();
1710
+ if (pseudoElementName) {
1711
+ const pseudoIdentifier = node.pseudoIdentifier();
1712
+ if (pseudoIdentifier) {
1713
+ pseudoElementName += `(${pseudoIdentifier})`;
1714
+ }
1715
+ this.buildPseudoElementDOM(titleDOM, pseudoElementName);
1712
1716
  break;
1713
1717
  }
1714
1718
 
@@ -14,8 +14,7 @@ import {crumbsToRender} from './ElementsBreadcrumbsUtils.js';
14
14
  import type * as SDK from '../../../core/sdk/sdk.js';
15
15
  import type {DOMNode} from './Helper.js';
16
16
 
17
- import {NodeText} from './NodeText.js';
18
- import type {NodeTextData} from './NodeText.js';
17
+ import * as NodeText from '../../../ui/components/node_text/node_text.js';
19
18
 
20
19
  const UIStrings = {
21
20
  /**
@@ -300,11 +299,11 @@ export class ElementsBreadcrumbs extends HTMLElement {
300
299
  @mouseleave=${this.#onCrumbMouseLeave(crumb.node)}
301
300
  @focus=${this.#onCrumbFocus(crumb.node)}
302
301
  @blur=${this.#onCrumbBlur(crumb.node)}
303
- ><${NodeText.litTagName} data-node-title=${crumb.title.main} .data=${{
302
+ ><${NodeText.NodeText.NodeText.litTagName} data-node-title=${crumb.title.main} .data=${{
304
303
  nodeTitle: crumb.title.main,
305
304
  nodeId: crumb.title.extras.id,
306
305
  nodeClasses: crumb.title.extras.classes,
307
- } as NodeTextData}></${NodeText.litTagName}></a>
306
+ } as NodeText.NodeText.NodeTextData}></${NodeText.NodeText.NodeText.litTagName}></a>
308
307
  </li>`;
309
308
  })}
310
309
  </ul>
@@ -10,10 +10,9 @@ import * as LitHtml from '../../../ui/lit-html/lit-html.js';
10
10
  import type {BooleanSetting, EnumSetting, Setting} from './LayoutPaneUtils.js';
11
11
  import type {LayoutElement} from './LayoutPaneUtils.js';
12
12
 
13
- import type {NodeTextData} from './NodeText.js';
14
- import {NodeText} from './NodeText.js';
15
13
  import layoutPaneStyles from '../layoutPane.css.js';
16
14
  import * as Input from '../../../ui/components/input/input.js';
15
+ import * as NodeText from '../../../ui/components/node_text/node_text.js';
17
16
  // eslint-disable-next-line rulesdir/es_modules_import
18
17
  import inspectorCommonStyles from '../../../ui/legacy/inspectorCommon.css.js';
19
18
 
@@ -262,11 +261,11 @@ export class LayoutPane extends HTMLElement {
262
261
  <label data-element="true" class="checkbox-label">
263
262
  <input data-input="true" type="checkbox" .checked=${element.enabled} @change=${onElementToggle} />
264
263
  <span class="node-text-container" data-label="true" @mouseenter=${onMouseEnter} @mouseleave=${onMouseLeave}>
265
- <${NodeText.litTagName} .data=${{
264
+ <${NodeText.NodeText.NodeText.litTagName} .data=${{
266
265
  nodeId: element.domId,
267
266
  nodeTitle: element.name,
268
267
  nodeClasses: element.domClasses,
269
- } as NodeTextData}></${NodeText.litTagName}>
268
+ } as NodeText.NodeText.NodeTextData}></${NodeText.NodeText.NodeText.litTagName}>
270
269
  </span>
271
270
  </label>
272
271
  <label @keyup=${onColorLabelKeyUp} @keydown=${onColorLabelKeyDown} tabindex="0" title=${i18nString(UIStrings.chooseElementOverlayColor)} class="color-picker-label" style="background: ${element.color};">
@@ -5,11 +5,10 @@
5
5
  import * as SDK from '../../../core/sdk/sdk.js';
6
6
  import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
7
7
  import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
8
+ import * as NodeText from '../../../ui/components/node_text/node_text.js';
8
9
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
9
10
 
10
11
  import type {DOMNode} from './Helper.js';
11
- import {NodeText} from './NodeText.js';
12
- import type {NodeTextData} from './NodeText.js';
13
12
  import queryContainerStyles from './queryContainer.css.js';
14
13
 
15
14
  const {render, html} = LitHtml;
@@ -90,13 +89,13 @@ export class QueryContainer extends HTMLElement {
90
89
  @click=${this.#onContainerLinkClick}
91
90
  @mouseenter=${this.#onContainerLinkMouseEnter}
92
91
  @mouseleave=${this.#onContainerLinkMouseLeave}
93
- ><${NodeText.litTagName}
92
+ ><${NodeText.NodeText.NodeText.litTagName}
94
93
  data-node-title=${nodeTitle}
95
94
  .data=${{
96
95
  nodeTitle,
97
96
  nodeId: idToDisplay,
98
97
  nodeClasses: classesToDisplay,
99
- } as NodeTextData}></${NodeText.litTagName}></a>
98
+ } as NodeText.NodeText.NodeTextData}></${NodeText.NodeText.NodeText.litTagName}></a>
100
99
  ${this.#isContainerLinkHovered ? this.#renderQueriedSizeDetails() : LitHtml.nothing}
101
100
  `, this.#shadow, {
102
101
  host: this,
@@ -15,7 +15,6 @@ import * as ElementsPanelLink from './ElementsPanelLink.js';
15
15
  import * as Helper from './Helper.js';
16
16
  import * as LayoutPane from './LayoutPane.js';
17
17
  import * as LayoutPaneUtils from './LayoutPaneUtils.js';
18
- import * as NodeText from './NodeText.js';
19
18
  import * as QueryContainer from './QueryContainer.js';
20
19
  import * as StylePropertyEditor from './StylePropertyEditor.js';
21
20
 
@@ -33,7 +32,6 @@ export {
33
32
  Helper,
34
33
  LayoutPane,
35
34
  LayoutPaneUtils,
36
- NodeText,
37
35
  QueryContainer,
38
36
  StylePropertyEditor,
39
37
  };
@@ -18,7 +18,9 @@
18
18
  }
19
19
 
20
20
  .lighthouse-start-view-fr {
21
- margin: 24px;
21
+ padding: 24px;
22
+ overflow: auto;
23
+ height: 100%;
22
24
  }
23
25
 
24
26
  .lighthouse-start-view header {
@@ -28,12 +28,11 @@
28
28
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
  */
30
30
 
31
- import * as Common from '../../core/common/common.js';
31
+ import type * as Common from '../../core/common/common.js';
32
32
  import * as Host from '../../core/host/host.js';
33
33
  import * as i18n from '../../core/i18n/i18n.js';
34
34
  import * as SDK from '../../core/sdk/sdk.js';
35
35
  import * as Protocol from '../../generated/protocol.js';
36
- import * as Bindings from '../../models/bindings/bindings.js';
37
36
  import * as SourceMapScopes from '../../models/source_map_scopes/source_map_scopes.js';
38
37
  import * as LinearMemoryInspector from '../../ui/components/linear_memory_inspector/linear_memory_inspector.js';
39
38
  import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
@@ -76,10 +75,6 @@ const UIStrings = {
76
75
  *@description A context menu item in the Scope View of the Sources Panel
77
76
  */
78
77
  revealInMemoryInspectorPanel: 'Reveal in Memory Inspector panel',
79
- /**
80
- *@description Error message that shows up in the console if a buffer to be opened in the lienar memory inspector cannot be found.
81
- */
82
- couldNotOpenLinearMemory: 'Could not open linear memory inspector: failed locating buffer.',
83
78
  };
84
79
  const str_ = i18n.i18n.registerUIStrings('panels/sources/ScopeChainSidebarPane.ts', UIStrings);
85
80
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -310,24 +305,10 @@ export class OpenLinearMemoryInspector extends UI.Widget.VBox implements UI.Cont
310
305
  return openLinearMemoryInspectorInstance;
311
306
  }
312
307
 
313
- private isMemoryObjectProperty(obj: SDK.RemoteObject.RemoteObject): boolean {
314
- const isWasmOrBuffer = obj.type === 'object' && obj.subtype &&
315
- LinearMemoryInspector.LinearMemoryInspectorController.ACCEPTED_MEMORY_TYPES.includes(obj.subtype);
316
- if (isWasmOrBuffer) {
317
- return true;
318
- }
319
-
320
- const isWasmDWARF = obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode;
321
- if (isWasmDWARF) {
322
- return obj.inspectableAddress !== undefined;
323
- }
324
-
325
- return false;
326
- }
327
-
328
308
  appendApplicableItems(event: Event, contextMenu: UI.ContextMenu.ContextMenu, target: Object): void {
329
309
  if (target instanceof ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement) {
330
- if (target.property && target.property.value && this.isMemoryObjectProperty(target.property.value)) {
310
+ if (target.property && target.property.value &&
311
+ LinearMemoryInspector.LinearMemoryInspectorController.isMemoryObjectProperty(target.property.value)) {
331
312
  contextMenu.debugSection().appendItem(
332
313
  i18nString(UIStrings.revealInMemoryInspectorPanel),
333
314
  this.openMemoryInspector.bind(this, target.property.value));
@@ -337,26 +318,7 @@ export class OpenLinearMemoryInspector extends UI.Widget.VBox implements UI.Cont
337
318
 
338
319
  private async openMemoryInspector(obj: SDK.RemoteObject.RemoteObject): Promise<void> {
339
320
  const controller = LinearMemoryInspector.LinearMemoryInspectorController.LinearMemoryInspectorController.instance();
340
- let address = 0;
341
- let memoryObj: SDK.RemoteObject.RemoteObject = obj;
342
-
343
- if (obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode) {
344
- const valueNode = obj;
345
- address = valueNode.inspectableAddress || 0;
346
- const callFrame = valueNode.callFrame;
347
- const response = await obj.debuggerModel().agent.invoke_evaluateOnCallFrame({
348
- callFrameId: callFrame.id,
349
- expression: 'memories[0]',
350
- });
351
- const error = response.getError();
352
- if (error) {
353
- console.error(error);
354
- Common.Console.Console.instance().error(i18nString(UIStrings.couldNotOpenLinearMemory));
355
- }
356
- const runtimeModel = obj.debuggerModel().runtimeModel();
357
- memoryObj = runtimeModel.createRemoteObject(response.result);
358
- }
359
321
  Host.userMetrics.linearMemoryInspectorRevealedFrom(Host.UserMetrics.LinearMemoryInspectorRevealedFrom.ContextMenu);
360
- void controller.openInspectorView(memoryObj, address);
322
+ void controller.openInspectorView(obj, 0);
361
323
  }
362
324
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as Common from '../../../core/common/common.js';
6
6
  import * as Host from '../../../core/host/host.js';
7
+ import * as i18n from '../../../core/i18n/i18n.js';
7
8
  import * as SDK from '../../../core/sdk/sdk.js';
8
9
  import * as Protocol from '../../../generated/protocol.js';
9
10
  import * as UI from '../../legacy/legacy.js';
@@ -12,7 +13,17 @@ import type {Settings} from './LinearMemoryInspector.js';
12
13
  import {Events as LmiEvents, LinearMemoryInspectorPaneImpl} from './LinearMemoryInspectorPane.js';
13
14
  import type {ValueType, ValueTypeMode} from './ValueInterpreterDisplayUtils.js';
14
15
  import {Endianness, getDefaultValueTypeMapping} from './ValueInterpreterDisplayUtils.js';
16
+ import * as Bindings from '../../../models/bindings/bindings.js';
15
17
 
18
+ const UIStrings = {
19
+ /**
20
+ *@description Error message that shows up in the console if a buffer to be opened in the linear memory inspector cannot be found.
21
+ */
22
+ couldNotOpenLinearMemory: 'Could not open linear memory inspector: failed locating buffer.',
23
+ };
24
+ const str_ =
25
+ i18n.i18n.registerUIStrings('ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts', UIStrings);
26
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
16
27
  const LINEAR_MEMORY_INSPECTOR_OBJECT_GROUP = 'linear-memory-inspector';
17
28
  const MEMORY_TRANSFER_MIN_CHUNK_SIZE = 1000;
18
29
  export const ACCEPTED_MEMORY_TYPES = ['webassemblymemory', 'typedarray', 'dataview', 'arraybuffer'];
@@ -66,6 +77,20 @@ async function getBufferFromObject(obj: SDK.RemoteObject.RemoteObject): Promise<
66
77
  return new SDK.RemoteObject.RemoteArrayBuffer(obj);
67
78
  }
68
79
 
80
+ export function isMemoryObjectProperty(obj: SDK.RemoteObject.RemoteObject): boolean {
81
+ const isWasmOrBuffer = obj.type === 'object' && obj.subtype && ACCEPTED_MEMORY_TYPES.includes(obj.subtype);
82
+ if (isWasmOrBuffer) {
83
+ return true;
84
+ }
85
+
86
+ const isWasmDWARF = obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode;
87
+ if (isWasmDWARF) {
88
+ return obj.inspectableAddress !== undefined;
89
+ }
90
+
91
+ return false;
92
+ }
93
+
69
94
  type SerializableSettings = {
70
95
  valueTypes: ValueType[],
71
96
  valueTypeModes: [ValueType, ValueTypeMode][],
@@ -142,21 +167,52 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
142
167
  };
143
168
  }
144
169
 
170
+ static async retrieveDWARFMemoryObjectAndAddress(obj: SDK.RemoteObject.RemoteObject):
171
+ Promise<{obj: SDK.RemoteObject.RemoteObject, address: number}|undefined> {
172
+ if (!(obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode)) {
173
+ return;
174
+ }
175
+
176
+ const valueNode = obj;
177
+ const address = valueNode.inspectableAddress || 0;
178
+ const callFrame = valueNode.callFrame;
179
+ const response = await obj.debuggerModel().agent.invoke_evaluateOnCallFrame({
180
+ callFrameId: callFrame.id,
181
+ expression: 'memories[0]',
182
+ });
183
+ const error = response.getError();
184
+ if (error) {
185
+ console.error(error);
186
+ Common.Console.Console.instance().error(i18nString(UIStrings.couldNotOpenLinearMemory));
187
+ }
188
+ const runtimeModel = obj.debuggerModel().runtimeModel();
189
+ obj = runtimeModel.createRemoteObject(response.result);
190
+ return {obj, address};
191
+ }
192
+
145
193
  async openInspectorView(obj: SDK.RemoteObject.RemoteObject, address?: number): Promise<void> {
146
- if (address !== undefined) {
194
+ const response = await LinearMemoryInspectorController.retrieveDWARFMemoryObjectAndAddress(obj);
195
+ let memoryObj = obj;
196
+ let memoryAddress = address;
197
+ if (response !== undefined) {
198
+ memoryAddress = response.address;
199
+ memoryObj = response.obj;
200
+ }
201
+
202
+ if (memoryAddress !== undefined) {
147
203
  Host.userMetrics.linearMemoryInspectorTarget(
148
204
  Host.UserMetrics.LinearMemoryInspectorTarget.DWARFInspectableAddress);
149
- } else if (obj.subtype === Protocol.Runtime.RemoteObjectSubtype.Arraybuffer) {
205
+ } else if (memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Arraybuffer) {
150
206
  Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.ArrayBuffer);
151
- } else if (obj.subtype === Protocol.Runtime.RemoteObjectSubtype.Dataview) {
207
+ } else if (memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Dataview) {
152
208
  Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.DataView);
153
- } else if (obj.subtype === Protocol.Runtime.RemoteObjectSubtype.Typedarray) {
209
+ } else if (memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Typedarray) {
154
210
  Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.TypedArray);
155
211
  } else {
156
- console.assert(obj.subtype === Protocol.Runtime.RemoteObjectSubtype.Webassemblymemory);
212
+ console.assert(memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Webassemblymemory);
157
213
  Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.WebAssemblyMemory);
158
214
  }
159
- const buffer = await getBufferFromObject(obj);
215
+ const buffer = await getBufferFromObject(memoryObj);
160
216
  const {internalProperties} = await buffer.object().getOwnProperties(false);
161
217
  const idProperty = internalProperties?.find(({name}) => name === '[[ArrayBufferData]]');
162
218
  const id = idProperty?.value?.value;
@@ -167,7 +223,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
167
223
  const memory = memoryProperty?.value;
168
224
 
169
225
  if (this.#bufferIdToRemoteObject.has(id)) {
170
- this.#paneInstance.reveal(id, address);
226
+ this.#paneInstance.reveal(id, memoryAddress);
171
227
  void UI.ViewManager.ViewManager.instance().showView('linear-memory-inspector');
172
228
  return;
173
229
  }
@@ -176,7 +232,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
176
232
  this.#bufferIdToRemoteObject.set(id, buffer.object());
177
233
  const arrayBufferWrapper = new RemoteArrayBufferWrapper(buffer);
178
234
 
179
- this.#paneInstance.create(id, title, arrayBufferWrapper, address);
235
+ this.#paneInstance.create(id, title, arrayBufferWrapper, memoryAddress);
180
236
  void UI.ViewManager.ViewManager.instance().showView('linear-memory-inspector');
181
237
  }
182
238
 
@@ -2,8 +2,9 @@
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 ComponentHelpers from '../../../ui/components/helpers/helpers.js';
6
5
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
6
+ import * as ComponentHelpers from '../helpers/helpers.js';
7
+
7
8
  import nodeTextStyles from './nodeText.css.js';
8
9
 
9
10
  const {render, html} = LitHtml;
@@ -0,0 +1,9 @@
1
+ // Copyright 2021 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 NodeText from './NodeText.js';
6
+
7
+ export {
8
+ NodeText,
9
+ };
@@ -359,7 +359,7 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
359
359
  // TypedArrays DataViews are also supported, but showing the icon next to their
360
360
  // previews is quite a significant visual overhead, and users can easily get to
361
361
  // their buffers and open the memory inspector from there.
362
- if (obj.type !== 'object' || (obj.subtype !== 'arraybuffer' && obj.subtype !== 'webassemblymemory')) {
362
+ if (!LinearMemoryInspector.LinearMemoryInspectorController.isMemoryObjectProperty(obj)) {
363
363
  return;
364
364
  }
365
365
  const memoryIcon = new IconButton.Icon.Icon();
@@ -369,12 +369,15 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
369
369
  width: '13px',
370
370
  height: '13px',
371
371
  };
372
- memoryIcon.onclick = (event: MouseEvent): void => {
373
- Host.userMetrics.linearMemoryInspectorRevealedFrom(Host.UserMetrics.LinearMemoryInspectorRevealedFrom.MemoryIcon);
374
- void LinearMemoryInspector.LinearMemoryInspectorController.LinearMemoryInspectorController.instance()
375
- .openInspectorView(obj);
372
+
373
+ memoryIcon.onclick = async(event: MouseEvent): Promise<void> => {
376
374
  event.stopPropagation();
375
+ const controller =
376
+ LinearMemoryInspector.LinearMemoryInspectorController.LinearMemoryInspectorController.instance();
377
+ Host.userMetrics.linearMemoryInspectorRevealedFrom(Host.UserMetrics.LinearMemoryInspectorRevealedFrom.MemoryIcon);
378
+ void controller.openInspectorView(obj, 0);
377
379
  };
380
+
378
381
  UI.Tooltip.Tooltip.install(memoryIcon, 'Reveal in Memory Inspector panel');
379
382
  element.classList.add('object-value-with-memory-icon');
380
383
  element.appendChild(memoryIcon);
@@ -56,10 +56,7 @@
56
56
  display: inline-flex;
57
57
  }
58
58
 
59
- .object-value-arraybuffer devtools-icon,
60
- .object-value-dataview devtools-icon,
61
- .object-value-typedarray devtools-icon,
62
- .object-value-webassemblymemory devtools-icon {
59
+ .object-value-with-memory-icon > devtools-icon {
63
60
  cursor: pointer;
64
61
  }
65
62
 
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.1014853"
58
+ "version": "1.0.1015723"
59
59
  }