Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 } | 189 } |
| 190 this._messageElement = this._format([consoleMessage.messageT ext]); | 190 this._messageElement = this._format([consoleMessage.messageT ext]); |
| 191 } | 191 } |
| 192 } else { | 192 } else { |
| 193 var args = consoleMessage.parameters || [consoleMessage.messageT ext]; | 193 var args = consoleMessage.parameters || [consoleMessage.messageT ext]; |
| 194 this._messageElement = this._format(args); | 194 this._messageElement = this._format(args); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 if (consoleMessage.source !== WebInspector.ConsoleMessage.MessageSource. Network || consoleMessage.request) { | 198 if (consoleMessage.source !== WebInspector.ConsoleMessage.MessageSource. Network || consoleMessage.request) { |
| 199 var callFrame = this._callFrameAnchorFromStackTrace(consoleMessage.s tackTrace); | 199 var callFrame = this._callFrameAnchorFromStackTrace(consoleMessage.s tackTrace, consoleMessage.source === WebInspector.ConsoleMessage.MessageSource.C onsoleAPI); |
| 200 if (callFrame) | 200 if (callFrame) |
| 201 this._anchorElement = this._linkifyCallFrame(callFrame); | 201 this._anchorElement = this._linkifyCallFrame(callFrame); |
| 202 else if (consoleMessage.url && consoleMessage.url !== "undefined") | 202 else if (consoleMessage.url && consoleMessage.url !== "undefined") |
| 203 this._anchorElement = this._linkifyLocation(consoleMessage.url, consoleMessage.line, consoleMessage.column); | 203 this._anchorElement = this._linkifyLocation(consoleMessage.url, consoleMessage.line, consoleMessage.column); |
| 204 } | 204 } |
| 205 | 205 |
| 206 this._formattedMessage.appendChild(this._messageElement); | 206 this._formattedMessage.appendChild(this._messageElement); |
| 207 if (this._anchorElement) { | 207 if (this._anchorElement) { |
| 208 this._formattedMessage.appendChild(document.createTextNode(" ")); | 208 this._formattedMessage.appendChild(document.createTextNode(" ")); |
| 209 this._formattedMessage.appendChild(this._anchorElement); | 209 this._formattedMessage.appendChild(this._anchorElement); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 console.assert(this._linkifier); | 278 console.assert(this._linkifier); |
| 279 var target = this._target(); | 279 var target = this._target(); |
| 280 if (!this._linkifier) | 280 if (!this._linkifier) |
| 281 return null; | 281 return null; |
| 282 | 282 |
| 283 return this._linkifier.linkifyConsoleCallFrame(target, callFrame, "conso le-message-url"); | 283 return this._linkifier.linkifyConsoleCallFrame(target, callFrame, "conso le-message-url"); |
| 284 }, | 284 }, |
| 285 | 285 |
| 286 /** | 286 /** |
| 287 * @param {?Array.<!ConsoleAgent.CallFrame>} stackTrace | 287 * @param {?Array.<!ConsoleAgent.CallFrame>} stackTrace |
| 288 * @param {boolean} isConsoleAPI | |
| 288 * @return {?ConsoleAgent.CallFrame} | 289 * @return {?ConsoleAgent.CallFrame} |
| 289 */ | 290 */ |
| 290 _callFrameAnchorFromStackTrace: function(stackTrace) | 291 _callFrameAnchorFromStackTrace: function(stackTrace, isConsoleAPI) |
|
vsevik
2014/08/08 08:55:50
I would call this flag useBlackboxing instead.
aandrey
2014/08/08 10:05:56
Done.
| |
| 291 { | 292 { |
| 292 if (!stackTrace || !stackTrace.length) | 293 if (!stackTrace || !stackTrace.length) |
| 293 return null; | 294 return null; |
| 294 var callFrame = stackTrace[0].scriptId ? stackTrace[0] : null; | 295 var callFrame = stackTrace[0].scriptId ? stackTrace[0] : null; |
| 296 if (!isConsoleAPI) | |
| 297 return callFrame; | |
| 295 if (!WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabl ed()) | 298 if (!WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabl ed()) |
| 296 return callFrame; | 299 return callFrame; |
| 297 var regex = WebInspector.settings.skipStackFramesPattern.asRegExp(); | |
| 298 if (!regex) | |
| 299 return callFrame; | |
| 300 for (var i = 0; i < stackTrace.length; ++i) { | 300 for (var i = 0; i < stackTrace.length; ++i) { |
| 301 var script = this._target().debuggerModel.scriptForId(stackTrace[i]. scriptId); | 301 if (!WebInspector.BlackboxSupport.isBlackboxedURL(stackTrace[i].url) ) |
| 302 if (!script || !regex.test(script.sourceURL)) | |
| 303 return stackTrace[i].scriptId ? stackTrace[i] : null; | 302 return stackTrace[i].scriptId ? stackTrace[i] : null; |
| 304 } | 303 } |
| 305 return callFrame; | 304 return callFrame; |
| 306 }, | 305 }, |
| 307 | 306 |
| 308 /** | 307 /** |
| 309 * @return {boolean} | 308 * @return {boolean} |
| 310 */ | 309 */ |
| 311 isErrorOrWarning: function() | 310 isErrorOrWarning: function() |
| 312 { | 311 { |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1056 return; | 1055 return; |
| 1057 | 1056 |
| 1058 for (var i = 0; i < stackTrace.length; i++) { | 1057 for (var i = 0; i < stackTrace.length; i++) { |
| 1059 var frame = stackTrace[i]; | 1058 var frame = stackTrace[i]; |
| 1060 | 1059 |
| 1061 var content = document.createElementWithClass("div", "stacktrace -entry"); | 1060 var content = document.createElementWithClass("div", "stacktrace -entry"); |
| 1062 var functionName = frame.functionName || WebInspector.UIString(" (anonymous function)"); | 1061 var functionName = frame.functionName || WebInspector.UIString(" (anonymous function)"); |
| 1063 content.createChild("span", "console-message-text source-code"). textContent = functionName; | 1062 content.createChild("span", "console-message-text source-code"). textContent = functionName; |
| 1064 | 1063 |
| 1065 if (frame.scriptId) { | 1064 if (frame.scriptId) { |
| 1066 content.createTextChild(" "); | |
| 1067 var urlElement = this._linkifyCallFrame(frame); | 1065 var urlElement = this._linkifyCallFrame(frame); |
| 1068 if (!urlElement) | 1066 if (!urlElement) |
| 1069 continue; | 1067 continue; |
| 1068 content.createTextChild(" "); | |
| 1070 content.appendChild(urlElement); | 1069 content.appendChild(urlElement); |
| 1071 } | 1070 } |
| 1072 | 1071 |
| 1073 parentTreeElement.appendChild(new TreeElement(content)); | 1072 parentTreeElement.appendChild(new TreeElement(content)); |
| 1074 } | 1073 } |
| 1075 } | 1074 } |
| 1076 | 1075 |
| 1077 appendStackTrace.call(this, this._message.stackTrace); | 1076 appendStackTrace.call(this, this._message.stackTrace); |
| 1078 | 1077 |
| 1079 for (var asyncTrace = this._message.asyncStackTrace; asyncTrace; asyncTr ace = asyncTrace.asyncStackTrace) { | 1078 for (var asyncTrace = this._message.asyncStackTrace; asyncTrace; asyncTr ace = asyncTrace.asyncStackTrace) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1258 { | 1257 { |
| 1259 if (!this._wrapperElement) { | 1258 if (!this._wrapperElement) { |
| 1260 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); | 1259 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); |
| 1261 this._wrapperElement.classList.toggle("collapsed", this._collapsed); | 1260 this._wrapperElement.classList.toggle("collapsed", this._collapsed); |
| 1262 } | 1261 } |
| 1263 return this._wrapperElement; | 1262 return this._wrapperElement; |
| 1264 }, | 1263 }, |
| 1265 | 1264 |
| 1266 __proto__: WebInspector.ConsoleViewMessage.prototype | 1265 __proto__: WebInspector.ConsoleViewMessage.prototype |
| 1267 } | 1266 } |
| OLD | NEW |