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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 else | 177 else |
178 delete listenerFilters.app; | 178 delete listenerFilters.app; |
179 break; | 179 break; |
180 case "app.open": | 180 case "app.open": |
181 if (message.what == "options") | 181 if (message.what == "options") |
182 ext.showOptions(); | 182 ext.showOptions(); |
183 break; | 183 break; |
184 case "filters.add": | 184 case "filters.add": |
185 var filter = Filter.fromText(message.text); | 185 var filter = Filter.fromText(message.text); |
186 var result = filterValidation.parseFilter(message.text); | 186 var result = filterValidation.parseFilter(message.text); |
187 if (result.error && result.error.type != "empty-filter") | 187 if (result.error) |
Thomas Greiner
2015/07/15 08:32:38
Look at the else-case. This means that empty filte
Sebastian Noack
2015/07/15 09:00:45
There is no error type "empty-filter". As I said,
saroyanm
2015/07/15 10:47:11
I think it was misunderstanding, what I understood
Sebastian Noack
2015/07/15 11:19:59
What I meant is, that you should merely leave the
| |
188 sendMessage("app", "error", [result.error.toString()], sender.page); | 188 sendMessage("app", "error", [result.error.toString()], sender.page); |
189 else | 189 else if (result.filter) |
190 FilterStorage.addFilter(result.filter); | 190 FilterStorage.addFilter(result.filter); |
191 break; | 191 break; |
192 case "filters.blocked": | 192 case "filters.blocked": |
193 var filter = defaultMatcher.matchesAny(message.url, message.requestType, | 193 var filter = defaultMatcher.matchesAny(message.url, message.requestType, |
194 message.docDomain, message.thirdParty); | 194 message.docDomain, message.thirdParty); |
195 callback(filter instanceof BlockingFilter); | 195 callback(filter instanceof BlockingFilter); |
196 break; | 196 break; |
197 case "filters.get": | 197 case "filters.get": |
198 var subscription = Subscription.fromURL(message.subscriptionUrl); | 198 var subscription = Subscription.fromURL(message.subscriptionUrl); |
199 if (!subscription) | 199 if (!subscription) |
200 { | 200 { |
201 callback([]); | 201 callback([]); |
202 break; | 202 break; |
203 } | 203 } |
204 | 204 |
205 callback(subscription.filters.map(convertFilter)); | 205 callback(subscription.filters.map(convertFilter)); |
206 break; | 206 break; |
207 case "filters.importRaw": | 207 case "filters.importRaw": |
208 var result = filterValidation.parseFilters(message.text); | 208 var result = filterValidation.parseFilters(message.text); |
209 var errors = []; | 209 var errors = []; |
210 for (var i = 0; i < result.errors.length; i++) | 210 for (var i = 0; i < result.errors.length; i++) |
211 { | 211 { |
212 var error = result.errors[i]; | 212 var error = result.errors[i]; |
213 if (error.type != "unexpected-filter-list-header" && | 213 if (error.type != "unexpected-filter-list-header") |
214 error.type != "empty-filter") | |
215 errors.push(error.toString()); | 214 errors.push(error.toString()); |
216 } | 215 } |
217 | 216 |
218 if (errors.length > 0) | 217 if (errors.length > 0) |
219 { | 218 { |
220 sendMessage("app", "error", errors, sender.page); | 219 sendMessage("app", "error", errors, sender.page); |
221 return; | 220 return; |
222 } | 221 } |
223 | 222 |
224 var seenFilter = Object.create(null); | 223 var seenFilter = Object.create(null); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 subscription.title = message.title; | 317 subscription.title = message.title; |
319 subscription.homepage = message.homepage; | 318 subscription.homepage = message.homepage; |
320 FilterStorage.addSubscription(subscription); | 319 FilterStorage.addSubscription(subscription); |
321 if (!subscription.lastDownload) | 320 if (!subscription.lastDownload) |
322 Synchronizer.execute(subscription); | 321 Synchronizer.execute(subscription); |
323 } | 322 } |
324 break; | 323 break; |
325 } | 324 } |
326 }); | 325 }); |
327 })(this); | 326 })(this); |
LEFT | RIGHT |