Changeset 225895 in webkit
- Timestamp:
- Dec 13, 2017 11:45:29 PM (6 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r225892 r225895 1 2017-12-13 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Network Tab - Make text filter just a URL filter and update incrementally 4 https://bugs.webkit.org/show_bug.cgi?id=180796 5 6 Reviewed by Brian Burg. 7 8 Revert the Network Tab's text filter back to being just a URL filter with the 9 normal behaviors of our other text filters that update as you type (incremental). 10 This also renames the "text filter" to "url filter" everywhere in the ContentView 11 for clarity. A follow-up change will make the url filter be case-insensitive 12 to fully match the filter bars in other tabs. 13 14 * Localizations/en.lproj/localizedStrings.js: 15 * UserInterface/Views/NetworkTableContentView.js: 16 (WI.NetworkTableContentView): 17 (WI.NetworkTableContentView.prototype.get filterNavigationItems): 18 (WI.NetworkTableContentView.prototype._checkURLFilterAgainstFinishedResource): 19 (WI.NetworkTableContentView.prototype._updateURLFilterActiveIndicator): 20 (WI.NetworkTableContentView.prototype._resourceLoadingDidFinish): 21 (WI.NetworkTableContentView.prototype._resourceLoadingDidFail): 22 (WI.NetworkTableContentView.prototype._hasURLFilter): 23 (WI.NetworkTableContentView.prototype._hasActiveFilter): 24 (WI.NetworkTableContentView.prototype._passURLFilter): 25 (WI.NetworkTableContentView.prototype._passFilter): 26 (WI.NetworkTableContentView.prototype._updateFilteredEntries): 27 (WI.NetworkTableContentView.prototype._resetFilters): 28 (WI.NetworkTableContentView.prototype._urlFilterDidChange): 29 (WI.NetworkTableContentView.prototype._checkTextFilterAgainstFinishedResource): Deleted. 30 (WI.NetworkTableContentView.prototype._checkTextFilterAgainstFailedResource): Deleted. 31 (WI.NetworkTableContentView.prototype._updateTextFilterActiveIndicator): Deleted. 32 (WI.NetworkTableContentView.prototype._hasTextFilter): Deleted. 33 (WI.NetworkTableContentView.prototype._passTextFilter): Deleted. 34 (WI.NetworkTableContentView.prototype._textFilterDidChange): Deleted. 35 1 36 2017-12-13 Joseph Pecoraro <pecoraro@apple.com> 2 37 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r225663 r225895 415 415 localizedStrings["Fill Mode"] = "Fill Mode"; 416 416 localizedStrings["Filter"] = "Filter"; 417 localizedStrings["Filter Full URL and Text"] = "Filter Full URL and Text";417 localizedStrings["Filter Full URL"] = "Filter Full URL"; 418 418 localizedStrings["Flexbox"] = "Flexbox"; 419 419 localizedStrings["Float"] = "Float"; -
trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
r225487 r225895 83 83 this._typeFilterScopeBar.addEventListener(WI.ScopeBar.Event.SelectionChanged, this._typeFilterScopeBarSelectionChanged, this); 84 84 85 this._textFilterSearchId = 0; 86 this._textFilterSearchText = null; 87 this._textFilterIsActive = false; 88 89 this._textFilterNavigationItem = new WI.FilterBarNavigationItem; 90 this._textFilterNavigationItem.filterBar.incremental = false; 91 this._textFilterNavigationItem.filterBar.addEventListener(WI.FilterBar.Event.FilterDidChange, this._textFilterDidChange, this); 92 this._textFilterNavigationItem.filterBar.placeholder = WI.UIString("Filter Full URL and Text"); 85 this._urlFilterSearchText = null; 86 this._urlFilterIsActive = false; 87 88 this._urlFilterNavigationItem = new WI.FilterBarNavigationItem; 89 this._urlFilterNavigationItem.filterBar.addEventListener(WI.FilterBar.Event.FilterDidChange, this._urlFilterDidChange, this); 90 this._urlFilterNavigationItem.filterBar.placeholder = WI.UIString("Filter Full URL"); 93 91 94 92 this._activeTypeFilters = this._generateTypeFilter(); 95 this._active TextFilterResources = new Set;93 this._activeURLFilterResources = new Set; 96 94 97 95 this._emptyFilterResultsMessageElement = null; … … 202 200 get filterNavigationItems() 203 201 { 204 let items = []; 205 if (window.PageAgent) 206 items.push(this._textFilterNavigationItem); 207 items.push(this._typeFilterScopeBar); 208 return items; 202 return [this._urlFilterNavigationItem, this._typeFilterScopeBar]; 209 203 } 210 204 … … 911 905 } 912 906 913 _checkTextFilterAgainstFinishedResource(resource) 914 { 915 let frame = resource.parentFrame; 916 if (!frame) 917 return; 918 919 let searchQuery = this._textFilterSearchText; 920 if (resource.url.includes(searchQuery)) { 921 this._activeTextFilterResources.add(resource); 922 return; 923 } 924 925 let searchId = this._textFilterSearchId; 926 927 const isCaseSensitive = true; 928 const isRegex = false; 929 PageAgent.searchInResource(frame.id, resource.url, searchQuery, isCaseSensitive, isRegex, resource.requestIdentifier, (error, searchResults) => { 930 if (searchId !== this._textFilterSearchId) 931 return; 932 933 if (error || !searchResults || !searchResults.length) 934 return; 935 936 this._activeTextFilterResources.add(resource); 937 938 this._pendingFilter = true; 939 this.needsLayout(); 940 }); 941 } 942 943 _checkTextFilterAgainstFailedResource(resource) 944 { 945 let searchQuery = this._textFilterSearchText; 907 _checkURLFilterAgainstFinishedResource(resource) 908 { 909 let searchQuery = this._urlFilterSearchText; 946 910 if (resource.url.includes(searchQuery)) 947 this._active TextFilterResources.add(resource);911 this._activeURLFilterResources.add(resource); 948 912 } 949 913 … … 1027 991 } 1028 992 1029 _update TextFilterActiveIndicator()1030 { 1031 this._ textFilterNavigationItem.filterBar.indicatingActive = this._hasTextFilter();993 _updateURLFilterActiveIndicator() 994 { 995 this._urlFilterNavigationItem.filterBar.indicatingActive = this._hasURLFilter(); 1032 996 } 1033 997 … … 1113 1077 this._waterfallEndTime = resource.timingData.responseEnd; 1114 1078 1115 if (this._has TextFilter())1116 this._check TextFilterAgainstFinishedResource(resource);1079 if (this._hasURLFilter()) 1080 this._checkURLFilterAgainstFinishedResource(resource); 1117 1081 1118 1082 this.needsLayout(); … … 1129 1093 this._waterfallEndTime = resource.timingData.responseEnd; 1130 1094 1131 if (this._has TextFilter())1132 this._check TextFilterAgainstFailedResource(resource);1095 if (this._hasURLFilter()) 1096 this._checkURLFilterAgainstFinishedResource(resource); 1133 1097 1134 1098 this.needsLayout(); … … 1246 1210 } 1247 1211 1248 _has TextFilter()1249 { 1250 return this._ textFilterIsActive;1212 _hasURLFilter() 1213 { 1214 return this._urlFilterIsActive; 1251 1215 } 1252 1216 … … 1254 1218 { 1255 1219 return this._hasTypeFilter() 1256 || this._has TextFilter();1220 || this._hasURLFilter(); 1257 1221 } 1258 1222 … … 1264 1228 } 1265 1229 1266 _pass TextFilter(entry)1267 { 1268 if (!this._has TextFilter())1230 _passURLFilter(entry) 1231 { 1232 if (!this._hasURLFilter()) 1269 1233 return true; 1270 return this._active TextFilterResources.has(entry.resource);1234 return this._activeURLFilterResources.has(entry.resource); 1271 1235 } 1272 1236 … … 1274 1238 { 1275 1239 return this._passTypeFilter(entry) 1276 && this._pass TextFilter(entry);1240 && this._passURLFilter(entry); 1277 1241 } 1278 1242 … … 1292 1256 this._restoreSelectedRow(); 1293 1257 1294 this._update TextFilterActiveIndicator();1258 this._updateURLFilterActiveIndicator(); 1295 1259 this._updateEmptyFilterResultsMessage(); 1296 1260 } … … 1309 1273 console.assert(this._hasActiveFilter()); 1310 1274 1311 // Clear text filter. 1312 this._textFilterSearchId++; 1313 this._textFilterNavigationItem.filterBar.indicatingProgress = false; 1314 this._textFilterSearchText = null; 1315 this._textFilterIsActive = false; 1316 this._activeTextFilterResources.clear(); 1317 this._textFilterNavigationItem.filterBar.clear(); 1318 console.assert(!this._hasTextFilter()); 1275 // Clear url filter. 1276 this._urlFilterSearchText = null; 1277 this._urlFilterIsActive = false; 1278 this._activeURLFilterResources.clear(); 1279 this._urlFilterNavigationItem.filterBar.clear(); 1280 console.assert(!this._hasURLFilter()); 1319 1281 1320 1282 // Clear type filter. … … 1362 1324 } 1363 1325 1364 _ textFilterDidChange(event)1365 { 1366 let searchQuery = this._ textFilterNavigationItem.filterBar.filters.text;1367 if (searchQuery === this._ textFilterSearchText)1326 _urlFilterDidChange(event) 1327 { 1328 let searchQuery = this._urlFilterNavigationItem.filterBar.filters.text; 1329 if (searchQuery === this._urlFilterSearchText) 1368 1330 return; 1369 1331 … … 1371 1333 this._hideResourceDetailView(); 1372 1334 1373 let searchId = ++this._textFilterSearchId;1374 1375 1335 // Search cleared. 1376 1336 if (!searchQuery) { 1377 this._textFilterNavigationItem.filterBar.indicatingProgress = false; 1378 this._textFilterSearchText = null; 1379 this._textFilterIsActive = false; 1380 this._activeTextFilterResources.clear(); 1337 this._urlFilterSearchText = null; 1338 this._urlFilterIsActive = false; 1339 this._activeURLFilterResources.clear(); 1381 1340 1382 1341 this._updateFilteredEntries(); … … 1385 1344 } 1386 1345 1387 this._textFilterSearchText = searchQuery; 1388 this._textFilterNavigationItem.filterBar.indicatingProgress = true; 1389 1390 // NetworkTable text filter currently searches: 1391 // - Resource URL 1392 // - Resource Text Content 1393 // It does not search all the content in the table (like mimeType, headers, etc). 1394 // For those we should provide more custom filters. 1395 1396 const isCaseSensitive = true; 1397 const isRegex = false; 1398 PageAgent.searchInResources(searchQuery, isCaseSensitive, isRegex, (error, searchResults) => { 1399 if (searchId !== this._textFilterSearchId) 1400 return; 1401 1402 this._textFilterIsActive = true; 1403 this._activeTextFilterResources.clear(); 1404 this._textFilterNavigationItem.filterBar.indicatingProgress = false; 1405 1406 // Add resources based on URL. 1407 for (let entry of this._entries) { 1408 let resource = entry.resource; 1409 if (resource.url.includes(searchQuery)) 1410 this._activeTextFilterResources.add(resource); 1411 } 1412 1413 // Add resources based on content. 1414 if (!error) { 1415 for (let {url, frameId, requestId} of searchResults) { 1416 if (requestId) { 1417 let resource = WI.frameResourceManager.resourceForRequestIdentifier(requestId); 1418 if (resource) { 1419 this._activeTextFilterResources.add(resource); 1420 continue; 1421 } 1422 } 1423 1424 if (frameId && url) { 1425 let frame = WI.frameResourceManager.frameForIdentifier(frameId); 1426 if (frame) { 1427 if (frame.mainResource.url === url) { 1428 this._activeTextFilterResources.add(frame.mainResource); 1429 continue; 1430 } 1431 let resource = frame.resourceForURL(url); 1432 if (resource) { 1433 this._activeTextFilterResources.add(resource); 1434 continue; 1435 } 1436 } 1437 } 1438 } 1439 } 1440 1441 // Apply. 1442 this._updateFilteredEntries(); 1443 this._table.reloadData(); 1444 }); 1346 this._urlFilterIsActive = true; 1347 this._urlFilterSearchText = searchQuery; 1348 this._activeURLFilterResources.clear(); 1349 1350 for (let entry of this._entries) { 1351 let resource = entry.resource; 1352 if (resource.url.includes(searchQuery)) 1353 this._activeURLFilterResources.add(resource); 1354 } 1355 1356 this._updateFilteredEntries(); 1357 this._table.reloadData(); 1445 1358 } 1446 1359
Note: See TracChangeset
for help on using the changeset viewer.