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-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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 test.done(); | 166 test.done(); |
167 }; | 167 }; |
168 | 168 |
169 exports.testSubscriptionDefaults = function(test) | 169 exports.testSubscriptionDefaults = function(test) |
170 { | 170 { |
171 let tests = [ | 171 let tests = [ |
172 ["blocking", "test"], | 172 ["blocking", "test"], |
173 ["whitelist", "@@test"], | 173 ["whitelist", "@@test"], |
174 ["elemhide", "##test"], | 174 ["elemhide", "##test"], |
175 ["elemhide", "#@#test"], | 175 ["elemhide", "#@#test"], |
176 ["elemhide", "foo##[-abp-properties='foo']"], | 176 ["elemhide", "foo##:-abp-properties(foo)"], |
| 177 ["elemhide", "foo#?#:-abp-properties(foo)"], |
| 178 // Invalid elemhide filter. Incorrectly classified as blocking. |
| 179 // See https://issues.adblockplus.org/ticket/6234 |
| 180 ["blocking", "foo#@?#:-abp-properties(foo)"], |
177 [null, "!test"], | 181 [null, "!test"], |
178 [null, "/??/"], | 182 [null, "/??/"], |
179 ["blocking whitelist", "test", "@@test"], | 183 ["blocking whitelist", "test", "@@test"], |
180 ["blocking elemhide", "test", "##test"] | 184 ["blocking elemhide", "test", "##test"] |
181 ]; | 185 ]; |
182 | 186 |
183 for (let [defaults, ...filters] of tests) | 187 for (let [defaults, ...filters] of tests) |
184 { | 188 { |
185 withNAD(1, testSerializeParse)(test, createSubscription("~user~" + filters.j
oin("~"), | 189 withNAD(1, testSerializeParse)(test, createSubscription("~user~" + filters.j
oin("~"), |
186 subscription => | 190 subscription => |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 exports.testEscapingFilterSerialization = function(test) | 330 exports.testEscapingFilterSerialization = function(test) |
327 { | 331 { |
328 withNAD(0, subscription => | 332 withNAD(0, subscription => |
329 { | 333 { |
330 let subsriptionAddFilter = withNAD(0, subscription.insertFilterAt, subscript
ion); | 334 let subsriptionAddFilter = withNAD(0, subscription.insertFilterAt, subscript
ion); |
331 | 335 |
332 subsriptionAddFilter(Filter.fromText("[[x[x[[]x]"), 0); | 336 subsriptionAddFilter(Filter.fromText("[[x[x[[]x]"), 0); |
333 subsriptionAddFilter(Filter.fromText("x[[x[x[[]x]x"), 1); | 337 subsriptionAddFilter(Filter.fromText("x[[x[x[[]x]x"), 1); |
334 subsriptionAddFilter(Filter.fromText("x\\[]x"), 2); | 338 subsriptionAddFilter(Filter.fromText("x\\[]x"), 2); |
335 | 339 |
336 withNAD(1, testSerializeParse)(test, subscription, (serializedData) => | 340 testSerializeParse(test, subscription, (serializedData) => |
337 test.ok(serializedData.includes("[Subscription filters]\n\\[\\[x\\[x\\[\\[
]x]\nx\\[\\[x\\[x\\[\\[]x]x\nx\\\\[]x\n"), "Filters should be escaped")); | 341 test.ok(serializedData.includes("[Subscription filters]\n\\[\\[x\\[x\\[\\[
]x]\nx\\[\\[x\\[x\\[\\[]x]x\nx\\\\[]x\n"), "Filters should be escaped")); |
338 })(Subscription.fromURL("~user~12345")); | 342 })(Subscription.fromURL("~user~12345")); |
339 test.done(); | 343 test.done(); |
340 }; | 344 }; |
341 | 345 |
342 exports.testNotifications = function(test) | 346 exports.testNotifications = function(test) |
343 { | 347 { |
344 function checkNotifications(action, expected, message) | 348 function checkNotifications(action, expected, message) |
345 { | 349 { |
346 let result = null; | 350 let result = null; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 subscription.downloadStatus = null; | 437 subscription.downloadStatus = null; |
434 }, ["subscription.downloadStatus", "http://example.com/"], "Resetting subscrip
tion.downloadStatus"); | 438 }, ["subscription.downloadStatus", "http://example.com/"], "Resetting subscrip
tion.downloadStatus"); |
435 | 439 |
436 checkNotifications(() => | 440 checkNotifications(() => |
437 { | 441 { |
438 subscription.errors++; | 442 subscription.errors++; |
439 }, ["subscription.errors", "http://example.com/"], "Increasing subscription.er
rors"); | 443 }, ["subscription.errors", "http://example.com/"], "Increasing subscription.er
rors"); |
440 checkNotifications(() => | 444 checkNotifications(() => |
441 { | 445 { |
442 subscription.errors = 0; | 446 subscription.errors = 0; |
443 }, ["subscription.errors", "http://example.com/"], "Resetting subscription.err
os"); | 447 }, ["subscription.errors", "http://example.com/"], "Resetting subscription.err
ors"); |
444 | 448 |
445 subscription.delete(); | 449 subscription.delete(); |
446 test.done(); | 450 test.done(); |
447 }; | 451 }; |
LEFT | RIGHT |