Skip to content

Commit

Permalink
[DevTools] Fix links for JSFrame records in timeline
Browse files Browse the repository at this point in the history
[email protected]

Review-Url: https://codereview.chromium.org/2156523003
Cr-Commit-Position: refs/heads/master@{#406203}
  • Loading branch information
alexkozy authored and Commit bot committed Jul 19, 2016
1 parent 5915191 commit 8d097c0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions front_end/components/Linkifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ WebInspector.Linkifier.prototype = {
* @param {string=} classes
* @return {?Element}
*/
maybeLinkifyConsoleCallFrameForTimeline: function(target, callFrame, classes)
maybeLinkifyConsoleCallFrameForTracing: function(target, callFrame, classes)
{
// TODO(kozyatinskiy): remove this when Profilers will migrate to 0-based lineNumber and columnNumber.
// TODO(kozyatinskiy): remove this when tracing will migrate to 0-based lineNumber and columnNumber.
return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame.url, callFrame.lineNumber - 1, callFrame.columnNumber - 1, classes);
},

Expand Down
15 changes: 13 additions & 2 deletions front_end/timeline/TimelineTreeView.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,22 @@ WebInspector.TimelineTreeView.prototype = {
*/
_onHover: function(node) { },

/**
* @param {!RuntimeAgent.CallFrame} frame
* @return {?Element}
*/
_linkifyLocationForTracing: function(frame)
{
return this._linkifier.maybeLinkifyConsoleCallFrameForTracing(this._model.target(), frame);
},

/**
* @param {!RuntimeAgent.CallFrame} frame
* @return {?Element}
*/
linkifyLocation: function(frame)
{
return this._linkifier.maybeLinkifyConsoleCallFrameForTimeline(this._model.target(), frame);
return this._linkifier.maybeLinkifyConsoleCallFrame(this._model.target(), frame);
},

/**
Expand Down Expand Up @@ -347,7 +356,9 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
var frame = WebInspector.TimelineProfileTree.eventStackFrame(event);
if (frame && frame["url"]) {
var callFrame = /** @type {!RuntimeAgent.CallFrame} */ (frame);
var link = this._treeView.linkifyLocation(callFrame);
var link = event.name === WebInspector.TimelineModel.RecordType.JSFrame
? this._treeView.linkifyLocation(callFrame)
: this._treeView._linkifyLocationForTracing(callFrame);
if (link)
container.createChild("div", "activity-link").appendChild(link);
}
Expand Down
15 changes: 6 additions & 9 deletions front_end/timeline/TimelineUIUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar
details = WebInspector.linkifyResourceAsNode(event.url);
break;
case recordType.FunctionCall:
details = linkifyLocation(eventData["scriptId"], eventData["scriptName"], eventData["scriptLine"], 0);
details = linkifyLocation(eventData["scriptId"], eventData["scriptName"], eventData["scriptLine"] - 1, 0);
break;
case recordType.JSFrame:
details = createElement("span");
Expand All @@ -580,7 +580,7 @@ WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar
case recordType.EvaluateScript:
var url = eventData["url"];
if (url)
details = linkifyLocation("", url, eventData["lineNumber"], 0);
details = linkifyLocation("", url, eventData["lineNumber"] - 1, 0);
break;
case recordType.ParseScriptOnBackground:
var url = eventData["url"];
Expand Down Expand Up @@ -608,10 +608,7 @@ WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar
*/
function linkifyLocation(scriptId, url, lineNumber, columnNumber)
{
// FIXME(62725): stack trace line/column numbers are one-based.
if (columnNumber)
--columnNumber;
return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber, columnNumber, "timeline-details");
}

/**
Expand All @@ -620,7 +617,7 @@ WebInspector.TimelineUIUtils.buildDetailsNodeForTraceEvent = function(event, tar
function linkifyTopCallFrame()
{
var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
return frame ? linkifier.maybeLinkifyConsoleCallFrameForTimeline(target, frame, "timeline-details") : null;
return frame ? linkifier.maybeLinkifyConsoleCallFrameForTracing(target, frame, "timeline-details") : null;
}
}

Expand Down Expand Up @@ -997,7 +994,7 @@ WebInspector.TimelineUIUtils.buildNetworkRequestDetails = function(request, mode
var sendRequest = request.children[0];
var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest);
if (topFrame) {
var link = linkifier.maybeLinkifyConsoleCallFrameForTimeline(target, topFrame);
var link = linkifier.maybeLinkifyConsoleCallFrameForTracing(target, topFrame);
if (link)
contentHelper.appendElementRow(title, link);
} else if (sendRequest.initiator) {
Expand Down Expand Up @@ -1246,7 +1243,7 @@ WebInspector.TimelineUIUtils.InvalidationsGroupElement.prototype = {
title.createTextChild(WebInspector.UIString(". "));
var stack = title.createChild("span", "monospace");
stack.createChild("span").textContent = WebInspector.beautifyFunctionName(topFrame.functionName);
var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFrameForTimeline(target, topFrame);
var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFrameForTracing(target, topFrame);
if (link) {
stack.createChild("span").textContent = " @ ";
stack.createChild("span").appendChild(link);
Expand Down

0 comments on commit 8d097c0

Please sign in to comment.