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

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 404953004: DevTools: Refactor linkifyRawLocation to use fallback url (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 this._linkifier.reset(); 1028 this._linkifier.reset();
1029 }, 1029 },
1030 1030
1031 /** 1031 /**
1032 * @param {!WebInspector.NetworkRequest} request 1032 * @param {!WebInspector.NetworkRequest} request
1033 * @return {!Element} 1033 * @return {!Element}
1034 */ 1034 */
1035 _generateScriptInitiatedPopoverContent: function(request) 1035 _generateScriptInitiatedPopoverContent: function(request)
1036 { 1036 {
1037 var framesTable = document.createElement("table"); 1037 var framesTable = document.createElement("table");
1038
1039 /** 1038 /**
1040 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace 1039 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace
1041 * @this {WebInspector.NetworkLogView} 1040 * @this {WebInspector.NetworkLogView}
1042 */ 1041 */
1043 function appendStackTrace(stackTrace) 1042 function appendStackTrace(stackTrace)
1044 { 1043 {
1045 for (var i = 0; i < stackTrace.length; ++i) { 1044 for (var i = 0; i < stackTrace.length; ++i) {
1046 var stackFrame = stackTrace[i]; 1045 var stackFrame = stackTrace[i];
1047 var rawLocation = request.target().debuggerModel.createRawLocati onByConsoleCallFrame(stackFrame); 1046 var rawLocation = request.target().debuggerModel.createRawLocati onByConsoleCallFrame(stackFrame);
1048 var row = document.createElement("tr"); 1047 var row = document.createElement("tr");
1049 row.createChild("td").textContent = stackFrame.functionName || W ebInspector.UIString("(anonymous function)"); 1048 row.createChild("td").textContent = stackFrame.functionName || W ebInspector.UIString("(anonymous function)");
1050 row.createChild("td").textContent = " @ "; 1049 row.createChild("td").textContent = " @ ";
1051 row.createChild("td").appendChild(this._linkifier.linkifyRawLoca tion(rawLocation)); 1050 row.createChild("td").appendChild(this._linkifier.linkifyRawLoca tion(rawLocation, stackFrame.url));
1052 framesTable.appendChild(row); 1051 framesTable.appendChild(row);
1053 } 1052 }
1054 } 1053 }
1055 1054
1056 appendStackTrace.call(this, request.initiator.stackTrace); 1055 appendStackTrace.call(this, request.initiator.stackTrace);
1057 1056
1058 var asyncStackTrace = request.initiator.asyncStackTrace; 1057 var asyncStackTrace = request.initiator.asyncStackTrace;
1059 while (asyncStackTrace) { 1058 while (asyncStackTrace) {
1060 var callFrames = asyncStackTrace.callFrames; 1059 var callFrames = asyncStackTrace.callFrames;
1061 if (!callFrames || !callFrames.length) 1060 if (!callFrames || !callFrames.length)
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 case WebInspector.NetworkRequest.InitiatorType.Redirect: 2766 case WebInspector.NetworkRequest.InitiatorType.Redirect:
2768 cell.title = initiator.url; 2767 cell.title = initiator.url;
2769 console.assert(request.redirectSource); 2768 console.assert(request.redirectSource);
2770 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource); 2769 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource);
2771 cell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource)); 2770 cell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource));
2772 this._appendSubtitle(cell, WebInspector.UIString("Redirect")); 2771 this._appendSubtitle(cell, WebInspector.UIString("Redirect"));
2773 break; 2772 break;
2774 2773
2775 case WebInspector.NetworkRequest.InitiatorType.Script: 2774 case WebInspector.NetworkRequest.InitiatorType.Script:
2776 if (!this._linkifiedInitiatorAnchor) { 2775 if (!this._linkifiedInitiatorAnchor) {
2777 this._linkifiedInitiatorAnchor = this._linkifier.linkifyLocation (request.target(), initiator.url, initiator.lineNumber - 1, initiator.columnNumb er - 1); 2776 this._linkifiedInitiatorAnchor = this._linkifier.linkifyScriptLo cation(request.target(), null, initiator.url, initiator.lineNumber - 1, initiato r.columnNumber - 1);
2778 this._linkifiedInitiatorAnchor.title = ""; 2777 this._linkifiedInitiatorAnchor.title = "";
2779 } 2778 }
2780 cell.appendChild(this._linkifiedInitiatorAnchor); 2779 cell.appendChild(this._linkifiedInitiatorAnchor);
2781 this._appendSubtitle(cell, WebInspector.UIString("Script")); 2780 this._appendSubtitle(cell, WebInspector.UIString("Script"));
2782 cell.classList.add("network-script-initiated"); 2781 cell.classList.add("network-script-initiated");
2783 cell.request = request; 2782 cell.request = request;
2784 break; 2783 break;
2785 2784
2786 default: 2785 default:
2787 cell.title = ""; 2786 cell.title = "";
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3051 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 3050 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
3052 { 3051 {
3053 var aValue = a._request[propertyName]; 3052 var aValue = a._request[propertyName];
3054 var bValue = b._request[propertyName]; 3053 var bValue = b._request[propertyName];
3055 if (aValue > bValue) 3054 if (aValue > bValue)
3056 return revert ? -1 : 1; 3055 return revert ? -1 : 1;
3057 if (bValue > aValue) 3056 if (bValue > aValue)
3058 return revert ? 1 : -1; 3057 return revert ? 1 : -1;
3059 return a._request.indentityCompare(b._request); 3058 return a._request.indentityCompare(b._request);
3060 } 3059 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698