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

Delta Between Two Patch Sets: chrome/content/ui/composer.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 | « no previous file | chrome/content/ui/sendReport.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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 let isSlow = false; 273 let isSlow = false;
274 let compiledFilter = Filter.fromText(filter); 274 let compiledFilter = Filter.fromText(filter);
275 if (E("regexpWarning").hidden) 275 if (E("regexpWarning").hidden)
276 { 276 {
277 if (compiledFilter instanceof RegExpFilter && defaultMatcher.isSlowFilter(co mpiledFilter)) 277 if (compiledFilter instanceof RegExpFilter && defaultMatcher.isSlowFilter(co mpiledFilter))
278 isSlow = true; 278 isSlow = true;
279 } 279 }
280 E("shortpatternWarning").hidden = !isSlow; 280 E("shortpatternWarning").hidden = !isSlow;
281 281
282 E("matchWarning").hidden = compiledFilter instanceof RegExpFilter && compiledF ilter.matches(item.location, RegExpFilter.toTypeMask(item.typeDescr), item.docDo main, item.thirdParty); 282 E("matchWarning").hidden = compiledFilter instanceof RegExpFilter && compiledF ilter.matches(item.location, RegExpFilter.typeMap[item.typeDescr], item.docDomai n, item.thirdParty);
283 283
284 E("filter").value = filter; 284 E("filter").value = filter;
285 } 285 }
286 286
287 function generateLinkText(element, replacement) 287 function generateLinkText(element, replacement)
288 { 288 {
289 let template = element.getAttribute("textTemplate"); 289 let template = element.getAttribute("textTemplate");
290 if (typeof replacement != "undefined") 290 if (typeof replacement != "undefined")
291 template = template.replace(/\?1\?/g, replacement) 291 template = template.replace(/\?1\?/g, replacement)
292 292
(...skipping 18 matching lines...) Expand all
311 pattern = E("customPattern").value; 311 pattern = E("customPattern").value;
312 } 312 }
313 else 313 else
314 { 314 {
315 E("anchorStart").checked = true; 315 E("anchorStart").checked = true;
316 E("anchorEnd").checked = false; 316 E("anchorEnd").checked = false;
317 } 317 }
318 318
319 function testFilter(/**String*/ filter) /**Boolean*/ 319 function testFilter(/**String*/ filter) /**Boolean*/
320 { 320 {
321 return RegExpFilter.fromText(filter + "$" + item.typeDescr).matches(item.loc ation, RegExpFilter.toTypeMask(item.typeDescr), item.docDomain, item.thirdParty) ; 321 return RegExpFilter.fromText(filter + "$" + item.typeDescr).matches(item.loc ation, RegExpFilter.typeMap[item.typeDescr], item.docDomain, item.thirdParty);
322 } 322 }
323 323
324 let anchorStartCheckbox = E("anchorStart"); 324 let anchorStartCheckbox = E("anchorStart");
325 if (!/^\*/.test(pattern) && testFilter("||" + pattern)) 325 if (!/^\*/.test(pattern) && testFilter("||" + pattern))
326 { 326 {
327 disableElement(anchorStartCheckbox, false, "checked", false); 327 disableElement(anchorStartCheckbox, false, "checked", false);
328 [anchorStartCheckbox.label, anchorStartCheckbox.accessKey] = Utils.splitLabe l(anchorStartCheckbox.getAttribute("labelFlexible")); 328 [anchorStartCheckbox.label, anchorStartCheckbox.accessKey] = Utils.splitLabe l(anchorStartCheckbox.getAttribute("labelFlexible"));
329 anchorStartCheckbox.flexibleAnchor = true; 329 anchorStartCheckbox.flexibleAnchor = true;
330 } 330 }
331 else 331 else
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 * Selects or unselects all type checkboxes except those 403 * Selects or unselects all type checkboxes except those
404 * that are disabled. 404 * that are disabled.
405 */ 405 */
406 function selectAllTypes(/**Boolean*/ select) 406 function selectAllTypes(/**Boolean*/ select)
407 { 407 {
408 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n extSibling) 408 for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.n extSibling)
409 if (typeNode.getAttribute("disabled") != "true") 409 if (typeNode.getAttribute("disabled") != "true")
410 typeNode.checked = select; 410 typeNode.checked = select;
411 updateFilter(); 411 updateFilter();
412 } 412 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld