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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 result.push("type=comment"); | 64 result.push("type=comment"); |
65 else if (filter instanceof ActiveFilter) | 65 else if (filter instanceof ActiveFilter) |
66 { | 66 { |
67 result.push("disabled=" + filter.disabled); | 67 result.push("disabled=" + filter.disabled); |
68 result.push("lastHit=" + filter.lastHit); | 68 result.push("lastHit=" + filter.lastHit); |
69 result.push("hitCount=" + filter.hitCount); | 69 result.push("hitCount=" + filter.hitCount); |
70 | 70 |
71 let domains = []; | 71 let domains = []; |
72 if (filter.domains) | 72 if (filter.domains) |
73 { | 73 { |
74 for (let [domain, isIncluded] of filter.domains) | 74 if (typeof filter.domains == "string") |
75 { | 75 { |
76 if (domain != "") | 76 domains.push(filter.domains); |
77 domains.push(isIncluded ? domain : "~" + domain); | 77 } |
| 78 else |
| 79 { |
| 80 for (let [domain, isIncluded] of filter.domains) |
| 81 { |
| 82 if (domain != "") |
| 83 domains.push(isIncluded ? domain : "~" + domain); |
| 84 } |
78 } | 85 } |
79 } | 86 } |
80 result.push("domains=" + domains.sort().join("|")); | 87 result.push("domains=" + domains.sort().join("|")); |
81 | 88 |
82 if (filter instanceof RegExpFilter) | 89 if (filter instanceof RegExpFilter) |
83 { | 90 { |
84 result.push("regexp=" + filter.regexp.source); | 91 result.push("regexp=" + filter.regexp.source); |
85 result.push("contentType=" + filter.contentType); | 92 result.push("contentType=" + filter.contentType); |
86 result.push("matchCase=" + filter.matchCase); | 93 result.push("matchCase=" + filter.matchCase); |
87 | 94 |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"), | 545 filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"), |
539 "http://content.server/file/foo.txt/disable" | 546 "http://content.server/file/foo.txt/disable" |
540 ); | 547 ); |
541 test.equal( | 548 test.equal( |
542 filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"), | 549 filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"), |
543 "http://example.com/file/foo.txt/disable" | 550 "http://example.com/file/foo.txt/disable" |
544 ); | 551 ); |
545 | 552 |
546 test.done(); | 553 test.done(); |
547 }; | 554 }; |
OLD | NEW |