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

Unified Diff: Source/devtools/front_end/sdk/RemoteObject.js

Issue 512003003: DevTools: Show preview in console of ES6 Map, Set, WeakMap and WeakSet entries. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed dbg tests Created 6 years, 3 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
« no previous file with comments | « Source/devtools/front_end/inspectorStyle.css ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/RemoteObject.js
diff --git a/Source/devtools/front_end/sdk/RemoteObject.js b/Source/devtools/front_end/sdk/RemoteObject.js
index 427f4cafbd56e199f37bc8772c673fbda15a76f2..a6f82e0ae1eeb43e996a7a3c79a0a26b2077e5e7 100644
--- a/Source/devtools/front_end/sdk/RemoteObject.js
+++ b/Source/devtools/front_end/sdk/RemoteObject.js
@@ -868,24 +868,31 @@ WebInspector.LocalJSONObject.prototype = {
/**
* @param {!WebInspector.RemoteObjectProperty} property
+ * @return {string}
+ * @this {WebInspector.LocalJSONObject}
*/
function formatArrayItem(property)
{
- return property.value.description;
+ return this._formatValue(property.value);
}
/**
* @param {!WebInspector.RemoteObjectProperty} property
+ * @return {string}
+ * @this {WebInspector.LocalJSONObject}
*/
function formatObjectItem(property)
{
- return property.name + ":" + property.value.description;
+ var name = property.name;
+ if (/^\s|\s$|^$|\n/.test(name))
+ name = "\"" + name.replace(/\n/g, "\u21B5") + "\"";
+ return name + ": " + this._formatValue(property.value);
}
if (this.type === "object") {
switch (this.subtype) {
case "array":
- this._cachedDescription = this._concatenate("[", "]", formatArrayItem);
+ this._cachedDescription = this._concatenate("[", "]", formatArrayItem.bind(this));
break;
case "date":
this._cachedDescription = "" + this._value;
@@ -894,23 +901,38 @@ WebInspector.LocalJSONObject.prototype = {
this._cachedDescription = "null";
break;
default:
- this._cachedDescription = this._concatenate("{", "}", formatObjectItem);
+ this._cachedDescription = this._concatenate("{", "}", formatObjectItem.bind(this));
}
- } else
+ } else {
this._cachedDescription = String(this._value);
+ }
return this._cachedDescription;
},
/**
+ * @param {?WebInspector.RemoteObject} value
+ * @return {string}
+ */
+ _formatValue: function(value)
+ {
+ if (!value)
+ return "undefined";
+ var description = value.description || "";
+ if (value.type === "string")
+ return "\"" + description.replace(/\n/g, "\u21B5") + "\"";
+ return description;
+ },
+
+ /**
* @param {string} prefix
* @param {string} suffix
- * @param {function (!WebInspector.RemoteObjectProperty)} formatProperty
+ * @param {function(!WebInspector.RemoteObjectProperty)} formatProperty
* @return {string}
*/
_concatenate: function(prefix, suffix, formatProperty)
{
- const previewChars = 100;
+ var previewChars = 100;
var buffer = prefix;
var children = this._children();
@@ -1069,3 +1091,29 @@ WebInspector.LocalJSONObject.prototype = {
__proto__: WebInspector.RemoteObject.prototype
}
+
+/**
+ * @constructor
+ * @extends {WebInspector.LocalJSONObject}
+ * @param {*} value
+ */
+WebInspector.MapEntryLocalJSONObject = function(value)
+{
+ WebInspector.LocalJSONObject.call(this, value);
+}
+
+WebInspector.MapEntryLocalJSONObject.prototype = {
+ /**
+ * @return {string}
+ */
+ get description()
+ {
+ if (!this._cachedDescription) {
+ var children = this._children();
+ this._cachedDescription = "{" + this._formatValue(children[0].value) + " => " + this._formatValue(children[1].value) + "}";
+ }
+ return this._cachedDescription;
+ },
+
+ __proto__: WebInspector.LocalJSONObject.prototype
+}
« no previous file with comments | « Source/devtools/front_end/inspectorStyle.css ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698