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

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: Added missing return 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
« no previous file with comments | « third_party/WebKit/Source/devtools/protocol.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60d9584600b81cb9fe3c31b72f20c73ec040c92f..b19286711fcbc135acd4dfac98497e8cee0d6c78 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js
@@ -842,12 +842,10 @@ InjectedScript.RemoteObject = function(object, objectGroupName, doNotBind, force
this.description = injectedScript._describe(object);
if (generatePreview && this.type === "object") {
- if (this.subtype === "proxy") {
+ if (this.subtype === "proxy")
this.preview = this._generatePreview(InjectedScriptHost.proxyTargetValue(object), undefined, columnNames, isTable, skipEntriesPreview);
- this.preview.lossless = false;
- } else if (this.subtype !== "node") {
+ else if (this.subtype !== "node")
this.preview = this._generatePreview(object, undefined, columnNames, isTable, skipEntriesPreview);
- }
}
if (injectedScript._customObjectFormatterEnabled) {
@@ -911,7 +909,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
@@ -964,9 +961,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;
},
@@ -983,51 +978,37 @@ InjectedScript.RemoteObject.prototype = {
for (var descriptor of descriptors) {
if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0)
break;
- if (!descriptor)
+ if (!descriptor || descriptor.wasThrown)
continue;
- if (descriptor.wasThrown) {
- preview.lossless = false;
- 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)
- 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))
@@ -1041,10 +1022,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;
}
@@ -1057,8 +1036,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 {
@@ -1066,7 +1043,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);
}
@@ -1085,7 +1061,6 @@ InjectedScript.RemoteObject.prototype = {
propertiesThreshold.properties--;
if (propertiesThreshold.indexes < 0 || propertiesThreshold.properties < 0) {
preview.overflow = true;
- preview.lossless = false;
} else {
push(preview.properties, property);
}
@@ -1102,10 +1077,8 @@ InjectedScript.RemoteObject.prototype = {
if (!entries)
return;
if (skipEntriesPreview) {
- if (entries.length) {
+ if (entries.length)
preview.overflow = true;
- preview.lossless = false;
- }
return;
}
preview.entries = [];
@@ -1113,7 +1086,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]);
@@ -1134,8 +1106,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;
}
},
« no previous file with comments | « third_party/WebKit/Source/devtools/protocol.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698