chrome-devtools-frontend 1.0.1015276 → 1.0.1015658
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.
- package/config/gni/devtools_grd_files.gni +1 -0
- package/front_end/core/common/JavaScriptMetaData.ts +20 -0
- package/front_end/core/i18n/locales/en-US.json +3 -3
- package/front_end/core/i18n/locales/en-XL.json +3 -3
- package/front_end/core/sdk/DOMModel.ts +9 -0
- package/front_end/core/sdk/DebuggerModel.ts +0 -28
- package/front_end/core/sdk/Script.ts +5 -14
- package/front_end/generated/InspectorBackendCommands.js +7 -3
- package/front_end/generated/protocol-mapping.d.ts +16 -0
- package/front_end/generated/protocol-proxy-api.d.ts +18 -0
- package/front_end/generated/protocol.ts +31 -5
- package/front_end/models/bindings/ResourceScriptMapping.ts +1 -2
- package/front_end/models/emulation/EmulatedDevices.ts +0 -13
- package/front_end/models/javascript_metadata/DOMPinnedProperties.ts +784 -3251
- package/front_end/models/javascript_metadata/JavaScriptMetadata.ts +3 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +4 -4
- package/front_end/models/javascript_metadata/javascript_metadata.ts +3 -0
- package/front_end/models/source_map_scopes/NamesResolver.ts +11 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +7 -3
- package/front_end/panels/lighthouse/lighthouseStartView.css +3 -1
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +4 -42
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +64 -8
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +8 -5
- package/front_end/ui/legacy/components/object_ui/objectValue.css +1 -4
- 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
|
-
|
58
|
-
|
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 = '
|
62
|
-
|
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
|
-
|
1710
|
-
if (
|
1711
|
-
|
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
|
|
@@ -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 &&
|
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(
|
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
|
-
|
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 (
|
205
|
+
} else if (memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Arraybuffer) {
|
150
206
|
Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.ArrayBuffer);
|
151
|
-
} else if (
|
207
|
+
} else if (memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Dataview) {
|
152
208
|
Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.DataView);
|
153
|
-
} else if (
|
209
|
+
} else if (memoryObj.subtype === Protocol.Runtime.RemoteObjectSubtype.Typedarray) {
|
154
210
|
Host.userMetrics.linearMemoryInspectorTarget(Host.UserMetrics.LinearMemoryInspectorTarget.TypedArray);
|
155
211
|
} else {
|
156
|
-
console.assert(
|
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(
|
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,
|
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,
|
235
|
+
this.#paneInstance.create(id, title, arrayBufferWrapper, memoryAddress);
|
180
236
|
void UI.ViewManager.ViewManager.instance().showView('linear-memory-inspector');
|
181
237
|
}
|
182
238
|
|
@@ -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 (
|
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
|
-
|
373
|
-
|
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-
|
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