| OLD | NEW |
| 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 if (request) { | 1243 if (request) { |
| 1244 contextMenu.appendApplicableItems(request); | 1244 contextMenu.appendApplicableItems(request); |
| 1245 if (request.requestHeadersText()) | 1245 if (request.requestHeadersText()) |
| 1246 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r
equest ^headers"), this._copyRequestHeaders.bind(this, request)); | 1246 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r
equest ^headers"), this._copyRequestHeaders.bind(this, request)); |
| 1247 if (request.responseHeadersText) | 1247 if (request.responseHeadersText) |
| 1248 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r
esponse ^headers"), this._copyResponseHeaders.bind(this, request)); | 1248 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r
esponse ^headers"), this._copyResponseHeaders.bind(this, request)); |
| 1249 if (request.finished) | 1249 if (request.finished) |
| 1250 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r
esponse"), this._copyResponse.bind(this, request)); | 1250 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^r
esponse"), this._copyResponse.bind(this, request)); |
| 1251 contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), this._
copyCurlCommand.bind(this, request)); | 1251 |
| 1252 if (WebInspector.isWin()) { |
| 1253 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (cmd)
"), this._copyCurlCommand.bind(this, request, "win")); |
| 1254 contextMenu.appendItem(WebInspector.UIString("Copy as cURL (bash
)"), this._copyCurlCommand.bind(this, request, "unix")); |
| 1255 } else { |
| 1256 contextMenu.appendItem(WebInspector.UIString("Copy as cURL"), th
is._copyCurlCommand.bind(this, request, "unix")); |
| 1257 } |
| 1252 } | 1258 } |
| 1253 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HA
R"), this._copyAll.bind(this)); | 1259 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^all as HA
R"), this._copyAll.bind(this)); |
| 1254 | 1260 |
| 1255 contextMenu.appendSeparator(); | 1261 contextMenu.appendSeparator(); |
| 1256 contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR wit
h ^content"), this._exportAll.bind(this)); | 1262 contextMenu.appendItem(WebInspector.UIString.capitalize("Save as HAR wit
h ^content"), this._exportAll.bind(this)); |
| 1257 | 1263 |
| 1258 contextMenu.appendSeparator(); | 1264 contextMenu.appendSeparator(); |
| 1259 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser
^cache"), this._clearBrowserCache.bind(this)); | 1265 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser
^cache"), this._clearBrowserCache.bind(this)); |
| 1260 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser
^cookies"), this._clearBrowserCookies.bind(this)); | 1266 contextMenu.appendItem(WebInspector.UIString.capitalize("Clear ^browser
^cookies"), this._clearBrowserCookies.bind(this)); |
| 1261 | 1267 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 /** | 1317 /** |
| 1312 * @param {!WebInspector.NetworkRequest} request | 1318 * @param {!WebInspector.NetworkRequest} request |
| 1313 */ | 1319 */ |
| 1314 _copyResponseHeaders: function(request) | 1320 _copyResponseHeaders: function(request) |
| 1315 { | 1321 { |
| 1316 InspectorFrontendHost.copyText(request.responseHeadersText); | 1322 InspectorFrontendHost.copyText(request.responseHeadersText); |
| 1317 }, | 1323 }, |
| 1318 | 1324 |
| 1319 /** | 1325 /** |
| 1320 * @param {!WebInspector.NetworkRequest} request | 1326 * @param {!WebInspector.NetworkRequest} request |
| 1327 * @param {string} platform |
| 1321 */ | 1328 */ |
| 1322 _copyCurlCommand: function(request) | 1329 _copyCurlCommand: function(request, platform) |
| 1323 { | 1330 { |
| 1324 InspectorFrontendHost.copyText(this._generateCurlCommand(request)); | 1331 InspectorFrontendHost.copyText(this._generateCurlCommand(request, platfo
rm)); |
| 1325 }, | 1332 }, |
| 1326 | 1333 |
| 1327 _exportAll: function() | 1334 _exportAll: function() |
| 1328 { | 1335 { |
| 1329 var filename = WebInspector.targetManager.inspectedPageDomain() + ".har"
; | 1336 var filename = WebInspector.targetManager.inspectedPageDomain() + ".har"
; |
| 1330 var stream = new WebInspector.FileOutputStream(); | 1337 var stream = new WebInspector.FileOutputStream(); |
| 1331 stream.open(filename, openCallback.bind(this)); | 1338 stream.open(filename, openCallback.bind(this)); |
| 1332 | 1339 |
| 1333 /** | 1340 /** |
| 1334 * @param {boolean} accepted | 1341 * @param {boolean} accepted |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 * @param {!WebInspector.NetworkDataGridNode} node | 1710 * @param {!WebInspector.NetworkDataGridNode} node |
| 1704 */ | 1711 */ |
| 1705 _highlightNode: function(node) | 1712 _highlightNode: function(node) |
| 1706 { | 1713 { |
| 1707 WebInspector.runCSSAnimationOnce(node.element(), "highlighted-row"); | 1714 WebInspector.runCSSAnimationOnce(node.element(), "highlighted-row"); |
| 1708 this._highlightedNode = node; | 1715 this._highlightedNode = node; |
| 1709 }, | 1716 }, |
| 1710 | 1717 |
| 1711 /** | 1718 /** |
| 1712 * @param {!WebInspector.NetworkRequest} request | 1719 * @param {!WebInspector.NetworkRequest} request |
| 1720 * @param {string} platform |
| 1713 * @return {string} | 1721 * @return {string} |
| 1714 */ | 1722 */ |
| 1715 _generateCurlCommand: function(request) | 1723 _generateCurlCommand: function(request, platform) |
| 1716 { | 1724 { |
| 1717 var command = ["curl"]; | 1725 var command = ["curl"]; |
| 1718 // These headers are derived from URL (except "version") and would be ad
ded by cURL anyway. | 1726 // These headers are derived from URL (except "version") and would be ad
ded by cURL anyway. |
| 1719 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v
ersion": 1}; | 1727 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v
ersion": 1}; |
| 1720 | 1728 |
| 1721 function escapeStringWin(str) | 1729 function escapeStringWin(str) |
| 1722 { | 1730 { |
| 1723 /* Replace quote by double quote (but not by \") because it is | 1731 /* Replace quote by double quote (but not by \") because it is |
| 1724 recognized by both cmd.exe and MS Crt arguments parser. | 1732 recognized by both cmd.exe and MS Crt arguments parser. |
| 1725 | 1733 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 .replace(/\r/g, "\\r") | 1769 .replace(/\r/g, "\\r") |
| 1762 .replace(/[^\x20-\x7E]/g, escapeCharacter) + "
'"; | 1770 .replace(/[^\x20-\x7E]/g, escapeCharacter) + "
'"; |
| 1763 } else { | 1771 } else { |
| 1764 // Use single quote syntax. | 1772 // Use single quote syntax. |
| 1765 return "'" + str + "'"; | 1773 return "'" + str + "'"; |
| 1766 } | 1774 } |
| 1767 } | 1775 } |
| 1768 | 1776 |
| 1769 // cURL command expected to run on the same platform that DevTools run | 1777 // cURL command expected to run on the same platform that DevTools run |
| 1770 // (it may be different from the inspected page platform). | 1778 // (it may be different from the inspected page platform). |
| 1771 var escapeString = WebInspector.isWin() ? escapeStringWin : escapeString
Posix; | 1779 var escapeString = platform === "win" ? escapeStringWin : escapeStringPo
six; |
| 1772 | 1780 |
| 1773 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&")); | 1781 command.push(escapeString(request.url).replace(/[[{}\]]/g, "\\$&")); |
| 1774 | 1782 |
| 1775 var inferredMethod = "GET"; | 1783 var inferredMethod = "GET"; |
| 1776 var data = []; | 1784 var data = []; |
| 1777 var requestContentType = request.requestContentType(); | 1785 var requestContentType = request.requestContentType(); |
| 1778 if (requestContentType && requestContentType.startsWith("application/x-w
ww-form-urlencoded") && request.requestFormData) { | 1786 if (requestContentType && requestContentType.startsWith("application/x-w
ww-form-urlencoded") && request.requestFormData) { |
| 1779 data.push("--data"); | 1787 data.push("--data"); |
| 1780 data.push(escapeString(request.requestFormData)); | 1788 data.push(escapeString(request.requestFormData)); |
| 1781 ignoredHeaders["content-length"] = true; | 1789 ignoredHeaders["content-length"] = true; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2021 return false; | 2029 return false; |
| 2022 return true; | 2030 return true; |
| 2023 } | 2031 } |
| 2024 | 2032 |
| 2025 WebInspector.NetworkLogView.EventTypes = { | 2033 WebInspector.NetworkLogView.EventTypes = { |
| 2026 RequestSelected: "RequestSelected", | 2034 RequestSelected: "RequestSelected", |
| 2027 SearchCountUpdated: "SearchCountUpdated", | 2035 SearchCountUpdated: "SearchCountUpdated", |
| 2028 SearchIndexUpdated: "SearchIndexUpdated", | 2036 SearchIndexUpdated: "SearchIndexUpdated", |
| 2029 UpdateRequest: "UpdateRequest" | 2037 UpdateRequest: "UpdateRequest" |
| 2030 }; | 2038 }; |
| OLD | NEW |