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

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

Issue 1963753003: DevTools: default all console object previews to lossy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 eb8115f9024830252f5a55e8b3822cce5c7d09d3..365dfc3e77f71226d8da0b71d1b81752643cac58 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
@@ -814,7 +814,6 @@ InjectedScript.RemoteObject = function(object, objectGroupName, doNotBind, force
if (generatePreview && this.type === "object") {
if (this.subtype === "proxy") {
kozy 2016/05/10 00:04:42 please remove brackets
luoe 2016/05/10 17:27:45 Done.
this.preview = this._generatePreview(InjectedScriptHost.proxyTargetValue(object), undefined, columnNames, isTable, skipEntriesPreview);
- this.preview.lossless = false;
} else if (this.subtype !== "node") {
this.preview = this._generatePreview(object, undefined, columnNames, isTable, skipEntriesPreview);
}
@@ -881,7 +880,6 @@ InjectedScript.RemoteObject.prototype = {
var preview = {
type: /** @type {!RuntimeAgent.ObjectPreviewType.<string>} */ (this.type),
description: this.description || toStringDescription(this.value),
- lossless: true,
overflow: false,
properties: [],
__proto__: null
@@ -934,9 +932,7 @@ InjectedScript.RemoteObject.prototype = {
if (this.subtype === "map" || this.subtype === "set" || this.subtype === "iterator")
this._appendEntriesPreview(object, preview, skipEntriesPreview);
- } catch (e) {
- preview.lossless = false;
- }
+ } catch (e) {}
return preview;
},
@@ -953,51 +949,38 @@ InjectedScript.RemoteObject.prototype = {
for (var descriptor of descriptors) {
if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
break;
- if (!descriptor)
- continue;
- if (descriptor.wasThrown) {
- preview.lossless = false;
+ if (!descriptor || descriptor.wasThrown) {
kozy 2016/05/10 00:04:42 ditto
luoe 2016/05/10 17:27:45 Done.
continue;
}
var name = descriptor.name;
- // Ignore __proto__ property, stay lossless.
+ // Ignore __proto__ property.
if (name === "__proto__")
continue;
- // Ignore non-enumerable members on prototype, stay lossless.
- if (!descriptor.isOwn && !descriptor.enumerable)
kozy 2016/05/10 00:04:42 Bring it back and remove following descriptor.isOw
luoe 2016/05/10 17:27:45 That would allow enumerable props on the prototype
kozy 2016/05/11 00:54:18 Yep, it's right. It's my fault.
- continue;
-
- // Ignore length property of array, stay lossless.
+ // Ignore length property of array.
if (this.subtype === "array" && name === "length")
continue;
- // Ignore size property of map, set, stay lossless.
+ // Ignore size property of map, set.
if ((this.subtype === "map" || this.subtype === "set") && name === "size")
continue;
- // Never preview prototype properties, turn lossy.
- if (!descriptor.isOwn) {
- preview.lossless = false;
+ // Never preview prototype properties.
+ if (!descriptor.isOwn)
continue;
- }
- // Ignore computed properties, turn lossy.
- if (!("value" in descriptor)) {
- preview.lossless = false;
+ // Ignore computed properties.
+ if (!("value" in descriptor))
continue;
- }
var value = descriptor.value;
var type = typeof value;
- // Never render functions in object preview, turn lossy
- if (type === "function" && (this.subtype !== "array" || !isUInt32(name))) {
- preview.lossless = false;
+ // Never render functions in object preview.
+ if (type === "function" && (this.subtype !== "array" || !isUInt32(name)))
continue;
- }
// Special-case HTMLAll.
if (type === "undefined" && injectedScript._isHTMLAllCollection(value))
@@ -1011,10 +994,8 @@ InjectedScript.RemoteObject.prototype = {
var maxLength = 100;
if (InjectedScript.primitiveTypes[type]) {
- if (type === "string" && value.length > maxLength) {
+ if (type === "string" && value.length > maxLength)
value = this._abbreviateString(value, maxLength, true);
- preview.lossless = false;
- }
this._appendPropertyPreview(preview, { name: name, type: type, value: toStringDescription(value), __proto__: null }, propertiesThreshold);
continue;
}
@@ -1027,8 +1008,6 @@ InjectedScript.RemoteObject.prototype = {
if (secondLevelKeys === null || secondLevelKeys) {
var subPreview = this._generatePreview(value, secondLevelKeys || undefined, undefined, isTable);
property.valuePreview = subPreview;
- if (!subPreview.lossless)
- preview.lossless = false;
if (subPreview.overflow)
preview.overflow = true;
} else {
@@ -1036,7 +1015,6 @@ InjectedScript.RemoteObject.prototype = {
if (type !== "function")
description = this._abbreviateString(/** @type {string} */ (injectedScript._describe(value)), maxLength, subtype === "regexp");
property.value = description;
- preview.lossless = false;
}
this._appendPropertyPreview(preview, property, propertiesThreshold);
}
@@ -1055,7 +1033,6 @@ InjectedScript.RemoteObject.prototype = {
propertiesThreshold.properties--;
if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) {
preview.overflow = true;
- preview.lossless = false;
} else {
push(preview.properties, property);
}
@@ -1074,7 +1051,6 @@ InjectedScript.RemoteObject.prototype = {
if (skipEntriesPreview) {
if (entries.length) {
kozy 2016/05/10 00:04:42 please remove brackets
luoe 2016/05/10 17:27:45 Done.
preview.overflow = true;
- preview.lossless = false;
}
return;
}
@@ -1083,7 +1059,6 @@ InjectedScript.RemoteObject.prototype = {
for (var i = 0; i < entries.length; ++i) {
if (preview.entries.length >= entriesThreshold) {
preview.overflow = true;
- preview.lossless = false;
break;
}
var entry = nullifyObjectProto(entries[i]);
@@ -1104,8 +1079,6 @@ InjectedScript.RemoteObject.prototype = {
{
var remoteObject = new InjectedScript.RemoteObject(value, undefined, true, undefined, true, undefined, undefined, true);
var valuePreview = remoteObject.preview || remoteObject._createEmptyPreview();
- if (!valuePreview.lossless)
- preview.lossless = false;
return valuePreview;
}
},

Powered by Google App Engine
This is Rietveld 408576698