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

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

Issue 2692653003: [Devtools] Added Enable/Disable for request blocking in network (Closed)
Patch Set: changes Created 3 years, 10 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this); 100 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.WillReloadPage, this ._willReloadPage, this);
101 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this); 101 SDK.targetManager.addModelListener(SDK.ResourceTreeModel, SDK.ResourceTreeMo del.Events.Load, this._load, this);
102 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this); 102 this._networkLogView.addEventListener(Network.NetworkLogView.Events.RequestS elected, this._onRequestSelected, this);
103 this._networkLogView.addEventListener( 103 this._networkLogView.addEventListener(
104 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this); 104 Network.NetworkLogView.Events.SearchCountUpdated, this._onSearchCountUpd ated, this);
105 this._networkLogView.addEventListener( 105 this._networkLogView.addEventListener(
106 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this); 106 Network.NetworkLogView.Events.SearchIndexUpdated, this._onSearchIndexUpd ated, this);
107 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this); 107 this._networkLogView.addEventListener(Network.NetworkLogView.Events.UpdateRe quest, this._onUpdateRequest, this);
108 108
109 Components.DataSaverInfobar.maybeShowInPanel(this); 109 Components.DataSaverInfobar.maybeShowInPanel(this);
110
111 var manager = SDK.multitargetNetworkManager;
112 manager.on(SDK.MultitargetNetworkManager.RequestBlockingEnabledChangedEvent, updateVisibility.bind(this));
113 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateVisibility.bind(this));
114 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
115 blockedURLsSetting.addChangeListener(updateVisibility.bind(this));
116
117 /**
118 * @this {Network.NetworkPanel}
119 */
120 function updateVisibility() {
pfeldman 2017/02/22 00:02:46 You need to call it immediately as well - what if
allada 2017/03/03 20:14:02 Done.
121 var icon = null;
122 if (manager.isThrottling()) {
123 icon = UI.Icon.create('smallicon-warning');
124 icon.title = Common.UIString('Network throttling is enabled');
125 } else if (SDK.multitargetNetworkManager.isRequestBlockingEnabled() && blo ckedURLsSetting.get().length) {
126 icon = UI.Icon.create('smallicon-warning');
127 icon.title = Common.UIString('Requests may be blocked');
pfeldman 2017/02/22 00:02:46 In this case you can go even further and report th
allada 2017/03/03 20:14:02 We report which requests are blocked in the networ
128 }
129 UI.inspectorView.setPanelIcon(this.name, icon);
130 }
110 } 131 }
111 132
112 /** 133 /**
113 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters 134 * @param {!Array<{filterType: !Network.NetworkLogView.FilterType, filterValue : string}>} filters
114 */ 135 */
115 static revealAndFilter(filters) { 136 static revealAndFilter(filters) {
116 var panel = Network.NetworkPanel._instance(); 137 var panel = Network.NetworkPanel._instance();
117 var filterString = ''; 138 var filterString = '';
118 for (var filter of filters) 139 for (var filter of filters)
119 filterString += `${filter.filterType}:${filter.filterValue} `; 140 filterString += `${filter.filterType}:${filter.filterValue} `;
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 * @param {string} actionId 747 * @param {string} actionId
727 * @return {boolean} 748 * @return {boolean}
728 */ 749 */
729 handleAction(context, actionId) { 750 handleAction(context, actionId) {
730 var panel = UI.context.flavor(Network.NetworkPanel); 751 var panel = UI.context.flavor(Network.NetworkPanel);
731 console.assert(panel && panel instanceof Network.NetworkPanel); 752 console.assert(panel && panel instanceof Network.NetworkPanel);
732 panel._toggleRecording(); 753 panel._toggleRecording();
733 return true; 754 return true;
734 } 755 }
735 }; 756 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698