chrome-devtools-frontend 1.0.1657110 → 1.0.1657855
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/.agents/skills/devtools-ux-writing-refactor/SKILL.md +125 -0
- package/.agents/skills/repro-flaky-tests/SKILL.md +53 -0
- package/front_end/Images/src/ads.svg +1 -0
- package/front_end/core/common/ResourceType.ts +19 -19
- package/front_end/core/common/Revealer.ts +15 -15
- package/front_end/core/common/SettingRegistration.ts +19 -19
- package/front_end/core/sdk/CSSMetadata.ts +110 -16
- package/front_end/core/sdk/NetworkManager.ts +1 -3
- package/front_end/entrypoints/devtools_app/devtools_app.ts +1 -1
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +13 -4
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +23 -4
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +7 -6
- package/front_end/entrypoints/main/MainImpl.ts +7 -34
- package/front_end/entrypoints/main/main-meta.ts +8 -8
- package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +5 -5
- package/front_end/entrypoints/node_app/app/NodeMain.ts +3 -3
- package/front_end/entrypoints/node_app/node_app.ts +7 -7
- package/front_end/foundation/Universe.ts +32 -5
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/protocol.ts +4 -0
- package/front_end/models/ai_assistance/AiUtils.ts +6 -6
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -5
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +13 -15
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +6 -4
- package/front_end/models/bindings/FileUtils.ts +11 -12
- package/front_end/models/emulation/DeviceModeModel.ts +14 -14
- package/front_end/models/emulation/EmulatedDevices.ts +3 -3
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +23 -12
- package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -1
- package/front_end/panels/application/BackgroundServiceView.ts +2 -1
- package/front_end/panels/application/IndexedDBViews.ts +52 -23
- package/front_end/panels/application/components/AdsView.ts +1 -1
- package/front_end/panels/application/resourcesSidebar.css +5 -0
- package/front_end/panels/console/ConsoleContextSelector.ts +3 -3
- package/front_end/panels/console/ConsolePinPane.ts +10 -10
- package/front_end/panels/console/ConsolePrompt.ts +4 -4
- package/front_end/panels/console/ConsoleSidebar.ts +7 -7
- package/front_end/panels/console/ConsoleView.ts +44 -43
- package/front_end/panels/console/ConsoleViewMessage.ts +40 -40
- package/front_end/panels/console/console-meta.ts +34 -34
- package/front_end/panels/coverage/CoverageView.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +19 -20
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +6 -8
- package/front_end/panels/developer_resources/developer_resources-meta.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +45 -1
- package/front_end/panels/media/EventDisplayTable.ts +2 -2
- package/front_end/panels/media/EventTimelineView.ts +4 -4
- package/front_end/panels/media/MainView.ts +4 -4
- package/front_end/panels/media/PlayerDetailView.ts +5 -5
- package/front_end/panels/media/PlayerListView.ts +1 -1
- package/front_end/panels/media/PlayerMessagesView.ts +12 -12
- package/front_end/panels/media/PlayerPropertiesView.ts +17 -17
- package/front_end/panels/network/NetworkLogView.ts +2 -1
- package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -3
- package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
- package/front_end/panels/network/networkPanel.css +1 -0
- package/front_end/panels/network/networkTimingTable.css +1 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +2 -1
- package/front_end/panels/profiler/ProfileView.ts +2 -1
- package/front_end/panels/protocol_monitor/JSONEditor.ts +10 -10
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +28 -32
- package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
- package/front_end/panels/recorder/RecorderController.ts +1 -0
- package/front_end/panels/recorder/RecorderEvents.ts +8 -0
- package/front_end/panels/webauthn/WebauthnPane.ts +10 -10
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/dialogs/shortcutDialog.css +15 -12
- package/front_end/ui/legacy/Treeoutline.ts +15 -0
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +5 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/package.json +1 -1
|
@@ -404,6 +404,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
404
404
|
SDK.TargetManager.SDKModelObserver<SDK.DebuggerModel.DebuggerModel> {
|
|
405
405
|
readonly #workspace: Workspace.Workspace.WorkspaceImpl;
|
|
406
406
|
readonly #debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
|
|
407
|
+
readonly #console: Common.Console.Console;
|
|
407
408
|
#plugins: DebuggerLanguagePlugin[];
|
|
408
409
|
readonly #debuggerModelToData: Map<SDK.DebuggerModel.DebuggerModel, ModelData>;
|
|
409
410
|
readonly #rawModuleHandles: Map<string, {
|
|
@@ -417,11 +418,11 @@ export class DebuggerLanguagePluginManager implements
|
|
|
417
418
|
private readonly stopIdByCallFrame = new Map<SDK.DebuggerModel.CallFrame, StopId>();
|
|
418
419
|
private nextStopId: StopId = 0n;
|
|
419
420
|
|
|
420
|
-
constructor(
|
|
421
|
-
|
|
422
|
-
debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
|
|
421
|
+
constructor(targetManager: SDK.TargetManager.TargetManager, workspace: Workspace.Workspace.WorkspaceImpl,
|
|
422
|
+
debuggerWorkspaceBinding: DebuggerWorkspaceBinding, console: Common.Console.Console) {
|
|
423
423
|
this.#workspace = workspace;
|
|
424
424
|
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
425
|
+
this.#console = console;
|
|
425
426
|
|
|
426
427
|
this.#plugins = [];
|
|
427
428
|
|
|
@@ -511,8 +512,8 @@ export class DebuggerLanguagePluginManager implements
|
|
|
511
512
|
const scripts = rawModuleHandle.scripts.filter(script => script.debuggerModel !== debuggerModel);
|
|
512
513
|
if (scripts.length === 0) {
|
|
513
514
|
rawModuleHandle.plugin.removeRawModule(rawModuleId).catch(error => {
|
|
514
|
-
|
|
515
|
-
|
|
515
|
+
this.#console.error(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}),
|
|
516
|
+
/* show=*/ false);
|
|
516
517
|
});
|
|
517
518
|
this.#rawModuleHandles.delete(rawModuleId);
|
|
518
519
|
} else {
|
|
@@ -633,8 +634,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
633
634
|
sourceLocation.lineNumber, sourceLocation.columnNumber >= 0 ? sourceLocation.columnNumber : undefined);
|
|
634
635
|
}
|
|
635
636
|
} catch (error) {
|
|
636
|
-
|
|
637
|
-
i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}), /* show=*/ false);
|
|
637
|
+
this.#console.error(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}), /* show=*/ false);
|
|
638
638
|
}
|
|
639
639
|
return null;
|
|
640
640
|
}
|
|
@@ -663,8 +663,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
return Promise.all(locationPromises).then(locations => locations.flat()).catch(error => {
|
|
666
|
-
|
|
667
|
-
i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}), /* show=*/ false);
|
|
666
|
+
this.#console.error(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}), /* show=*/ false);
|
|
668
667
|
return null;
|
|
669
668
|
});
|
|
670
669
|
|
|
@@ -841,7 +840,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
841
840
|
let rawModuleHandle = this.#rawModuleHandles.get(rawModuleId);
|
|
842
841
|
if (!rawModuleHandle) {
|
|
843
842
|
const sourceFileURLsPromise = (async () => {
|
|
844
|
-
const console =
|
|
843
|
+
const console = this.#console;
|
|
845
844
|
const url = script.sourceURL;
|
|
846
845
|
const symbolsUrl = (script.debugSymbols?.externalURL) || '';
|
|
847
846
|
if (symbolsUrl) {
|
|
@@ -962,8 +961,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
962
961
|
}
|
|
963
962
|
return Array.from(scopes.values());
|
|
964
963
|
} catch (error) {
|
|
965
|
-
|
|
966
|
-
i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}), /* show=*/ false);
|
|
964
|
+
this.#console.error(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}), /* show=*/ false);
|
|
967
965
|
return null;
|
|
968
966
|
}
|
|
969
967
|
}
|
|
@@ -995,7 +993,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
995
993
|
}
|
|
996
994
|
return functionInfo;
|
|
997
995
|
} catch (error) {
|
|
998
|
-
|
|
996
|
+
this.#console.warn(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}));
|
|
999
997
|
return {frames: []};
|
|
1000
998
|
}
|
|
1001
999
|
}
|
|
@@ -1032,7 +1030,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
1032
1030
|
script.debuggerModel, script.scriptId, 0, Number(m.endOffset) + (script.codeOffset() || 0)),
|
|
1033
1031
|
}));
|
|
1034
1032
|
} catch (error) {
|
|
1035
|
-
|
|
1033
|
+
this.#console.warn(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}));
|
|
1036
1034
|
return [];
|
|
1037
1035
|
}
|
|
1038
1036
|
}
|
|
@@ -1069,7 +1067,7 @@ export class DebuggerLanguagePluginManager implements
|
|
|
1069
1067
|
script.debuggerModel, script.scriptId, 0, Number(m.endOffset) + (script.codeOffset() || 0)),
|
|
1070
1068
|
}));
|
|
1071
1069
|
} catch (error) {
|
|
1072
|
-
|
|
1070
|
+
this.#console.warn(i18nString(UIStrings.errorInDebuggerLanguagePlugin, {PH1: error.message}));
|
|
1073
1071
|
return [];
|
|
1074
1072
|
}
|
|
1075
1073
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as Common from '../../core/common/common.js';
|
|
5
|
+
import type * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
7
|
import * as Root from '../../core/root/root.js';
|
|
8
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
@@ -34,6 +34,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
34
34
|
readonly pluginManager: DebuggerLanguagePluginManager;
|
|
35
35
|
readonly ignoreListManager: Workspace.IgnoreListManager.IgnoreListManager;
|
|
36
36
|
readonly workspace: Workspace.Workspace.WorkspaceImpl;
|
|
37
|
+
readonly #settings: Common.Settings.Settings;
|
|
37
38
|
|
|
38
39
|
constructor(
|
|
39
40
|
resourceMapping: ResourceMapping, targetManager: SDK.TargetManager.TargetManager,
|
|
@@ -42,6 +43,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
42
43
|
this.resourceMapping.debuggerWorkspaceBinding = this;
|
|
43
44
|
this.ignoreListManager = ignoreListManager;
|
|
44
45
|
this.workspace = workspace;
|
|
46
|
+
this.#settings = targetManager.settings;
|
|
45
47
|
|
|
46
48
|
this.#debuggerModelToData = new Map();
|
|
47
49
|
targetManager.observeModels(SDK.DebuggerModel.DebuggerModel, this);
|
|
@@ -50,7 +52,8 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
50
52
|
|
|
51
53
|
this.#liveLocationPromises = new Set();
|
|
52
54
|
|
|
53
|
-
this.pluginManager =
|
|
55
|
+
this.pluginManager =
|
|
56
|
+
new DebuggerLanguagePluginManager(targetManager, resourceMapping.workspace, this, targetManager.getConsole());
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
setFunctionRanges(
|
|
@@ -489,8 +492,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
489
492
|
}
|
|
490
493
|
const functionLocation = frame.functionLocation();
|
|
491
494
|
if (!autoSteppingContext || debuggerPausedDetails.reason !== Protocol.Debugger.PausedEventReason.Step ||
|
|
492
|
-
!functionLocation || !frame.script.isWasm() ||
|
|
493
|
-
!Common.Settings.Settings.instance().moduleSetting('wasm-auto-stepping').get() ||
|
|
495
|
+
!functionLocation || !frame.script.isWasm() || !this.#settings.moduleSetting('wasm-auto-stepping').get() ||
|
|
494
496
|
!this.pluginManager.hasPluginForScript(frame.script)) {
|
|
495
497
|
return true;
|
|
496
498
|
}
|
|
@@ -170,10 +170,12 @@ export class ChunkedFileReader implements ChunkedReader {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
export class FileOutputStream implements Common.StringOutputStream.OutputStream {
|
|
173
|
+
readonly #fileManager: Workspace.FileManager.FileManager;
|
|
173
174
|
#writeCallbacks: Array<() => void>;
|
|
174
175
|
#fileName!: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString;
|
|
175
176
|
#closed?: boolean;
|
|
176
|
-
constructor() {
|
|
177
|
+
constructor(fileManager: Workspace.FileManager.FileManager) {
|
|
178
|
+
this.#fileManager = fileManager;
|
|
177
179
|
this.#writeCallbacks = [];
|
|
178
180
|
}
|
|
179
181
|
|
|
@@ -181,11 +183,10 @@ export class FileOutputStream implements Common.StringOutputStream.OutputStream
|
|
|
181
183
|
this.#closed = false;
|
|
182
184
|
this.#writeCallbacks = [];
|
|
183
185
|
this.#fileName = fileName;
|
|
184
|
-
const saveResponse = await
|
|
185
|
-
|
|
186
|
+
const saveResponse = await this.#fileManager.save(this.#fileName, TextUtils.ContentData.EMPTY_TEXT_CONTENT_DATA,
|
|
187
|
+
/* forceSaveAs=*/ true);
|
|
186
188
|
if (saveResponse) {
|
|
187
|
-
Workspace.FileManager.
|
|
188
|
-
Workspace.FileManager.Events.APPENDED_TO_URL, this.onAppendDone, this);
|
|
189
|
+
this.#fileManager.addEventListener(Workspace.FileManager.Events.APPENDED_TO_URL, this.onAppendDone, this);
|
|
189
190
|
}
|
|
190
191
|
return Boolean(saveResponse);
|
|
191
192
|
}
|
|
@@ -193,7 +194,7 @@ export class FileOutputStream implements Common.StringOutputStream.OutputStream
|
|
|
193
194
|
write(data: string): Promise<void> {
|
|
194
195
|
return new Promise(resolve => {
|
|
195
196
|
this.#writeCallbacks.push(resolve);
|
|
196
|
-
|
|
197
|
+
this.#fileManager.append(this.#fileName, data);
|
|
197
198
|
});
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -202,9 +203,8 @@ export class FileOutputStream implements Common.StringOutputStream.OutputStream
|
|
|
202
203
|
if (this.#writeCallbacks.length) {
|
|
203
204
|
return;
|
|
204
205
|
}
|
|
205
|
-
Workspace.FileManager.
|
|
206
|
-
|
|
207
|
-
Workspace.FileManager.FileManager.instance().close(this.#fileName);
|
|
206
|
+
this.#fileManager.removeEventListener(Workspace.FileManager.Events.APPENDED_TO_URL, this.onAppendDone, this);
|
|
207
|
+
this.#fileManager.close(this.#fileName);
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
private onAppendDone(event: Common.EventTarget.EventTargetEvent<string>): void {
|
|
@@ -221,8 +221,7 @@ export class FileOutputStream implements Common.StringOutputStream.OutputStream
|
|
|
221
221
|
if (!this.#closed) {
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
224
|
-
Workspace.FileManager.
|
|
225
|
-
|
|
226
|
-
Workspace.FileManager.FileManager.instance().close(this.#fileName);
|
|
224
|
+
this.#fileManager.removeEventListener(Workspace.FileManager.Events.APPENDED_TO_URL, this.onAppendDone, this);
|
|
225
|
+
this.#fileManager.close(this.#fileName);
|
|
227
226
|
}
|
|
228
227
|
}
|
|
@@ -21,62 +21,62 @@ import {
|
|
|
21
21
|
|
|
22
22
|
const UIStrings = {
|
|
23
23
|
/**
|
|
24
|
-
* @description Error message shown
|
|
24
|
+
* @description Error message shown on the Devices settings tab when the user enters an empty
|
|
25
25
|
* width for a custom device.
|
|
26
26
|
*/
|
|
27
|
-
widthCannotBeEmpty: 'Width
|
|
27
|
+
widthCannotBeEmpty: 'Width can’t be empty.',
|
|
28
28
|
/**
|
|
29
|
-
* @description Error message shown
|
|
29
|
+
* @description Error message shown on the Devices settings tab when the user enters an invalid
|
|
30
30
|
* width for a custom device.
|
|
31
31
|
*/
|
|
32
32
|
widthMustBeANumber: 'Width must be a number.',
|
|
33
33
|
/**
|
|
34
|
-
* @description Error message shown
|
|
34
|
+
* @description Error message shown on the Devices settings tab when the user has entered a width
|
|
35
35
|
* for a custom device that is too large.
|
|
36
36
|
* @example {9999} PH1
|
|
37
37
|
*/
|
|
38
38
|
widthMustBeLessThanOrEqualToS: 'Width must be less than or equal to {PH1}.',
|
|
39
39
|
/**
|
|
40
|
-
* @description Error message shown
|
|
40
|
+
* @description Error message shown on the Devices settings tab when the user has entered a width
|
|
41
41
|
* for a custom device that is too small.
|
|
42
42
|
* @example {50} PH1
|
|
43
43
|
*/
|
|
44
44
|
widthMustBeGreaterThanOrEqualToS: 'Width must be greater than or equal to {PH1}.',
|
|
45
45
|
/**
|
|
46
|
-
* @description Error message shown
|
|
46
|
+
* @description Error message shown on the Devices settings tab when the user enters an empty
|
|
47
47
|
* height for a custom device.
|
|
48
48
|
*/
|
|
49
|
-
heightCannotBeEmpty: 'Height
|
|
49
|
+
heightCannotBeEmpty: 'Height can’t be empty.',
|
|
50
50
|
/**
|
|
51
|
-
* @description Error message shown
|
|
51
|
+
* @description Error message shown on the Devices settings tab when the user enters an invalid
|
|
52
52
|
* height for a custom device.
|
|
53
53
|
*/
|
|
54
54
|
heightMustBeANumber: 'Height must be a number.',
|
|
55
55
|
/**
|
|
56
|
-
* @description Error message shown
|
|
56
|
+
* @description Error message shown on the Devices settings tab when the user has entered a height
|
|
57
57
|
* for a custom device that is too large.
|
|
58
58
|
* @example {9999} PH1
|
|
59
59
|
*/
|
|
60
60
|
heightMustBeLessThanOrEqualToS: 'Height must be less than or equal to {PH1}.',
|
|
61
61
|
/**
|
|
62
|
-
* @description Error message shown
|
|
62
|
+
* @description Error message shown on the Devices settings tab when the user has entered a height
|
|
63
63
|
* for a custom device that is too small.
|
|
64
64
|
* @example {50} PH1
|
|
65
65
|
*/
|
|
66
66
|
heightMustBeGreaterThanOrEqualTo: 'Height must be greater than or equal to {PH1}.',
|
|
67
67
|
/**
|
|
68
|
-
* @description Error message shown
|
|
68
|
+
* @description Error message shown on the Devices settings tab when the user enters an invalid
|
|
69
69
|
* device pixel ratio for a custom device.
|
|
70
70
|
*/
|
|
71
71
|
devicePixelRatioMustBeANumberOr: 'Device pixel ratio must be a number or blank.',
|
|
72
72
|
/**
|
|
73
|
-
* @description Error message shown
|
|
73
|
+
* @description Error message shown on the Devices settings tab when the user enters a device
|
|
74
74
|
* pixel ratio for a custom device that is too large.
|
|
75
75
|
* @example {10} PH1
|
|
76
76
|
*/
|
|
77
77
|
devicePixelRatioMustBeLessThanOr: 'Device pixel ratio must be less than or equal to {PH1}.',
|
|
78
78
|
/**
|
|
79
|
-
* @description Error message shown
|
|
79
|
+
* @description Error message shown on the Devices settings tab when the user enters a device
|
|
80
80
|
* pixel ratio for a custom device that is too small.
|
|
81
81
|
* @example {0} PH1
|
|
82
82
|
*/
|
|
@@ -166,7 +166,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
166
166
|
this.#deviceScaleFactorSetting = this.#settings.createSetting('emulation.device-scale-factor', 0);
|
|
167
167
|
this.#deviceScaleFactorSetting.addChangeListener(this.deviceScaleFactorSettingChanged, this);
|
|
168
168
|
|
|
169
|
-
this.#deviceOutlineSetting = this.#settings.
|
|
169
|
+
this.#deviceOutlineSetting = this.#settings.moduleSetting('emulation.show-device-outline');
|
|
170
170
|
this.#deviceOutlineSetting.addChangeListener(this.deviceOutlineSettingChanged, this);
|
|
171
171
|
|
|
172
172
|
this.#toolbarControlsEnabledSetting = this.#settings.createSetting('emulation.toolbar-controls-enabled', true,
|
|
@@ -14,15 +14,15 @@ import {Insets, MaxDeviceSize, MinDeviceSize} from './DeviceModeModel.js';
|
|
|
14
14
|
|
|
15
15
|
const UIStrings = {
|
|
16
16
|
/**
|
|
17
|
-
* @description Title of the Laptop with touch device
|
|
17
|
+
* @description Title of the Laptop with touch device.
|
|
18
18
|
*/
|
|
19
19
|
laptopWithTouch: 'Laptop with touch',
|
|
20
20
|
/**
|
|
21
|
-
* @description Title of the Laptop with HiDPI screen device
|
|
21
|
+
* @description Title of the Laptop with HiDPI screen device.
|
|
22
22
|
*/
|
|
23
23
|
laptopWithHiDPIScreen: 'Laptop with HiDPI screen',
|
|
24
24
|
/**
|
|
25
|
-
* @description Title of the Laptop with MDPI screen device
|
|
25
|
+
* @description Title of the Laptop with MDPI screen device.
|
|
26
26
|
*/
|
|
27
27
|
laptopWithMDPIScreen: 'Laptop with MDPI screen',
|
|
28
28
|
} as const;
|
|
@@ -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 Root from '../../core/root/root.js';
|
|
7
8
|
import * as Diff from '../../third_party/diff/diff.js';
|
|
8
9
|
import * as FormatterModule from '../formatter/formatter.js';
|
|
9
10
|
import * as Persistence from '../persistence/persistence.js';
|
|
@@ -16,15 +17,23 @@ interface DiffResponse {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export class WorkspaceDiffImpl extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
19
|
-
readonly #persistence
|
|
20
|
+
readonly #persistence: Persistence.Persistence.PersistenceImpl;
|
|
21
|
+
readonly #networkPersistenceManager: Persistence.NetworkPersistenceManager.NetworkPersistenceManager;
|
|
20
22
|
readonly #diffs = new WeakMap<Workspace.UISourceCode.UISourceCode, UISourceCodeDiff>();
|
|
21
23
|
/** used in web tests */
|
|
22
24
|
private readonly loadingUISourceCodes =
|
|
23
25
|
new Map<Workspace.UISourceCode.UISourceCode, Promise<[string | null, string|null]>>();
|
|
24
26
|
readonly #modified = new Set<Workspace.UISourceCode.UISourceCode>();
|
|
25
27
|
|
|
26
|
-
constructor(
|
|
28
|
+
constructor(
|
|
29
|
+
workspace: Workspace.Workspace.WorkspaceImpl,
|
|
30
|
+
persistence: Persistence.Persistence.PersistenceImpl = Persistence.Persistence.PersistenceImpl.instance(),
|
|
31
|
+
networkPersistenceManager: Persistence.NetworkPersistenceManager.NetworkPersistenceManager =
|
|
32
|
+
Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance(),
|
|
33
|
+
) {
|
|
27
34
|
super();
|
|
35
|
+
this.#persistence = persistence;
|
|
36
|
+
this.#networkPersistenceManager = networkPersistenceManager;
|
|
28
37
|
workspace.addEventListener(Workspace.Workspace.Events.WorkingCopyChanged, this.#uiSourceCodeChanged, this);
|
|
29
38
|
workspace.addEventListener(Workspace.Workspace.Events.WorkingCopyCommitted, this.#uiSourceCodeChanged, this);
|
|
30
39
|
workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdded, this.#uiSourceCodeAdded, this);
|
|
@@ -54,7 +63,7 @@ export class WorkspaceDiffImpl extends Common.ObjectWrapper.ObjectWrapper<EventT
|
|
|
54
63
|
#uiSourceCodeDiff(uiSourceCode: Workspace.UISourceCode.UISourceCode): UISourceCodeDiff {
|
|
55
64
|
let diff = this.#diffs.get(uiSourceCode);
|
|
56
65
|
if (!diff) {
|
|
57
|
-
diff = new UISourceCodeDiff(uiSourceCode);
|
|
66
|
+
diff = new UISourceCodeDiff(uiSourceCode, this.#networkPersistenceManager);
|
|
58
67
|
this.#diffs.set(uiSourceCode, diff);
|
|
59
68
|
}
|
|
60
69
|
return diff;
|
|
@@ -195,12 +204,17 @@ export interface EventTypes {
|
|
|
195
204
|
|
|
196
205
|
export class UISourceCodeDiff extends Common.ObjectWrapper.ObjectWrapper<UISourceCodeDiffEventTypes> {
|
|
197
206
|
#uiSourceCode: Workspace.UISourceCode.UISourceCode;
|
|
207
|
+
readonly #networkPersistenceManager: Persistence.NetworkPersistenceManager.NetworkPersistenceManager;
|
|
198
208
|
#requestDiffPromise: Promise<DiffResponse|null>|null = null;
|
|
199
209
|
#pendingChanges: number|null = null;
|
|
200
210
|
dispose = false;
|
|
201
|
-
constructor(
|
|
211
|
+
constructor(
|
|
212
|
+
uiSourceCode: Workspace.UISourceCode.UISourceCode,
|
|
213
|
+
networkPersistenceManager: Persistence.NetworkPersistenceManager.NetworkPersistenceManager,
|
|
214
|
+
) {
|
|
202
215
|
super();
|
|
203
216
|
this.#uiSourceCode = uiSourceCode;
|
|
217
|
+
this.#networkPersistenceManager = networkPersistenceManager;
|
|
204
218
|
uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyChanged, this.#uiSourceCodeChanged, this);
|
|
205
219
|
uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyCommitted, this.#uiSourceCodeChanged, this);
|
|
206
220
|
}
|
|
@@ -233,9 +247,7 @@ export class UISourceCodeDiff extends Common.ObjectWrapper.ObjectWrapper<UISourc
|
|
|
233
247
|
}
|
|
234
248
|
|
|
235
249
|
async originalContent(): Promise<string|null> {
|
|
236
|
-
const originalNetworkContent =
|
|
237
|
-
Persistence.NetworkPersistenceManager.NetworkPersistenceManager.instance().originalContentForUISourceCode(
|
|
238
|
-
this.#uiSourceCode);
|
|
250
|
+
const originalNetworkContent = this.#networkPersistenceManager.originalContentForUISourceCode(this.#uiSourceCode);
|
|
239
251
|
if (originalNetworkContent) {
|
|
240
252
|
return await originalNetworkContent;
|
|
241
253
|
}
|
|
@@ -305,11 +317,10 @@ export interface UISourceCodeDiffEventTypes {
|
|
|
305
317
|
[UISourceCodeDiffEvents.DIFF_CHANGED]: void;
|
|
306
318
|
}
|
|
307
319
|
|
|
308
|
-
let workspaceDiffImplInstance: WorkspaceDiffImpl|null = null;
|
|
309
|
-
|
|
310
320
|
export function workspaceDiff({forceNew}: {forceNew?: boolean} = {}): WorkspaceDiffImpl {
|
|
311
|
-
if (!
|
|
312
|
-
|
|
321
|
+
if (!Root.DevToolsContext.globalInstance().has(WorkspaceDiffImpl) || forceNew) {
|
|
322
|
+
Root.DevToolsContext.globalInstance().set(WorkspaceDiffImpl,
|
|
323
|
+
new WorkspaceDiffImpl(Workspace.Workspace.WorkspaceImpl.instance()));
|
|
313
324
|
}
|
|
314
|
-
return
|
|
325
|
+
return Root.DevToolsContext.globalInstance().get(WorkspaceDiffImpl);
|
|
315
326
|
}
|
|
@@ -115,6 +115,10 @@ const UIStrings = {
|
|
|
115
115
|
* @description Text in Application Panel Sidebar of the Application panel
|
|
116
116
|
*/
|
|
117
117
|
ads: 'Ads',
|
|
118
|
+
/**
|
|
119
|
+
* @description Tooltip for the experimental icon in the Ads panel
|
|
120
|
+
*/
|
|
121
|
+
experimental: 'Experimental',
|
|
118
122
|
/**
|
|
119
123
|
* @description Text in Application Panel Sidebar of the Application panel
|
|
120
124
|
*/
|
|
@@ -411,8 +415,12 @@ export class ApplicationPanelSidebar extends UI.Widget.VBox implements SDK.Targe
|
|
|
411
415
|
|
|
412
416
|
if (Root.Runtime.hostConfig.devToolsAdsPanel?.enabled) {
|
|
413
417
|
const adsTreeElement = new ApplicationPanelTreeElement(panel, i18nString(UIStrings.ads), false, 'ads');
|
|
414
|
-
|
|
418
|
+
adsTreeElement.listItemElement.classList.add('ads-tree-element');
|
|
419
|
+
const icon = createIcon('ads');
|
|
415
420
|
adsTreeElement.setLeadingIcons([icon]);
|
|
421
|
+
const experimentIcon = createIcon('experiment', 'medium');
|
|
422
|
+
UI.Tooltip.Tooltip.install(experimentIcon, i18nString(UIStrings.experimental));
|
|
423
|
+
adsTreeElement.setTrailingIcons([experimentIcon]);
|
|
416
424
|
adsTreeElement.itemURL = 'ads://' as Platform.DevToolsPath.UrlString;
|
|
417
425
|
let adsView: ApplicationComponents.AdsView.AdsView;
|
|
418
426
|
adsTreeElement.onselect = (selectedByUser?: boolean): boolean => {
|
|
@@ -11,6 +11,7 @@ import * as Platform from '../../core/platform/platform.js';
|
|
|
11
11
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
12
12
|
import * as Protocol from '../../generated/protocol.js';
|
|
13
13
|
import * as Bindings from '../../models/bindings/bindings.js';
|
|
14
|
+
import * as Workspace from '../../models/workspace/workspace.js';
|
|
14
15
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
15
16
|
import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
|
|
16
17
|
// eslint-disable-next-line @devtools/es-modules-import
|
|
@@ -526,7 +527,7 @@ export class BackgroundServiceView extends UI.Widget.VBox {
|
|
|
526
527
|
private async saveToFile(): Promise<void> {
|
|
527
528
|
const fileName = `${this.serviceName}-${Platform.DateUtilities.toISO8601Compact(new Date())}.json` as
|
|
528
529
|
Platform.DevToolsPath.RawPathString;
|
|
529
|
-
const stream = new Bindings.FileUtils.FileOutputStream();
|
|
530
|
+
const stream = new Bindings.FileUtils.FileOutputStream(Workspace.FileManager.FileManager.instance());
|
|
530
531
|
|
|
531
532
|
const accepted = await stream.open(fileName);
|
|
532
533
|
if (!accepted) {
|
|
@@ -249,6 +249,13 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
249
249
|
private skipCount: number;
|
|
250
250
|
// Used in Web Tests
|
|
251
251
|
protected entries: Entry[];
|
|
252
|
+
#hasMore = false;
|
|
253
|
+
#selectedRowNumber = 0;
|
|
254
|
+
#needsRefreshVisible = false;
|
|
255
|
+
#clearButtonEnabled = true;
|
|
256
|
+
#metadata: ObjectStoreMetadata|null = null;
|
|
257
|
+
#lastRenderedEntries: Entry[]|null = null;
|
|
258
|
+
|
|
252
259
|
private objectStore!: ObjectStore;
|
|
253
260
|
private index!: Index|null;
|
|
254
261
|
private keyInput!: UI.Toolbar.ToolbarInput;
|
|
@@ -311,9 +318,9 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
311
318
|
|
|
312
319
|
this.pageSize = 50;
|
|
313
320
|
this.skipCount = 0;
|
|
321
|
+
this.entries = [];
|
|
314
322
|
|
|
315
323
|
this.update(objectStore, index);
|
|
316
|
-
this.entries = [];
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
private createDataGrid(): DataGrid.DataGrid.DataGridImpl<unknown> {
|
|
@@ -469,6 +476,9 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
469
476
|
this.dataGrid = this.createDataGrid();
|
|
470
477
|
this.dataGrid.setRowContextMenuCallback(this.populateContextMenu.bind(this));
|
|
471
478
|
this.dataGrid.asWidget().show(this.element);
|
|
479
|
+
if (this.summaryBarElement) {
|
|
480
|
+
this.element.appendChild(this.summaryBarElement);
|
|
481
|
+
}
|
|
472
482
|
|
|
473
483
|
this.skipCount = 0;
|
|
474
484
|
this.updateData(true);
|
|
@@ -490,9 +500,8 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
490
500
|
const key = this.parseKey(this.keyInput.value());
|
|
491
501
|
const pageSize = this.pageSize;
|
|
492
502
|
let skipCount: 0|number = this.skipCount;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
this.clearButton.setEnabled(!this.isIndex);
|
|
503
|
+
const selected = this.dataGrid.selectedNode ? this.dataGrid.selectedNode.data['number'] : 0;
|
|
504
|
+
this.#selectedRowNumber = Math.max(selected, this.skipCount); // Page forward should select top entry
|
|
496
505
|
|
|
497
506
|
if (!force && this.lastKey === key && this.lastPageSize === pageSize && this.lastSkipCount === skipCount) {
|
|
498
507
|
return;
|
|
@@ -507,13 +516,10 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
507
516
|
this.lastSkipCount = skipCount;
|
|
508
517
|
|
|
509
518
|
function callback(this: IDBDataView, entries: Entry[], hasMore: boolean): void {
|
|
510
|
-
this.clear();
|
|
511
519
|
this.entries = entries;
|
|
512
|
-
this
|
|
513
|
-
this
|
|
514
|
-
this.
|
|
515
|
-
this.needsRefresh.setVisible(false);
|
|
516
|
-
this.updateToolbarEnablement();
|
|
520
|
+
this.#hasMore = hasMore;
|
|
521
|
+
this.#needsRefreshVisible = false;
|
|
522
|
+
this.performUpdate();
|
|
517
523
|
this.updatedDataForTests();
|
|
518
524
|
}
|
|
519
525
|
|
|
@@ -525,23 +531,30 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
525
531
|
this.model.loadObjectStoreData(this.databaseId, this.objectStore.name, idbKeyRange, skipCount, pageSize,
|
|
526
532
|
callback.bind(this));
|
|
527
533
|
}
|
|
528
|
-
void this.model.getMetadata(this.databaseId, this.objectStore).then(
|
|
534
|
+
void this.model.getMetadata(this.databaseId, this.objectStore).then(metadata => {
|
|
535
|
+
this.#metadata = metadata;
|
|
536
|
+
this.performUpdate();
|
|
537
|
+
});
|
|
529
538
|
}
|
|
530
539
|
|
|
531
|
-
private populateDataGrid(
|
|
540
|
+
private populateDataGrid(): void {
|
|
541
|
+
if (this.entries === this.#lastRenderedEntries) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
this.dataGrid.rootNode().removeChildren();
|
|
532
545
|
let selectedNode: IDBDataGridNode|null = null;
|
|
533
|
-
for (let i = 0; i < entries.length; ++i) {
|
|
546
|
+
for (let i = 0; i < this.entries.length; ++i) {
|
|
534
547
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
535
548
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
536
549
|
const data: any = {};
|
|
537
|
-
data['number'] = i + skipCount;
|
|
538
|
-
data['key'] = entries[i].key;
|
|
539
|
-
data['primary-key'] = entries[i].primaryKey;
|
|
540
|
-
data['value'] = entries[i].value;
|
|
550
|
+
data['number'] = i + this.skipCount;
|
|
551
|
+
data['key'] = this.entries[i].key;
|
|
552
|
+
data['primary-key'] = this.entries[i].primaryKey;
|
|
553
|
+
data['value'] = this.entries[i].value;
|
|
541
554
|
|
|
542
555
|
const node = new IDBDataGridNode(data);
|
|
543
556
|
this.dataGrid.rootNode().appendChild(node);
|
|
544
|
-
if (data['number'] <=
|
|
557
|
+
if (data['number'] <= this.#selectedRowNumber) {
|
|
545
558
|
selectedNode = node;
|
|
546
559
|
}
|
|
547
560
|
}
|
|
@@ -549,13 +562,15 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
549
562
|
if (selectedNode) {
|
|
550
563
|
selectedNode.select();
|
|
551
564
|
}
|
|
565
|
+
this.#lastRenderedEntries = this.entries;
|
|
552
566
|
}
|
|
553
567
|
|
|
554
|
-
private updateSummaryBar(
|
|
568
|
+
private updateSummaryBar(): void {
|
|
555
569
|
if (!this.summaryBarElement) {
|
|
556
570
|
this.summaryBarElement = this.element.createChild('div', 'object-store-summary-bar');
|
|
557
571
|
}
|
|
558
572
|
this.summaryBarElement.removeChildren();
|
|
573
|
+
const metadata = this.#metadata;
|
|
559
574
|
if (!metadata) {
|
|
560
575
|
return;
|
|
561
576
|
}
|
|
@@ -585,11 +600,13 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
585
600
|
i18nString(UIStrings.confirmClearObjectStore, {PH1: this.objectStore.name}),
|
|
586
601
|
this.element, {jslogContext: 'clear-object-store-confirmation'});
|
|
587
602
|
if (ok) {
|
|
588
|
-
this
|
|
603
|
+
this.#clearButtonEnabled = false;
|
|
604
|
+
this.performUpdate();
|
|
589
605
|
this.clearingObjectStore = true;
|
|
590
606
|
await this.model.clearObjectStore(this.databaseId, this.objectStore.name);
|
|
591
607
|
this.clearingObjectStore = false;
|
|
592
|
-
this
|
|
608
|
+
this.#clearButtonEnabled = true;
|
|
609
|
+
this.performUpdate();
|
|
593
610
|
this.updateData(true);
|
|
594
611
|
}
|
|
595
612
|
}
|
|
@@ -599,7 +616,8 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
599
616
|
if (this.clearingObjectStore) {
|
|
600
617
|
return;
|
|
601
618
|
}
|
|
602
|
-
this
|
|
619
|
+
this.#needsRefreshVisible = true;
|
|
620
|
+
this.performUpdate();
|
|
603
621
|
}
|
|
604
622
|
|
|
605
623
|
private async resolveArrayKey(key: SDK.RemoteObject.RemoteObject): Promise<IDBKeyValue> {
|
|
@@ -639,14 +657,25 @@ export class IDBDataView extends UI.View.SimpleView {
|
|
|
639
657
|
}
|
|
640
658
|
|
|
641
659
|
clear(): void {
|
|
642
|
-
this.dataGrid.rootNode().removeChildren();
|
|
643
660
|
this.entries = [];
|
|
661
|
+
this.performUpdate();
|
|
644
662
|
}
|
|
645
663
|
|
|
646
664
|
private updateToolbarEnablement(): void {
|
|
647
665
|
const empty = !this.dataGrid || this.dataGrid.rootNode().children.length === 0;
|
|
648
666
|
this.deleteSelectedButton.setEnabled(!empty && this.dataGrid.selectedNode !== null);
|
|
649
667
|
}
|
|
668
|
+
|
|
669
|
+
override performUpdate(): void {
|
|
670
|
+
this.populateDataGrid();
|
|
671
|
+
this.updateSummaryBar();
|
|
672
|
+
|
|
673
|
+
this.pageBackButton.setEnabled(this.skipCount > 0);
|
|
674
|
+
this.pageForwardButton.setEnabled(this.#hasMore);
|
|
675
|
+
this.needsRefresh.setVisible(this.#needsRefreshVisible);
|
|
676
|
+
this.clearButton.setEnabled(!this.isIndex && this.#clearButtonEnabled);
|
|
677
|
+
this.updateToolbarEnablement();
|
|
678
|
+
}
|
|
650
679
|
}
|
|
651
680
|
|
|
652
681
|
export class IDBDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown> {
|
|
@@ -80,7 +80,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
const formatCpu = (val: number): string => {
|
|
83
|
-
return i18n.TimeUtilities.
|
|
83
|
+
return i18n.TimeUtilities.millisToString(val);
|
|
84
84
|
};
|
|
85
85
|
|
|
86
86
|
const formatNetwork = (val: number): string => {
|
|
@@ -15,15 +15,15 @@ import consoleContextSelectorStyles from './consoleContextSelector.css.js';
|
|
|
15
15
|
const {render, nothing, html} = Lit;
|
|
16
16
|
const UIStrings = {
|
|
17
17
|
/**
|
|
18
|
-
* @description Title of toolbar item in
|
|
18
|
+
* @description Title of toolbar item in Console context selector of the Console panel.
|
|
19
19
|
*/
|
|
20
20
|
javascriptContextNotSelected: 'JavaScript context: Not selected',
|
|
21
21
|
/**
|
|
22
|
-
* @description Text in Console
|
|
22
|
+
* @description Text in Console context selector of the Console panel.
|
|
23
23
|
*/
|
|
24
24
|
extension: 'Extension',
|
|
25
25
|
/**
|
|
26
|
-
* @description Text in Console
|
|
26
|
+
* @description Text in Console context selector of the Console panel.
|
|
27
27
|
* @example {top} PH1
|
|
28
28
|
*/
|
|
29
29
|
javascriptContextS: 'JavaScript context: {PH1}',
|