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

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

Issue 211493002: DevTools: Show user code location for wrapped console.log() calls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « LayoutTests/inspector/console/resources/framework.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/ConsoleViewMessage.js
diff --git a/Source/devtools/front_end/ConsoleViewMessage.js b/Source/devtools/front_end/ConsoleViewMessage.js
index 7618270136fb491b3ef1c5b64588549f6cb68750..e65e9c0a38ee8e52e005de8512603f2785f4619b 100644
--- a/Source/devtools/front_end/ConsoleViewMessage.js
+++ b/Source/devtools/front_end/ConsoleViewMessage.js
@@ -30,7 +30,7 @@
/**
* @constructor
- *
+ * @param {!WebInspector.Target} target
* @param {!WebInspector.ConsoleMessage} consoleMessage
* @param {?WebInspector.Linkifier} linkifier
*/
@@ -160,11 +160,11 @@ WebInspector.ConsoleViewMessage.prototype = {
}
if (consoleMessage.source !== WebInspector.ConsoleMessage.MessageSource.Network || consoleMessage.request) {
- if (consoleMessage.stackTrace && consoleMessage.stackTrace.length && consoleMessage.stackTrace[0].scriptId) {
- this._anchorElement = this._linkifyCallFrame(consoleMessage.stackTrace[0]);
- } else if (consoleMessage.url && consoleMessage.url !== "undefined") {
+ var callFrame = this._callFrameAnchorFromStackTrace(consoleMessage.stackTrace);
+ if (callFrame)
+ this._anchorElement = this._linkifyCallFrame(callFrame);
+ else if (consoleMessage.url && consoleMessage.url !== "undefined")
this._anchorElement = this._linkifyLocation(consoleMessage.url, consoleMessage.line, consoleMessage.column);
- }
}
this._formattedMessage.appendChild(this._messageElement);
@@ -247,6 +247,35 @@ WebInspector.ConsoleViewMessage.prototype = {
},
/**
+ * @param {?Array.<!ConsoleAgent.CallFrame>} stackTrace
+ * @return {?ConsoleAgent.CallFrame}
+ */
+ _callFrameAnchorFromStackTrace: function(stackTrace)
+ {
+ if (!stackTrace || !stackTrace.length)
+ return null;
+ var callFrame = stackTrace[0];
+ if (WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabled() && WebInspector.settings.skipStackFramesSwitch.get()) {
pfeldman 2014/03/26 08:57:25 I'd use early return instead.
aandrey 2014/03/26 09:30:18 Done.
+ var regex;
+ try {
+ // FIXME: Cache the created RegExp object.
aandrey 2014/03/26 08:48:31 this will be addressed after https://codereview.ch
+ regex = new RegExp(WebInspector.settings.skipStackFramesPattern.get());
+ } catch (e) {
+ }
+ if (regex) {
pfeldman 2014/03/26 08:57:25 ditto
aandrey 2014/03/26 09:30:18 Done.
+ for (var i = 0; i < stackTrace.length; ++i) {
+ var script = this._target.debuggerModel.scriptForId(stackTrace[i].scriptId);
+ if (!script || !regex.test(script.sourceURL)) {
+ callFrame = stackTrace[i];
+ break;
+ }
+ }
+ }
+ }
+ return callFrame.scriptId ? callFrame : null;
+ },
+
+ /**
* @return {boolean}
*/
isErrorOrWarning: function()
« no previous file with comments | « LayoutTests/inspector/console/resources/framework.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698