chrome-devtools-frontend 1.0.1681091 → 1.0.1682249
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/eslint.config.mjs +8 -3
- package/front_end/core/sdk/ConsoleModel.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +8 -0
- package/front_end/core/sdk/NetworkManager.ts +9 -4
- package/front_end/core/sdk/OverlayModel.ts +3 -2
- package/front_end/core/sdk/PreloadingModel.ts +44 -22
- package/front_end/core/sdk/RemoteObject.ts +4 -1
- package/front_end/core/sdk/RuntimeModel.ts +5 -5
- package/front_end/core/sdk/SDKSettings.ts +19 -0
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -1
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
- package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -5
- package/front_end/entrypoints/main/MainImpl.ts +9 -10
- package/front_end/entrypoints/main/main-meta.ts +82 -0
- package/front_end/entrypoints/shell/shell.ts +0 -5
- package/front_end/entrypoints/trace_app/trace_app.ts +0 -5
- package/front_end/generated/InspectorBackendCommands.ts +2 -0
- package/front_end/generated/protocol-mapping.d.ts +16 -0
- package/front_end/generated/protocol-proxy-api.d.ts +12 -0
- package/front_end/generated/protocol.ts +12 -0
- package/front_end/models/ai_assistance/ExtensionScope.ts +11 -12
- package/front_end/models/ai_assistance/agents/AiAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +2 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -1
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +2 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +8 -8
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +8 -8
- package/front_end/models/ai_code_completion/debug.ts +6 -3
- package/front_end/models/ai_code_generation/debug.ts +6 -3
- package/front_end/models/badges/UserBadges.ts +9 -2
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +1 -0
- package/front_end/models/emulation/DeviceModeModel.ts +16 -27
- package/front_end/models/emulation/EmulatedDevices.ts +30 -125
- package/front_end/models/extensions/ExtensionAPI.ts +34 -23
- package/front_end/models/formatter/ScriptFormatter.ts +1 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
- package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +4 -4
- package/front_end/models/logs/NetworkLog.ts +11 -4
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +4 -2
- package/front_end/models/persistence/NetworkPersistenceManager.ts +7 -1
- package/front_end/models/stack_trace/StackTraceImpl.ts +1 -0
- package/front_end/models/trace/Name.ts +5 -5
- package/front_end/models/trace/Styles.ts +115 -115
- package/front_end/models/trace/extras/TraceTree.ts +2 -1
- package/front_end/models/trace/helpers/Network.ts +4 -1
- package/front_end/models/trace/insights/CLSCulprits.ts +4 -2
- package/front_end/models/trace/insights/CharacterSet.ts +3 -3
- package/front_end/models/trace/insights/DOMSize.ts +1 -1
- package/front_end/models/trace/insights/DuplicatedJavaScript.ts +6 -2
- package/front_end/models/trace/insights/FontDisplay.ts +9 -3
- package/front_end/models/trace/insights/ForcedReflow.ts +4 -4
- package/front_end/models/trace/insights/INPBreakdown.ts +3 -4
- package/front_end/models/trace/insights/ImageDelivery.ts +2 -2
- package/front_end/models/trace/insights/LCPBreakdown.ts +1 -1
- package/front_end/models/trace/insights/LCPDiscovery.ts +5 -5
- package/front_end/models/trace/insights/LegacyJavaScript.ts +7 -3
- package/front_end/models/trace/insights/ModernHTTP.ts +3 -3
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +13 -9
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
- package/front_end/models/trace/insights/SlowCSSSelector.ts +29 -25
- package/front_end/models/trace/insights/ThirdParties.ts +13 -5
- package/front_end/models/trace/insights/Viewport.ts +4 -2
- package/front_end/models/workspace/IgnoreListManager.ts +53 -17
- package/front_end/panels/accessibility/ARIAAttributesView.ts +11 -2
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +67 -53
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
- package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +2 -2
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +5 -5
- package/front_end/panels/animation/AnimationTimeline.ts +2 -0
- package/front_end/panels/application/ServiceWorkersView.ts +1 -1
- package/front_end/panels/application/StorageView.ts +2 -0
- package/front_end/panels/application/preloading/PreloadingView.ts +9 -3
- package/front_end/panels/application/preloading/components/components.ts +2 -0
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +10 -11
- package/front_end/panels/changes/CombinedDiffView.ts +1 -1
- package/front_end/panels/common/BadgeNotification.ts +1 -1
- package/front_end/panels/common/ExtensionPanel.ts +12 -7
- package/front_end/panels/common/ExtensionServer.ts +85 -26
- package/front_end/panels/common/GdpSignUpDialog.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +2 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +3 -2
- package/front_end/panels/console/console-meta.ts +9 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +9 -4
- package/front_end/panels/elements/CSSRuleValidator.ts +12 -12
- package/front_end/panels/elements/CSSSpecificityBreakdown.ts +1 -1
- package/front_end/panels/elements/ClassesPaneWidget.ts +6 -6
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +4 -5
- package/front_end/panels/elements/DOMTreeContextMenu.ts +3 -6
- package/front_end/panels/elements/ElementIssueUtils.ts +20 -20
- package/front_end/panels/elements/ElementStatePaneWidget.ts +9 -6
- package/front_end/panels/elements/ElementsPanel.ts +10 -10
- package/front_end/panels/elements/ElementsTreeElement.ts +35 -29
- package/front_end/panels/elements/ElementsTreeOutline.ts +5 -20
- package/front_end/panels/elements/EventListenersWidget.ts +18 -19
- package/front_end/panels/elements/LayersWidget.ts +4 -4
- package/front_end/panels/elements/LayoutPane.ts +11 -11
- package/front_end/panels/elements/MarkerDecorator.ts +3 -3
- package/front_end/panels/elements/PlatformFontsWidget.ts +8 -8
- package/front_end/panels/elements/PropertiesWidget.ts +4 -4
- package/front_end/panels/elements/PropertyRenderer.ts +2 -2
- package/front_end/panels/elements/ShortcutTreeElement.ts +1 -1
- package/front_end/panels/elements/StylePropertiesSection.ts +14 -14
- package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -21
- package/front_end/panels/elements/StylesSidebarPane.ts +12 -13
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +1 -1
- package/front_end/panels/elements/components/CSSHintDetailsView.ts +1 -1
- package/front_end/panels/elements/components/CSSVariableValueView.ts +3 -3
- package/front_end/panels/elements/components/ElementsBreadcrumbsUtils.ts +2 -2
- package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +1 -1
- package/front_end/panels/elements/elements-meta.ts +13 -13
- package/front_end/panels/issues/AffectedCookiesView.ts +2 -0
- package/front_end/panels/issues/AffectedElementsView.ts +5 -0
- package/front_end/panels/issues/IssueView.ts +12 -8
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +11 -7
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +2 -0
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +1 -1
- package/front_end/panels/media/PlayerPropertiesView.ts +309 -416
- package/front_end/panels/media/playerPropertiesView.css +1 -1
- package/front_end/panels/network/NetworkLogView.ts +5 -2
- package/front_end/panels/network/NetworkOverview.ts +11 -5
- package/front_end/panels/network/NetworkPanel.ts +4 -2
- package/front_end/panels/network/NetworkWaterfallColumn.ts +16 -3
- package/front_end/panels/network/RequestHeadersView.ts +4 -4
- package/front_end/panels/network/components/ResponseHeaderSection.ts +7 -4
- package/front_end/panels/network/network-meta.ts +63 -0
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
- package/front_end/panels/recorder/RecordingView.ts +89 -73
- package/front_end/panels/recorder/ReplaySection.ts +59 -40
- package/front_end/panels/recorder/injected/injected.ts +4 -0
- package/front_end/panels/security/SecurityPanel.ts +5 -6
- package/front_end/panels/security/SecurityPanelSidebar.ts +244 -204
- package/front_end/panels/security/security.ts +0 -4
- package/front_end/panels/settings/EditFileSystemView.ts +8 -7
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +20 -14
- package/front_end/panels/settings/components/SyncSection.ts +1 -1
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +0 -3
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +10 -11
- package/front_end/panels/sources/NavigatorView.ts +6 -2
- package/front_end/panels/sources/SourcesNavigator.ts +8 -4
- package/front_end/panels/sources/SourcesPanel.ts +4 -2
- package/front_end/panels/sources/SourcesSearchScope.ts +3 -1
- package/front_end/panels/sources/UISourceCodeFrame.ts +2 -2
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -3
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +5 -5
- package/front_end/panels/timeline/components/CWVMetrics.ts +1 -2
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +5 -5
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +2 -3
- package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
- package/front_end/panels/timeline/components/Sidebar.ts +3 -3
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -2
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -1
- package/front_end/panels/timeline/components/insights/CLSCulprits.ts +1 -2
- package/front_end/panels/timeline/components/insights/Cache.ts +1 -2
- package/front_end/panels/timeline/components/insights/CharacterSet.ts +1 -2
- package/front_end/panels/timeline/components/insights/DOMSize.ts +1 -2
- package/front_end/panels/timeline/components/insights/DocumentLatency.ts +2 -2
- package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
- package/front_end/panels/timeline/components/insights/FontDisplay.ts +1 -2
- package/front_end/panels/timeline/components/insights/ForcedReflow.ts +1 -2
- package/front_end/panels/timeline/components/insights/INPBreakdown.ts +1 -2
- package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -2
- package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +13 -13
- package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +1 -2
- package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +4 -4
- package/front_end/panels/timeline/components/insights/ModernHTTP.ts +1 -2
- package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +10 -8
- package/front_end/panels/timeline/components/insights/RenderBlocking.ts +2 -2
- package/front_end/panels/timeline/components/insights/SidebarInsight.ts +3 -1
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/components/insights/ThirdParties.ts +1 -2
- package/front_end/panels/timeline/components/insights/Viewport.ts +1 -2
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -2
- package/front_end/panels/timeline/timeline.ts +0 -2
- package/front_end/panels/web_audio/WebAudioView.ts +14 -6
- package/front_end/panels/webauthn/WebauthnPane.ts +9 -9
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/web-vitals/rebuild.sh +1 -1
- package/front_end/ui/components/diff_view/DiffView.ts +2 -1
- package/front_end/ui/components/report_view/ReportView.docs.ts +2 -2
- package/front_end/ui/components/text_editor/javascript.ts +12 -13
- package/front_end/ui/legacy/GlassPane.ts +38 -14
- package/front_end/ui/legacy/Treeoutline.ts +14 -3
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +11 -11
- package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +1 -1
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +19 -20
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +3 -3
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +185 -355
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +3 -8
- package/front_end/ui/legacy/components/utils/ImagePreview.ts +15 -16
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +4 -4
- package/front_end/ui/legacy/components/utils/Linkifier.ts +8 -10
- package/front_end/ui/settings/InspectorMainSettings.ts +12 -0
- package/front_end/ui/settings/settings.ts +2 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +32 -0
- package/mcp/mcp.ts +0 -9
- package/package.json +1 -1
- package/front_end/core/sdk/sdk-meta.ts +0 -40
- package/front_end/models/badges/badges-meta.ts +0 -27
- package/front_end/models/logs/logs-meta.ts +0 -84
- package/front_end/models/persistence/persistence-meta.ts +0 -69
- package/front_end/models/workspace/workspace-meta.ts +0 -40
- package/front_end/panels/security/OriginTreeElement.ts +0 -60
- package/front_end/panels/security/SecurityPanelSidebarTreeElement.ts +0 -30
|
@@ -68,92 +68,83 @@ const {widget, widgetRef} = UI.Widget;
|
|
|
68
68
|
const {ref, repeat, ifDefined, classMap} = Directives;
|
|
69
69
|
const UIStrings = {
|
|
70
70
|
/**
|
|
71
|
-
* @description Text in
|
|
71
|
+
* @description Text shown in an object properties tree when evaluating a property throws an exception.
|
|
72
72
|
* @example {function alert() [native code] } PH1
|
|
73
73
|
*/
|
|
74
74
|
exceptionS: '[Exception: {PH1}]',
|
|
75
75
|
/**
|
|
76
|
-
* @description
|
|
76
|
+
* @description Placeholder text shown for a property value whose type or value is unknown.
|
|
77
77
|
*/
|
|
78
78
|
unknown: 'unknown',
|
|
79
79
|
/**
|
|
80
|
-
* @description
|
|
80
|
+
* @description Context menu item to expand an object and all of its child properties recursively.
|
|
81
81
|
*/
|
|
82
82
|
expandRecursively: 'Expand recursively',
|
|
83
83
|
/**
|
|
84
|
-
* @description
|
|
84
|
+
* @description Context menu item to collapse all child properties of an object.
|
|
85
85
|
*/
|
|
86
86
|
collapseChildren: 'Collapse children',
|
|
87
87
|
/**
|
|
88
|
-
* @description
|
|
88
|
+
* @description Context menu item to sort object properties alphabetically.
|
|
89
89
|
*/
|
|
90
90
|
sortPropertiesAlphabetically: 'Sort properties alphabetically',
|
|
91
91
|
/**
|
|
92
|
-
* @description
|
|
92
|
+
* @description Message displayed in an object properties tree when an object has no properties.
|
|
93
93
|
*/
|
|
94
94
|
noProperties: 'No properties',
|
|
95
95
|
/**
|
|
96
|
-
* @description
|
|
96
|
+
* @description Placeholder text indicating more content or an invocable getter in an object properties tree.
|
|
97
97
|
*/
|
|
98
98
|
dots: '(...)',
|
|
99
99
|
/**
|
|
100
|
-
* @description
|
|
100
|
+
* @description Tooltip text for the button that invokes an object property getter.
|
|
101
101
|
*/
|
|
102
102
|
invokePropertyGetter: 'Invoke property getter',
|
|
103
103
|
/**
|
|
104
|
-
* @description
|
|
104
|
+
* @description Tooltip text on a button to expand and show all hidden child properties.
|
|
105
105
|
* @example {50} PH1
|
|
106
106
|
*/
|
|
107
107
|
showAllD: 'Show all {PH1}',
|
|
108
108
|
/**
|
|
109
|
-
* @description
|
|
109
|
+
* @description Context menu checkbox item to show all properties, including null and undefined values.
|
|
110
110
|
*/
|
|
111
111
|
showAll: 'Show all',
|
|
112
112
|
/**
|
|
113
|
-
* @description
|
|
114
|
-
* viewing a variable in the Scope view, whose value is not available (i.e. because it was optimized
|
|
115
|
-
* out) by the JavaScript engine, or inspecting a JavaScript object accessor property, which has no
|
|
116
|
-
* getter. This string should be translated.
|
|
113
|
+
* @description Text shown when a variable or property value is unavailable, such as when optimized out by the JavaScript engine or missing a getter.
|
|
117
114
|
*/
|
|
118
115
|
valueUnavailable: '<value unavailable>',
|
|
119
116
|
/**
|
|
120
|
-
* @description Tooltip for
|
|
121
|
-
* aren't accessible to the debugger (potentially due to being optimized out by the JavaScript
|
|
122
|
-
* engine), or for JavaScript object accessor properties which have no getter.
|
|
117
|
+
* @description Tooltip text for property values that aren't accessible to the debugger.
|
|
123
118
|
*/
|
|
124
|
-
valueNotAccessibleToTheDebugger: 'Value
|
|
119
|
+
valueNotAccessibleToTheDebugger: 'Value isn’t accessible to the debugger',
|
|
125
120
|
/**
|
|
126
|
-
* @description
|
|
121
|
+
* @description Context menu item to copy the value of a property to the clipboard.
|
|
127
122
|
*/
|
|
128
123
|
copyValue: 'Copy value',
|
|
129
124
|
/**
|
|
130
|
-
* @description
|
|
125
|
+
* @description Context menu item to copy the property path of an object property to the clipboard.
|
|
131
126
|
*/
|
|
132
127
|
copyPropertyPath: 'Copy property path',
|
|
133
128
|
/**
|
|
134
|
-
* @description
|
|
135
|
-
* too large for DevTools to properly display a text editor. This is shown instead of the string in
|
|
136
|
-
* question. Should be translated.
|
|
129
|
+
* @description Placeholder text shown when a string property is too large to display in a text editor.
|
|
137
130
|
*/
|
|
138
131
|
stringIsTooLargeToEdit: '<string is too large to edit>',
|
|
139
132
|
/**
|
|
140
|
-
* @description
|
|
133
|
+
* @description Context menu item and button text to expand truncated long text and show the remaining size.
|
|
141
134
|
* @example {30 MB} PH1
|
|
142
135
|
*/
|
|
143
136
|
showMoreS: 'Show more ({PH1})',
|
|
144
137
|
/**
|
|
145
|
-
* @description
|
|
138
|
+
* @description Button text indicating that a long text string was truncated and showing its total size.
|
|
146
139
|
* @example {30 MB} PH1
|
|
147
140
|
*/
|
|
148
|
-
longTextWasTruncatedS: '
|
|
141
|
+
longTextWasTruncatedS: 'Long text was truncated ({PH1})',
|
|
149
142
|
/**
|
|
150
|
-
* @description
|
|
143
|
+
* @description Button and context menu item to copy text to the clipboard.
|
|
151
144
|
*/
|
|
152
145
|
copy: 'Copy',
|
|
153
146
|
/**
|
|
154
|
-
* @description
|
|
155
|
-
* which are based on bytes and can be shown in a hexadecimal viewer.
|
|
156
|
-
* Clicking on the button will display that object in the Memory inspector panel.
|
|
147
|
+
* @description Tooltip text for the button to open a memory buffer object in the Memory inspector panel.
|
|
157
148
|
*/
|
|
158
149
|
openInMemoryInpector: 'Open in Memory inspector panel',
|
|
159
150
|
} as const;
|
|
@@ -161,7 +152,6 @@ const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/object_ui/ObjectP
|
|
|
161
152
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
162
153
|
export const EXPANDABLE_MAX_DEPTH = 100;
|
|
163
154
|
|
|
164
|
-
const objectPropertiesSectionMap = new WeakMap<Element, ObjectPropertiesSection>();
|
|
165
155
|
// TODO(crbug.com/457388389): This cache is a temporary workaround for the <devtools-tree> migration.
|
|
166
156
|
// It can be removed once the entire ObjectPropertiesSection is fully migrated to Lit and
|
|
167
157
|
// the legacy TreeOutline/TreeElement dependencies are removed.
|
|
@@ -621,7 +611,7 @@ export abstract class ObjectTreeNodeBase extends Common.ObjectWrapper.ObjectWrap
|
|
|
621
611
|
propertiesMode: ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
|
|
622
612
|
}));
|
|
623
613
|
properties?.push(...this.extraProperties);
|
|
624
|
-
properties?.sort((a, b) =>
|
|
614
|
+
properties?.sort((a, b) => compareProperties(a, b, this.sortPropertiesAlphabetically));
|
|
625
615
|
const accessors = properties && ObjectTreeNodeBase.getGettersAndSetters(properties, this.options);
|
|
626
616
|
|
|
627
617
|
const internalProperties =
|
|
@@ -751,7 +741,7 @@ export class ArrayGroupTreeNode extends ObjectTreeNodeBase {
|
|
|
751
741
|
...this.options,
|
|
752
742
|
}));
|
|
753
743
|
properties?.push(...this.extraProperties);
|
|
754
|
-
properties?.sort((a, b) =>
|
|
744
|
+
properties?.sort((a, b) => compareProperties(a, b, this.sortPropertiesAlphabetically));
|
|
755
745
|
const accessors = properties && ObjectTreeNodeBase.getGettersAndSetters(properties, this.options);
|
|
756
746
|
return {properties, accessors};
|
|
757
747
|
}
|
|
@@ -929,267 +919,179 @@ export class ObjectTreeNode extends ObjectTreeNodeBase {
|
|
|
929
919
|
}
|
|
930
920
|
}
|
|
931
921
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
constructor(object: SDK.RemoteObject.RemoteObject, title?: string|Element|null,
|
|
943
|
-
linkifier?: Components.Linkifier.Linkifier, showOverflow?: boolean, editable = true,
|
|
944
|
-
search?: UI.TreeOutline.TreeSearch<ObjectTreeNodeBase>) {
|
|
945
|
-
super();
|
|
946
|
-
this.root = new ObjectTree(object, {
|
|
947
|
-
readOnly: !editable,
|
|
948
|
-
propertiesMode: ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
|
|
949
|
-
search,
|
|
950
|
-
});
|
|
951
|
-
if (!showOverflow) {
|
|
952
|
-
this.setHideOverflow(true);
|
|
953
|
-
}
|
|
954
|
-
this.setFocusable(true);
|
|
955
|
-
this.setShowSelectionOnKeyboardFocus(true);
|
|
956
|
-
this.#objectTreeElement = new RootElement(this.root, linkifier);
|
|
957
|
-
this.appendChild(this.#objectTreeElement);
|
|
958
|
-
if (typeof title === 'string' || !title) {
|
|
959
|
-
this.titleElement = this.element.createChild('span');
|
|
960
|
-
this.titleElement.textContent = title ? Platform.StringUtilities.escapeUnicodeAsText(title) : '';
|
|
961
|
-
} else {
|
|
962
|
-
this.titleElement = title;
|
|
963
|
-
this.element.appendChild(title);
|
|
964
|
-
}
|
|
965
|
-
if (this.titleElement instanceof HTMLElement && !this.titleElement.hasAttribute('tabIndex')) {
|
|
966
|
-
this.titleElement.tabIndex = -1;
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
objectPropertiesSectionMap.set(this.element, this);
|
|
970
|
-
this.registerRequiredCSS(objectValueStyles, objectPropertiesSectionStyles);
|
|
971
|
-
this.rootElement().childrenListElement.classList.add('source-code', 'object-properties-section');
|
|
922
|
+
// The RemoteObjectProperty overload is kept for web test compatibility for now.
|
|
923
|
+
export function compareProperties(propertyA: ObjectTreeNode|SDK.RemoteObject.RemoteObjectProperty,
|
|
924
|
+
propertyB: ObjectTreeNode|SDK.RemoteObject.RemoteObjectProperty,
|
|
925
|
+
sortPropertiesAlphabetically = true): number {
|
|
926
|
+
if (propertyA instanceof ObjectTreeNode) {
|
|
927
|
+
propertyA = propertyA.property;
|
|
928
|
+
}
|
|
929
|
+
if (propertyB instanceof ObjectTreeNode) {
|
|
930
|
+
propertyB = propertyB.property;
|
|
972
931
|
}
|
|
973
932
|
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
933
|
+
if (!propertyA.synthetic && propertyB.synthetic) {
|
|
934
|
+
return 1;
|
|
935
|
+
}
|
|
936
|
+
if (!propertyB.synthetic && propertyA.synthetic) {
|
|
937
|
+
return -1;
|
|
938
|
+
}
|
|
939
|
+
if (!propertyA.isOwn && propertyB.isOwn) {
|
|
940
|
+
return 1;
|
|
941
|
+
}
|
|
942
|
+
if (!propertyB.isOwn && propertyA.isOwn) {
|
|
943
|
+
return -1;
|
|
944
|
+
}
|
|
945
|
+
if (!propertyA.enumerable && propertyB.enumerable) {
|
|
946
|
+
return 1;
|
|
947
|
+
}
|
|
948
|
+
if (!propertyB.enumerable && propertyA.enumerable) {
|
|
949
|
+
return -1;
|
|
950
|
+
}
|
|
951
|
+
if (propertyA.symbol && !propertyB.symbol) {
|
|
952
|
+
return 1;
|
|
953
|
+
}
|
|
954
|
+
if (propertyB.symbol && !propertyA.symbol) {
|
|
955
|
+
return -1;
|
|
956
|
+
}
|
|
957
|
+
if (propertyA.private && !propertyB.private) {
|
|
958
|
+
return 1;
|
|
959
|
+
}
|
|
960
|
+
if (propertyB.private && !propertyA.private) {
|
|
961
|
+
return -1;
|
|
962
|
+
}
|
|
984
963
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
if (
|
|
989
|
-
return -1;
|
|
990
|
-
}
|
|
991
|
-
if (!propertyA.isOwn && propertyB.isOwn) {
|
|
992
|
-
return 1;
|
|
993
|
-
}
|
|
994
|
-
if (!propertyB.isOwn && propertyA.isOwn) {
|
|
995
|
-
return -1;
|
|
996
|
-
}
|
|
997
|
-
if (!propertyA.enumerable && propertyB.enumerable) {
|
|
998
|
-
return 1;
|
|
999
|
-
}
|
|
1000
|
-
if (!propertyB.enumerable && propertyA.enumerable) {
|
|
1001
|
-
return -1;
|
|
1002
|
-
}
|
|
1003
|
-
if (propertyA.symbol && !propertyB.symbol) {
|
|
1004
|
-
return 1;
|
|
1005
|
-
}
|
|
1006
|
-
if (propertyB.symbol && !propertyA.symbol) {
|
|
1007
|
-
return -1;
|
|
1008
|
-
}
|
|
1009
|
-
if (propertyA.private && !propertyB.private) {
|
|
964
|
+
if (sortPropertiesAlphabetically) {
|
|
965
|
+
const nameA = propertyA.name;
|
|
966
|
+
const nameB = propertyB.name;
|
|
967
|
+
if (nameA.startsWith('_') && !nameB.startsWith('_')) {
|
|
1010
968
|
return 1;
|
|
1011
969
|
}
|
|
1012
|
-
if (
|
|
970
|
+
if (nameB.startsWith('_') && !nameA.startsWith('_')) {
|
|
1013
971
|
return -1;
|
|
1014
972
|
}
|
|
1015
|
-
|
|
1016
|
-
if (sortPropertiesAlphabetically) {
|
|
1017
|
-
const nameA = propertyA.name;
|
|
1018
|
-
const nameB = propertyB.name;
|
|
1019
|
-
if (nameA.startsWith('_') && !nameB.startsWith('_')) {
|
|
1020
|
-
return 1;
|
|
1021
|
-
}
|
|
1022
|
-
if (nameB.startsWith('_') && !nameA.startsWith('_')) {
|
|
1023
|
-
return -1;
|
|
1024
|
-
}
|
|
1025
|
-
return Platform.StringUtilities.naturalOrderComparator(nameA, nameB);
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
return 0;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
static valueElementForFunctionDescription(description?: string, includePreview?: boolean, defaultName?: string,
|
|
1032
|
-
details?: SDK.DebuggerModel.FunctionDetails|null,
|
|
1033
|
-
linkify?: boolean): LitTemplate {
|
|
1034
|
-
const contents =
|
|
1035
|
-
(description: string, defaultName: string): {prefix: string, abbreviation: string, body: string} => {
|
|
1036
|
-
const text = description.replace(/^function [gs]et /, 'function ')
|
|
1037
|
-
.replace(/^function [gs]et\(/, 'function\(')
|
|
1038
|
-
.replace(/^[gs]et /, '');
|
|
1039
|
-
|
|
1040
|
-
// This set of best-effort regular expressions captures common function descriptions.
|
|
1041
|
-
// Ideally, some parser would provide prefix, arguments, function body text separately.
|
|
1042
|
-
const asyncMatch = text.match(/^(async\s+function)/);
|
|
1043
|
-
const isGenerator = text.startsWith('function*');
|
|
1044
|
-
const isGeneratorShorthand = text.startsWith('*');
|
|
1045
|
-
const isBasic = !isGenerator && text.startsWith('function');
|
|
1046
|
-
const isClass = text.startsWith('class ') || text.startsWith('class{');
|
|
1047
|
-
const firstArrowIndex = text.indexOf('=>');
|
|
1048
|
-
const isArrow = !asyncMatch && !isGenerator && !isBasic && !isClass && firstArrowIndex > 0;
|
|
1049
|
-
|
|
1050
|
-
if (isClass) {
|
|
1051
|
-
const body = text.substring('class'.length);
|
|
1052
|
-
const classNameMatch = /^[^{\s]+/.exec(body.trim());
|
|
1053
|
-
let className: string = defaultName;
|
|
1054
|
-
if (classNameMatch) {
|
|
1055
|
-
className = classNameMatch[0].trim() || defaultName;
|
|
1056
|
-
}
|
|
1057
|
-
return {prefix: 'class', body, abbreviation: className};
|
|
1058
|
-
}
|
|
1059
|
-
if (asyncMatch) {
|
|
1060
|
-
const body = text.substring(asyncMatch[1].length);
|
|
1061
|
-
return {prefix: 'async \u0192', body, abbreviation: nameAndArguments(body)};
|
|
1062
|
-
}
|
|
1063
|
-
if (isGenerator) {
|
|
1064
|
-
const body = text.substring('function*'.length);
|
|
1065
|
-
return {prefix: '\u0192*', body, abbreviation: nameAndArguments(body)};
|
|
1066
|
-
}
|
|
1067
|
-
if (isGeneratorShorthand) {
|
|
1068
|
-
const body = text.substring('*'.length);
|
|
1069
|
-
return {prefix: '\u0192*', body, abbreviation: nameAndArguments(body)};
|
|
1070
|
-
}
|
|
1071
|
-
if (isBasic) {
|
|
1072
|
-
const body = text.substring('function'.length);
|
|
1073
|
-
return {prefix: '\u0192', body, abbreviation: nameAndArguments(body)};
|
|
1074
|
-
}
|
|
1075
|
-
if (isArrow) {
|
|
1076
|
-
const maxArrowFunctionCharacterLength = 60;
|
|
1077
|
-
let abbreviation: string = text;
|
|
1078
|
-
if (defaultName) {
|
|
1079
|
-
abbreviation = defaultName + '()';
|
|
1080
|
-
} else if (text.length > maxArrowFunctionCharacterLength) {
|
|
1081
|
-
abbreviation = text.substring(0, firstArrowIndex + 2) + ' {…}';
|
|
1082
|
-
}
|
|
1083
|
-
return {prefix: '', body: text, abbreviation};
|
|
1084
|
-
}
|
|
1085
|
-
return {prefix: '\u0192', body: text, abbreviation: nameAndArguments(text)};
|
|
1086
|
-
};
|
|
1087
|
-
|
|
1088
|
-
const {prefix, body, abbreviation} = contents(description ?? '', defaultName ?? '');
|
|
1089
|
-
const maxFunctionBodyLength = 200;
|
|
1090
|
-
|
|
1091
|
-
const location = details?.location;
|
|
1092
|
-
const clickHandler = linkify && location ? (event: Event) => {
|
|
1093
|
-
void Common.Revealer.reveal(location);
|
|
1094
|
-
event.consume(true);
|
|
1095
|
-
} : undefined;
|
|
1096
|
-
|
|
1097
|
-
const classes = classMap({
|
|
1098
|
-
'object-value-function': true,
|
|
1099
|
-
linkified: Boolean(linkify && location),
|
|
1100
|
-
});
|
|
1101
|
-
const title = description ? Platform.StringUtilities.trimEndWithMaxLength(description, 500) : undefined;
|
|
1102
|
-
|
|
1103
|
-
return html`<span
|
|
1104
|
-
class=${classes}
|
|
1105
|
-
@click=${clickHandler || nothing}
|
|
1106
|
-
title=${ifDefined(title)}>${prefix && html`<span class=object-value-function-prefix>${prefix} </span>`}${
|
|
1107
|
-
includePreview ? Platform.StringUtilities.trimEndWithMaxLength(body.trim(), maxFunctionBodyLength) :
|
|
1108
|
-
abbreviation.replace(/\n/g, ' ')}</span>`;
|
|
1109
|
-
|
|
1110
|
-
function nameAndArguments(contents: string): string {
|
|
1111
|
-
const startOfArgumentsIndex = contents.indexOf('(');
|
|
1112
|
-
const endOfArgumentsMatch = contents.match(/\)\s*{/);
|
|
1113
|
-
if (startOfArgumentsIndex !== -1 && endOfArgumentsMatch?.index !== undefined &&
|
|
1114
|
-
endOfArgumentsMatch.index > startOfArgumentsIndex) {
|
|
1115
|
-
const name = contents.substring(0, startOfArgumentsIndex).trim() || (defaultName ?? '');
|
|
1116
|
-
const args = contents.substring(startOfArgumentsIndex, endOfArgumentsMatch.index + 1);
|
|
1117
|
-
return name + args;
|
|
1118
|
-
}
|
|
1119
|
-
return defaultName + '()';
|
|
1120
|
-
}
|
|
973
|
+
return Platform.StringUtilities.naturalOrderComparator(nameA, nameB);
|
|
1121
974
|
}
|
|
1122
975
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
// styled within the context of code mirror.
|
|
1126
|
-
// clang-format off
|
|
1127
|
-
return !object.isLinearMemoryInspectable() ? nothing : html`<devtools-icon
|
|
1128
|
-
name=memory
|
|
1129
|
-
style="width: var(--sys-size-8); height: 13px; vertical-align: sub; cursor: pointer;"
|
|
1130
|
-
@click=${(event: Event) => {
|
|
1131
|
-
event.consume();
|
|
1132
|
-
void Common.Revealer.reveal(new SDK.RemoteObject.LinearMemoryInspectable(object, expression));
|
|
1133
|
-
}}
|
|
1134
|
-
jslog=${VisualLogging.action('open-memory-inspector').track({click: true})}
|
|
1135
|
-
title=${i18nString(UIStrings.openInMemoryInpector)}
|
|
1136
|
-
aria-label=${i18nString(UIStrings.openInMemoryInpector)}></devtools-icon>`;
|
|
1137
|
-
// clang-format on
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
|
-
static appendMemoryIcon(element: Element, object: SDK.RemoteObject.RemoteObject, expression?: string): void {
|
|
1141
|
-
const fragment = document.createDocumentFragment();
|
|
1142
|
-
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
1143
|
-
render(ObjectPropertiesSection.getMemoryIcon(object, expression), fragment);
|
|
1144
|
-
element.appendChild(fragment);
|
|
1145
|
-
}
|
|
976
|
+
return 0;
|
|
977
|
+
}
|
|
1146
978
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
979
|
+
export function valueElementForFunctionDescription(description?: string, includePreview?: boolean, defaultName?: string,
|
|
980
|
+
details?: SDK.DebuggerModel.FunctionDetails|null,
|
|
981
|
+
linkify?: boolean): LitTemplate {
|
|
982
|
+
const contents = (description: string, defaultName: string): {prefix: string, abbreviation: string, body: string} => {
|
|
983
|
+
const text = description.replace(/^function [gs]et /, 'function ')
|
|
984
|
+
.replace(/^function [gs]et\(/, 'function\(')
|
|
985
|
+
.replace(/^[gs]et /, '');
|
|
986
|
+
|
|
987
|
+
// This set of best-effort regular expressions captures common function descriptions.
|
|
988
|
+
// Ideally, some parser would provide prefix, arguments, function body text separately.
|
|
989
|
+
const asyncMatch = text.match(/^(async\s+function)/);
|
|
990
|
+
const isGenerator = text.startsWith('function*');
|
|
991
|
+
const isGeneratorShorthand = text.startsWith('*');
|
|
992
|
+
const isBasic = !isGenerator && text.startsWith('function');
|
|
993
|
+
const isClass = text.startsWith('class ') || text.startsWith('class{');
|
|
994
|
+
const firstArrowIndex = text.indexOf('=>');
|
|
995
|
+
const isArrow = !asyncMatch && !isGenerator && !isBasic && !isClass && firstArrowIndex > 0;
|
|
996
|
+
|
|
997
|
+
if (isClass) {
|
|
998
|
+
const body = text.substring('class'.length);
|
|
999
|
+
const classNameMatch = /^[^{\s]+/.exec(body.trim());
|
|
1000
|
+
let className: string = defaultName;
|
|
1001
|
+
if (classNameMatch) {
|
|
1002
|
+
className = classNameMatch[0].trim() || defaultName;
|
|
1003
|
+
}
|
|
1004
|
+
return {prefix: 'class', body, abbreviation: className};
|
|
1005
|
+
}
|
|
1006
|
+
if (asyncMatch) {
|
|
1007
|
+
const body = text.substring(asyncMatch[1].length);
|
|
1008
|
+
return {prefix: 'async \u0192', body, abbreviation: nameAndArguments(body)};
|
|
1009
|
+
}
|
|
1010
|
+
if (isGenerator) {
|
|
1011
|
+
const body = text.substring('function*'.length);
|
|
1012
|
+
return {prefix: '\u0192*', body, abbreviation: nameAndArguments(body)};
|
|
1013
|
+
}
|
|
1014
|
+
if (isGeneratorShorthand) {
|
|
1015
|
+
const body = text.substring('*'.length);
|
|
1016
|
+
return {prefix: '\u0192*', body, abbreviation: nameAndArguments(body)};
|
|
1017
|
+
}
|
|
1018
|
+
if (isBasic) {
|
|
1019
|
+
const body = text.substring('function'.length);
|
|
1020
|
+
return {prefix: '\u0192', body, abbreviation: nameAndArguments(body)};
|
|
1021
|
+
}
|
|
1022
|
+
if (isArrow) {
|
|
1023
|
+
const maxArrowFunctionCharacterLength = 60;
|
|
1024
|
+
let abbreviation: string = text;
|
|
1025
|
+
if (defaultName) {
|
|
1026
|
+
abbreviation = defaultName + '()';
|
|
1027
|
+
} else if (text.length > maxArrowFunctionCharacterLength) {
|
|
1028
|
+
abbreviation = text.substring(0, firstArrowIndex + 2) + ' {…}';
|
|
1029
|
+
}
|
|
1030
|
+
return {prefix: '', body: text, abbreviation};
|
|
1151
1031
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
return !useless;
|
|
1155
|
-
}
|
|
1032
|
+
return {prefix: '\u0192', body: text, abbreviation: nameAndArguments(text)};
|
|
1033
|
+
};
|
|
1156
1034
|
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
}
|
|
1035
|
+
const {prefix, body, abbreviation} = contents(description ?? '', defaultName ?? '');
|
|
1036
|
+
const maxFunctionBodyLength = 200;
|
|
1160
1037
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1038
|
+
const location = details?.location;
|
|
1039
|
+
const clickHandler = linkify && location ? (event: Event) => {
|
|
1040
|
+
void Common.Revealer.reveal(location);
|
|
1041
|
+
event.consume(true);
|
|
1042
|
+
} : undefined;
|
|
1164
1043
|
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1044
|
+
const classes = classMap({
|
|
1045
|
+
'object-value-function': true,
|
|
1046
|
+
linkified: Boolean(linkify && location),
|
|
1047
|
+
});
|
|
1048
|
+
const title = description ? Platform.StringUtilities.trimEndWithMaxLength(description, 500) : undefined;
|
|
1168
1049
|
|
|
1169
|
-
|
|
1170
|
-
|
|
1050
|
+
return html`<span
|
|
1051
|
+
class=${classes}
|
|
1052
|
+
@click=${clickHandler || nothing}
|
|
1053
|
+
title=${ifDefined(title)}>${prefix && html`<span class=object-value-function-prefix>${prefix} </span>`}${
|
|
1054
|
+
includePreview ? Platform.StringUtilities.trimEndWithMaxLength(body.trim(), maxFunctionBodyLength) :
|
|
1055
|
+
abbreviation.replace(/\n/g, ' ')}</span>`;
|
|
1056
|
+
|
|
1057
|
+
function nameAndArguments(contents: string): string {
|
|
1058
|
+
const startOfArgumentsIndex = contents.indexOf('(');
|
|
1059
|
+
const endOfArgumentsMatch = contents.match(/\)\s*{/);
|
|
1060
|
+
if (startOfArgumentsIndex !== -1 && endOfArgumentsMatch?.index !== undefined &&
|
|
1061
|
+
endOfArgumentsMatch.index > startOfArgumentsIndex) {
|
|
1062
|
+
const name = contents.substring(0, startOfArgumentsIndex).trim() || (defaultName ?? '');
|
|
1063
|
+
const args = contents.substring(startOfArgumentsIndex, endOfArgumentsMatch.index + 1);
|
|
1064
|
+
return name + args;
|
|
1065
|
+
}
|
|
1066
|
+
return defaultName + '()';
|
|
1171
1067
|
}
|
|
1068
|
+
}
|
|
1172
1069
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1070
|
+
export function getMemoryIcon(object: SDK.RemoteObject.RemoteObject, expression?: string): LitTemplate {
|
|
1071
|
+
// Directly set styles on memory icon, so that the memory icon is also
|
|
1072
|
+
// styled within the context of code mirror.
|
|
1073
|
+
// clang-format off
|
|
1074
|
+
return !object.isLinearMemoryInspectable() ? nothing : html`<devtools-icon
|
|
1075
|
+
name=memory
|
|
1076
|
+
style="width: var(--sys-size-8); height: 13px; vertical-align: sub; cursor: pointer;"
|
|
1077
|
+
@click=${(event: Event) => {
|
|
1078
|
+
event.consume();
|
|
1079
|
+
void Common.Revealer.reveal(new SDK.RemoteObject.LinearMemoryInspectable(object, expression));
|
|
1080
|
+
}}
|
|
1081
|
+
jslog=${VisualLogging.action('open-memory-inspector').track({click: true})}
|
|
1082
|
+
title=${i18nString(UIStrings.openInMemoryInpector)}
|
|
1083
|
+
aria-label=${i18nString(UIStrings.openInMemoryInpector)}></devtools-icon>`;
|
|
1084
|
+
// clang-format on
|
|
1085
|
+
}
|
|
1187
1086
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1087
|
+
function isDisplayableProperty(property: SDK.RemoteObject.RemoteObjectProperty,
|
|
1088
|
+
parentProperty?: SDK.RemoteObject.RemoteObjectProperty): boolean {
|
|
1089
|
+
if (!parentProperty?.synthetic) {
|
|
1090
|
+
return true;
|
|
1192
1091
|
}
|
|
1092
|
+
const name = property.name;
|
|
1093
|
+
const useless = (parentProperty.name === '[[Entries]]' && (name === 'length' || name === '__proto__'));
|
|
1094
|
+
return !useless;
|
|
1193
1095
|
}
|
|
1194
1096
|
|
|
1195
1097
|
export class ObjectPropertiesSectionWidget extends UI.Widget.Widget {
|
|
@@ -1611,74 +1513,6 @@ export const OBJECT_PROPERTIES_SECTION_DEFAULT_VIEW: ObjectPropertiesSectionView
|
|
|
1611
1513
|
target);
|
|
1612
1514
|
};
|
|
1613
1515
|
|
|
1614
|
-
class RootElement extends UI.TreeOutline.TreeElement {
|
|
1615
|
-
private readonly object: ObjectTree;
|
|
1616
|
-
private readonly linkifier: Components.Linkifier.Linkifier|undefined;
|
|
1617
|
-
private readonly emptyPlaceholder: string|null|undefined;
|
|
1618
|
-
override toggleOnClick: boolean;
|
|
1619
|
-
constructor(object: ObjectTree, linkifier?: Components.Linkifier.Linkifier, emptyPlaceholder?: string|null) {
|
|
1620
|
-
const contentElement = document.createElement('slot');
|
|
1621
|
-
super(contentElement);
|
|
1622
|
-
|
|
1623
|
-
this.object = object;
|
|
1624
|
-
this.object.addEventListener(ObjectTreeNodeBase.Events.CHILDREN_CHANGED, this.onpopulate, this);
|
|
1625
|
-
this.linkifier = linkifier;
|
|
1626
|
-
this.emptyPlaceholder = emptyPlaceholder;
|
|
1627
|
-
|
|
1628
|
-
this.setExpandable(true);
|
|
1629
|
-
this.selectable = true;
|
|
1630
|
-
this.toggleOnClick = true;
|
|
1631
|
-
this.listItemElement.classList.add('object-properties-section-root-element');
|
|
1632
|
-
this.listItemElement.addEventListener('contextmenu', this.onContextMenu.bind(this), false);
|
|
1633
|
-
if (object.expanded) {
|
|
1634
|
-
this.expand();
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
override onexpand(): void {
|
|
1639
|
-
this.object.expanded = true;
|
|
1640
|
-
if (this.treeOutline) {
|
|
1641
|
-
this.treeOutline.element.classList.add('expanded');
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
override oncollapse(): void {
|
|
1646
|
-
this.object.expanded = false;
|
|
1647
|
-
if (this.treeOutline) {
|
|
1648
|
-
this.treeOutline.element.classList.remove('expanded');
|
|
1649
|
-
}
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
override ondblclick(_e: Event): boolean {
|
|
1653
|
-
return true;
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
private onContextMenu(event: Event): void {
|
|
1657
|
-
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
1658
|
-
populateObjectTreeContextMenu(
|
|
1659
|
-
contextMenu,
|
|
1660
|
-
this.object,
|
|
1661
|
-
this.expandRecursively.bind(this, EXPANDABLE_MAX_DEPTH),
|
|
1662
|
-
this.collapseChildren.bind(this),
|
|
1663
|
-
() => {
|
|
1664
|
-
this.object.sortPropertiesAlphabetically = !this.object.sortPropertiesAlphabetically;
|
|
1665
|
-
},
|
|
1666
|
-
() => {
|
|
1667
|
-
this.object.includeNullOrUndefinedValues = !this.object.includeNullOrUndefinedValues;
|
|
1668
|
-
},
|
|
1669
|
-
);
|
|
1670
|
-
void contextMenu.show();
|
|
1671
|
-
}
|
|
1672
|
-
|
|
1673
|
-
override async onpopulate(): Promise<void> {
|
|
1674
|
-
this.removeChildren();
|
|
1675
|
-
const treeOutline = (this.treeOutline as ObjectPropertiesSection | null);
|
|
1676
|
-
const skipProto = treeOutline ? Boolean(treeOutline.skipProtoInternal) : false;
|
|
1677
|
-
return await ObjectPropertyTreeElement.populate(this, this.object, skipProto, false, this.linkifier,
|
|
1678
|
-
this.emptyPlaceholder);
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
1516
|
export function renderPropertyName(name: string|null, isPrivate?: boolean, title?: string): TemplateResult {
|
|
1683
1517
|
if (name === null) {
|
|
1684
1518
|
return html`<span class="name" title=${ifDefined(title)}></span>`;
|
|
@@ -1701,8 +1535,7 @@ export async function formatObjectAsFunction(func: SDK.RemoteObject.RemoteObject
|
|
|
1701
1535
|
// The includePreview flag is false for formats such as console.dir().
|
|
1702
1536
|
const defaultName = details?.functionName ?? (includePreview ? '' : 'anonymous');
|
|
1703
1537
|
|
|
1704
|
-
return
|
|
1705
|
-
details, linkify);
|
|
1538
|
+
return valueElementForFunctionDescription(func.description, includePreview, defaultName, details, linkify);
|
|
1706
1539
|
}
|
|
1707
1540
|
|
|
1708
1541
|
export function renderPropertyValue(value: SDK.RemoteObject.RemoteObject, wasThrown: boolean, showPreview: boolean,
|
|
@@ -1770,7 +1603,7 @@ export function renderPropertyValue(value: SDK.RemoteObject.RemoteObject, wasThr
|
|
|
1770
1603
|
title = tooLong ? undefined : text;
|
|
1771
1604
|
content = tooLong ? widget(ExpandableTextPropertyValue, {text}) : renderTrustedType(description, className);
|
|
1772
1605
|
} else if (isFunction) {
|
|
1773
|
-
content =
|
|
1606
|
+
content = valueElementForFunctionDescription(description);
|
|
1774
1607
|
} else if (description.length > maxRenderableStringLength) {
|
|
1775
1608
|
title = description;
|
|
1776
1609
|
content = widget(ExpandableTextPropertyValue, {text: description});
|
|
@@ -1780,8 +1613,7 @@ export function renderPropertyValue(value: SDK.RemoteObject.RemoteObject, wasThr
|
|
|
1780
1613
|
const previewContent = hasPreview ?
|
|
1781
1614
|
new RemoteObjectPreviewFormatter().renderObjectPreview(value.preview, includeNullOrUndefined) :
|
|
1782
1615
|
description;
|
|
1783
|
-
content = html`${previewContent}${
|
|
1784
|
-
isSyntheticProperty ? nothing : ObjectPropertiesSection.getMemoryIcon(value, variableName)}`;
|
|
1616
|
+
content = html`${previewContent}${isSyntheticProperty ? nothing : getMemoryIcon(value, variableName)}`;
|
|
1785
1617
|
}
|
|
1786
1618
|
|
|
1787
1619
|
if (wasThrown) {
|
|
@@ -1951,7 +1783,7 @@ export const OBJECT_PROPERTY_DEFAULT_VIEW: ObjectPropertyView = (input, output,
|
|
|
1951
1783
|
Platform.StringUtilities.trimMiddle(property.value.description ?? '',
|
|
1952
1784
|
maxRenderableStringLength)}${
|
|
1953
1785
|
property.synthetic ? nothing :
|
|
1954
|
-
|
|
1786
|
+
getMemoryIcon(property.value)}</span>` :
|
|
1955
1787
|
value()
|
|
1956
1788
|
}</devtools-highlight>
|
|
1957
1789
|
<datalist id=${completionsId}>${repeat(input.completions, c => html`<option>${c}</option>`)}</datalist>
|
|
@@ -2184,7 +2016,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2184
2016
|
for (const childNode of ObjectPropertyTreeElement.createNodes(
|
|
2185
2017
|
value, skipProto, skipGettersAndSetters, linkifier, emptyPlaceholder,
|
|
2186
2018
|
property => treeElement instanceof ObjectPropertyTreeElement &&
|
|
2187
|
-
!
|
|
2019
|
+
!isDisplayableProperty(property, treeElement.property?.property))) {
|
|
2188
2020
|
treeElement.appendChild(childNode);
|
|
2189
2021
|
}
|
|
2190
2022
|
}
|
|
@@ -2224,7 +2056,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2224
2056
|
empty = false;
|
|
2225
2057
|
}
|
|
2226
2058
|
const sortPropertiesAlphabetically = properties?.[0]?.parent?.sortPropertiesAlphabetically ?? true;
|
|
2227
|
-
properties?.sort((a, b) =>
|
|
2059
|
+
properties?.sort((a, b) => compareProperties(a, b, sortPropertiesAlphabetically));
|
|
2228
2060
|
|
|
2229
2061
|
const entriesProperty = internalProperties?.find(({property}) => property.name === '[[Entries]]');
|
|
2230
2062
|
if (entriesProperty) {
|
|
@@ -2285,7 +2117,7 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2285
2117
|
for (const childNode of this.createPropertyNodes(
|
|
2286
2118
|
children, skipProto, skipGettersAndSetters, linkifier, emptyPlaceholder,
|
|
2287
2119
|
property => treeNode instanceof ObjectPropertyTreeElement &&
|
|
2288
|
-
!
|
|
2120
|
+
!isDisplayableProperty(property, treeNode.property?.property))) {
|
|
2289
2121
|
treeNode.appendChild(childNode);
|
|
2290
2122
|
}
|
|
2291
2123
|
}
|
|
@@ -2344,12 +2176,10 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
2344
2176
|
}
|
|
2345
2177
|
|
|
2346
2178
|
override async onpopulate(): Promise<void> {
|
|
2347
|
-
const treeOutline = (this.treeOutline as ObjectPropertiesSection | null);
|
|
2348
|
-
const skipProto = treeOutline ? Boolean(treeOutline.skipProtoInternal) : false;
|
|
2349
2179
|
this.removeChildren();
|
|
2350
2180
|
|
|
2351
2181
|
if (this.property.object) {
|
|
2352
|
-
await ObjectPropertyTreeElement.populate(this, this.property,
|
|
2182
|
+
await ObjectPropertyTreeElement.populate(this, this.property, false, false, this.linkifier);
|
|
2353
2183
|
if (this.childCount() > this.maxNumPropertiesToShow) {
|
|
2354
2184
|
this.createShowAllPropertiesButton();
|
|
2355
2185
|
}
|