Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js |
index 5812cb8a8558e2fb7f0c4842058b7fae168177d3..1f32060d36969e36809328cab6e7918a54b71617 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js |
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js |
@@ -46,7 +46,7 @@ WebInspector.ConsoleViewMessage = function(consoleMessage, linkifier, nestingLev |
/** @type {?WebInspector.DataGrid} */ |
this._dataGrid = null; |
- /** @type {!Object.<string, function(!WebInspector.RemoteObject, !Element, boolean=)>} */ |
+ /** @type {!Object.<string, function(!WebInspector.ConsoleViewMessage.FormatterOptions)>} */ |
this._customFormatters = { |
"array": this._formatParameterAsArray, |
"typedarray": this._formatParameterAsArray, |
@@ -148,7 +148,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
if (table) |
table = this._parameterToRemoteObject(table, this._target()); |
if (!table || !table.preview) |
- return this._buildMessageAnchor(formattedResult, consoleMessage); |
+ return this._buildMessageAnchor(formattedResult, consoleMessage, this._linkifier); |
var columnNames = []; |
var preview = table.preview; |
@@ -195,25 +195,26 @@ WebInspector.ConsoleViewMessage.prototype = { |
var tableElement = formattedResult.createChild("div", "console-message-formatted-table"); |
var dataGridContainer = tableElement.createChild("span"); |
- tableElement.appendChild(this._formatParameter(table, true, false)); |
+ tableElement.appendChild(this._formatParameter(consoleMessage, this._linkifier, table, true, false)); |
this._dataGrid.renderInline(); |
dataGridContainer.appendChild(this._dataGrid.element); |
- return this._buildMessageAnchor(formattedResult, consoleMessage); |
+ return this._buildMessageAnchor(formattedResult, consoleMessage, this._linkifier); |
} |
- return this._buildMessageAnchor(formattedResult, consoleMessage); |
+ return this._buildMessageAnchor(formattedResult, consoleMessage, this._linkifier); |
}, |
/** |
* @param {!WebInspector.ConsoleMessage} consoleMessage |
+ * @param {!WebInspector.Linkifier} linkifier |
* @return {!Element} |
*/ |
- _buildMessage: function(consoleMessage) |
+ _buildMessage: function(consoleMessage, linkifier) |
{ |
var messageElement; |
if (consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.ConsoleAPI) { |
switch (consoleMessage.type) { |
case WebInspector.ConsoleMessage.MessageType.Trace: |
- messageElement = this._format(consoleMessage.parameters || ["console.trace"]); |
+ messageElement = this._format(consoleMessage, linkifier, consoleMessage.parameters || ["console.trace"]); |
break; |
case WebInspector.ConsoleMessage.MessageType.Clear: |
messageElement = createElementWithClass("span", "console-info"); |
@@ -223,22 +224,22 @@ WebInspector.ConsoleViewMessage.prototype = { |
var args = [WebInspector.UIString("Assertion failed:")]; |
if (consoleMessage.parameters) |
args = args.concat(consoleMessage.parameters); |
- messageElement = this._format(args); |
+ messageElement = this._format(consoleMessage, linkifier, args); |
break; |
case WebInspector.ConsoleMessage.MessageType.Dir: |
var obj = consoleMessage.parameters ? consoleMessage.parameters[0] : undefined; |
var args = ["%O", obj]; |
- messageElement = this._format(args); |
+ messageElement = this._format(consoleMessage, linkifier, args); |
break; |
case WebInspector.ConsoleMessage.MessageType.Profile: |
case WebInspector.ConsoleMessage.MessageType.ProfileEnd: |
- messageElement = this._format([consoleMessage.messageText]); |
+ messageElement = this._format(consoleMessage, linkifier, [consoleMessage.messageText]); |
break; |
default: |
if (consoleMessage.parameters && consoleMessage.parameters.length === 1 && consoleMessage.parameters[0].type === "string") |
- messageElement = this._tryFormatAsError(/** @type {string} */(consoleMessage.parameters[0].value)); |
+ messageElement = this._tryFormatAsError(consoleMessage.target(), linkifier, /** @type {string} */(consoleMessage.parameters[0].value)); |
var args = consoleMessage.parameters || [consoleMessage.messageText]; |
- messageElement = messageElement || this._format(args); |
+ messageElement = messageElement || this._format(consoleMessage, linkifier, args); |
} |
} else if (consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.Network) { |
if (consoleMessage.request) { |
@@ -255,16 +256,16 @@ WebInspector.ConsoleViewMessage.prototype = { |
messageElement.appendChild(fragment); |
} |
} else { |
- messageElement = this._format([consoleMessage.messageText]); |
+ messageElement = this._format(consoleMessage, linkifier, [consoleMessage.messageText]); |
} |
} else { |
var args = consoleMessage.parameters || [consoleMessage.messageText]; |
- messageElement = this._format(args); |
+ messageElement = this._format(consoleMessage, linkifier, args); |
} |
- var formattedMessage = this._buildMessageAnchor(messageElement, consoleMessage); |
+ var formattedMessage = this._buildMessageAnchor(messageElement, consoleMessage, linkifier); |
if (!!consoleMessage.stackTrace && (consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.Network || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.RevokedError || consoleMessage.type === WebInspector.ConsoleMessage.MessageType.Trace || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Warning)) |
- formattedMessage = this._buildMessageStackTrace(formattedMessage, consoleMessage, this._linkifier); |
+ formattedMessage = this._buildMessageStackTrace(formattedMessage, consoleMessage, linkifier); |
return formattedMessage; |
/** |
@@ -281,20 +282,19 @@ WebInspector.ConsoleViewMessage.prototype = { |
/** |
* @param {!Element} contents |
* @param {!WebInspector.ConsoleMessage} consoleMessage |
+ * @param {!WebInspector.Linkifier} linkifier |
* @return {!Element} |
*/ |
- _buildMessageAnchor: function(contents, consoleMessage) |
+ _buildMessageAnchor: function(contents, consoleMessage, linkifier) |
{ |
var anchorElement = null; |
if (consoleMessage.source !== WebInspector.ConsoleMessage.MessageSource.Network || consoleMessage.request) { |
- if (consoleMessage.scriptId) { |
- anchorElement = this._linkifyScriptId(consoleMessage.scriptId, consoleMessage.url || "", consoleMessage.line, consoleMessage.column); |
- } else { |
- if (consoleMessage.stackTrace && consoleMessage.stackTrace.callFrames.length) |
- anchorElement = this._linkifyStackTraceTopFrame(consoleMessage.stackTrace); |
- else if (consoleMessage.url && consoleMessage.url !== "undefined") |
- anchorElement = this._linkifyLocation(consoleMessage.url, consoleMessage.line, consoleMessage.column); |
- } |
+ if (consoleMessage.scriptId) |
+ anchorElement = this._linkifyScriptId(linkifier, consoleMessage); |
+ else if (consoleMessage.stackTrace && consoleMessage.stackTrace.callFrames.length) |
+ anchorElement = this._linkifyStackTraceTopFrame(linkifier, consoleMessage); |
+ else if (consoleMessage.url && consoleMessage.url !== "undefined") |
+ anchorElement = this._linkifyLocation(linkifier, consoleMessage); |
} else if (consoleMessage.url) { |
var url = consoleMessage.url; |
var isExternal = !WebInspector.resourceForURL(url) && !WebInspector.networkMapping.uiSourceCodeForURLForAnyTarget(url); |
@@ -367,44 +367,42 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
- * @param {string} url |
- * @param {number} lineNumber |
- * @param {number} columnNumber |
+ * @param {!WebInspector.Linkifier} linkifier |
+ * @param {!WebInspector.ConsoleMessage} consoleMessage |
* @return {?Element} |
*/ |
- _linkifyLocation: function(url, lineNumber, columnNumber) |
+ _linkifyLocation: function(linkifier, consoleMessage) |
{ |
- var target = this._target(); |
+ var target = consoleMessage.target(); |
if (!target) |
return null; |
- return this._linkifier.linkifyScriptLocation(target, null, url, lineNumber, columnNumber, "console-message-url"); |
+ return linkifier.linkifyScriptLocation(target, null, consoleMessage.url || "", consoleMessage.line, consoleMessage.column, "console-message-url"); |
}, |
/** |
- * @param {!RuntimeAgent.StackTrace} stackTrace |
+ * @param {!WebInspector.Linkifier} linkifier |
+ * @param {!WebInspector.ConsoleMessage} consoleMessage |
* @return {?Element} |
*/ |
- _linkifyStackTraceTopFrame: function(stackTrace) |
+ _linkifyStackTraceTopFrame: function(linkifier, consoleMessage) |
{ |
- var target = this._target(); |
+ var target = consoleMessage.target(); |
if (!target) |
return null; |
- return this._linkifier.linkifyStackTraceTopFrame(target, stackTrace, "console-message-url"); |
+ return linkifier.linkifyStackTraceTopFrame(target, /** @type {!RuntimeAgent.StackTrace} **/ (consoleMessage.stackTrace), "console-message-url"); |
}, |
/** |
- * @param {string} scriptId |
- * @param {string} url |
- * @param {number} lineNumber |
- * @param {number} columnNumber |
+ * @param {!WebInspector.Linkifier} linkifier |
+ * @param {!WebInspector.ConsoleMessage} consoleMessage |
* @return {?Element} |
*/ |
- _linkifyScriptId: function(scriptId, url, lineNumber, columnNumber) |
+ _linkifyScriptId: function(linkifier, consoleMessage) |
{ |
- var target = this._target(); |
+ var target = consoleMessage.target(); |
if (!target) |
return null; |
- return this._linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber, columnNumber, "console-message-url"); |
+ return linkifier.linkifyScriptLocation(target, consoleMessage.scriptId, consoleMessage.url || "", consoleMessage.line, consoleMessage.column, "console-message-url"); |
}, |
/** |
@@ -424,10 +422,12 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
+ * @param {!WebInspector.ConsoleMessage} consoleMessage |
+ * @param {!WebInspector.Linkifier} linkifier |
* @param {!Array.<!WebInspector.RemoteObject|string>} parameters |
* @return {!Element} |
*/ |
- _format: function(parameters) |
+ _format: function(consoleMessage, linkifier, parameters) |
{ |
// This node is used like a Builder. Values are continually appended onto it. |
var formattedResult = createElement("span"); |
@@ -438,14 +438,15 @@ WebInspector.ConsoleViewMessage.prototype = { |
// API allows passing arbitrary values as messages (strings, numbers, etc.). Wrap them here. |
// FIXME: Only pass runtime wrappers here. |
for (var i = 0; i < parameters.length; ++i) |
- parameters[i] = this._parameterToRemoteObject(parameters[i], this._target()); |
+ parameters[i] = this._parameterToRemoteObject(parameters[i], consoleMessage.target()); |
// There can be string log and string eval result. We distinguish between them based on message type. |
- var shouldFormatMessage = WebInspector.RemoteObject.type((/** @type {!Array.<!WebInspector.RemoteObject>} **/ (parameters))[0]) === "string" && (this._message.type !== WebInspector.ConsoleMessage.MessageType.Result || this._message.level === WebInspector.ConsoleMessage.MessageLevel.Error || this._message.level === WebInspector.ConsoleMessage.MessageLevel.RevokedError); |
+ var messageType = consoleMessage.type; |
+ var shouldFormatMessage = WebInspector.RemoteObject.type((/** @type {!Array.<!WebInspector.RemoteObject>} **/ (parameters))[0]) === "string" && (messageType !== WebInspector.ConsoleMessage.MessageType.Result || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.Error || consoleMessage.level === WebInspector.ConsoleMessage.MessageLevel.RevokedError); |
// Multiple parameters with the first being a format string. Save unused substitutions. |
if (shouldFormatMessage) { |
- var result = this._formatWithSubstitutionString(/** @type {string} **/ (parameters[0].description), parameters.slice(1), formattedResult); |
+ var result = this._formatWithSubstitutionString(consoleMessage, linkifier, /** @type {string} **/ (parameters[0].description), parameters.slice(1), formattedResult); |
parameters = result.unusedSubstitutions; |
if (parameters.length) |
formattedResult.createTextChild(" "); |
@@ -457,7 +458,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
if (shouldFormatMessage && parameters[i].type === "string") |
formattedResult.appendChild(WebInspector.linkifyStringAsFragment(parameters[i].description)); |
else |
- formattedResult.appendChild(this._formatParameter(parameters[i], false, true)); |
+ formattedResult.appendChild(this._formatParameter(consoleMessage, linkifier, parameters[i], false, true)); |
if (i < parameters.length - 1) |
formattedResult.createTextChild(" "); |
} |
@@ -465,55 +466,53 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
+ * @param {!WebInspector.ConsoleMessage} consoleMessage |
+ * @param {!WebInspector.Linkifier} linkifier |
* @param {!WebInspector.RemoteObject} output |
* @param {boolean=} forceObjectFormat |
* @param {boolean=} includePreview |
* @return {!Element} |
*/ |
- _formatParameter: function(output, forceObjectFormat, includePreview) |
+ _formatParameter: function(consoleMessage, linkifier, output, forceObjectFormat, includePreview) |
{ |
- if (output.customPreview()) { |
+ if (output.customPreview()) |
return (new WebInspector.CustomPreviewComponent(output)).element; |
- } |
var type = forceObjectFormat ? "object" : (output.subtype || output.type); |
var formatter = this._customFormatters[type] || this._formatParameterAsValue; |
var span = createElement("span"); |
span.className = "object-value-" + type + " source-code"; |
- formatter.call(this, output, span, includePreview); |
+ formatter.call(this, { |
+ object: output, |
+ element: span, |
+ includePreview: includePreview, |
+ linkifier: linkifier, |
+ consoleMessage: consoleMessage |
+ }); |
return span; |
}, |
/** |
- * @param {!WebInspector.RemoteObject} obj |
- * @param {!Element} elem |
+ * @param {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsValue: function(obj, elem) |
+ _formatParameterAsValue: function(options) |
{ |
+ var elem = options.element; |
+ var obj = options.object; |
elem.createTextChild(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 {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsObject: function(obj, elem, includePreview) |
- { |
- this._formatParameterAsArrayOrObject(obj, elem, includePreview); |
- }, |
- |
- /** |
- * @param {!WebInspector.RemoteObject} obj |
- * @param {!Element} elem |
- * @param {boolean=} includePreview |
- */ |
- _formatParameterAsArrayOrObject: function(obj, elem, includePreview) |
+ _formatParameterAsObject: function(options) |
{ |
+ var obj = options.object; |
+ var elem = options.element; |
var titleElement = createElement("span"); |
- if (includePreview && obj.preview) { |
+ if (options.includePreview && obj.preview) { |
titleElement.classList.add("console-object-preview"); |
this._previewFormatter.appendObjectPreview(titleElement, obj.preview); |
} else { |
@@ -525,19 +524,20 @@ WebInspector.ConsoleViewMessage.prototype = { |
} |
} |
- var section = new WebInspector.ObjectPropertiesSection(obj, titleElement, this._linkifier); |
+ var section = new WebInspector.ObjectPropertiesSection(obj, titleElement, options.linkifier); |
section.element.classList.add("console-view-object-properties-section"); |
section.enableContextMenu(); |
elem.appendChild(section.element); |
}, |
/** |
- * @param {!WebInspector.RemoteObject} func |
- * @param {!Element} element |
- * @param {boolean=} includePreview |
+ * @param {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsFunction: function(func, element, includePreview) |
+ _formatParameterAsFunction: function(options) |
{ |
+ var func = options.object; |
+ var element = options.element; |
+ var includePreview = options.includePreview; |
WebInspector.RemoteFunction.objectAsFunction(func).targetFunction().then(formatTargetFunction.bind(this)); |
/** |
@@ -582,11 +582,13 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
- * @param {!WebInspector.RemoteObject} object |
- * @param {!Element} elem |
+ * @param {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsNode: function(object, elem) |
+ _formatParameterAsNode: function(options) |
{ |
+ var object = options.object; |
+ var elem = options.element; |
+ var linkifier = options.linkifier; |
WebInspector.Renderer.renderPromise(object).then(appendRenderer.bind(this), failedToRender.bind(this)); |
/** |
* @param {!Element} rendererElement |
@@ -603,7 +605,12 @@ WebInspector.ConsoleViewMessage.prototype = { |
*/ |
function failedToRender() |
{ |
- this._formatParameterAsObject(object, elem, false); |
+ this._formatParameterAsObject({ |
+ object: object, |
+ element: elem, |
+ includePreview: false, |
+ linkifier: linkifier |
+ }); |
} |
}, |
@@ -612,37 +619,38 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
- * @return {boolean} |
- */ |
- _usePrintedArrayFormatter: function() |
- { |
- return this._message.type !== WebInspector.ConsoleMessage.MessageType.DirXML && this._message.type !== WebInspector.ConsoleMessage.MessageType.Result; |
- }, |
- |
- /** |
- * @param {!WebInspector.RemoteObject} array |
- * @param {!Element} elem |
+ * @param {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsArray: function(array, elem) |
+ _formatParameterAsArray: function(options) |
{ |
+ var array = options.object; |
+ var elem = options.element; |
+ var linkifier = options.linkifier; |
+ var messageType = options.consoleMessage.type; |
+ var usePrintedArrayFormat = messageType !== WebInspector.ConsoleMessage.MessageType.DirXML && messageType !== WebInspector.ConsoleMessage.MessageType.Result; |
var maxFlatArrayLength = 100; |
- if (this._usePrintedArrayFormatter() || array.arrayLength() > maxFlatArrayLength) |
- this._formatParameterAsArrayOrObject(array, elem, this._usePrintedArrayFormatter() || array.arrayLength() <= maxFlatArrayLength); |
+ if (usePrintedArrayFormat || array.arrayLength() > maxFlatArrayLength) |
+ this._formatParameterAsObject({ |
+ object: array, |
+ element: elem, |
+ includePreview: usePrintedArrayFormat || array.arrayLength() <= maxFlatArrayLength, |
+ linkifier: linkifier |
+ }); |
else |
- array.getAllProperties(false, this._printArrayResult.bind(this, array, elem)); |
+ array.getAllProperties(false, this._printArrayResult.bind(this, array, elem, linkifier)); |
}, |
/** |
- * @param {!WebInspector.RemoteObject} output |
- * @param {!Element} elem |
+ * @param {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsString: function(output, elem) |
+ _formatParameterAsString: function(options) |
{ |
var span = createElement("span"); |
span.className = "object-value-string source-code"; |
- span.appendChild(WebInspector.linkifyStringAsFragment(output.description || "")); |
+ span.appendChild(WebInspector.linkifyStringAsFragment(options.object.description || "")); |
// Make black quotes. |
+ var elem = options.element; |
elem.classList.remove("object-value-string"); |
elem.createTextChild("\""); |
elem.appendChild(span); |
@@ -650,25 +658,31 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
- * @param {!WebInspector.RemoteObject} output |
- * @param {!Element} elem |
+ * @param {!WebInspector.ConsoleViewMessage.FormatterOptions} options |
*/ |
- _formatParameterAsError: function(output, elem) |
+ _formatParameterAsError: function(options) |
{ |
- var span = elem.createChild("span", "object-value-error source-code"); |
- var errorSpan = this._tryFormatAsError(output.description || ""); |
- span.appendChild(errorSpan ? errorSpan : WebInspector.linkifyStringAsFragment(output.description || "")); |
+ var obj = options.object; |
+ var span = options.element.createChild("span", "object-value-error source-code"); |
+ var errorSpan = this._tryFormatAsError(options.consoleMessage.target(), options.linkifier, obj.description || ""); |
+ span.appendChild(errorSpan ? errorSpan : WebInspector.linkifyStringAsFragment(obj.description || "")); |
}, |
/** |
* @param {!WebInspector.RemoteObject} array |
* @param {!Element} elem |
+ * @param {!WebInspector.Linkifier} linkifier |
* @param {?Array.<!WebInspector.RemoteObjectProperty>} properties |
*/ |
- _printArrayResult: function(array, elem, properties) |
+ _printArrayResult: function(array, elem, linkifier, properties) |
{ |
if (!properties) { |
- this._formatParameterAsObject(array, elem, false); |
+ this._formatParameterAsObject({ |
+ object: array, |
+ element: elem, |
+ includePreview: false, |
+ linkifier: linkifier |
+ }); |
return; |
} |
@@ -716,7 +730,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
titleElement.createTextChild("]"); |
- var section = new WebInspector.ObjectPropertiesSection(array, titleElement, this._linkifier); |
+ var section = new WebInspector.ObjectPropertiesSection(array, titleElement, linkifier); |
section.element.classList.add("console-view-object-properties-section"); |
section.enableContextMenu(); |
elem.appendChild(section.element); |
@@ -728,10 +742,11 @@ WebInspector.ConsoleViewMessage.prototype = { |
*/ |
_formatAsArrayEntry: function(output) |
{ |
- if (this._message.type === WebInspector.ConsoleMessage.MessageType.DirXML) { |
- // Prevent infinite expansion of cross-referencing arrays. |
- return this._formatParameter(output, output.subtype === "array" || output.subtype === "typedarray", false); |
- } |
+ // // TODO(luoe): This condition won't be here after rebase with master VV |
+ // if (this._message.type === WebInspector.ConsoleMessage.MessageType.DirXML) { |
+ // // Prevent infinite expansion of cross-referencing arrays. |
+ // return this._formatParameter(output, output.subtype === "array" || output.subtype === "typedarray", false); |
+ // } |
return this._previewFormatter.renderPropertyPreview(output.type, output.subtype, output.description); |
}, |
@@ -781,23 +796,25 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
+ * @param {!WebInspector.ConsoleMessage} consoleMessage |
+ * @param {!WebInspector.Linkifier} linkifier |
* @param {string} format |
* @param {!Array.<!WebInspector.RemoteObject>} parameters |
* @param {!Element} formattedResult |
*/ |
- _formatWithSubstitutionString: function(format, parameters, formattedResult) |
+ _formatWithSubstitutionString: function(consoleMessage, linkifier, format, parameters, formattedResult) |
{ |
var formatters = {}; |
/** |
- * @param {boolean} force |
* @param {!WebInspector.RemoteObject} obj |
+ * @param {boolean} force |
* @return {!Element} |
* @this {WebInspector.ConsoleViewMessage} |
*/ |
function parameterFormatter(force, obj) |
{ |
- return this._formatParameter(obj, force, false); |
+ return this._formatParameter(consoleMessage, linkifier, obj, force, false); |
} |
function stringFormatter(obj) |
@@ -975,7 +992,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
if (this._message.type === WebInspector.ConsoleMessage.MessageType.Table) |
formattedMessage = this._formatMessageAsTable(this._message); |
else |
- formattedMessage = this._buildMessage(this._message); |
+ formattedMessage = this._buildMessage(this._message, this._linkifier); |
contentElement.appendChild(formattedMessage); |
this.updateTimestamp(WebInspector.moduleSetting("consoleTimestampsEnabled").get()); |
@@ -1139,10 +1156,12 @@ WebInspector.ConsoleViewMessage.prototype = { |
}, |
/** |
+ * @param {?WebInspector.Target} target |
+ * @param {!WebInspector.Linkifier} linkifier |
* @param {string} string |
* @return {?Element} |
*/ |
- _tryFormatAsError: function(string) |
+ _tryFormatAsError: function(target, linkifier, string) |
{ |
/** |
* @param {string} prefix |
@@ -1153,7 +1172,6 @@ WebInspector.ConsoleViewMessage.prototype = { |
} |
var errorPrefixes = ["EvalError", "ReferenceError", "SyntaxError", "TypeError", "RangeError", "Error", "URIError"]; |
- var target = this._target(); |
if (!target || !errorPrefixes.some(startsWith)) |
return null; |
var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
@@ -1208,7 +1226,7 @@ WebInspector.ConsoleViewMessage.prototype = { |
var start = 0; |
for (var i = 0; i < links.length; ++i) { |
formattedResult.appendChild(WebInspector.linkifyStringAsFragment(string.substring(start, links[i].positionLeft))); |
- formattedResult.appendChild(this._linkifier.linkifyScriptLocation(target, null, links[i].url, links[i].lineNumber, links[i].columnNumber)); |
+ formattedResult.appendChild(linkifier.linkifyScriptLocation(target, null, links[i].url, links[i].lineNumber, links[i].columnNumber)); |
start = links[i].positionRight; |
} |
@@ -1220,6 +1238,17 @@ WebInspector.ConsoleViewMessage.prototype = { |
} |
/** |
+ * @typedef {{ |
+ * object: (!WebInspector.RemoteObject), |
+ * element: (!Element), |
+ * linkifier: (!WebInspector.Linkifier), |
+ * includePreview: (boolean|undefined), |
+ * consoleMessage: (!WebInspector.ConsoleMessage|undefined) |
+ * }} |
+ **/ |
lushnikov
2016/09/30 21:56:46
let's not create an options object; instead, let's
luoe
2016/10/01 01:10:52
Done.
|
+WebInspector.ConsoleViewMessage.FormatterOptions; |
+ |
+/** |
* @constructor |
* @extends {WebInspector.ConsoleViewMessage} |
* @param {!WebInspector.ConsoleMessage} consoleMessage |