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-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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return errorCallback("synchronize_invalid_data"); | 153 return errorCallback("synchronize_invalid_data"); |
154 let minVersion = headerMatch[1]; | 154 let minVersion = headerMatch[1]; |
155 | 155 |
156 let params = { | 156 let params = { |
157 redirect: null, | 157 redirect: null, |
158 homepage: null, | 158 homepage: null, |
159 title: null, | 159 title: null, |
160 version: null, | 160 version: null, |
161 expires: null | 161 expires: null |
162 }; | 162 }; |
163 for (let i = 0; i < lines.length; i++) | 163 for (let i = 1; i < lines.length; i++) |
164 { | 164 { |
165 let match = /^\s*!\s*(\w+)\s*:\s*(.*)/.exec(lines[i]); | 165 let match = /^\s*!\s*(?:(\w+)\s*:\s*(.*)|\S)/.exec(lines[i]); |
166 if (match) | 166 if (!match) |
| 167 break; |
| 168 |
| 169 if (typeof match[1] != "undefined") |
167 { | 170 { |
168 let keyword = match[1].toLowerCase(); | 171 let keyword = match[1].toLowerCase(); |
169 let value = match[2]; | 172 if (params.hasOwnProperty(keyword)) |
170 if (keyword in params) | |
171 { | 173 { |
172 params[keyword] = value; | 174 params[keyword] = match[2]; |
173 lines.splice(i--, 1); | 175 lines.splice(i--, 1); |
174 } | 176 } |
175 } | 177 } |
176 } | 178 } |
177 | 179 |
178 if (params.redirect) | 180 if (params.redirect) |
179 return redirectCallback(params.redirect); | 181 return redirectCallback(params.redirect); |
180 | 182 |
181 // Handle redirects | 183 // Handle redirects |
182 let subscription = Subscription.fromURL(downloadable.redirectURL || | 184 let subscription = Subscription.fromURL(downloadable.redirectURL || |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 subscription.filters.map(f => f.text).join("\n"); | 335 subscription.filters.map(f => f.text).join("\n"); |
334 redirectCallback("data:text/plain," + encodeURIComponent(data)); | 336 redirectCallback("data:text/plain," + encodeURIComponent(data)); |
335 } | 337 } |
336 }, false); | 338 }, false); |
337 request.send(null); | 339 request.send(null); |
338 } | 340 } |
339 } | 341 } |
340 } | 342 } |
341 }; | 343 }; |
342 Synchronizer.init(); | 344 Synchronizer.init(); |
OLD | NEW |