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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js

Issue 2156523003: [DevTools] Fix links for JSFrame records in timeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 case recordType.XHRReadyStateChange: 558 case recordType.XHRReadyStateChange:
559 case recordType.XHRLoad: 559 case recordType.XHRLoad:
560 case recordType.ResourceSendRequest: 560 case recordType.ResourceSendRequest:
561 case recordType.ResourceReceivedData: 561 case recordType.ResourceReceivedData:
562 case recordType.ResourceReceiveResponse: 562 case recordType.ResourceReceiveResponse:
563 case recordType.ResourceFinish: 563 case recordType.ResourceFinish:
564 if (event.url) 564 if (event.url)
565 details = WebInspector.linkifyResourceAsNode(event.url); 565 details = WebInspector.linkifyResourceAsNode(event.url);
566 break; 566 break;
567 case recordType.FunctionCall: 567 case recordType.FunctionCall:
568 details = linkifyLocation(eventData["scriptId"], eventData["scriptName"] , eventData["scriptLine"], 0); 568 details = linkifyLocation(eventData["scriptId"], eventData["scriptName"] , eventData["scriptLine"] - 1, 0);
569 break; 569 break;
570 case recordType.JSFrame: 570 case recordType.JSFrame:
571 details = createElement("span"); 571 details = createElement("span");
572 details.createTextChild(WebInspector.beautifyFunctionName(eventData["fun ctionName"])); 572 details.createTextChild(WebInspector.beautifyFunctionName(eventData["fun ctionName"]));
573 var location = linkifyLocation(eventData["scriptId"], eventData["url"], eventData["lineNumber"], eventData["columnNumber"]); 573 var location = linkifyLocation(eventData["scriptId"], eventData["url"], eventData["lineNumber"], eventData["columnNumber"]);
574 if (location) { 574 if (location) {
575 details.createTextChild(" @ "); 575 details.createTextChild(" @ ");
576 details.appendChild(location); 576 details.appendChild(location);
577 } 577 }
578 break; 578 break;
579 case recordType.CompileScript: 579 case recordType.CompileScript:
580 case recordType.EvaluateScript: 580 case recordType.EvaluateScript:
581 var url = eventData["url"]; 581 var url = eventData["url"];
582 if (url) 582 if (url)
583 details = linkifyLocation("", url, eventData["lineNumber"], 0); 583 details = linkifyLocation("", url, eventData["lineNumber"] - 1, 0);
584 break; 584 break;
585 case recordType.ParseScriptOnBackground: 585 case recordType.ParseScriptOnBackground:
586 var url = eventData["url"]; 586 var url = eventData["url"];
587 if (url) 587 if (url)
588 details = linkifyLocation("", url, 0, 0); 588 details = linkifyLocation("", url, 0, 0);
589 break; 589 break;
590 default: 590 default:
591 if (event.hasCategory(WebInspector.TimelineModel.Category.Console)) 591 if (event.hasCategory(WebInspector.TimelineModel.Category.Console))
592 detailsText = null; 592 detailsText = null;
593 else 593 else
594 details = linkifyTopCallFrame(); 594 details = linkifyTopCallFrame();
595 break; 595 break;
596 } 596 }
597 597
598 if (!details && detailsText) 598 if (!details && detailsText)
599 details = createTextNode(detailsText); 599 details = createTextNode(detailsText);
600 return details; 600 return details;
601 601
602 /** 602 /**
603 * @param {string} scriptId 603 * @param {string} scriptId
604 * @param {string} url 604 * @param {string} url
605 * @param {number} lineNumber 605 * @param {number} lineNumber
606 * @param {number=} columnNumber 606 * @param {number=} columnNumber
607 * @return {?Element} 607 * @return {?Element}
608 */ 608 */
609 function linkifyLocation(scriptId, url, lineNumber, columnNumber) 609 function linkifyLocation(scriptId, url, lineNumber, columnNumber)
610 { 610 {
611 // FIXME(62725): stack trace line/column numbers are one-based. 611 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber , columnNumber, "timeline-details");
612 if (columnNumber)
613 --columnNumber;
614 return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber - 1, columnNumber, "timeline-details");
615 } 612 }
616 613
617 /** 614 /**
618 * @return {?Element} 615 * @return {?Element}
619 */ 616 */
620 function linkifyTopCallFrame() 617 function linkifyTopCallFrame()
621 { 618 {
622 var frame = WebInspector.TimelineUIUtils.topStackFrame(event); 619 var frame = WebInspector.TimelineUIUtils.topStackFrame(event);
623 return frame ? linkifier.maybeLinkifyConsoleCallFrameForTimeline(target, frame, "timeline-details") : null; 620 return frame ? linkifier.maybeLinkifyConsoleCallFrameForTracing(target, frame, "timeline-details") : null;
624 } 621 }
625 } 622 }
626 623
627 /** 624 /**
628 * @param {!WebInspector.TracingModel.Event} event 625 * @param {!WebInspector.TracingModel.Event} event
629 * @param {!WebInspector.TimelineModel} model 626 * @param {!WebInspector.TimelineModel} model
630 * @param {!WebInspector.Linkifier} linkifier 627 * @param {!WebInspector.Linkifier} linkifier
631 * @param {boolean} detailed 628 * @param {boolean} detailed
632 * @param {function(!DocumentFragment)} callback 629 * @param {function(!DocumentFragment)} callback
633 */ 630 */
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 var priority = WebInspector.uiLabelForPriority(/** @type {!NetworkAgent. ResourcePriority} */ (request.priority)); 987 var priority = WebInspector.uiLabelForPriority(/** @type {!NetworkAgent. ResourcePriority} */ (request.priority));
991 contentHelper.appendTextRow(WebInspector.UIString("Priority"), priority) ; 988 contentHelper.appendTextRow(WebInspector.UIString("Priority"), priority) ;
992 } 989 }
993 if (request.mimeType) 990 if (request.mimeType)
994 contentHelper.appendTextRow(WebInspector.UIString("Mime Type"), request. mimeType); 991 contentHelper.appendTextRow(WebInspector.UIString("Mime Type"), request. mimeType);
995 992
996 var title = WebInspector.UIString("Initiator"); 993 var title = WebInspector.UIString("Initiator");
997 var sendRequest = request.children[0]; 994 var sendRequest = request.children[0];
998 var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest); 995 var topFrame = WebInspector.TimelineUIUtils.topStackFrame(sendRequest);
999 if (topFrame) { 996 if (topFrame) {
1000 var link = linkifier.maybeLinkifyConsoleCallFrameForTimeline(target, top Frame); 997 var link = linkifier.maybeLinkifyConsoleCallFrameForTracing(target, topF rame);
1001 if (link) 998 if (link)
1002 contentHelper.appendElementRow(title, link); 999 contentHelper.appendElementRow(title, link);
1003 } else if (sendRequest.initiator) { 1000 } else if (sendRequest.initiator) {
1004 var initiatorURL = WebInspector.TimelineUIUtils.eventURL(sendRequest.ini tiator); 1001 var initiatorURL = WebInspector.TimelineUIUtils.eventURL(sendRequest.ini tiator);
1005 if (initiatorURL) { 1002 if (initiatorURL) {
1006 var link = linkifier.maybeLinkifyScriptLocation(target, null, initia torURL, 0); 1003 var link = linkifier.maybeLinkifyScriptLocation(target, null, initia torURL, 0);
1007 if (link) 1004 if (link)
1008 contentHelper.appendElementRow(title, link); 1005 contentHelper.appendElementRow(title, link);
1009 } 1006 }
1010 } 1007 }
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 title.createTextChild(WebInspector.UIString("%s for ", reason)); 1236 title.createTextChild(WebInspector.UIString("%s for ", reason));
1240 else 1237 else
1241 title.createTextChild(WebInspector.UIString("Unknown cause for ")); 1238 title.createTextChild(WebInspector.UIString("Unknown cause for "));
1242 1239
1243 this._appendTruncatedNodeList(title, this._invalidations); 1240 this._appendTruncatedNodeList(title, this._invalidations);
1244 1241
1245 if (topFrame && this._contentHelper.linkifier()) { 1242 if (topFrame && this._contentHelper.linkifier()) {
1246 title.createTextChild(WebInspector.UIString(". ")); 1243 title.createTextChild(WebInspector.UIString(". "));
1247 var stack = title.createChild("span", "monospace"); 1244 var stack = title.createChild("span", "monospace");
1248 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName); 1245 stack.createChild("span").textContent = WebInspector.beautifyFunctio nName(topFrame.functionName);
1249 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFr ameForTimeline(target, topFrame); 1246 var link = this._contentHelper.linkifier().maybeLinkifyConsoleCallFr ameForTracing(target, topFrame);
1250 if (link) { 1247 if (link) {
1251 stack.createChild("span").textContent = " @ "; 1248 stack.createChild("span").textContent = " @ ";
1252 stack.createChild("span").appendChild(link); 1249 stack.createChild("span").appendChild(link);
1253 } 1250 }
1254 } 1251 }
1255 1252
1256 return title; 1253 return title;
1257 }, 1254 },
1258 1255
1259 /** 1256 /**
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 case warnings.V8Deopt: 2150 case warnings.V8Deopt:
2154 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53", 2151 span.appendChild(WebInspector.linkifyURLAsNode("https://github.com/Googl eChrome/devtools-docs/issues/53",
2155 WebInspector.UIString("Not optimized"), undefined, true)); 2152 WebInspector.UIString("Not optimized"), undefined, true));
2156 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"])); 2153 span.createTextChild(WebInspector.UIString(": %s", eventData["deoptReaso n"]));
2157 break; 2154 break;
2158 default: 2155 default:
2159 console.assert(false, "Unhandled TimelineModel.WarningType"); 2156 console.assert(false, "Unhandled TimelineModel.WarningType");
2160 } 2157 }
2161 return span; 2158 return span;
2162 } 2159 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698