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

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

Issue 1817193003: [DevTools] Added regex support in search for network tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js » ('j') | 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 }, 245 },
246 246
247 clearSelection: function() 247 clearSelection: function()
248 { 248 {
249 if (this._dataGrid.selectedNode) 249 if (this._dataGrid.selectedNode)
250 this._dataGrid.selectedNode.deselect(); 250 this._dataGrid.selectedNode.deselect();
251 }, 251 },
252 252
253 _addFilters: function() 253 _addFilters: function()
254 { 254 {
255 this._textFilterUI = new WebInspector.TextFilterUI(); 255 this._textFilterUI = new WebInspector.TextFilterUI(true);
256 this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterC hanged, this._filterChanged, this); 256 this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterC hanged, this._filterChanged, this);
257 this._filterBar.addFilter(this._textFilterUI); 257 this._filterBar.addFilter(this._textFilterUI);
258 258
259 var dataURLSetting = this._networkHideDataURLSetting; 259 var dataURLSetting = this._networkHideDataURLSetting;
260 this._dataURLFilterUI = new WebInspector.CheckboxFilterUI("hide-data-url ", WebInspector.UIString("Hide data URLs"), true, dataURLSetting); 260 this._dataURLFilterUI = new WebInspector.CheckboxFilterUI("hide-data-url ", WebInspector.UIString("Hide data URLs"), true, dataURLSetting);
261 this._dataURLFilterUI.addEventListener(WebInspector.FilterUI.Events.Filt erChanged, this._filterChanged.bind(this), this); 261 this._dataURLFilterUI.addEventListener(WebInspector.FilterUI.Events.Filt erChanged, this._filterChanged.bind(this), this);
262 this._filterBar.addFilter(this._dataURLFilterUI); 262 this._filterBar.addFilter(this._dataURLFilterUI);
263 263
264 var filterItems = []; 264 var filterItems = [];
265 for (var categoryId in WebInspector.resourceCategories) { 265 for (var categoryId in WebInspector.resourceCategories) {
(...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 { 1563 {
1564 return false; 1564 return false;
1565 }, 1565 },
1566 1566
1567 /** 1567 /**
1568 * @override 1568 * @override
1569 * @return {boolean} 1569 * @return {boolean}
1570 */ 1570 */
1571 supportsRegexSearch: function() 1571 supportsRegexSearch: function()
1572 { 1572 {
1573 return false; 1573 return true;
1574 }, 1574 },
1575 1575
1576 /** 1576 /**
1577 * @param {?WebInspector.NetworkDataGridNode} node 1577 * @param {?WebInspector.NetworkDataGridNode} node
1578 * @return {number} 1578 * @return {number}
1579 */ 1579 */
1580 _updateMatchCountAndFindMatchIndex: function(node) 1580 _updateMatchCountAndFindMatchIndex: function(node)
1581 { 1581 {
1582 /** @type {!Array.<!WebInspector.NetworkDataGridNode>} */ 1582 /** @type {!Array.<!WebInspector.NetworkDataGridNode>} */
1583 var nodes = this._dataGrid.rootNode().children; 1583 var nodes = this._dataGrid.rootNode().children;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 return false; 1627 return false;
1628 } 1628 }
1629 return true; 1629 return true;
1630 }, 1630 },
1631 1631
1632 /** 1632 /**
1633 * @param {string} query 1633 * @param {string} query
1634 */ 1634 */
1635 _parseFilterQuery: function(query) 1635 _parseFilterQuery: function(query)
1636 { 1636 {
1637 var parsedQuery = this._suggestionBuilder.parseQuery(query); 1637 var parsedQuery;
1638 this._filters = parsedQuery.text.map(this._createTextFilter); 1638 if (this._textFilterUI.isRegexChecked() && query !== "")
1639 parsedQuery = {text: [query], filters: []};
1640 else
1641 parsedQuery = this._suggestionBuilder.parseQuery(query);
1642
1643 this._filters = parsedQuery.text.map(this._createTextFilter, this);
1644
1639 var n = parsedQuery.filters.length; 1645 var n = parsedQuery.filters.length;
1640 for (var i = 0; i < n; ++i) { 1646 for (var i = 0; i < n; ++i) {
1641 var filter = parsedQuery.filters[i]; 1647 var filter = parsedQuery.filters[i];
1642 var filterType = /** @type {!WebInspector.NetworkLogView.FilterType} */ (filter.type.toLowerCase()); 1648 var filterType = /** @type {!WebInspector.NetworkLogView.FilterType} */ (filter.type.toLowerCase());
1643 this._filters.push(this._createFilter(filterType, filter.data, filte r.negative)); 1649 this._filters.push(this._createFilter(filterType, filter.data, filte r.negative));
1644 } 1650 }
1645 }, 1651 },
1646 1652
1647 /** 1653 /**
1648 * @param {string} text 1654 * @param {string} text
1649 * @return {!WebInspector.NetworkLogView.Filter} 1655 * @return {!WebInspector.NetworkLogView.Filter}
1650 */ 1656 */
1651 _createTextFilter: function(text) 1657 _createTextFilter: function(text)
1652 { 1658 {
1653 var negative = false; 1659 var negative = false;
1654 if (text[0] === "-" && text.length > 1) { 1660 if (!this._textFilterUI.isRegexChecked() && text[0] === "-" && text.leng th > 1) {
1655 negative = true; 1661 negative = true;
1656 text = text.substring(1); 1662 text = text.substring(1);
1657 } 1663 }
1658 var regexp = new RegExp(text.escapeForRegExp(), "i"); 1664 var regexp = this._textFilterUI.regex();
1665
1659 var filter = WebInspector.NetworkLogView._requestNameOrPathFilter.bind(n ull, regexp); 1666 var filter = WebInspector.NetworkLogView._requestNameOrPathFilter.bind(n ull, regexp);
1660 if (negative) 1667 if (negative)
1661 filter = WebInspector.NetworkLogView._negativeFilter.bind(null, filt er); 1668 filter = WebInspector.NetworkLogView._negativeFilter.bind(null, filt er);
1662 return filter; 1669 return filter;
1663 }, 1670 },
1664 1671
1665 /** 1672 /**
1666 * @param {!WebInspector.NetworkLogView.FilterType} type 1673 * @param {!WebInspector.NetworkLogView.FilterType} type
1667 * @param {string} value 1674 * @param {string} value
1668 * @param {boolean} negative 1675 * @param {boolean} negative
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 * @param {!WebInspector.NetworkLogView.Filter} filter 1935 * @param {!WebInspector.NetworkLogView.Filter} filter
1929 * @param {!WebInspector.NetworkRequest} request 1936 * @param {!WebInspector.NetworkRequest} request
1930 * @return {boolean} 1937 * @return {boolean}
1931 */ 1938 */
1932 WebInspector.NetworkLogView._negativeFilter = function(filter, request) 1939 WebInspector.NetworkLogView._negativeFilter = function(filter, request)
1933 { 1940 {
1934 return !filter(request); 1941 return !filter(request);
1935 } 1942 }
1936 1943
1937 /** 1944 /**
1938 * @param {!RegExp} regex 1945 * @param {!RegExp} regex
lushnikov 2016/03/21 21:49:27 fix annotation
allada 2016/03/21 22:50:45 Done.
1939 * @param {!WebInspector.NetworkRequest} request 1946 * @param {!WebInspector.NetworkRequest} request
1940 * @return {boolean} 1947 * @return {boolean}
1941 */ 1948 */
1942 WebInspector.NetworkLogView._requestNameOrPathFilter = function(regex, request) 1949 WebInspector.NetworkLogView._requestNameOrPathFilter = function(regex, request)
1943 { 1950 {
1951 if (!regex)
1952 return false;
1944 return regex.test(request.name()) || regex.test(request.path()); 1953 return regex.test(request.name()) || regex.test(request.path());
1945 } 1954 }
1946 1955
1947 /** 1956 /**
1948 * @param {string} domain 1957 * @param {string} domain
1949 * @return {!Array.<string>} 1958 * @return {!Array.<string>}
1950 */ 1959 */
1951 WebInspector.NetworkLogView._subdomains = function(domain) 1960 WebInspector.NetworkLogView._subdomains = function(domain)
1952 { 1961 {
1953 var result = [domain]; 1962 var result = [domain];
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2152 return false; 2161 return false;
2153 return true; 2162 return true;
2154 } 2163 }
2155 2164
2156 WebInspector.NetworkLogView.EventTypes = { 2165 WebInspector.NetworkLogView.EventTypes = {
2157 RequestSelected: "RequestSelected", 2166 RequestSelected: "RequestSelected",
2158 SearchCountUpdated: "SearchCountUpdated", 2167 SearchCountUpdated: "SearchCountUpdated",
2159 SearchIndexUpdated: "SearchIndexUpdated", 2168 SearchIndexUpdated: "SearchIndexUpdated",
2160 UpdateRequest: "UpdateRequest" 2169 UpdateRequest: "UpdateRequest"
2161 }; 2170 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698