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

Side by Side Diff: lib/filterClasses.js

Issue 29339071: Issue 3873 - Replace object literals using __proto__ with Object.create(null) (Closed)
Patch Set: Created March 24, 2016, 5:26 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/filterClasses.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 * 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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 { 376 {
377 let source = this.domainSource; 377 let source = this.domainSource;
378 if (!this.domainSourceIsUpperCase) { 378 if (!this.domainSourceIsUpperCase) {
379 // RegExpFilter already have uppercase domains 379 // RegExpFilter already have uppercase domains
380 source = source.toUpperCase(); 380 source = source.toUpperCase();
381 } 381 }
382 let list = source.split(this.domainSeparator); 382 let list = source.split(this.domainSeparator);
383 if (list.length == 1 && list[0][0] != "~") 383 if (list.length == 1 && list[0][0] != "~")
384 { 384 {
385 // Fast track for the common one-domain scenario 385 // Fast track for the common one-domain scenario
386 domains = {__proto__: null, "": false}; 386 domains = Object.create(null);
387 domains[""] = false;
387 if (this.ignoreTrailingDot) 388 if (this.ignoreTrailingDot)
388 list[0] = list[0].replace(/\.+$/, ""); 389 list[0] = list[0].replace(/\.+$/, "");
389 domains[list[0]] = true; 390 domains[list[0]] = true;
390 } 391 }
391 else 392 else
392 { 393 {
393 let hasIncludes = false; 394 let hasIncludes = false;
394 for (let i = 0; i < list.length; i++) 395 for (let i = 0; i < list.length; i++)
395 { 396 {
396 let domain = list[i]; 397 let domain = list[i];
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 // several times on Safari, due to WebKit bug 132872 1061 // several times on Safari, due to WebKit bug 132872
1061 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); 1062 let prop = Object.getOwnPropertyDescriptor(this, "regexpString");
1062 if (prop) 1063 if (prop)
1063 return prop.value; 1064 return prop.value;
1064 1065
1065 let regexp = Filter.toRegExp(this.regexpSource); 1066 let regexp = Filter.toRegExp(this.regexpSource);
1066 Object.defineProperty(this, "regexpString", {value: regexp}); 1067 Object.defineProperty(this, "regexpString", {value: regexp});
1067 return regexp; 1068 return regexp;
1068 } 1069 }
1069 }; 1070 };
OLDNEW
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld