Left: | ||
Right: |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 | 50 |
51 let matches = Snippets.getScriptsForDomain(domain); | 51 let matches = Snippets.getScriptsForDomain(domain); |
52 test.deepEqual(matches.sort(), expectedMatches.sort(), description); | 52 test.deepEqual(matches.sort(), expectedMatches.sort(), description); |
53 | 53 |
54 Snippets.clear(); | 54 Snippets.clear(); |
55 } | 55 } |
56 | 56 |
57 testScriptMatches( | 57 testScriptMatches( |
58 "Ignore generic filters", | 58 "Ignore generic filters", |
59 [ | 59 [ |
60 "#$#foo", "example.com#$#foo", | 60 "#$#foo-1", "example.com#$#foo-2", |
kzar
2018/08/08 11:31:50
Shouldn't we use different snippet names for these
Manish Jethani
2018/08/08 13:56:42
Thanks, this makes sense.
Done.
| |
61 "~example.com#$#foo" | 61 "~example.com#$#foo-3" |
62 ], | 62 ], |
63 "example.com", | 63 "example.com", |
64 ["foo"] | 64 ["foo-2"] |
65 ); | 65 ); |
66 testScriptMatches( | 66 testScriptMatches( |
67 "Ignore filters that include parent domain but exclude subdomain", | 67 "Ignore filters that include parent domain but exclude subdomain", |
68 [ | 68 [ |
69 "~www.example.com,example.com#$#foo" | 69 "~www.example.com,example.com#$#foo" |
70 ], | 70 ], |
71 "www.example.com", | 71 "www.example.com", |
72 [] | 72 [] |
73 ); | 73 ); |
74 testScriptMatches( | 74 testScriptMatches( |
75 "Ignore filters for other subdomain", | 75 "Ignore filters for other subdomain", |
76 [ | 76 [ |
77 "www.example.com#$#foo", | 77 "www.example.com#$#foo-1", |
78 "other.example.com#$#foo" | 78 "other.example.com#$#foo-2" |
79 ], | 79 ], |
80 "other.example.com", | 80 "other.example.com", |
81 ["foo"] | 81 ["foo-2"] |
82 ); | 82 ); |
83 | 83 |
84 test.done(); | 84 test.done(); |
85 }; | 85 }; |
86 | 86 |
87 exports.testSnippetFiltersContainer = function(test) | 87 exports.testSnippetFiltersContainer = function(test) |
88 { | 88 { |
89 function compareRules(description, domain, expectedMatches) | 89 function compareRules(description, domain, expectedMatches) |
90 { | 90 { |
91 let result = Snippets.getScriptsForDomain(domain); | 91 let result = Snippets.getScriptsForDomain(domain); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 // between executions. In the example below, assertFoo does not find 456 but | 247 // between executions. In the example below, assertFoo does not find 456 but |
248 // it doesn't find 123 either. It's the initial value 0. | 248 // it doesn't find 123 either. It's the initial value 0. |
249 new Function( | 249 new Function( |
250 compileScript("setFoo 456; assertFoo 0", [ | 250 compileScript("setFoo 456; assertFoo 0", [ |
251 ...libraries, "let foo = 1; exports.setFoo = value => { foo = value; };" | 251 ...libraries, "let foo = 1; exports.setFoo = value => { foo = value; };" |
252 ]) | 252 ]) |
253 )(); | 253 )(); |
254 | 254 |
255 test.done(); | 255 test.done(); |
256 }; | 256 }; |
LEFT | RIGHT |