Index: third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js b/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js |
index 30cb1a700ee91cca76392ab33f5162e37f90aa55..1eff924ae65596a0dcc053a1075f377812627247 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js |
+++ b/third_party/WebKit/Source/devtools/front_end/components/RemoteObjectPreviewFormatter.js |
@@ -28,8 +28,22 @@ Components.RemoteObjectPreviewFormatter = class { |
parentElement.appendChild(this.renderPropertyPreview(preview.type, preview.subtype, description)); |
return; |
} |
- if (description && preview.subtype !== 'array') |
- parentElement.createTextChildren(description, ' '); |
+ if (description) { |
+ if (Runtime.experiments.isEnabled('objectPreviews')) { |
+ var text = ''; |
+ if (preview.subtype === 'typedarray' || preview.subtype === 'map' || preview.subtype === 'set') |
+ text = description.replace(/\[([0-9]+)\]|\(([0-9]+)\)/, ''); |
+ else if (preview.subtype !== 'array') |
+ text = description; |
+ var size = SDK.RemoteObject.arrayLength(preview) || SDK.RemoteObject.mapOrSetEntriesCount(preview); |
+ if (size > 1) |
+ text += '(' + size + ')'; |
+ if (text.length > 0) |
+ parentElement.createChild('span', 'object-description').textContent = text + ' '; |
+ } else if (preview.subtype !== 'array') { |
+ parentElement.createTextChildren(description, ' '); |
+ } |
+ } |
var isArray = preview.subtype === 'array' || preview.subtype === 'typedarray'; |
parentElement.createTextChild(isArray ? '[' : '{'); |