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

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js

Issue 2058513003: DevTools: max length limit for formatting commands (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made const 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/devtools/front_end/console/ConsoleView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
index 14ea9163233aac7ca023995c716cda4d134ea920..588a2c6d370dbb8ead72418694bc9ed536a73315 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
@@ -1192,8 +1192,12 @@ WebInspector.ConsoleCommand.prototype = {
this._formattedCommand.textContent = this.text.replaceControlCharacters();
this._element.appendChild(this._formattedCommand);
- var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
- javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand).then(this._updateSearch.bind(this))
+ if (this._formattedCommand.textContent.length < WebInspector.ConsoleCommand.MaxLengthToIgnoreHighlighter) {
+ var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
+ javascriptSyntaxHighlighter.syntaxHighlightNode(this._formattedCommand).then(this._updateSearch.bind(this))
+ } else {
+ this._updateSearch.bind(this);
dgozman 2016/06/14 08:55:04 this._updateSearch();
luoe 2016/06/14 18:29:54 Done.
+ }
}
return this._element;
},
@@ -1207,6 +1211,13 @@ WebInspector.ConsoleCommand.prototype = {
}
/**
+ * The maximum length before strings are considered too long for syntax highlighting.
+ * @const
+ * @type {number}
+ */
+WebInspector.ConsoleCommand.MaxLengthToIgnoreHighlighter = 10000;
+
+/**
* @constructor
* @extends {WebInspector.ConsoleViewMessage}
* @param {!WebInspector.ConsoleMessage} message

Powered by Google App Engine
This is Rietveld 408576698