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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js

Issue 2102453003: [DevTools] Move collectionEntries to internalProperties in protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/platform/v8_inspector/InjectedScriptSource.js
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
index 0e0c4f8d28065b05a5f348091ce7784c29cfe994..bac0f5f7ecd7022ce78a0c5ae34e0eef0cd8a500 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
@@ -635,10 +635,29 @@ InjectedScript.prototype = {
}
}
+ if (subtype === "internal#entry") {
+ if ("key" in obj)
+ return "{" + this._describeIncludingPrimitives(obj.key) + " => " + this._describeIncludingPrimitives(obj.value) + "}";
+ return this._describeIncludingPrimitives(obj.value);
+ }
+
return className;
},
/**
+ * @param {*} value
+ * @return {string}
+ */
+ _describeIncludingPrimitives: function(value)
+ {
+ if (typeof value === "string")
+ return "\"" + value.replace(/\n/g, "\u21B5") + "\"";
+ if (value === null)
+ return "" + value;
+ return this.isPrimitiveValue(value) ? toStringDescription(value) : (this._describe(value) || "");
+ },
+
+ /**
* @param {boolean} enabled
*/
setCustomObjectFormatterEnabled: function(enabled)
@@ -827,7 +846,12 @@ InjectedScript.RemoteObject.prototype = {
// Add internal properties to preview.
var rawInternalProperties = InjectedScriptHost.getInternalProperties(object) || [];
var internalProperties = [];
+ var entries = null;
for (var i = 0; i < rawInternalProperties.length; i += 2) {
+ if (rawInternalProperties[i] === "[[Entries]]") {
+ entries = /** @type {!Array<*>} */(rawInternalProperties[i + 1]);
+ continue;
+ }
push(internalProperties, {
name: rawInternalProperties[i],
value: rawInternalProperties[i + 1],
@@ -839,7 +863,7 @@ InjectedScript.RemoteObject.prototype = {
this._appendPropertyDescriptors(preview, internalProperties, propertiesThreshold, secondLevelKeys, isTable);
if (this.subtype === "map" || this.subtype === "set" || this.subtype === "iterator")
- this._appendEntriesPreview(object, preview, skipEntriesPreview);
+ this._appendEntriesPreview(entries, preview, skipEntriesPreview);
} catch (e) {}
@@ -947,13 +971,12 @@ InjectedScript.RemoteObject.prototype = {
},
/**
- * @param {!Object} object
+ * @param {?Array<*>} entries
* @param {!RuntimeAgent.ObjectPreview} preview
* @param {boolean=} skipEntriesPreview
*/
- _appendEntriesPreview: function(object, preview, skipEntriesPreview)
+ _appendEntriesPreview: function(entries, preview, skipEntriesPreview)
{
- var entries = InjectedScriptHost.collectionEntries(object);
if (!entries)
return;
if (skipEntriesPreview) {

Powered by Google App Engine
This is Rietveld 408576698