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

Unified Diff: Source/devtools/front_end/ObjectPropertiesSection.js

Issue 186693002: DevTools: Prevent setting huge textContent in UI. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/DOMExtension.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ObjectPropertiesSection.js
diff --git a/Source/devtools/front_end/ObjectPropertiesSection.js b/Source/devtools/front_end/ObjectPropertiesSection.js
index edd37c782c8a82bc16e502407d80698ce6a80863..79a3632268c026dc628f7f126382c4ab797c7262 100644
--- a/Source/devtools/front_end/ObjectPropertiesSection.js
+++ b/Source/devtools/front_end/ObjectPropertiesSection.js
@@ -204,17 +204,20 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
this.valueElement = document.createElement("span");
this.valueElement.className = "value";
var description = this.property.value.description;
- // Render \n as a nice unicode cr symbol.
if (this.property.wasThrown) {
- this.valueElement.textContent = "[Exception: " + description + "]";
+ var text = "[Exception: " + description + "]";
+ this.valueElement.setTextContentTruncatedIfNeeded(text);
pfeldman 2014/03/05 05:14:03 Do it once for all below?
aandrey 2014/03/05 10:47:35 Done.
} else if (this.property.value.type === "string" && typeof description === "string") {
- this.valueElement.textContent = "\"" + description.replace(/\n/g, "\u21B5") + "\"";
+ // Render \n as a nice unicode cr symbol.
+ var text = "\"" + description.replace(/\n/g, "\u21B5") + "\"";
+ this.valueElement.setTextContentTruncatedIfNeeded(text);
this.valueElement._originalTextContent = "\"" + description + "\"";
} else if (this.property.value.type === "function" && typeof description === "string") {
- this.valueElement.textContent = /.*/.exec(description)[0].replace(/ +$/g, "");
+ var text = /.*/.exec(description)[0].replace(/ +$/g, "");
+ this.valueElement.setTextContentTruncatedIfNeeded(text);
this.valueElement._originalTextContent = description;
pfeldman 2014/03/05 05:14:03 Accidental click will start editing the original.
aandrey 2014/03/05 10:47:35 Done.
} else if (this.property.value.type !== "object" || this.property.value.subtype !== "node") {
- this.valueElement.textContent = description;
+ this.valueElement.setTextContentTruncatedIfNeeded(description);
}
if (this.property.wasThrown)
@@ -316,7 +319,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
// Edit original source.
if (typeof valueToEdit !== "undefined")
- elementToEdit.textContent = valueToEdit;
+ elementToEdit.setTextContentTruncatedIfNeeded(valueToEdit);
var context = { expanded: this.expanded, elementToEdit: elementToEdit, previousContent: elementToEdit.textContent };
« no previous file with comments | « Source/devtools/front_end/DOMExtension.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698