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-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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); | 48 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); |
49 return this.appLocale; | 49 return this.appLocale; |
50 }, | 50 }, |
51 generateChecksum: function(lines) | 51 generateChecksum: function(lines) |
52 { | 52 { |
53 // We cannot calculate MD5 checksums yet :-( | 53 // We cannot calculate MD5 checksums yet :-( |
54 return null; | 54 return null; |
55 }, | 55 }, |
56 makeURI: function(url) | 56 makeURI: function(url) |
57 { | 57 { |
58 return Services.io.newURI(url); | 58 let urlObj; |
| 59 try |
| 60 { |
| 61 urlObj = new URL(url); |
| 62 } |
| 63 catch (e) |
| 64 { |
| 65 return null; |
| 66 } |
| 67 |
| 68 return { |
| 69 spec: urlObj.href, |
| 70 scheme: urlObj.protocol, |
| 71 host: urlObj.hostname |
| 72 }; |
59 }, | 73 }, |
60 | |
61 checkLocalePrefixMatch: function(prefixes) | 74 checkLocalePrefixMatch: function(prefixes) |
62 { | 75 { |
63 if (!prefixes) | 76 if (!prefixes) |
64 return null; | 77 return null; |
65 | 78 |
66 var list = prefixes.split(","); | 79 var list = prefixes.split(","); |
67 for (var i = 0; i < list.length; i++) | 80 for (var i = 0; i < list.length; i++) |
68 if (new RegExp("^" + list[i] + "\\b").test(this.appLocale)) | 81 if (new RegExp("^" + list[i] + "\\b").test(this.appLocale)) |
69 return list[i]; | 82 return list[i]; |
70 | 83 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 { | 127 { |
115 var Prefs = require("prefs").Prefs; | 128 var Prefs = require("prefs").Prefs; |
116 var docLink = Prefs.documentation_link; | 129 var docLink = Prefs.documentation_link; |
117 return docLink.replace(/%LINK%/g, linkID).replace(/%LANG%/g, Utils.appLocale
); | 130 return docLink.replace(/%LINK%/g, linkID).replace(/%LANG%/g, Utils.appLocale
); |
118 }, | 131 }, |
119 | 132 |
120 yield: function() | 133 yield: function() |
121 { | 134 { |
122 } | 135 } |
123 }; | 136 }; |
OLD | NEW |