*/
WebInspector.ObjectPropertiesSection = function(object, title, subtitle, emptyPlaceholder, ignoreHasOwnProperty, extraProperties, treeElementConstructor)
{
- this.emptyPlaceholder = (emptyPlaceholder || WebInspector.UIString("No Properties"));
+ this._emptyPlaceholder = emptyPlaceholder;
this.object = object;
this.ignoreHasOwnProperty = ignoreHasOwnProperty;
this.extraProperties = extraProperties;
WebInspector.ObjectPropertyTreeElement.populateWithProperties(this.propertiesTreeOutline,
properties, internalProperties,
rootTreeElementConstructor, rootPropertyComparer,
- this.skipProto, this.object);
+ this.skipProto, this.object, this._emptyPlaceholder);
this.propertiesForTest = properties;
-
- if (!this.propertiesTreeOutline.children.length) {
- var title = document.createElementWithClass("div", "info");
- title.textContent = this.emptyPlaceholder;
- var infoElement = new TreeElement(title, null, false);
- this.propertiesTreeOutline.appendChild(infoElement);
- }
},
__proto__: WebInspector.PropertiesSection.prototype
/**
* @param {!TreeElement} treeElement
* @param {!WebInspector.RemoteObject} value
+ * @param {string=} emptyPlaceholder
*/
-WebInspector.ObjectPropertyTreeElement.populate = function(treeElement, value) {
+WebInspector.ObjectPropertyTreeElement.populate = function(treeElement, value, emptyPlaceholder) {
if (treeElement.children.length && !treeElement.shouldRefreshChildren)
return;
treeElement.removeChildren();
if (!properties)
return;
- if (!internalProperties)
- internalProperties = [];
-
WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElement, properties, internalProperties,
treeElement.treeOutline.section.treeElementConstructor, WebInspector.ObjectPropertiesSection.CompareProperties,
- treeElement.treeOutline.section.skipProto, value);
+ treeElement.treeOutline.section.skipProto, value, emptyPlaceholder);
}
WebInspector.RemoteObject.loadFromObjectPerProto(value, callback);
* @param {function (!WebInspector.RemoteObjectProperty, !WebInspector.RemoteObjectProperty): number} comparator
* @param {boolean} skipProto
* @param {?WebInspector.RemoteObject} value
+ * @param {?string=} emptyPlaceholder
*/
-WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeElement, properties, internalProperties, treeElementConstructor, comparator, skipProto, value) {
+WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeElement, properties, internalProperties, treeElementConstructor, comparator, skipProto, value, emptyPlaceholder) {
properties.sort(comparator);
for (var i = 0; i < properties.length; ++i) {
if (!hasTargetFunction)
treeElement.appendChild(new WebInspector.FunctionScopeMainTreeElement(value));
}
+ if (value && value.type === "object" && (value.subtype === "map" || value.subtype === "set"))
+ treeElement.appendChild(new WebInspector.CollectionEntriesMainTreeElement(value));
if (internalProperties) {
for (var i = 0; i < internalProperties.length; i++) {
internalProperties[i].parentObject = value;
treeElement.appendChild(new treeElementConstructor(internalProperties[i]));
}
}
+
+ WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeElement, emptyPlaceholder);
}
/**
- * @param {!WebInspector.RemoteObject} object
+ * @param {!TreeElement|!TreeOutline} treeElement
+ * @param {?string=} emptyPlaceholder
+ */
+WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = function(treeElement, emptyPlaceholder)
+{
+ if (treeElement.children.length)
+ return;
+ var title = document.createElementWithClass("div", "info");
+ title.textContent = emptyPlaceholder || WebInspector.UIString("No Properties");
+ var infoElement = new TreeElement(title, null, false);
+ treeElement.appendChild(infoElement);
+}
+
+/**
+ * @param {?WebInspector.RemoteObject} object
* @param {!Array.<string>} propertyPath
* @param {function(?WebInspector.RemoteObject, boolean=)} callback
* @return {!Element}
WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan = function(object, propertyPath, callback)
{
var rootElement = document.createElement("span");
- var element = rootElement.createChild("span", "properties-calculate-value-button");
+ var element = rootElement.createChild("span");
element.textContent = WebInspector.UIString("(...)");
+ if (!object)
+ return rootElement;
+ element.classList.add("properties-calculate-value-button");
element.title = WebInspector.UIString("Invoke property getter");
element.addEventListener("click", onInvokeGetterClick, false);
return;
this.removeChildren();
- var scopeChain = response.scopeChain;
- if (!scopeChain)
- return;
+ var scopeChain = response.scopeChain || [];
for (var i = 0; i < scopeChain.length; ++i) {
var scope = scopeChain[i];
var title = null;
} else {
var scopeRef = new WebInspector.ScopeRef(i, undefined, this._remoteObject.objectId);
var remoteObject = runtimeModel.createScopeRemoteObject(scope.object, scopeRef);
- var scopeTreeElement = new WebInspector.ScopeTreeElement(title, null, remoteObject);
+ var scopeTreeElement = new WebInspector.ScopeTreeElement(title, remoteObject);
this.appendChild(scopeTreeElement);
}
}
+
+ WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(this, WebInspector.UIString("No Scopes"));
}
+
this._remoteObject.functionDetails(didGetDetails.bind(this));
},
/**
* @constructor
* @extends {TreeElement}
+ * @param {!WebInspector.RemoteObject} remoteObject
+ */
+WebInspector.CollectionEntriesMainTreeElement = function(remoteObject)
+{
+ TreeElement.call(this, "<entries>", null, false);
+ this.toggleOnClick = true;
+ this.selectable = false;
+ this._remoteObject = remoteObject;
+ this.hasChildren = true;
+}
+
+WebInspector.CollectionEntriesMainTreeElement.prototype = {
+ onpopulate: function()
+ {
+ if (this.children.length && !this.shouldRefreshChildren)
+ return;
+
+ /**
+ * @param {?Array.<!DebuggerAgent.CollectionEntry>} entries
+ * @this {WebInspector.CollectionEntriesMainTreeElement}
+ */
+ function didGetCollectionEntries(entries)
+ {
+ if (!entries)
+ return;
+ this.removeChildren();
+
+ var entriesLocalObject = [];
+ var runtimeModel = this._remoteObject.target().runtimeModel;
+ for (var i = 0; i < entries.length; ++i) {
+ var entry = entries[i];
+ if (entry.key) {
+ entriesLocalObject.push(new WebInspector.MapEntryLocalJSONObject({
+ key: runtimeModel.createRemoteObject(entry.key),
+ value: runtimeModel.createRemoteObject(entry.value)
+ }));
+ } else {
+ entriesLocalObject.push(runtimeModel.createRemoteObject(entry.value));
+ }
+ }
+ WebInspector.ObjectPropertyTreeElement.populate(this, WebInspector.RemoteObject.fromLocalObject(entriesLocalObject), WebInspector.UIString("No Entries"));
+ this.title = "<entries>[" + entriesLocalObject.length + "]";
+ }
+
+ this._remoteObject.collectionEntries(didGetCollectionEntries.bind(this));
+ },
+
+ __proto__: TreeElement.prototype
+}
+
+/**
+ * @constructor
+ * @extends {TreeElement}
* @param {string} title
- * @param {?string} subtitle
* @param {!WebInspector.RemoteObject} remoteObject
*/
-WebInspector.ScopeTreeElement = function(title, subtitle, remoteObject)
+WebInspector.ScopeTreeElement = function(title, remoteObject)
{
- // TODO: use subtitle parameter.
TreeElement.call(this, title, null, false);
this.toggleOnClick = true;
this.selectable = false;
WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, propertyCount)
{
TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex), undefined, true);
+ this.toggleOnClick = true;
+ this.selectable = false;
this._fromIndex = fromIndex;
this._toIndex = toIndex;
this._object = object;