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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestUpdated, this._onRequestUpdated, this); | 79 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestUpdated, this._onRequestUpdated, this); |
80 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestFinished, this._onRequestUpdated, this); | 80 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestFinished, this._onRequestUpdated, this); |
81 | 81 |
82 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.WillReloadPage, this._willReloadPage, this); | 82 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.WillReloadPage, this._willReloadPage, this); |
83 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); | 83 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); |
84 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.Load, this._loadEventFired, this); | 84 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.Load, this._loadEventFired, this); |
85 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); | 85 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); |
86 | 86 |
87 this._addFilters(); | 87 this._addFilters(); |
88 this._initializeView(); | 88 this._initializeView(); |
| 89 this._recordButton.toggled = true; |
| 90 WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this)); |
89 } | 91 } |
90 | 92 |
91 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr
ue, "wss": true}; | 93 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr
ue, "wss": true}; |
92 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti
on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified"
, "Server", "Vary"]; | 94 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti
on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified"
, "Server", "Vary"]; |
93 WebInspector.NetworkLogView._defaultColumnsVisibility = { | 95 WebInspector.NetworkLogView._defaultColumnsVisibility = { |
94 method: true, status: true, scheme: false, domain: false, type: true, initia
tor: true, cookies: false, setCookies: false, size: true, time: true, | 96 method: true, status: true, scheme: false, domain: false, type: true, initia
tor: true, cookies: false, setCookies: false, size: true, time: true, |
95 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con
tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false,
"Server": false, "Vary": false | 97 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con
tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false,
"Server": false, "Vary": false |
96 }; | 98 }; |
97 WebInspector.NetworkLogView._defaultRefreshDelay = 500; | 99 WebInspector.NetworkLogView._defaultRefreshDelay = 500; |
98 | 100 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Enable faster hint. | 143 // Enable faster hint. |
142 this._popoverHelper.setTimeout(100); | 144 this._popoverHelper.setTimeout(100); |
143 | 145 |
144 this.calculator = new WebInspector.NetworkTransferTimeCalculator(); | 146 this.calculator = new WebInspector.NetworkTransferTimeCalculator(); |
145 | 147 |
146 this.switchToDetailedView(); | 148 this.switchToDetailedView(); |
147 }, | 149 }, |
148 | 150 |
149 get statusBarItems() | 151 get statusBarItems() |
150 { | 152 { |
151 return [this._recordButton.element, this._clearButton.element, this._fil
terBar.filterButton(), this._largerRequestsButton.element, this._progressBarCont
ainer]; | 153 return [this._recordButton.element, this._clearButton.element, this._fil
terBar.filterButton(), this._largerRequestsButton.element, this._preserveLogChec
kbox.element, this._progressBarContainer]; |
152 }, | 154 }, |
153 | 155 |
154 get useLargeRows() | 156 get useLargeRows() |
155 { | 157 { |
156 return WebInspector.settings.resourcesLargeRows.get(); | 158 return WebInspector.settings.resourcesLargeRows.get(); |
157 }, | 159 }, |
158 | 160 |
159 set allowPopover(flag) | 161 set allowPopover(flag) |
160 { | 162 { |
161 this._allowPopover = flag; | 163 this._allowPopover = flag; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 { | 618 { |
617 this._recordButton = new WebInspector.StatusBarButton(WebInspector.UIStr
ing("Record Network Log"), "record-profile-status-bar-item"); | 619 this._recordButton = new WebInspector.StatusBarButton(WebInspector.UIStr
ing("Record Network Log"), "record-profile-status-bar-item"); |
618 this._recordButton.addEventListener("click", this._onRecordButtonClicked
, this); | 620 this._recordButton.addEventListener("click", this._onRecordButtonClicked
, this); |
619 | 621 |
620 this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIStri
ng("Clear"), "clear-status-bar-item"); | 622 this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIStri
ng("Clear"), "clear-status-bar-item"); |
621 this._clearButton.addEventListener("click", this._reset, this); | 623 this._clearButton.addEventListener("click", this._reset, this); |
622 | 624 |
623 this._largerRequestsButton = new WebInspector.StatusBarButton(WebInspect
or.UIString("Use small resource rows."), "network-larger-resources-status-bar-it
em"); | 625 this._largerRequestsButton = new WebInspector.StatusBarButton(WebInspect
or.UIString("Use small resource rows."), "network-larger-resources-status-bar-it
em"); |
624 this._largerRequestsButton.toggled = WebInspector.settings.resourcesLarg
eRows.get(); | 626 this._largerRequestsButton.toggled = WebInspector.settings.resourcesLarg
eRows.get(); |
625 this._largerRequestsButton.addEventListener("click", this._toggleLargerR
equests, this); | 627 this._largerRequestsButton.addEventListener("click", this._toggleLargerR
equests, this); |
| 628 |
| 629 this._preserveLogCheckbox = new WebInspector.StatusBarCheckbox(WebInspec
tor.UIString("Preserve log")); |
626 }, | 630 }, |
627 | 631 |
628 _loadEventFired: function(event) | 632 _loadEventFired: function(event) |
629 { | 633 { |
630 if (!this._recordButton.toggled) | 634 if (!this._recordButton.toggled) |
631 return; | 635 return; |
632 if (!this._userInitiatedRecording) | |
633 this._recordButton.toggled = false; | |
634 | 636 |
635 this._mainRequestLoadTime = event.data || -1; | 637 this._mainRequestLoadTime = event.data || -1; |
636 // Schedule refresh to update boundaries and draw the new line. | 638 // Schedule refresh to update boundaries and draw the new line. |
637 this._scheduleRefresh(); | 639 this._scheduleRefresh(); |
638 }, | 640 }, |
639 | 641 |
640 _domContentLoadedEventFired: function(event) | 642 _domContentLoadedEventFired: function(event) |
641 { | 643 { |
642 if (!this._recordButton.toggled) | 644 if (!this._recordButton.toggled) |
643 return; | 645 return; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 this._sortItems(); | 704 this._sortItems(); |
703 this._updateSummaryBar(); | 705 this._updateSummaryBar(); |
704 this._dataGrid.updateWidths(); | 706 this._dataGrid.updateWidths(); |
705 // FIXME: evaluate performance impact of moving this before a call to so
rtItems() | 707 // FIXME: evaluate performance impact of moving this before a call to so
rtItems() |
706 if (wasScrolledToLastRow) | 708 if (wasScrolledToLastRow) |
707 this._dataGrid.scrollToLastRow(); | 709 this._dataGrid.scrollToLastRow(); |
708 }, | 710 }, |
709 | 711 |
710 _onRecordButtonClicked: function(e) | 712 _onRecordButtonClicked: function(e) |
711 { | 713 { |
| 714 if (!this._recordButton.toggled) |
| 715 this._reset(); |
712 this._recordButton.toggled = !this._recordButton.toggled; | 716 this._recordButton.toggled = !this._recordButton.toggled; |
713 this._userInitiatedRecording = this._recordButton.toggled; | |
714 delete this._truncateLogAfterNavigation; | |
715 }, | 717 }, |
716 | 718 |
717 _reset: function() | 719 _reset: function() |
718 { | 720 { |
719 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Vie
wCleared); | 721 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Vie
wCleared); |
720 | 722 |
721 this._clearSearchMatchedList(); | 723 this._clearSearchMatchedList(); |
722 if (this._popoverHelper) | 724 if (this._popoverHelper) |
723 this._popoverHelper.hidePopover(); | 725 this._popoverHelper.hidePopover(); |
724 | 726 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 _refreshRequest: function(request) | 799 _refreshRequest: function(request) |
798 { | 800 { |
799 if (!this._requestsById[request.requestId]) | 801 if (!this._requestsById[request.requestId]) |
800 return; | 802 return; |
801 this._staleRequests[request.requestId] = request; | 803 this._staleRequests[request.requestId] = request; |
802 this._scheduleRefresh(); | 804 this._scheduleRefresh(); |
803 }, | 805 }, |
804 | 806 |
805 _willReloadPage: function(event) | 807 _willReloadPage: function(event) |
806 { | 808 { |
807 if (this._userInitiatedRecording) | |
808 return; | |
809 if (!this.isShowing()) | |
810 return; | |
811 this._recordButton.toggled = true; | 809 this._recordButton.toggled = true; |
812 this._truncateLogAfterNavigation = true; | 810 if (!this._preserveLogCheckbox.checked()) |
813 this._reset(); | 811 this._reset(); |
814 }, | 812 }, |
815 | 813 |
816 /** | 814 /** |
817 * @param {WebInspector.Event} event | 815 * @param {WebInspector.Event} event |
818 */ | 816 */ |
819 _mainFrameNavigated: function(event) | 817 _mainFrameNavigated: function(event) |
820 { | 818 { |
821 if (!this._truncateLogAfterNavigation) | 819 if (!this._recordButton.toggled || this._preserveLogCheckbox.checked()) |
822 return; | 820 return; |
823 delete this._truncateLogAfterNavigation; | |
824 | 821 |
825 var frame = /** @type {WebInspector.ResourceTreeFrame} */ (event.data); | 822 var frame = /** @type {WebInspector.ResourceTreeFrame} */ (event.data); |
826 var loaderId = frame.loaderId; | 823 var loaderId = frame.loaderId; |
827 | 824 |
828 // Pick provisional load requests. | 825 // Pick provisional load requests. |
829 var requestsToPick = []; | 826 var requestsToPick = []; |
830 var requests = WebInspector.networkLog.requests; | 827 var requests = WebInspector.networkLog.requests; |
831 for (var i = 0; i < requests.length; ++i) { | 828 for (var i = 0; i < requests.length; ++i) { |
832 var request = requests[i]; | 829 var request = requests[i]; |
833 if (request.loaderId === loaderId) | 830 if (request.loaderId === loaderId) |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) | 2546 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) |
2550 { | 2547 { |
2551 var aValue = a._request[propertyName]; | 2548 var aValue = a._request[propertyName]; |
2552 var bValue = b._request[propertyName]; | 2549 var bValue = b._request[propertyName]; |
2553 if (aValue > bValue) | 2550 if (aValue > bValue) |
2554 return revert ? -1 : 1; | 2551 return revert ? -1 : 1; |
2555 if (bValue > aValue) | 2552 if (bValue > aValue) |
2556 return revert ? 1 : -1; | 2553 return revert ? 1 : -1; |
2557 return 0; | 2554 return 0; |
2558 } | 2555 } |
OLD | NEW |