| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 const seenFilter = Object.create(null); | 304 const seenFilter = Object.create(null); |
| 305 for (const filter of result.filters) | 305 for (const filter of result.filters) |
| 306 { | 306 { |
| 307 FilterStorage.addFilter(filter); | 307 FilterStorage.addFilter(filter); |
| 308 seenFilter[filter.text] = null; | 308 seenFilter[filter.text] = null; |
| 309 } | 309 } |
| 310 | 310 |
| 311 if (!message.removeExisting) | 311 if (!message.removeExisting) |
| 312 return errors; | 312 return errors; |
| 313 | 313 |
| 314 for (const subscription of FilterStorage.subscriptions) | 314 for (const subscription of FilterStorage.knownSubscriptions.values()) |
| 315 { | 315 { |
| 316 if (!(subscription instanceof SpecialSubscription)) | 316 if (!(subscription instanceof SpecialSubscription)) |
| 317 continue; | 317 continue; |
| 318 | 318 |
| 319 for (let j = subscription.filters.length - 1; j >= 0; j--) | 319 for (let j = subscription.filters.length - 1; j >= 0; j--) |
| 320 { | 320 { |
| 321 const filter = subscription.filters[j]; | 321 const filter = subscription.filters[j]; |
| 322 if (/^@@\|\|([^/:]+)\^\$document$/.test(filter.text)) | 322 if (/^@@\|\|([^/:]+)\^\$document$/.test(filter.text)) |
| 323 continue; | 323 continue; |
| 324 | 324 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 }); | 399 }); |
| 400 } | 400 } |
| 401 else | 401 else |
| 402 { | 402 { |
| 403 addSubscription(subscription, message); | 403 addSubscription(subscription, message); |
| 404 } | 404 } |
| 405 }); | 405 }); |
| 406 | 406 |
| 407 port.on("subscriptions.get", (message, sender) => | 407 port.on("subscriptions.get", (message, sender) => |
| 408 { | 408 { |
| 409 const subscriptions = FilterStorage.subscriptions.filter((s) => | 409 const subscriptions = [ |
| 410 { | 410 ...FilterStorage.knownSubscriptions.values()].filter((s) => |
| 411 if (message.ignoreDisabled && s.disabled) | 411 { |
| 412 if (message.ignoreDisabled && s.disabled) |
| 413 return false; |
| 414 if (s instanceof DownloadableSubscription && message.downloadable) |
| 415 return true; |
| 416 if (s instanceof SpecialSubscription && message.special) |
| 417 return true; |
| 412 return false; | 418 return false; |
| 413 if (s instanceof DownloadableSubscription && message.downloadable) | 419 }); |
| 414 return true; | |
| 415 if (s instanceof SpecialSubscription && message.special) | |
| 416 return true; | |
| 417 return false; | |
| 418 }); | |
| 419 | 420 |
| 420 return subscriptions.map((s) => | 421 return subscriptions.map((s) => |
| 421 { | 422 { |
| 422 const result = convertSubscription(s); | 423 const result = convertSubscription(s); |
| 423 if (message.disabledFilters) | 424 if (message.disabledFilters) |
| 424 { | 425 { |
| 425 result.disabledFilters = s.filters | 426 result.disabledFilters = s.filters |
| 426 .filter((f) => f instanceof ActiveFilter && f.disabled) | 427 .filter((f) => f instanceof ActiveFilter && f.disabled) |
| 427 .map((f) => f.text); | 428 .map((f) => f.text); |
| 428 } | 429 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // "*.listen" messages to tackle #6440 | 524 // "*.listen" messages to tackle #6440 |
| 524 if (action == "listen") | 525 if (action == "listen") |
| 525 { | 526 { |
| 526 listen(type, filters, message.filter, message, uiPort.sender.tab.id); | 527 listen(type, filters, message.filter, message, uiPort.sender.tab.id); |
| 527 } | 528 } |
| 528 }); | 529 }); |
| 529 } | 530 } |
| 530 | 531 |
| 531 browser.runtime.onConnect.addListener(onConnect); | 532 browser.runtime.onConnect.addListener(onConnect); |
| 532 })(this); | 533 })(this); |
| OLD | NEW |