OLD | NEW |
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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 20 matching lines...) Expand all Loading... |
31 }, | 31 }, |
32 get appLocale() | 32 get appLocale() |
33 { | 33 { |
34 return _appInfo.locale; | 34 return _appInfo.locale; |
35 }, | 35 }, |
36 generateChecksum: function(lines) | 36 generateChecksum: function(lines) |
37 { | 37 { |
38 // We cannot calculate MD5 checksums yet :-( | 38 // We cannot calculate MD5 checksums yet :-( |
39 return null; | 39 return null; |
40 }, | 40 }, |
41 makeURI: function(url) | |
42 { | |
43 return Services.io.newURI(url); | |
44 }, | |
45 | 41 |
46 checkLocalePrefixMatch: function(prefixes) | 42 checkLocalePrefixMatch: function(prefixes) |
47 { | 43 { |
48 if (!prefixes) | 44 if (!prefixes) |
49 return null; | 45 return null; |
50 | 46 |
51 let list = prefixes.split(","); | 47 let list = prefixes.split(","); |
52 for (let prefix of list) | 48 for (let prefix of list) |
53 if (new RegExp("^" + prefix + "\\b").test(this.appLocale)) | 49 if (new RegExp("^" + prefix + "\\b").test(this.appLocale)) |
54 return prefix; | 50 return prefix; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // probability 1/N (N being the number of matches). | 82 // probability 1/N (N being the number of matches). |
87 if (Math.random() * matchCount < 1) | 83 if (Math.random() * matchCount < 1) |
88 { | 84 { |
89 selectedItem = subscription; | 85 selectedItem = subscription; |
90 selectedPrefix = prefix; | 86 selectedPrefix = prefix; |
91 } | 87 } |
92 } | 88 } |
93 } | 89 } |
94 } | 90 } |
95 return selectedItem; | 91 return selectedItem; |
96 }, | |
97 | |
98 yield: function() | |
99 { | |
100 } | 92 } |
101 }; | 93 }; |
OLD | NEW |