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

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

Issue 1992093002: [Devtools] Fixed regression with negative filters in networking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/network/network-filters-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 if (confirm(WebInspector.UIString("Are you sure you want to clear browse r cookies?"))) 1489 if (confirm(WebInspector.UIString("Are you sure you want to clear browse r cookies?")))
1490 WebInspector.multitargetNetworkManager.clearBrowserCookies(); 1490 WebInspector.multitargetNetworkManager.clearBrowserCookies();
1491 }, 1491 },
1492 1492
1493 /** 1493 /**
1494 * @param {!WebInspector.NetworkRequest} request 1494 * @param {!WebInspector.NetworkRequest} request
1495 * @return {boolean} 1495 * @return {boolean}
1496 */ 1496 */
1497 _matchRequest: function(request) 1497 _matchRequest: function(request)
1498 { 1498 {
1499 var re = this._searchRegExp; 1499 var re = this._searchRegex;
1500 if (!re) 1500 if (!re)
1501 return false; 1501 return false;
1502 return re.test(request.name()) || (this._networkLogLargeRowsSetting.get( ) && re.test(request.path())); 1502 return re.test(request.name()) || (this._networkLogLargeRowsSetting.get( ) && re.test(request.path()));
1503 }, 1503 },
1504 1504
1505 _clearSearchMatchedList: function() 1505 _clearSearchMatchedList: function()
1506 { 1506 {
1507 this._matchedRequestCount = -1; 1507 this._matchedRequestCount = -1;
1508 this._currentMatchedRequestNode = null; 1508 this._currentMatchedRequestNode = null;
1509 this._removeAllHighlights(); 1509 this._removeAllHighlights();
(...skipping 29 matching lines...) Expand all
1539 } 1539 }
1540 } 1540 }
1541 if (!node) { 1541 if (!node) {
1542 this._currentMatchedRequestNode = null; 1542 this._currentMatchedRequestNode = null;
1543 return; 1543 return;
1544 } 1544 }
1545 1545
1546 var request = node.request(); 1546 var request = node.request();
1547 if (reveal) 1547 if (reveal)
1548 WebInspector.Revealer.reveal(request); 1548 WebInspector.Revealer.reveal(request);
1549 var highlightedSubstringChanges = node.highlightMatchedSubstring(this._s earchRegExp); 1549 var highlightedSubstringChanges = node.highlightMatchedSubstring(this._s earchRegex);
1550 this._highlightedSubstringChanges.push(highlightedSubstringChanges); 1550 this._highlightedSubstringChanges.push(highlightedSubstringChanges);
1551 1551
1552 this._currentMatchedRequestNode = node; 1552 this._currentMatchedRequestNode = node;
1553 this._currentMatchedRequestIndex = n; 1553 this._currentMatchedRequestIndex = n;
1554 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchIndexUpdated, n); 1554 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchIndexUpdated, n);
1555 }, 1555 },
1556 1556
1557 /** 1557 /**
1558 * @override 1558 * @override
1559 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig 1559 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig
1560 * @param {boolean} shouldJump 1560 * @param {boolean} shouldJump
1561 * @param {boolean=} jumpBackwards 1561 * @param {boolean=} jumpBackwards
1562 */ 1562 */
1563 performSearch: function(searchConfig, shouldJump, jumpBackwards) 1563 performSearch: function(searchConfig, shouldJump, jumpBackwards)
1564 { 1564 {
1565 var query = searchConfig.query; 1565 var query = searchConfig.query;
1566 var currentMatchedRequestNode = this._currentMatchedRequestNode; 1566 var currentMatchedRequestNode = this._currentMatchedRequestNode;
1567 this._clearSearchMatchedList(); 1567 this._clearSearchMatchedList();
1568 this._searchRegExp = createPlainTextSearchRegex(query, "i"); 1568 this._searchRegex = createPlainTextSearchRegex(query, "i");
1569 1569
1570 /** @type {!Array.<!WebInspector.NetworkDataGridNode>} */ 1570 /** @type {!Array.<!WebInspector.NetworkDataGridNode>} */
1571 var nodes = this._dataGrid.rootNode().children; 1571 var nodes = this._dataGrid.rootNode().children;
1572 for (var i = 0; i < nodes.length; ++i) 1572 for (var i = 0; i < nodes.length; ++i)
1573 nodes[i][WebInspector.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchRequest(nodes[i].request()); 1573 nodes[i][WebInspector.NetworkLogView._isMatchingSearchQuerySymbol] = this._matchRequest(nodes[i].request());
1574 var newMatchedRequestIndex = this._updateMatchCountAndFindMatchIndex(cur rentMatchedRequestNode); 1574 var newMatchedRequestIndex = this._updateMatchCountAndFindMatchIndex(cur rentMatchedRequestNode);
1575 if (!newMatchedRequestIndex && jumpBackwards) 1575 if (!newMatchedRequestIndex && jumpBackwards)
1576 newMatchedRequestIndex = this._matchedRequestCount - 1; 1576 newMatchedRequestIndex = this._matchedRequestCount - 1;
1577 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, should Jump); 1577 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, should Jump);
1578 }, 1578 },
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 } 1672 }
1673 }, 1673 },
1674 1674
1675 /** 1675 /**
1676 * @param {string} text 1676 * @param {string} text
1677 * @return {!WebInspector.NetworkLogView.Filter} 1677 * @return {!WebInspector.NetworkLogView.Filter}
1678 */ 1678 */
1679 _createTextFilter: function(text) 1679 _createTextFilter: function(text)
1680 { 1680 {
1681 var negative = false; 1681 var negative = false;
1682 /** @type {?RegExp} */
1683 var regex;
1682 if (!this._textFilterUI.isRegexChecked() && text[0] === "-" && text.leng th > 1) { 1684 if (!this._textFilterUI.isRegexChecked() && text[0] === "-" && text.leng th > 1) {
1683 negative = true; 1685 negative = true;
1684 text = text.substring(1); 1686 text = text.substring(1);
1687 regex = new RegExp(text.escapeForRegExp(), "i");
1688 } else {
1689 regex = this._textFilterUI.regex();
1685 } 1690 }
1686 var regexp = this._textFilterUI.regex();
1687 1691
1688 var filter = WebInspector.NetworkLogView._requestNameOrPathFilter.bind(n ull, regexp); 1692 var filter = WebInspector.NetworkLogView._requestNameOrPathFilter.bind(n ull, regex);
1689 if (negative) 1693 if (negative)
1690 filter = WebInspector.NetworkLogView._negativeFilter.bind(null, filt er); 1694 filter = WebInspector.NetworkLogView._negativeFilter.bind(null, filt er);
1691 return filter; 1695 return filter;
1692 }, 1696 },
1693 1697
1694 /** 1698 /**
1695 * @param {!WebInspector.NetworkLogView.FilterType} type 1699 * @param {!WebInspector.NetworkLogView.FilterType} type
1696 * @param {string} value 1700 * @param {string} value
1697 * @param {boolean} negative 1701 * @param {boolean} negative
1698 * @return {!WebInspector.NetworkLogView.Filter} 1702 * @return {!WebInspector.NetworkLogView.Filter}
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 return; 1806 return;
1803 var index = this._normalizeSearchResultIndex(this._currentMatchedRequest Index + 1); 1807 var index = this._normalizeSearchResultIndex(this._currentMatchedRequest Index + 1);
1804 this._highlightNthMatchedRequestForSearch(index, true); 1808 this._highlightNthMatchedRequestForSearch(index, true);
1805 }, 1809 },
1806 1810
1807 /** 1811 /**
1808 * @override 1812 * @override
1809 */ 1813 */
1810 searchCanceled: function() 1814 searchCanceled: function()
1811 { 1815 {
1812 delete this._searchRegExp; 1816 delete this._searchRegex;
1813 this._clearSearchMatchedList(); 1817 this._clearSearchMatchedList();
1814 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, 0); 1818 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, 0);
1815 }, 1819 },
1816 1820
1817 /** 1821 /**
1818 * @param {!WebInspector.NetworkRequest} request 1822 * @param {!WebInspector.NetworkRequest} request
1819 */ 1823 */
1820 revealAndHighlightRequest: function(request) 1824 revealAndHighlightRequest: function(request)
1821 { 1825 {
1822 this._removeAllNodeHighlights(); 1826 this._removeAllNodeHighlights();
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 return false; 2187 return false;
2184 return true; 2188 return true;
2185 } 2189 }
2186 2190
2187 WebInspector.NetworkLogView.EventTypes = { 2191 WebInspector.NetworkLogView.EventTypes = {
2188 RequestSelected: "RequestSelected", 2192 RequestSelected: "RequestSelected",
2189 SearchCountUpdated: "SearchCountUpdated", 2193 SearchCountUpdated: "SearchCountUpdated",
2190 SearchIndexUpdated: "SearchIndexUpdated", 2194 SearchIndexUpdated: "SearchIndexUpdated",
2191 UpdateRequest: "UpdateRequest" 2195 UpdateRequest: "UpdateRequest"
2192 }; 2196 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/network/network-filters-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698