chrome-devtools-frontend 1.0.927127 → 1.0.928589
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/AUTHORS +1 -0
- package/config/gni/all_devtools_files.gni +0 -1
- package/config/gni/devtools_grd_files.gni +30 -4
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_preview_feature.svg +3 -0
- package/front_end/Tests.js +2 -3
- package/front_end/core/common/Settings.ts +26 -45
- package/front_end/core/host/UserMetrics.ts +2 -2
- package/front_end/core/i18n/locales/en-US.json +60 -15
- package/front_end/core/i18n/locales/en-XL.json +60 -15
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +62 -61
- package/front_end/core/sdk/AccessibilityModel.ts +73 -73
- package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
- package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
- package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
- package/front_end/core/sdk/CSSFontFace.ts +10 -10
- package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSMetadata.ts +53 -49
- package/front_end/core/sdk/CSSModel.ts +139 -135
- package/front_end/core/sdk/CSSProperty.ts +18 -18
- package/front_end/core/sdk/CSSRule.ts +15 -15
- package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
- package/front_end/core/sdk/ChildTargetManager.ts +41 -40
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
- package/front_end/core/sdk/Connections.ts +81 -81
- package/front_end/core/sdk/ConsoleModel.ts +68 -68
- package/front_end/core/sdk/Cookie.ts +48 -48
- package/front_end/core/sdk/CookieModel.ts +13 -13
- package/front_end/core/sdk/CookieParser.ts +45 -45
- package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
- package/front_end/core/sdk/DOMModel.ts +264 -252
- package/front_end/core/sdk/DebuggerModel.ts +209 -205
- package/front_end/core/sdk/EmulationModel.ts +76 -76
- package/front_end/core/sdk/FilmStripModel.ts +29 -29
- package/front_end/core/sdk/FrameManager.ts +43 -42
- package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
- package/front_end/core/sdk/IsolateManager.ts +82 -82
- package/front_end/core/sdk/IssuesModel.ts +6 -6
- package/front_end/core/sdk/LayerTreeBase.ts +37 -37
- package/front_end/core/sdk/LogModel.ts +5 -5
- package/front_end/core/sdk/NetworkManager.ts +229 -225
- package/front_end/core/sdk/NetworkRequest.ts +368 -360
- package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
- package/front_end/core/sdk/OverlayModel.ts +155 -153
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
- package/front_end/core/sdk/PageResourceLoader.ts +30 -30
- package/front_end/core/sdk/PaintProfiler.ts +16 -16
- package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
- package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
- package/front_end/core/sdk/RemoteObject.ts +108 -104
- package/front_end/core/sdk/Resource.ts +85 -84
- package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
- package/front_end/core/sdk/RuntimeModel.ts +38 -34
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
- package/front_end/core/sdk/Script.ts +29 -29
- package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
- package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
- package/front_end/core/sdk/SourceMap.ts +40 -36
- package/front_end/core/sdk/SourceMapManager.ts +57 -57
- package/front_end/core/sdk/Target.ts +64 -63
- package/front_end/core/sdk/TargetManager.ts +60 -56
- package/front_end/core/sdk/TracingManager.ts +39 -39
- package/front_end/core/sdk/TracingModel.ts +125 -125
- package/front_end/core/sdk/WebAuthnModel.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
- package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
- package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/GenericIssue.ts +86 -0
- package/front_end/models/issues_manager/Issue.ts +24 -0
- package/front_end/models/issues_manager/IssuesManager.ts +18 -6
- package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
- package/front_end/panels/console/ConsoleSidebar.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
- package/front_end/panels/elements/components/LayoutPane.ts +5 -1
- package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
- package/front_end/panels/issues/IssueAggregator.ts +16 -0
- package/front_end/panels/issues/IssueKindView.ts +95 -0
- package/front_end/panels/issues/IssueView.ts +6 -0
- package/front_end/panels/issues/IssuesPane.ts +81 -18
- package/front_end/panels/issues/issuesTree.css +8 -3
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -0
- package/front_end/panels/settings/settingsScreen.css +24 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/ARIAUtils.ts +14 -11
- package/front_end/ui/legacy/TabbedPane.ts +32 -3
- package/front_end/ui/legacy/UIUtils.ts +3 -1
- package/front_end/ui/legacy/View.ts +6 -0
- package/front_end/ui/legacy/ViewManager.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +5 -0
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/closeButton.css +6 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/tabbedPane.css +24 -0
- package/front_end/ui/legacy/toolbar.css +5 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +9 -0
- package/scripts/migration/class-fields/migrate.js +56 -0
- package/scripts/migration/class-fields/package.json +5 -0
- package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
- package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
|
@@ -49,12 +49,12 @@ export class ProfileNode {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export class ProfileTreeModel {
|
|
52
|
-
|
|
52
|
+
readonly #targetInternal: Target|null;
|
|
53
53
|
root!: ProfileNode;
|
|
54
54
|
total!: number;
|
|
55
55
|
maxDepth!: number;
|
|
56
56
|
constructor(target?: Target|null) {
|
|
57
|
-
this
|
|
57
|
+
this.#targetInternal = target || null;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
initialize(root: ProfileNode): void {
|
|
@@ -105,6 +105,6 @@ export class ProfileTreeModel {
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
target(): Target|null {
|
|
108
|
-
return this
|
|
108
|
+
return this.#targetInternal;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
|
|
1
5
|
/*
|
|
2
6
|
* Copyright (C) 2009 Google Inc. All rights reserved.
|
|
3
7
|
*
|
|
@@ -11,7 +15,7 @@
|
|
|
11
15
|
* copyright notice, this list of conditions and the following disclaimer
|
|
12
16
|
* in the documentation and/or other materials provided with the
|
|
13
17
|
* distribution.
|
|
14
|
-
* * Neither the name of Google Inc. nor the names of its
|
|
18
|
+
* * Neither the #name of Google Inc. nor the names of its
|
|
15
19
|
* contributors may be used to endorse or promote products derived from
|
|
16
20
|
* this software without specific prior written permission.
|
|
17
21
|
*
|
|
@@ -172,7 +176,7 @@ export class RemoteObject {
|
|
|
172
176
|
propertySymbols.push(property);
|
|
173
177
|
} else if (property.isOwn || property.name !== '__proto__') {
|
|
174
178
|
// TODO(crbug/1076820): Eventually we should move away from
|
|
175
|
-
// showing accessor properties directly on the receiver.
|
|
179
|
+
// showing accessor #properties directly on the receiver.
|
|
176
180
|
propertiesMap.set(property.name, property);
|
|
177
181
|
}
|
|
178
182
|
}
|
|
@@ -295,19 +299,19 @@ export class RemoteObject {
|
|
|
295
299
|
|
|
296
300
|
export class RemoteObjectImpl extends RemoteObject {
|
|
297
301
|
runtimeModelInternal: RuntimeModel;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
readonly #runtimeAgent: ProtocolProxyApi.RuntimeApi;
|
|
303
|
+
readonly #typeInternal: string;
|
|
304
|
+
readonly #subtypeInternal: string|undefined;
|
|
305
|
+
#objectIdInternal: Protocol.Runtime.RemoteObjectId|undefined;
|
|
306
|
+
#descriptionInternal: string|undefined;
|
|
303
307
|
hasChildrenInternal: boolean;
|
|
304
|
-
|
|
305
|
-
|
|
308
|
+
readonly #previewInternal: Protocol.Runtime.ObjectPreview|undefined;
|
|
309
|
+
readonly #unserializableValueInternal: string|undefined;
|
|
306
310
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
307
311
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
312
|
+
readonly #valueInternal: any;
|
|
313
|
+
readonly #customPreviewInternal: Protocol.Runtime.CustomPreview|null;
|
|
314
|
+
readonly #classNameInternal: string|null;
|
|
311
315
|
|
|
312
316
|
constructor(
|
|
313
317
|
runtimeModel: RuntimeModel, objectId: Protocol.Runtime.RemoteObjectId|undefined, type: string,
|
|
@@ -318,27 +322,27 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
318
322
|
super();
|
|
319
323
|
|
|
320
324
|
this.runtimeModelInternal = runtimeModel;
|
|
321
|
-
this
|
|
325
|
+
this.#runtimeAgent = runtimeModel.target().runtimeAgent();
|
|
322
326
|
|
|
323
|
-
this
|
|
324
|
-
this
|
|
327
|
+
this.#typeInternal = type;
|
|
328
|
+
this.#subtypeInternal = subtype;
|
|
325
329
|
if (objectId) {
|
|
326
330
|
// handle
|
|
327
|
-
this
|
|
328
|
-
this
|
|
331
|
+
this.#objectIdInternal = objectId;
|
|
332
|
+
this.#descriptionInternal = description;
|
|
329
333
|
this.hasChildrenInternal = (type !== 'symbol');
|
|
330
|
-
this
|
|
334
|
+
this.#previewInternal = preview;
|
|
331
335
|
} else {
|
|
332
|
-
this
|
|
336
|
+
this.#descriptionInternal = description;
|
|
333
337
|
if (!this.description && unserializableValue) {
|
|
334
|
-
this
|
|
338
|
+
this.#descriptionInternal = unserializableValue;
|
|
335
339
|
}
|
|
336
|
-
if (!this
|
|
337
|
-
this
|
|
340
|
+
if (!this.#descriptionInternal && (typeof value !== 'object' || value === null)) {
|
|
341
|
+
this.#descriptionInternal = String(value);
|
|
338
342
|
}
|
|
339
343
|
this.hasChildrenInternal = false;
|
|
340
344
|
if (typeof unserializableValue === 'string') {
|
|
341
|
-
this
|
|
345
|
+
this.#unserializableValueInternal = unserializableValue;
|
|
342
346
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
343
347
|
// @ts-expect-error
|
|
344
348
|
if (unserializableValue === UnserializableNumber.Infinity ||
|
|
@@ -351,53 +355,53 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
351
355
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
352
356
|
// @ts-expect-error
|
|
353
357
|
unserializableValue === UnserializableNumber.NaN) {
|
|
354
|
-
this
|
|
358
|
+
this.#valueInternal = Number(unserializableValue);
|
|
355
359
|
} else if (type === 'bigint' && unserializableValue.endsWith('n')) {
|
|
356
|
-
this
|
|
360
|
+
this.#valueInternal = BigInt(unserializableValue.substring(0, unserializableValue.length - 1));
|
|
357
361
|
} else {
|
|
358
|
-
this
|
|
362
|
+
this.#valueInternal = unserializableValue;
|
|
359
363
|
}
|
|
360
364
|
|
|
361
365
|
} else {
|
|
362
|
-
this
|
|
366
|
+
this.#valueInternal = value;
|
|
363
367
|
}
|
|
364
368
|
}
|
|
365
|
-
this
|
|
366
|
-
this
|
|
369
|
+
this.#customPreviewInternal = customPreview || null;
|
|
370
|
+
this.#classNameInternal = typeof className === 'string' ? className : null;
|
|
367
371
|
}
|
|
368
372
|
|
|
369
373
|
customPreview(): Protocol.Runtime.CustomPreview|null {
|
|
370
|
-
return this
|
|
374
|
+
return this.#customPreviewInternal;
|
|
371
375
|
}
|
|
372
376
|
|
|
373
377
|
get objectId(): Protocol.Runtime.RemoteObjectId|undefined {
|
|
374
|
-
return this
|
|
378
|
+
return this.#objectIdInternal;
|
|
375
379
|
}
|
|
376
380
|
|
|
377
381
|
get type(): string {
|
|
378
|
-
return this
|
|
382
|
+
return this.#typeInternal;
|
|
379
383
|
}
|
|
380
384
|
|
|
381
385
|
get subtype(): string|undefined {
|
|
382
|
-
return this
|
|
386
|
+
return this.#subtypeInternal;
|
|
383
387
|
}
|
|
384
388
|
|
|
385
389
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
386
390
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
387
391
|
get value(): any {
|
|
388
|
-
return this
|
|
392
|
+
return this.#valueInternal;
|
|
389
393
|
}
|
|
390
394
|
|
|
391
395
|
unserializableValue(): string|undefined {
|
|
392
|
-
return this
|
|
396
|
+
return this.#unserializableValueInternal;
|
|
393
397
|
}
|
|
394
398
|
|
|
395
399
|
get description(): string|undefined {
|
|
396
|
-
return this
|
|
400
|
+
return this.#descriptionInternal;
|
|
397
401
|
}
|
|
398
402
|
|
|
399
403
|
set description(description: string|undefined) {
|
|
400
|
-
this
|
|
404
|
+
this.#descriptionInternal = description;
|
|
401
405
|
}
|
|
402
406
|
|
|
403
407
|
get hasChildren(): boolean {
|
|
@@ -405,11 +409,11 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
405
409
|
}
|
|
406
410
|
|
|
407
411
|
get preview(): Protocol.Runtime.ObjectPreview|undefined {
|
|
408
|
-
return this
|
|
412
|
+
return this.#previewInternal;
|
|
409
413
|
}
|
|
410
414
|
|
|
411
415
|
get className(): string|null {
|
|
412
|
-
return this
|
|
416
|
+
return this.#classNameInternal;
|
|
413
417
|
}
|
|
414
418
|
|
|
415
419
|
getOwnProperties(generatePreview: boolean, nonIndexedPropertiesOnly: boolean = false): Promise<GetPropertiesResult> {
|
|
@@ -429,12 +433,12 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
429
433
|
async doGetProperties(
|
|
430
434
|
ownProperties: boolean, accessorPropertiesOnly: boolean, nonIndexedPropertiesOnly: boolean,
|
|
431
435
|
generatePreview: boolean): Promise<GetPropertiesResult> {
|
|
432
|
-
if (!this
|
|
436
|
+
if (!this.#objectIdInternal) {
|
|
433
437
|
return {properties: null, internalProperties: null} as GetPropertiesResult;
|
|
434
438
|
}
|
|
435
439
|
|
|
436
|
-
const response = await this
|
|
437
|
-
objectId: this
|
|
440
|
+
const response = await this.#runtimeAgent.invoke_getProperties({
|
|
441
|
+
objectId: this.#objectIdInternal,
|
|
438
442
|
ownProperties,
|
|
439
443
|
accessorPropertiesOnly,
|
|
440
444
|
nonIndexedPropertiesOnly,
|
|
@@ -490,11 +494,11 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
490
494
|
}
|
|
491
495
|
|
|
492
496
|
async setPropertyValue(name: string|Protocol.Runtime.CallArgument, value: string): Promise<string|undefined> {
|
|
493
|
-
if (!this
|
|
497
|
+
if (!this.#objectIdInternal) {
|
|
494
498
|
return 'Can’t set a property of non-object.';
|
|
495
499
|
}
|
|
496
500
|
|
|
497
|
-
const response = await this
|
|
501
|
+
const response = await this.#runtimeAgent.invoke_evaluate({expression: value, silent: true});
|
|
498
502
|
if (response.getError() || response.exceptionDetails) {
|
|
499
503
|
return response.getError() ||
|
|
500
504
|
(response.result.type !== 'string' ? response.result.description : response.result.value as string);
|
|
@@ -507,7 +511,7 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
507
511
|
const resultPromise = this.doSetObjectPropertyValue(response.result, name);
|
|
508
512
|
|
|
509
513
|
if (response.result.objectId) {
|
|
510
|
-
this
|
|
514
|
+
this.#runtimeAgent.invoke_releaseObject({objectId: response.result.objectId});
|
|
511
515
|
}
|
|
512
516
|
|
|
513
517
|
return resultPromise;
|
|
@@ -522,8 +526,8 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
522
526
|
const setPropertyValueFunction = 'function(a, b) { this[a] = b; }';
|
|
523
527
|
|
|
524
528
|
const argv = [name, RemoteObject.toCallArgument(result)];
|
|
525
|
-
const response = await this
|
|
526
|
-
objectId: this
|
|
529
|
+
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
530
|
+
objectId: this.#objectIdInternal,
|
|
527
531
|
functionDeclaration: setPropertyValueFunction,
|
|
528
532
|
arguments: argv,
|
|
529
533
|
silent: true,
|
|
@@ -533,13 +537,13 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
533
537
|
}
|
|
534
538
|
|
|
535
539
|
async deleteProperty(name: Protocol.Runtime.CallArgument): Promise<string|undefined> {
|
|
536
|
-
if (!this
|
|
540
|
+
if (!this.#objectIdInternal) {
|
|
537
541
|
return 'Can’t delete a property of non-object.';
|
|
538
542
|
}
|
|
539
543
|
|
|
540
544
|
const deletePropertyFunction = 'function(a) { delete this[a]; return !(a in this); }';
|
|
541
|
-
const response = await this
|
|
542
|
-
objectId: this
|
|
545
|
+
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
546
|
+
objectId: this.#objectIdInternal,
|
|
543
547
|
functionDeclaration: deletePropertyFunction,
|
|
544
548
|
arguments: [name],
|
|
545
549
|
silent: true,
|
|
@@ -559,8 +563,8 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
559
563
|
async callFunction<T>(
|
|
560
564
|
functionDeclaration: (this: Object, ...arg1: unknown[]) => T,
|
|
561
565
|
args?: Protocol.Runtime.CallArgument[]): Promise<CallFunctionResult> {
|
|
562
|
-
const response = await this
|
|
563
|
-
objectId: this
|
|
566
|
+
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
567
|
+
objectId: this.#objectIdInternal,
|
|
564
568
|
functionDeclaration: functionDeclaration.toString(),
|
|
565
569
|
arguments: args,
|
|
566
570
|
silent: true,
|
|
@@ -578,8 +582,8 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
578
582
|
async callFunctionJSON<T>(
|
|
579
583
|
functionDeclaration: (this: Object, ...arg1: unknown[]) => T,
|
|
580
584
|
args: Protocol.Runtime.CallArgument[]|undefined): Promise<T> {
|
|
581
|
-
const response = await this
|
|
582
|
-
objectId: this
|
|
585
|
+
const response = await this.#runtimeAgent.invoke_callFunctionOn({
|
|
586
|
+
objectId: this.#objectIdInternal,
|
|
583
587
|
functionDeclaration: functionDeclaration.toString(),
|
|
584
588
|
arguments: args,
|
|
585
589
|
silent: true,
|
|
@@ -590,10 +594,10 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
590
594
|
}
|
|
591
595
|
|
|
592
596
|
release(): void {
|
|
593
|
-
if (!this
|
|
597
|
+
if (!this.#objectIdInternal) {
|
|
594
598
|
return;
|
|
595
599
|
}
|
|
596
|
-
this
|
|
600
|
+
this.#runtimeAgent.invoke_releaseObject({objectId: this.#objectIdInternal});
|
|
597
601
|
}
|
|
598
602
|
|
|
599
603
|
arrayLength(): number {
|
|
@@ -613,13 +617,13 @@ export class RemoteObjectImpl extends RemoteObject {
|
|
|
613
617
|
}
|
|
614
618
|
|
|
615
619
|
isNode(): boolean {
|
|
616
|
-
return Boolean(this
|
|
620
|
+
return Boolean(this.#objectIdInternal) && this.type === 'object' && this.subtype === 'node';
|
|
617
621
|
}
|
|
618
622
|
}
|
|
619
623
|
|
|
620
624
|
export class ScopeRemoteObject extends RemoteObjectImpl {
|
|
621
|
-
|
|
622
|
-
|
|
625
|
+
#scopeRef: ScopeRef;
|
|
626
|
+
#savedScopeProperties: RemoteObjectProperty[]|undefined;
|
|
623
627
|
|
|
624
628
|
constructor(
|
|
625
629
|
runtimeModel: RuntimeModel, objectId: Protocol.Runtime.RemoteObjectId|undefined, scopeRef: ScopeRef, type: string,
|
|
@@ -628,8 +632,8 @@ export class ScopeRemoteObject extends RemoteObjectImpl {
|
|
|
628
632
|
subtype: string|undefined, value: any, unserializableValue?: string, description?: string,
|
|
629
633
|
preview?: Protocol.Runtime.ObjectPreview) {
|
|
630
634
|
super(runtimeModel, objectId, type, subtype, value, unserializableValue, description, preview);
|
|
631
|
-
this
|
|
632
|
-
this
|
|
635
|
+
this.#scopeRef = scopeRef;
|
|
636
|
+
this.#savedScopeProperties = undefined;
|
|
633
637
|
}
|
|
634
638
|
|
|
635
639
|
async doGetProperties(ownProperties: boolean, accessorPropertiesOnly: boolean, _generatePreview: boolean):
|
|
@@ -638,19 +642,19 @@ export class ScopeRemoteObject extends RemoteObjectImpl {
|
|
|
638
642
|
return {properties: [], internalProperties: []} as GetPropertiesResult;
|
|
639
643
|
}
|
|
640
644
|
|
|
641
|
-
if (this
|
|
645
|
+
if (this.#savedScopeProperties) {
|
|
642
646
|
// No need to reload scope variables, as the remote object never
|
|
643
|
-
// changes its properties. If variable is updated, the properties
|
|
647
|
+
// changes its #properties. If variable is updated, the #properties
|
|
644
648
|
// array is patched locally.
|
|
645
|
-
return {properties: this
|
|
649
|
+
return {properties: this.#savedScopeProperties.slice(), internalProperties: null};
|
|
646
650
|
}
|
|
647
651
|
|
|
648
652
|
const allProperties = await super.doGetProperties(
|
|
649
653
|
ownProperties, accessorPropertiesOnly, false /* nonIndexedPropertiesOnly */, true /* generatePreview */);
|
|
650
|
-
if (this
|
|
651
|
-
this
|
|
652
|
-
if (!this
|
|
653
|
-
for (const property of this
|
|
654
|
+
if (this.#scopeRef && Array.isArray(allProperties.properties)) {
|
|
655
|
+
this.#savedScopeProperties = allProperties.properties.slice();
|
|
656
|
+
if (!this.#scopeRef.callFrameId) {
|
|
657
|
+
for (const property of this.#savedScopeProperties) {
|
|
654
658
|
property.writable = false;
|
|
655
659
|
}
|
|
656
660
|
}
|
|
@@ -662,13 +666,13 @@ export class ScopeRemoteObject extends RemoteObjectImpl {
|
|
|
662
666
|
Promise<string|undefined> {
|
|
663
667
|
const name = (argumentName.value as string);
|
|
664
668
|
const error = await this.debuggerModel().setVariableValue(
|
|
665
|
-
this
|
|
666
|
-
(this
|
|
669
|
+
this.#scopeRef.number, name, RemoteObject.toCallArgument(result),
|
|
670
|
+
(this.#scopeRef.callFrameId as Protocol.Debugger.CallFrameId));
|
|
667
671
|
if (error) {
|
|
668
672
|
return error;
|
|
669
673
|
}
|
|
670
|
-
if (this
|
|
671
|
-
for (const property of this
|
|
674
|
+
if (this.#savedScopeProperties) {
|
|
675
|
+
for (const property of this.#savedScopeProperties) {
|
|
672
676
|
if (property.name === name) {
|
|
673
677
|
property.value = this.runtimeModel().createRemoteObject(result);
|
|
674
678
|
}
|
|
@@ -744,15 +748,15 @@ export class RemoteObjectProperty {
|
|
|
744
748
|
// Below is a wrapper around a local object that implements the RemoteObject interface,
|
|
745
749
|
// which can be used by the UI code (primarily ObjectPropertiesSection).
|
|
746
750
|
// Note that only JSON-compliant objects are currently supported, as there's no provision
|
|
747
|
-
// for traversing prototypes, extracting class names via constructor, handling properties
|
|
751
|
+
// for traversing prototypes, extracting class names via constructor, handling #properties
|
|
748
752
|
// or functions.
|
|
749
753
|
|
|
750
754
|
export class LocalJSONObject extends RemoteObject {
|
|
751
755
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
752
756
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
753
757
|
valueInternal: any;
|
|
754
|
-
|
|
755
|
-
|
|
758
|
+
#cachedDescription!: string;
|
|
759
|
+
#cachedChildren!: RemoteObjectProperty[];
|
|
756
760
|
|
|
757
761
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
758
762
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -777,8 +781,8 @@ export class LocalJSONObject extends RemoteObject {
|
|
|
777
781
|
}
|
|
778
782
|
|
|
779
783
|
get description(): string {
|
|
780
|
-
if (this
|
|
781
|
-
return this
|
|
784
|
+
if (this.#cachedDescription) {
|
|
785
|
+
return this.#cachedDescription;
|
|
782
786
|
}
|
|
783
787
|
|
|
784
788
|
function formatArrayItem(this: LocalJSONObject, property: RemoteObjectProperty): string {
|
|
@@ -796,22 +800,22 @@ export class LocalJSONObject extends RemoteObject {
|
|
|
796
800
|
if (this.type === 'object') {
|
|
797
801
|
switch (this.subtype) {
|
|
798
802
|
case 'array':
|
|
799
|
-
this
|
|
803
|
+
this.#cachedDescription = this.concatenate('[', ']', formatArrayItem.bind(this));
|
|
800
804
|
break;
|
|
801
805
|
case 'date':
|
|
802
|
-
this
|
|
806
|
+
this.#cachedDescription = String(this.valueInternal);
|
|
803
807
|
break;
|
|
804
808
|
case 'null':
|
|
805
|
-
this
|
|
809
|
+
this.#cachedDescription = 'null';
|
|
806
810
|
break;
|
|
807
811
|
default:
|
|
808
|
-
this
|
|
812
|
+
this.#cachedDescription = this.concatenate('{', '}', formatObjectItem.bind(this));
|
|
809
813
|
}
|
|
810
814
|
} else {
|
|
811
|
-
this
|
|
815
|
+
this.#cachedDescription = String(this.valueInternal);
|
|
812
816
|
}
|
|
813
817
|
|
|
814
|
-
return this
|
|
818
|
+
return this.#cachedDescription;
|
|
815
819
|
}
|
|
816
820
|
|
|
817
821
|
private formatValue(value: RemoteObject|null): string {
|
|
@@ -910,10 +914,10 @@ export class LocalJSONObject extends RemoteObject {
|
|
|
910
914
|
}
|
|
911
915
|
return new RemoteObjectProperty(propName, propValue);
|
|
912
916
|
}
|
|
913
|
-
if (!this
|
|
914
|
-
this
|
|
917
|
+
if (!this.#cachedChildren) {
|
|
918
|
+
this.#cachedChildren = Object.keys((value as Object)).map(buildProperty);
|
|
915
919
|
}
|
|
916
|
-
return this
|
|
920
|
+
return this.#cachedChildren;
|
|
917
921
|
}
|
|
918
922
|
|
|
919
923
|
arrayLength(): number {
|
|
@@ -957,16 +961,16 @@ export class LocalJSONObject extends RemoteObject {
|
|
|
957
961
|
}
|
|
958
962
|
|
|
959
963
|
export class RemoteArrayBuffer {
|
|
960
|
-
|
|
964
|
+
readonly #objectInternal: RemoteObject;
|
|
961
965
|
constructor(object: RemoteObject) {
|
|
962
966
|
if (object.type !== 'object' || object.subtype !== 'arraybuffer') {
|
|
963
967
|
throw new Error('Object is not an arraybuffer');
|
|
964
968
|
}
|
|
965
|
-
this
|
|
969
|
+
this.#objectInternal = object;
|
|
966
970
|
}
|
|
967
971
|
|
|
968
972
|
byteLength(): number {
|
|
969
|
-
return this
|
|
973
|
+
return this.#objectInternal.arrayBufferByteLength();
|
|
970
974
|
}
|
|
971
975
|
|
|
972
976
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
@@ -980,7 +984,7 @@ export class RemoteArrayBuffer {
|
|
|
980
984
|
}
|
|
981
985
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
982
986
|
// @ts-expect-error
|
|
983
|
-
return await this
|
|
987
|
+
return await this.#objectInternal.callFunctionJSON(bytes, [{value: start}, {value: end - start}]);
|
|
984
988
|
|
|
985
989
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
986
990
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -990,14 +994,14 @@ export class RemoteArrayBuffer {
|
|
|
990
994
|
}
|
|
991
995
|
|
|
992
996
|
object(): RemoteObject {
|
|
993
|
-
return this
|
|
997
|
+
return this.#objectInternal;
|
|
994
998
|
}
|
|
995
999
|
}
|
|
996
1000
|
|
|
997
1001
|
export class RemoteArray {
|
|
998
|
-
|
|
1002
|
+
readonly #objectInternal: RemoteObject;
|
|
999
1003
|
constructor(object: RemoteObject) {
|
|
1000
|
-
this
|
|
1004
|
+
this.#objectInternal = object;
|
|
1001
1005
|
}
|
|
1002
1006
|
|
|
1003
1007
|
static objectAsArray(object: RemoteObject|null): RemoteArray {
|
|
@@ -1035,12 +1039,12 @@ export class RemoteArray {
|
|
|
1035
1039
|
}
|
|
1036
1040
|
|
|
1037
1041
|
at(index: number): Promise<RemoteObject> {
|
|
1038
|
-
if (index < 0 || index > this
|
|
1042
|
+
if (index < 0 || index > this.#objectInternal.arrayLength()) {
|
|
1039
1043
|
throw new Error('Out of range');
|
|
1040
1044
|
}
|
|
1041
1045
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
1042
1046
|
// @ts-expect-error
|
|
1043
|
-
return this
|
|
1047
|
+
return this.#objectInternal.callFunction(at, [RemoteObject.toCallArgument(index)]).then(assertCallFunctionResult);
|
|
1044
1048
|
|
|
1045
1049
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
1046
1050
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1057,7 +1061,7 @@ export class RemoteArray {
|
|
|
1057
1061
|
}
|
|
1058
1062
|
|
|
1059
1063
|
length(): number {
|
|
1060
|
-
return this
|
|
1064
|
+
return this.#objectInternal.arrayLength();
|
|
1061
1065
|
}
|
|
1062
1066
|
|
|
1063
1067
|
map<T>(func: (arg0: RemoteObject) => Promise<T>): Promise<T[]> {
|
|
@@ -1069,15 +1073,15 @@ export class RemoteArray {
|
|
|
1069
1073
|
}
|
|
1070
1074
|
|
|
1071
1075
|
object(): RemoteObject {
|
|
1072
|
-
return this
|
|
1076
|
+
return this.#objectInternal;
|
|
1073
1077
|
}
|
|
1074
1078
|
}
|
|
1075
1079
|
|
|
1076
1080
|
export class RemoteFunction {
|
|
1077
|
-
|
|
1081
|
+
readonly #objectInternal: RemoteObject;
|
|
1078
1082
|
|
|
1079
1083
|
constructor(object: RemoteObject) {
|
|
1080
|
-
this
|
|
1084
|
+
this.#objectInternal = object;
|
|
1081
1085
|
}
|
|
1082
1086
|
|
|
1083
1087
|
static objectAsFunction(object: RemoteObject|null): RemoteFunction {
|
|
@@ -1088,11 +1092,11 @@ export class RemoteFunction {
|
|
|
1088
1092
|
}
|
|
1089
1093
|
|
|
1090
1094
|
targetFunction(): Promise<RemoteObject> {
|
|
1091
|
-
return this
|
|
1095
|
+
return this.#objectInternal.getOwnProperties(false /* generatePreview */).then(targetFunction.bind(this));
|
|
1092
1096
|
|
|
1093
1097
|
function targetFunction(this: RemoteFunction, ownProperties: GetPropertiesResult): RemoteObject {
|
|
1094
1098
|
if (!ownProperties.internalProperties) {
|
|
1095
|
-
return this
|
|
1099
|
+
return this.#objectInternal;
|
|
1096
1100
|
}
|
|
1097
1101
|
const internalProperties = ownProperties.internalProperties;
|
|
1098
1102
|
for (const property of internalProperties) {
|
|
@@ -1100,7 +1104,7 @@ export class RemoteFunction {
|
|
|
1100
1104
|
return property.value as RemoteObject;
|
|
1101
1105
|
}
|
|
1102
1106
|
}
|
|
1103
|
-
return this
|
|
1107
|
+
return this.#objectInternal;
|
|
1104
1108
|
}
|
|
1105
1109
|
}
|
|
1106
1110
|
|
|
@@ -1109,7 +1113,7 @@ export class RemoteFunction {
|
|
|
1109
1113
|
|
|
1110
1114
|
function functionDetails(this: RemoteFunction, targetFunction: RemoteObject): Promise<FunctionDetails|null> {
|
|
1111
1115
|
const boundReleaseFunctionDetails =
|
|
1112
|
-
releaseTargetFunction.bind(null, this
|
|
1116
|
+
releaseTargetFunction.bind(null, this.#objectInternal !== targetFunction ? targetFunction : null);
|
|
1113
1117
|
return targetFunction.debuggerModel().functionDetailsPromise(targetFunction).then(boundReleaseFunctionDetails);
|
|
1114
1118
|
}
|
|
1115
1119
|
|
|
@@ -1123,7 +1127,7 @@ export class RemoteFunction {
|
|
|
1123
1127
|
}
|
|
1124
1128
|
|
|
1125
1129
|
object(): RemoteObject {
|
|
1126
|
-
return this
|
|
1130
|
+
return this.#objectInternal;
|
|
1127
1131
|
}
|
|
1128
1132
|
}
|
|
1129
1133
|
|