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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 299 |
300 subscription2.disabled = false; | 300 subscription2.disabled = false; |
301 checkKnownFilters(test, "enable blocking filters", {blacklist: [filter1.text]}
); | 301 checkKnownFilters(test, "enable blocking filters", {blacklist: [filter1.text]}
); |
302 | 302 |
303 let subscription3 = Subscription.fromURL("~wl~"); | 303 let subscription3 = Subscription.fromURL("~wl~"); |
304 subscription3.disabled = true; | 304 subscription3.disabled = true; |
305 checkKnownFilters(test, "disable exception rules", {blacklist: [filter1.text]}
); | 305 checkKnownFilters(test, "disable exception rules", {blacklist: [filter1.text]}
); |
306 | 306 |
307 filterStorage.addFilter(filter2); | 307 filterStorage.addFilter(filter2); |
308 checkKnownFilters(test, "add @@filter2", {blacklist: [filter1.text], whitelist
: [filter2.text]}); | 308 checkKnownFilters(test, "add @@filter2", {blacklist: [filter1.text], whitelist
: [filter2.text]}); |
309 test.equal(filter2.subscriptionCount, 1, "@@filter2.subscriptionCount"); | 309 test.equal([...filterStorage.subscriptions(filter2.text)].length, 1, "@@filter
2 subscription count"); |
310 test.ok([...filter2.subscriptions()][0] instanceof SpecialSubscription, "@@fil
ter2 added to a new filter group"); | 310 test.ok([...filterStorage.subscriptions(filter2.text)][0] instanceof SpecialSu
bscription, "@@filter2 added to a new filter group"); |
311 test.ok([...filter2.subscriptions()][0] != subscription3, "@@filter2 filter gr
oup is not the disabled exceptions group"); | 311 test.ok([...filterStorage.subscriptions(filter2.text)][0] != subscription3, "@
@filter2 filter group is not the disabled exceptions group"); |
312 | 312 |
313 subscription3.disabled = false; | 313 subscription3.disabled = false; |
314 checkKnownFilters(test, "enable exception rules", {blacklist: [filter1.text],
whitelist: [filter2.text]}); | 314 checkKnownFilters(test, "enable exception rules", {blacklist: [filter1.text],
whitelist: [filter2.text]}); |
315 | 315 |
316 filterStorage.removeFilter(filter2); | 316 filterStorage.removeFilter(filter2); |
317 filterStorage.addFilter(filter2); | 317 filterStorage.addFilter(filter2); |
318 checkKnownFilters(test, "re-add @@filter2", {blacklist: [filter1.text], whitel
ist: [filter2.text]}); | 318 checkKnownFilters(test, "re-add @@filter2", {blacklist: [filter1.text], whitel
ist: [filter2.text]}); |
319 test.equal(filter2.subscriptionCount, 1, "@@filter2.subscriptionCount"); | 319 test.equal([...filterStorage.subscriptions(filter2.text)].length, 1, "@@filter
2 subscription count"); |
320 test.ok([...filter2.subscriptions()][0] == subscription3, "@@filter2 added to
the default exceptions group"); | 320 test.ok([...filterStorage.subscriptions(filter2.text)][0] == subscription3, "@
@filter2 added to the default exceptions group"); |
321 | 321 |
322 let subscription4 = Subscription.fromURL("http://test/"); | 322 let subscription4 = Subscription.fromURL("http://test/"); |
323 filterStorage.updateSubscriptionFilters(subscription4, [filter3.text, filter4.
text, filter5.text]); | 323 filterStorage.updateSubscriptionFilters(subscription4, [filter3.text, filter4.
text, filter5.text]); |
324 checkKnownFilters(test, "update subscription not in the list yet", {blacklist:
[filter1.text], whitelist: [filter2.text]}); | 324 checkKnownFilters(test, "update subscription not in the list yet", {blacklist:
[filter1.text], whitelist: [filter2.text]}); |
325 | 325 |
326 filterStorage.addSubscription(subscription4); | 326 filterStorage.addSubscription(subscription4); |
327 checkKnownFilters(test, "add subscription to the list", {blacklist: [filter1.t
ext, filter3.text], whitelist: [filter2.text, filter4.text]}); | 327 checkKnownFilters(test, "add subscription to the list", {blacklist: [filter1.t
ext, filter3.text], whitelist: [filter2.text, filter4.text]}); |
328 | 328 |
329 filterStorage.updateSubscriptionFilters(subscription4, [filter3.text, filter2.
text, filter5.text]); | 329 filterStorage.updateSubscriptionFilters(subscription4, [filter3.text, filter2.
text, filter5.text]); |
330 checkKnownFilters(test, "update subscription while in the list", {blacklist: [
filter1.text, filter3.text], whitelist: [filter2.text]}); | 330 checkKnownFilters(test, "update subscription while in the list", {blacklist: [
filter1.text, filter3.text], whitelist: [filter2.text]}); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f
ilter1.text, filter2.text]}); | 368 checkKnownFilters(test, "add special subscription with filter2", {snippets: [f
ilter1.text, filter2.text]}); |
369 | 369 |
370 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl
us.org/abp-filters-anti-cv.txt"); | 370 let subscription4 = Subscription.fromURL("https://easylist-downloads.adblockpl
us.org/abp-filters-anti-cv.txt"); |
371 subscription4.addFilter(filter3); | 371 subscription4.addFilter(filter3); |
372 | 372 |
373 filterStorage.addSubscription(subscription4); | 373 filterStorage.addSubscription(subscription4); |
374 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3"
, {snippets: [filter1.text, filter2.text, filter3.text]}); | 374 checkKnownFilters(test, "add ABP anti-circumvention subscription with filter3"
, {snippets: [filter1.text, filter2.text, filter3.text]}); |
375 | 375 |
376 test.done(); | 376 test.done(); |
377 }; | 377 }; |
OLD | NEW |