Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: third_party/WebKit/Source/devtools/front_end/object_ui/RemoteObjectPreviewFormatter.js

Issue 2723773003: DevTools: restore array lengths for long arrays (Closed)
Patch Set: ac Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/object_ui/RemoteObjectPreviewFormatter.js
diff --git a/third_party/WebKit/Source/devtools/front_end/object_ui/RemoteObjectPreviewFormatter.js b/third_party/WebKit/Source/devtools/front_end/object_ui/RemoteObjectPreviewFormatter.js
index cc2234f9a834ff8b48616fec293d7e3fd8c1f0d4..31a94d7e43cb604776e67cdd94c5242de2a289bd 100644
--- a/third_party/WebKit/Source/devtools/front_end/object_ui/RemoteObjectPreviewFormatter.js
+++ b/third_party/WebKit/Source/devtools/front_end/object_ui/RemoteObjectPreviewFormatter.js
@@ -32,20 +32,18 @@ ObjectUI.RemoteObjectPreviewFormatter = class {
}
const isArrayOrTypedArray = preview.subtype === 'array' || preview.subtype === 'typedarray';
if (description) {
- if (previewExperimentEnabled) {
- // Hide the description for plain objects and plain arrays.
- const plainObjectDescription = 'Object';
- const size = SDK.RemoteObject.arrayLength(preview) || SDK.RemoteObject.mapOrSetEntriesCount(preview);
- var text = preview.subtype === 'typedarray' ? SDK.RemoteObject.arrayNameFromDescription(description) : '';
- if (isArrayOrTypedArray)
- text += size > 1 ? ('(' + size + ')') : '';
- else
- text = description === plainObjectDescription ? '' : description;
- if (text.length > 0)
- parentElement.createChild('span', 'object-description').textContent = text + ' ';
- } else if (preview.subtype !== 'array') {
- parentElement.createTextChildren(description, ' ');
+ var text;
+ if (isArrayOrTypedArray) {
+ var arrayLength = SDK.RemoteObject.arrayLength(preview);
+ var arrayLengthText = arrayLength > 1 ? ('(' + arrayLength + ')') : '';
+ var arrayName = preview.subtype === 'typedarray' ? SDK.RemoteObject.arrayNameFromDescription(description) : '';
+ text = arrayName + arrayLengthText;
+ } else {
+ var hideDescription = previewExperimentEnabled && description === 'Object';
+ text = hideDescription ? '' : description;
}
+ if (text.length > 0)
+ parentElement.createChild('span', 'object-description').textContent = text + ' ';
}
parentElement.createTextChild(isArrayOrTypedArray ? '[' : '{');

Powered by Google App Engine
This is Rietveld 408576698