| LEFT | RIGHT | 
| (no file at all) |  | 
|    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-2017 eyeo GmbH |    3  * Copyright (C) 2006-2017 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  163     ]); |  163     ]); | 
|  164     testRules(test, ["@@||example.com/path^$font,document"], [ |  164     testRules(test, ["@@||example.com/path^$font,document"], [ | 
|  165       {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com/path", |  165       {trigger: {"url-filter": "^https?://([^/]+\\.)?example\\.com/path", | 
|  166                  "resource-type": ["font"]}, |  166                  "resource-type": ["font"]}, | 
|  167        action: {type: "ignore-previous-rules"}} |  167        action: {type: "ignore-previous-rules"}} | 
|  168     ]); |  168     ]); | 
|  169  |  169  | 
|  170     test.done(); |  170     test.done(); | 
|  171   }, |  171   }, | 
|  172  |  172  | 
 |  173   testGenericblockExceptions: function(test) | 
 |  174   { | 
 |  175     testRules(test, ["^ad.jpg|", "@@||example.com^$genericblock"], | 
 |  176               [[undefined, ["*example.com"]]], | 
 |  177               rules => rules.map(rule => [rule.trigger["if-domain"], | 
 |  178                                           rule.trigger["unless-domain"]])); | 
 |  179     testRules(test, ["^ad.jpg|$domain=test.com", | 
 |  180                      "@@||example.com^$genericblock"], | 
 |  181               [[["*test.com"], undefined]], | 
 |  182               rules => rules.map(rule => [rule.trigger["if-domain"], | 
 |  183                                           rule.trigger["unless-domain"]])); | 
 |  184     testRules(test, ["^ad.jpg|$domain=~test.com", | 
 |  185                      "@@||example.com^$genericblock"], | 
 |  186               [[undefined, ["*test.com", "*example.com"]]], | 
 |  187               rules => rules.map(rule => [rule.trigger["if-domain"], | 
 |  188                                           rule.trigger["unless-domain"]])); | 
 |  189  | 
 |  190     test.done(); | 
 |  191   }, | 
 |  192  | 
|  173   testRuleOrdering: function(test) |  193   testRuleOrdering: function(test) | 
|  174   { |  194   { | 
|  175     testRules( |  195     testRules( | 
|  176       test, |  196       test, | 
|  177       ["/ads.jpg", "@@example.com", "test.com#@#foo", "##bar"], |  197       ["/ads.jpg", "@@example.com", "test.com#@#foo", "##bar"], | 
|  178       ["css-display-none", "block", "ignore-previous-rules"], |  198       ["css-display-none", "block", "ignore-previous-rules"], | 
|  179       rules => rules.map(rule => rule.action.type) |  199       rules => rules.map(rule => rule.action.type) | 
|  180     ); |  200     ); | 
|  181     testRules( |  201     testRules( | 
|  182       test, |  202       test, | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  214        ["style-sheet", "script", "font", "media", "raw", "document"]], |  234        ["style-sheet", "script", "font", "media", "raw", "document"]], | 
|  215       rules => rules.map(rule => rule.trigger["resource-type"]) |  235       rules => rules.map(rule => rule.trigger["resource-type"]) | 
|  216     ); |  236     ); | 
|  217  |  237  | 
|  218     test.done(); |  238     test.done(); | 
|  219   }, |  239   }, | 
|  220  |  240  | 
|  221   testUnsupportedfilters: function(test) |  241   testUnsupportedfilters: function(test) | 
|  222   { |  242   { | 
|  223     // These types of filters are currently completely unsupported. |  243     // These types of filters are currently completely unsupported. | 
|  224     testRules(test, ["foo$sitekey=bar", "@@foo$genericblock"], []); |  244     testRules(test, ["foo$sitekey=bar"], []); | 
|  225  |  245  | 
|  226     test.done(); |  246     test.done(); | 
|  227   }, |  247   }, | 
|  228  |  248  | 
|  229   testFilterOptions: function(test) |  249   testFilterOptions: function(test) | 
|  230   { |  250   { | 
|  231     testRules(test, ["1$domain=foo.com"], ["*foo.com"], |  251     testRules(test, ["1$domain=foo.com"], ["*foo.com"], | 
|  232               rules => rules[0]["trigger"]["if-domain"]); |  252               rules => rules[0]["trigger"]["if-domain"]); | 
|  233     testRules(test, ["2$third-party"], ["third-party"], |  253     testRules(test, ["2$third-party"], ["third-party"], | 
|  234               rules => rules[0]["trigger"]["load-type"]); |  254               rules => rules[0]["trigger"]["load-type"]); | 
|  235     testRules(test, ["foo$match_case"], true, |  255     testRules(test, ["foo$match_case"], true, | 
|  236               rules => rules[0]["trigger"]["url-filter-is-case-sensitive"]); |  256               rules => rules[0]["trigger"]["url-filter-is-case-sensitive"]); | 
|  237  |  257  | 
|  238     test.done(); |  258     test.done(); | 
|  239   }, |  259   }, | 
|  240  |  260  | 
|  241   testUnicode: function(test) |  261   testUnicode: function(test) | 
|  242   { |  262   { | 
|  243     testRules(test, ["$domain=🐈.cat"], ["*xn--zn8h.cat"], |  263     testRules(test, ["$domain=🐈.cat"], ["*xn--zn8h.cat"], | 
|  244               rules => rules[0]["trigger"]["if-domain"]); |  264               rules => rules[0]["trigger"]["if-domain"]); | 
|  245     testRules(test, ["🐈$domain=🐈.cat"], []); |  265     testRules(test, ["🐈$domain=🐈.cat"], []); | 
|  246     testRules(test, ["###🐈"], []); |  266     testRules(test, ["###🐈"], []); | 
|  247  |  267  | 
|  248     test.done(); |  268     test.done(); | 
|  249   } |  269   } | 
|  250 }; |  270 }; | 
| LEFT | RIGHT |