| 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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 728 |
| 729 _createStatusbarButtons: function() | 729 _createStatusbarButtons: function() |
| 730 { | 730 { |
| 731 this._recordButton = new WebInspector.StatusBarButton("", "record-profil
e-status-bar-item"); | 731 this._recordButton = new WebInspector.StatusBarButton("", "record-profil
e-status-bar-item"); |
| 732 this._recordButton.addEventListener("click", this._onRecordButtonClicked
, this); | 732 this._recordButton.addEventListener("click", this._onRecordButtonClicked
, this); |
| 733 | 733 |
| 734 this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIStri
ng("Clear"), "clear-status-bar-item"); | 734 this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIStri
ng("Clear"), "clear-status-bar-item"); |
| 735 this._clearButton.addEventListener("click", this._reset, this); | 735 this._clearButton.addEventListener("click", this._reset, this); |
| 736 | 736 |
| 737 this._largerRequestsButton = new WebInspector.StatusBarButton(WebInspect
or.UIString("Use small resource rows."), "network-larger-resources-status-bar-it
em"); | 737 this._largerRequestsButton = new WebInspector.StatusBarButton(WebInspect
or.UIString("Use small resource rows."), "network-larger-resources-status-bar-it
em"); |
| 738 this._largerRequestsButton.toggled = WebInspector.settings.resourcesLarg
eRows.get(); | 738 this._largerRequestsButton.setToggled(WebInspector.settings.resourcesLar
geRows.get()); |
| 739 this._largerRequestsButton.addEventListener("click", this._toggleLargerR
equests, this); | 739 this._largerRequestsButton.addEventListener("click", this._toggleLargerR
equests, this); |
| 740 | 740 |
| 741 this._preserveLogCheckbox = new WebInspector.StatusBarCheckbox(WebInspec
tor.UIString("Preserve log")); | 741 this._preserveLogCheckbox = new WebInspector.StatusBarCheckbox(WebInspec
tor.UIString("Preserve log")); |
| 742 this._preserveLogCheckbox.element.title = WebInspector.UIString("Do not
clear log on page reload / navigation."); | 742 this._preserveLogCheckbox.element.title = WebInspector.UIString("Do not
clear log on page reload / navigation."); |
| 743 | 743 |
| 744 this._disableCacheCheckbox = new WebInspector.StatusBarCheckbox(WebInspe
ctor.UIString("Disable cache")); | 744 this._disableCacheCheckbox = new WebInspector.StatusBarCheckbox(WebInspe
ctor.UIString("Disable cache")); |
| 745 WebInspector.SettingsUI.bindCheckbox(this._disableCacheCheckbox.inputEle
ment, WebInspector.settings.cacheDisabled); | 745 WebInspector.SettingsUI.bindCheckbox(this._disableCacheCheckbox.inputEle
ment, WebInspector.settings.cacheDisabled); |
| 746 this._disableCacheCheckbox.element.title = WebInspector.UIString("Disabl
e cache (while DevTools is open)."); | 746 this._disableCacheCheckbox.element.title = WebInspector.UIString("Disabl
e cache (while DevTools is open)."); |
| 747 }, | 747 }, |
| 748 | 748 |
| 749 /** | 749 /** |
| 750 * @param {!WebInspector.Event} event | 750 * @param {!WebInspector.Event} event |
| 751 */ | 751 */ |
| 752 _loadEventFired: function(event) | 752 _loadEventFired: function(event) |
| 753 { | 753 { |
| 754 if (!this._recordButton.toggled) | 754 if (!this._recordButton.toggled()) |
| 755 return; | 755 return; |
| 756 | 756 |
| 757 var data = /** @type {number} */ (event.data); | 757 var data = /** @type {number} */ (event.data); |
| 758 this._mainRequestLoadTime = data || -1; | 758 this._mainRequestLoadTime = data || -1; |
| 759 // Schedule refresh to update boundaries and draw the new line. | 759 // Schedule refresh to update boundaries and draw the new line. |
| 760 this._scheduleRefresh(); | 760 this._scheduleRefresh(); |
| 761 }, | 761 }, |
| 762 | 762 |
| 763 /** | 763 /** |
| 764 * @param {!WebInspector.Event} event | 764 * @param {!WebInspector.Event} event |
| 765 */ | 765 */ |
| 766 _domContentLoadedEventFired: function(event) | 766 _domContentLoadedEventFired: function(event) |
| 767 { | 767 { |
| 768 if (!this._recordButton.toggled) | 768 if (!this._recordButton.toggled()) |
| 769 return; | 769 return; |
| 770 var data = /** @type {number} */ (event.data); | 770 var data = /** @type {number} */ (event.data); |
| 771 this._mainRequestDOMContentLoadedTime = data || -1; | 771 this._mainRequestDOMContentLoadedTime = data || -1; |
| 772 // Schedule refresh to update boundaries and draw the new line. | 772 // Schedule refresh to update boundaries and draw the new line. |
| 773 this._scheduleRefresh(); | 773 this._scheduleRefresh(); |
| 774 }, | 774 }, |
| 775 | 775 |
| 776 wasShown: function() | 776 wasShown: function() |
| 777 { | 777 { |
| 778 this._refreshIfNeeded(); | 778 this._refreshIfNeeded(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 for (var i = 0; i < nodes.length; ++i) | 832 for (var i = 0; i < nodes.length; ++i) |
| 833 nodes[i].refreshGraph(); | 833 nodes[i].refreshGraph(); |
| 834 } | 834 } |
| 835 | 835 |
| 836 this._staleRequestIds = {}; | 836 this._staleRequestIds = {}; |
| 837 this._updateSummaryBar(); | 837 this._updateSummaryBar(); |
| 838 }, | 838 }, |
| 839 | 839 |
| 840 _onRecordButtonClicked: function() | 840 _onRecordButtonClicked: function() |
| 841 { | 841 { |
| 842 if (!this._recordButton.toggled) | 842 if (!this._recordButton.toggled()) |
| 843 this._reset(); | 843 this._reset(); |
| 844 this._toggleRecordButton(!this._recordButton.toggled); | 844 this._toggleRecordButton(!this._recordButton.toggled()); |
| 845 }, | 845 }, |
| 846 | 846 |
| 847 /** | 847 /** |
| 848 * @param {boolean} toggled | 848 * @param {boolean} toggled |
| 849 */ | 849 */ |
| 850 _toggleRecordButton: function(toggled) | 850 _toggleRecordButton: function(toggled) |
| 851 { | 851 { |
| 852 this._recordButton.toggled = toggled; | 852 this._recordButton.setToggled(toggled); |
| 853 this._recordButton.title = toggled ? WebInspector.UIString("Stop Recordi
ng Network Log") : WebInspector.UIString("Record Network Log"); | 853 this._recordButton.setTitle(toggled ? WebInspector.UIString("Stop Record
ing Network Log") : WebInspector.UIString("Record Network Log")); |
| 854 }, | 854 }, |
| 855 | 855 |
| 856 _reset: function() | 856 _reset: function() |
| 857 { | 857 { |
| 858 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Vie
wCleared); | 858 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Vie
wCleared); |
| 859 | 859 |
| 860 this._clearSearchMatchedList(); | 860 this._clearSearchMatchedList(); |
| 861 if (this._popoverHelper) | 861 if (this._popoverHelper) |
| 862 this._popoverHelper.hidePopover(); | 862 this._popoverHelper.hidePopover(); |
| 863 | 863 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 880 | 880 |
| 881 this._mainRequestLoadTime = -1; | 881 this._mainRequestLoadTime = -1; |
| 882 this._mainRequestDOMContentLoadedTime = -1; | 882 this._mainRequestDOMContentLoadedTime = -1; |
| 883 }, | 883 }, |
| 884 | 884 |
| 885 /** | 885 /** |
| 886 * @param {!WebInspector.Event} event | 886 * @param {!WebInspector.Event} event |
| 887 */ | 887 */ |
| 888 _onRequestStarted: function(event) | 888 _onRequestStarted: function(event) |
| 889 { | 889 { |
| 890 if (this._recordButton.toggled) { | 890 if (this._recordButton.toggled()) { |
| 891 var request = /** @type {!WebInspector.NetworkRequest} */ (event.dat
a); | 891 var request = /** @type {!WebInspector.NetworkRequest} */ (event.dat
a); |
| 892 this._appendRequest(request); | 892 this._appendRequest(request); |
| 893 } | 893 } |
| 894 }, | 894 }, |
| 895 | 895 |
| 896 /** | 896 /** |
| 897 * @param {!WebInspector.NetworkRequest} request | 897 * @param {!WebInspector.NetworkRequest} request |
| 898 */ | 898 */ |
| 899 _appendRequest: function(request) | 899 _appendRequest: function(request) |
| 900 { | 900 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 this._staleRequestIds[request.requestId] = true; | 953 this._staleRequestIds[request.requestId] = true; |
| 954 this._scheduleRefresh(); | 954 this._scheduleRefresh(); |
| 955 }, | 955 }, |
| 956 | 956 |
| 957 /** | 957 /** |
| 958 * @param {!WebInspector.Event} event | 958 * @param {!WebInspector.Event} event |
| 959 */ | 959 */ |
| 960 _willReloadPage: function(event) | 960 _willReloadPage: function(event) |
| 961 { | 961 { |
| 962 this._recordButton.toggled = true; | 962 this._recordButton.setToggled(true); |
| 963 if (!this._preserveLogCheckbox.checked()) | 963 if (!this._preserveLogCheckbox.checked()) |
| 964 this._reset(); | 964 this._reset(); |
| 965 }, | 965 }, |
| 966 | 966 |
| 967 /** | 967 /** |
| 968 * @param {!WebInspector.Event} event | 968 * @param {!WebInspector.Event} event |
| 969 */ | 969 */ |
| 970 _mainFrameNavigated: function(event) | 970 _mainFrameNavigated: function(event) |
| 971 { | 971 { |
| 972 if (!this._recordButton.toggled || this._preserveLogCheckbox.checked()) | 972 if (!this._recordButton.toggled() || this._preserveLogCheckbox.checked()
) |
| 973 return; | 973 return; |
| 974 | 974 |
| 975 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data); | 975 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data); |
| 976 var loaderId = frame.loaderId; | 976 var loaderId = frame.loaderId; |
| 977 | 977 |
| 978 // Pick provisional load requests. | 978 // Pick provisional load requests. |
| 979 var requestsToPick = []; | 979 var requestsToPick = []; |
| 980 var requests = frame.target().networkLog.requests; | 980 var requests = frame.target().networkLog.requests; |
| 981 for (var i = 0; i < requests.length; ++i) { | 981 for (var i = 0; i < requests.length; ++i) { |
| 982 var request = requests[i]; | 982 var request = requests[i]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 * @return {number} | 1021 * @return {number} |
| 1022 */ | 1022 */ |
| 1023 rowHeight: function() | 1023 rowHeight: function() |
| 1024 { | 1024 { |
| 1025 return this._rowHeight; | 1025 return this._rowHeight; |
| 1026 }, | 1026 }, |
| 1027 | 1027 |
| 1028 _updateRowsSize: function() | 1028 _updateRowsSize: function() |
| 1029 { | 1029 { |
| 1030 var largeRows = this.usesLargeRows(); | 1030 var largeRows = this.usesLargeRows(); |
| 1031 this._largerRequestsButton.toggled = largeRows; | 1031 this._largerRequestsButton.setToggled(largeRows); |
| 1032 this._rowHeight = largeRows ? 41 : 21; | 1032 this._rowHeight = largeRows ? 41 : 21; |
| 1033 this._largerRequestsButton.title = WebInspector.UIString(largeRows ? "Us
e small resource rows." : "Use large resource rows."); | 1033 this._largerRequestsButton.setTitle(WebInspector.UIString(largeRows ? "U
se small resource rows." : "Use large resource rows.")); |
| 1034 this._dataGrid.element.classList.toggle("small", !largeRows); | 1034 this._dataGrid.element.classList.toggle("small", !largeRows); |
| 1035 this._timelineGrid.element.classList.toggle("small", !largeRows); | 1035 this._timelineGrid.element.classList.toggle("small", !largeRows); |
| 1036 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Row
SizeChanged, { largeRows: largeRows }); | 1036 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Row
SizeChanged, { largeRows: largeRows }); |
| 1037 }, | 1037 }, |
| 1038 | 1038 |
| 1039 /** | 1039 /** |
| 1040 * @param {!Element} element | 1040 * @param {!Element} element |
| 1041 * @param {!Event} event | 1041 * @param {!Event} event |
| 1042 * @return {!Element|!AnchorBox|undefined} | 1042 * @return {!Element|!AnchorBox|undefined} |
| 1043 */ | 1043 */ |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 } | 1377 } |
| 1378 if (!node) { | 1378 if (!node) { |
| 1379 this._currentMatchedRequestNode = null; | 1379 this._currentMatchedRequestNode = null; |
| 1380 return; | 1380 return; |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 var request = node.request(); | 1383 var request = node.request(); |
| 1384 var regExp = this._searchRegExp; | 1384 var regExp = this._searchRegExp; |
| 1385 var nameMatched = request.name().match(regExp); | 1385 var nameMatched = request.name().match(regExp); |
| 1386 var pathMatched = request.path().match(regExp); | 1386 var pathMatched = request.path().match(regExp); |
| 1387 if (!nameMatched && pathMatched && !this._largerRequestsButton.toggled) | 1387 if (!nameMatched && pathMatched && !this._largerRequestsButton.toggled()
) |
| 1388 this._toggleLargerRequests(); | 1388 this._toggleLargerRequests(); |
| 1389 if (reveal) | 1389 if (reveal) |
| 1390 WebInspector.Revealer.reveal(request); | 1390 WebInspector.Revealer.reveal(request); |
| 1391 var highlightedSubstringChanges = node.highlightMatchedSubstring(regExp)
; | 1391 var highlightedSubstringChanges = node.highlightMatchedSubstring(regExp)
; |
| 1392 this._highlightedSubstringChanges.push(highlightedSubstringChanges); | 1392 this._highlightedSubstringChanges.push(highlightedSubstringChanges); |
| 1393 | 1393 |
| 1394 this._currentMatchedRequestNode = node; | 1394 this._currentMatchedRequestNode = node; |
| 1395 this._currentMatchedRequestIndex = n; | 1395 this._currentMatchedRequestIndex = n; |
| 1396 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchIndexUpdated, n); | 1396 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchIndexUpdated, n); |
| 1397 }, | 1397 }, |
| (...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3312 this._writeProgress.done(); | 3312 this._writeProgress.done(); |
| 3313 return; | 3313 return; |
| 3314 } | 3314 } |
| 3315 const chunkSize = 100000; | 3315 const chunkSize = 100000; |
| 3316 var text = this._text.substring(this._bytesWritten, this._bytesWritten +
chunkSize); | 3316 var text = this._text.substring(this._bytesWritten, this._bytesWritten +
chunkSize); |
| 3317 this._bytesWritten += text.length; | 3317 this._bytesWritten += text.length; |
| 3318 stream.write(text, this._writeNextChunk.bind(this)); | 3318 stream.write(text, this._writeNextChunk.bind(this)); |
| 3319 this._writeProgress.setWorked(this._bytesWritten); | 3319 this._writeProgress.setWorked(this._bytesWritten); |
| 3320 } | 3320 } |
| 3321 } | 3321 } |
| OLD | NEW |