Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: chrome/content/ui/sidebar.js

Issue 29321478: Issue 2738 - Make RegExpFilter.matches() take a bit mask instead of content type string (Closed)
Left Patch Set: Created July 9, 2015, 1:45 p.m.
Right Patch Set: Changed API as discussed and addressed feedback Created July 12, 2015, 1:55 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/content/ui/sendReport.js ('k') | lib/contentPolicy.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 } 1087 }
1088 1088
1089 // Add new item to the list 1089 // Add new item to the list
1090 // Store original item in orig property - reading out prototype is messed up in Gecko 1.9.2 1090 // Store original item in orig property - reading out prototype is messed up in Gecko 1.9.2
1091 item = {__proto__: item, orig: item, nodes: [node]}; 1091 item = {__proto__: item, orig: item, nodes: [node]};
1092 this.allData.push(item); 1092 this.allData.push(item);
1093 this.dataMap[key] = item; 1093 this.dataMap[key] = item;
1094 1094
1095 // Show disabled filters if no other filter applies 1095 // Show disabled filters if no other filter applies
1096 if (!item.filter) 1096 if (!item.filter)
1097 item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.toTyp eMask(item.typeDescr), item.docDomain, item.thirdParty); 1097 item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.typeM ap[item.typeDescr], item.docDomain, item.thirdParty);
1098 1098
1099 if (!this.matchesFilter(item)) 1099 if (!this.matchesFilter(item))
1100 return; 1100 return;
1101 1101
1102 let index = -1; 1102 let index = -1;
1103 if (this.sortProc && this.sortColumn && this.sortColumn.id == "size") 1103 if (this.sortProc && this.sortColumn && this.sortColumn.id == "size")
1104 { 1104 {
1105 // Sorting by size requires accessing content document, and that's 1105 // Sorting by size requires accessing content document, and that's
1106 // dangerous from a content policy (and we are likely called directly 1106 // dangerous from a content policy (and we are likely called directly
1107 // from a content policy call). Size data will be inaccurate anyway, 1107 // from a content policy call). Size data will be inaccurate anyway,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 this.boxObject.ensureRowIsVisible(this.selection.currentIndex); 1142 this.boxObject.ensureRowIsVisible(this.selection.currentIndex);
1143 }, 1143 },
1144 1144
1145 updateFilters: function() 1145 updateFilters: function()
1146 { 1146 {
1147 for (let item of this.allData) 1147 for (let item of this.allData)
1148 { 1148 {
1149 if (item.filter instanceof RegExpFilter && item.filter.disabled) 1149 if (item.filter instanceof RegExpFilter && item.filter.disabled)
1150 delete item.filter; 1150 delete item.filter;
1151 if (!item.filter) 1151 if (!item.filter)
1152 item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.toT ypeMask(item.typeDescr), item.docDomain, item.thirdParty); 1152 item.filter = disabledMatcher.matchesAny(item.location, RegExpFilter.typ eMap[item.typeDescr], item.docDomain, item.thirdParty);
1153 } 1153 }
1154 this.refilter(); 1154 this.refilter();
1155 }, 1155 },
1156 1156
1157 /** 1157 /**
1158 * Updates the list after a filter or sorting change. 1158 * Updates the list after a filter or sorting change.
1159 */ 1159 */
1160 refilter: function() 1160 refilter: function()
1161 { 1161 {
1162 if (this.resortTimeout) 1162 if (this.resortTimeout)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 return {tooltip: this.itemsDummyTooltip}; 1262 return {tooltip: this.itemsDummyTooltip};
1263 }, 1263 },
1264 1264
1265 invalidateItem: function(item) 1265 invalidateItem: function(item)
1266 { 1266 {
1267 let row = this.data.indexOf(item); 1267 let row = this.data.indexOf(item);
1268 if (row >= 0) 1268 if (row >= 0)
1269 this.boxObject.invalidateRow(row); 1269 this.boxObject.invalidateRow(row);
1270 } 1270 }
1271 } 1271 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld