 Issue 30011555:
  Issue 7303 - Deprecate the use of String.prototype.substr()  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/
    
  
    Issue 30011555:
  Issue 7303 - Deprecate the use of String.prototype.substr()  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 905 | 905 | 
| 906 if (!this.matchCase) | 906 if (!this.matchCase) | 
| 907 location = lowerCaseLocation || location.toLowerCase(); | 907 location = lowerCaseLocation || location.toLowerCase(); | 
| 908 | 908 | 
| 909 let {pattern} = this; | 909 let {pattern} = this; | 
| 910 | 910 | 
| 911 let startsWithDoubleAnchor = pattern[0] == "|" && pattern[1] == "|"; | 911 let startsWithDoubleAnchor = pattern[0] == "|" && pattern[1] == "|"; | 
| 912 let endsWithSeparator = pattern[pattern.length - 1] == "^"; | 912 let endsWithSeparator = pattern[pattern.length - 1] == "^"; | 
| 913 | 913 | 
| 914 if (startsWithDoubleAnchor) | 914 if (startsWithDoubleAnchor) | 
| 915 pattern = pattern.substring(2); | 915 pattern = pattern.substr(2); | 
| 
Manish Jethani
2019/02/21 15:04:39
This is a hot spot, let's leave it as it is.
 
hub
2019/02/21 18:09:42
Done.
 | |
| 916 | 916 | 
| 917 if (endsWithSeparator) | 917 if (endsWithSeparator) | 
| 918 pattern = pattern.slice(0, -1); | 918 pattern = pattern.slice(0, -1); | 
| 919 | 919 | 
| 920 let index = location.indexOf(pattern); | 920 let index = location.indexOf(pattern); | 
| 921 | 921 | 
| 922 // The "||" prefix requires that the text that follows does not start | 922 // The "||" prefix requires that the text that follows does not start | 
| 923 // with a forward slash. | 923 // with a forward slash. | 
| 924 return index != -1 && | 924 return index != -1 && | 
| 925 (!startsWithDoubleAnchor || location[index] != "/" && | 925 (!startsWithDoubleAnchor || location[index] != "/" && | 
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1437 | 1437 | 
| 1438 /** | 1438 /** | 
| 1439 * Script that should be executed | 1439 * Script that should be executed | 
| 1440 * @type {string} | 1440 * @type {string} | 
| 1441 */ | 1441 */ | 
| 1442 get script() | 1442 get script() | 
| 1443 { | 1443 { | 
| 1444 return this.body; | 1444 return this.body; | 
| 1445 } | 1445 } | 
| 1446 }); | 1446 }); | 
| LEFT | RIGHT |