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

Unified Diff: Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 297163014: DevTools: Some printed objects in console are not pinnable. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/console/ConsoleViewMessage.js
diff --git a/Source/devtools/front_end/console/ConsoleViewMessage.js b/Source/devtools/front_end/console/ConsoleViewMessage.js
index 4af3f31b3ea467fa78d0786f1d4732a2937316c5..f23d837ce35c9d8372b6b1943f887fdc3d9c992b 100644
--- a/Source/devtools/front_end/console/ConsoleViewMessage.js
+++ b/Source/devtools/front_end/console/ConsoleViewMessage.js
@@ -48,6 +48,7 @@ WebInspector.ConsoleViewMessage = function(consoleMessage, linkifier, nestingLev
/** @type {!Map.<!WebInspector.DataGrid, ?Element>} */
this._dataGridParents = new Map();
+ /** @type {!Object.<string, function(!WebInspector.RemoteObject, !Element, boolean=)>} */
this._customFormatters = {
"object": this._formatParameterAsObject,
"array": this._formatParameterAsArray,
@@ -365,42 +366,36 @@ WebInspector.ConsoleViewMessage.prototype = {
},
/**
- * @param {?Object} output
+ * @param {!WebInspector.RemoteObject} output
* @param {boolean=} forceObjectFormat
* @param {boolean=} includePreview
* @return {!Element}
*/
_formatParameter: function(output, forceObjectFormat, includePreview)
{
- var type;
- if (forceObjectFormat)
- type = "object";
- else if (output instanceof WebInspector.RemoteObject)
- type = output.subtype || output.type;
- else
- type = typeof output;
-
- var formatter = this._customFormatters[type];
- if (!formatter) {
- formatter = this._formatParameterAsValue;
- output = output.description;
- }
-
+ var type = forceObjectFormat ? "object" : (output.subtype || output.type);
+ var formatter = this._customFormatters[type] || this._formatParameterAsValue;
var span = document.createElement("span");
span.className = "console-formatted-" + type + " source-code";
formatter.call(this, output, span, includePreview);
return span;
},
- _formatParameterAsValue: function(val, elem)
+ /**
+ * @param {!WebInspector.RemoteObject} obj
+ * @param {!Element} elem
+ */
+ _formatParameterAsValue: function(obj, elem)
{
- elem.appendChild(document.createTextNode(val));
+ elem.appendChild(document.createTextNode(obj.description || ""));
+ if (obj.objectId)
+ elem.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, obj), false);
},
/**
* @param {!WebInspector.RemoteObject} obj
* @param {!Element} elem
- * @param {boolean} includePreview
+ * @param {boolean=} includePreview
*/
_formatParameterAsObject: function(obj, elem, includePreview)
{
@@ -411,7 +406,7 @@ WebInspector.ConsoleViewMessage.prototype = {
* @param {!WebInspector.RemoteObject} obj
* @param {string} description
* @param {!Element} elem
- * @param {boolean} includePreview
+ * @param {boolean=} includePreview
*/
_formatParameterAsArrayOrObject: function(obj, description, elem, includePreview)
{
@@ -530,6 +525,10 @@ WebInspector.ConsoleViewMessage.prototype = {
return span;
},
+ /**
+ * @param {!WebInspector.RemoteObject} object
+ * @param {!Element} elem
+ */
_formatParameterAsNode: function(object, elem)
{
/**
@@ -645,11 +644,15 @@ WebInspector.ConsoleViewMessage.prototype = {
return element;
},
+ /**
+ * @param {!WebInspector.RemoteObject} output
+ * @param {!Element} elem
+ */
_formatParameterAsString: function(output, elem)
{
var span = document.createElement("span");
span.className = "console-formatted-string source-code";
- span.appendChild(WebInspector.linkifyStringAsFragment(output.description));
+ span.appendChild(WebInspector.linkifyStringAsFragment(output.description || ""));
// Make black quotes.
elem.classList.remove("console-formatted-string");
@@ -779,7 +782,7 @@ WebInspector.ConsoleViewMessage.prototype = {
/**
* @param {boolean} force
- * @param {!Object} obj
+ * @param {!WebInspector.RemoteObject} obj
* @return {!Element}
* @this {WebInspector.ConsoleViewMessage}
*/
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698