| OLD | NEW |
| 1 (function() | 1 (function() |
| 2 { | 2 { |
| 3 module("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFil
terComponents}); | 3 module("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFil
terComponents}); |
| 4 | 4 |
| 5 function compareKeywords(text, expected) | 5 function compareKeywords(text, expected) |
| 6 { | 6 { |
| 7 for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)]) | 7 for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)]) |
| 8 { | 8 { |
| 9 let matcher = new Matcher(); | 9 let matcher = new Matcher(); |
| 10 let result = []; | 10 let result = []; |
| 11 for (let dummy of expected) | 11 for (let dummy of expected) |
| 12 { | 12 { |
| 13 keyword = matcher.findKeyword(filter); | 13 keyword = matcher.findKeyword(filter); |
| 14 result.push(keyword); | 14 result.push(keyword); |
| 15 if (keyword) | 15 if (keyword) |
| 16 { | 16 { |
| 17 let dummyFilter = Filter.fromText('^' + keyword + '^'); | 17 let dummyFilter = Filter.fromText('^' + keyword + '^'); |
| 18 dummyFilter.filterCount = Infinity; | 18 dummyFilter.filterCount = Infinity; |
| 19 matcher.add(dummyFilter); | 19 matcher.add(dummyFilter); |
| 20 } | 20 } |
| 21 } | 21 } |
| 22 | 22 |
| 23 equal(result.join(", "), expected.join(", "), "Keyword candidates for " +
filter.text); | 23 equal(result.join(", "), expected.join(", "), "Keyword candidates for " +
filter.text); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 function checkMatch(filters, location, contentType, docDomain, thirdParty, exp
ected) | 27 function checkMatch(filters, location, contentType, docDomain, thirdParty, sit
ekey, expected) |
| 28 { | 28 { |
| 29 let matcher = new Matcher(); | 29 let matcher = new Matcher(); |
| 30 for (let filter of filters) | 30 for (let filter of filters) |
| 31 matcher.add(Filter.fromText(filter)); | 31 matcher.add(Filter.fromText(filter)); |
| 32 | 32 |
| 33 let result = matcher.matchesAny(location, contentType, docDomain, thirdParty
); | 33 let result = matcher.matchesAny(location, contentType, docDomain, thirdParty
, sitekey); |
| 34 if (result) | 34 if (result) |
| 35 result = result.text; | 35 result = result.text; |
| 36 | 36 |
| 37 equal(result, expected, "match(" + location + ", " + contentType + ", " + do
cDomain + ", " + (thirdParty ? "third-party" : "first-party") + ") with:\n" + fi
lters.join("\n")); | 37 equal(result, expected, "match(" + location + ", " + contentType + ", " + do
cDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " + (sitekey
|| "no-sitekey") + ") with:\n" + filters.join("\n")); |
| 38 | 38 |
| 39 let combinedMatcher = new CombinedMatcher(); | 39 let combinedMatcher = new CombinedMatcher(); |
| 40 for (let i = 0; i < 2; i++) | 40 for (let i = 0; i < 2; i++) |
| 41 { | 41 { |
| 42 for (let filter of filters) | 42 for (let filter of filters) |
| 43 combinedMatcher.add(Filter.fromText(filter)); | 43 combinedMatcher.add(Filter.fromText(filter)); |
| 44 | 44 |
| 45 let result = combinedMatcher.matchesAny(location, contentType, docDomain,
thirdParty); | 45 let result = combinedMatcher.matchesAny(location, contentType, docDomain,
thirdParty, sitekey); |
| 46 if (result) | 46 if (result) |
| 47 result = result.text; | 47 result = result.text; |
| 48 | 48 |
| 49 equal(result, expected, "combinedMatch(" + location + ", " + contentType +
", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ") wit
h:\n" + filters.join("\n")); | 49 equal(result, expected, "combinedMatch(" + location + ", " + contentType +
", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " +
(sitekey || "no-sitekey") + ") with:\n" + filters.join("\n")); |
| 50 | 50 |
| 51 // For next run: add whitelisting filters | 51 // For next run: add whitelisting filters |
| 52 filters = filters.map((text) => "@@" + text); | 52 filters = filters.map((text) => "@@" + text); |
| 53 if (expected) | 53 if (expected) |
| 54 expected = "@@" + expected; | 54 expected = "@@" + expected; |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 function cacheCheck(matcher, location, contentType, docDomain, thirdParty, exp
ected) | 58 function cacheCheck(matcher, location, contentType, docDomain, thirdParty, exp
ected) |
| 59 { | 59 { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 89 compareKeywords("^foo%2Ebar^", ["foo%2ebar"]); | 89 compareKeywords("^foo%2Ebar^", ["foo%2ebar"]); |
| 90 compareKeywords("^aSdF^1234", ["asdf"]); | 90 compareKeywords("^aSdF^1234", ["asdf"]); |
| 91 compareKeywords("_asdf_1234_", ["asdf", "1234"]); | 91 compareKeywords("_asdf_1234_", ["asdf", "1234"]); |
| 92 compareKeywords("+asdf-1234=", ["asdf", "1234"]); | 92 compareKeywords("+asdf-1234=", ["asdf", "1234"]); |
| 93 compareKeywords("/123^ad2&ad&", ["123", "ad2"]); | 93 compareKeywords("/123^ad2&ad&", ["123", "ad2"]); |
| 94 compareKeywords("/123^ad2&ad$script,domain=example.com", ["123", "ad2"]); | 94 compareKeywords("/123^ad2&ad$script,domain=example.com", ["123", "ad2"]); |
| 95 }); | 95 }); |
| 96 | 96 |
| 97 test("Filter matching", function() | 97 test("Filter matching", function() |
| 98 { | 98 { |
| 99 checkMatch([], "http://abc/def", "IMAGE", null, false, null); | 99 checkMatch([], "http://abc/def", "IMAGE", null, false, null, null); |
| 100 checkMatch(["abc"], "http://abc/def", "IMAGE", null, false, "abc"); | 100 checkMatch(["abc"], "http://abc/def", "IMAGE", null, false, null, "abc"); |
| 101 checkMatch(["abc", "ddd"], "http://abc/def", "IMAGE", null, false, "abc"); | 101 checkMatch(["abc", "ddd"], "http://abc/def", "IMAGE", null, false, null, "ab
c"); |
| 102 checkMatch(["ddd", "abc"], "http://abc/def", "IMAGE", null, false, "abc"); | 102 checkMatch(["ddd", "abc"], "http://abc/def", "IMAGE", null, false, null, "ab
c"); |
| 103 checkMatch(["ddd", "abd"], "http://abc/def", "IMAGE", null, false, null); | 103 checkMatch(["ddd", "abd"], "http://abc/def", "IMAGE", null, false, null, nul
l); |
| 104 checkMatch(["abc", "://abc/d"], "http://abc/def", "IMAGE", null, false, "://
abc/d"); | 104 checkMatch(["abc", "://abc/d"], "http://abc/def", "IMAGE", null, false, null
, "://abc/d"); |
| 105 checkMatch(["://abc/d", "abc"], "http://abc/def", "IMAGE", null, false, "://
abc/d"); | 105 checkMatch(["://abc/d", "abc"], "http://abc/def", "IMAGE", null, false, null
, "://abc/d"); |
| 106 checkMatch(["|http://"], "http://abc/def", "IMAGE", null, false, "|http://")
; | 106 checkMatch(["|http://"], "http://abc/def", "IMAGE", null, false, null, "|htt
p://"); |
| 107 checkMatch(["|http://abc"], "http://abc/def", "IMAGE", null, false, "|http:/
/abc"); | 107 checkMatch(["|http://abc"], "http://abc/def", "IMAGE", null, false, null, "|
http://abc"); |
| 108 checkMatch(["|abc"], "http://abc/def", "IMAGE", null, false, null); | 108 checkMatch(["|abc"], "http://abc/def", "IMAGE", null, false, null, null); |
| 109 checkMatch(["|/abc/def"], "http://abc/def", "IMAGE", null, false, null); | 109 checkMatch(["|/abc/def"], "http://abc/def", "IMAGE", null, false, null, null
); |
| 110 checkMatch(["/def|"], "http://abc/def", "IMAGE", null, false, "/def|"); | 110 checkMatch(["/def|"], "http://abc/def", "IMAGE", null, false, null, "/def|")
; |
| 111 checkMatch(["/abc/def|"], "http://abc/def", "IMAGE", null, false, "/abc/def|
"); | 111 checkMatch(["/abc/def|"], "http://abc/def", "IMAGE", null, false, null, "/ab
c/def|"); |
| 112 checkMatch(["/abc/|"], "http://abc/def", "IMAGE", null, false, null); | 112 checkMatch(["/abc/|"], "http://abc/def", "IMAGE", null, false, null, null); |
| 113 checkMatch(["http://abc/|"], "http://abc/def", "IMAGE", null, false, null); | 113 checkMatch(["http://abc/|"], "http://abc/def", "IMAGE", null, false, null, n
ull); |
| 114 checkMatch(["|http://abc/def|"], "http://abc/def", "IMAGE", null, false, "|h
ttp://abc/def|"); | 114 checkMatch(["|http://abc/def|"], "http://abc/def", "IMAGE", null, false, nul
l, "|http://abc/def|"); |
| 115 checkMatch(["|/abc/def|"], "http://abc/def", "IMAGE", null, false, null); | 115 checkMatch(["|/abc/def|"], "http://abc/def", "IMAGE", null, false, null, nul
l); |
| 116 checkMatch(["|http://abc/|"], "http://abc/def", "IMAGE", null, false, null); | 116 checkMatch(["|http://abc/|"], "http://abc/def", "IMAGE", null, false, null,
null); |
| 117 checkMatch(["|/abc/|"], "http://abc/def", "IMAGE", null, false, null); | 117 checkMatch(["|/abc/|"], "http://abc/def", "IMAGE", null, false, null, null); |
| 118 checkMatch(["||example.com/abc"], "http://example.com/abc/def", "IMAGE", nul
l, false, "||example.com/abc"); | 118 checkMatch(["||example.com/abc"], "http://example.com/abc/def", "IMAGE", nul
l, false, null, "||example.com/abc"); |
| 119 checkMatch(["||com/abc/def"], "http://example.com/abc/def", "IMAGE", null, f
alse, "||com/abc/def"); | 119 checkMatch(["||com/abc/def"], "http://example.com/abc/def", "IMAGE", null, f
alse, null, "||com/abc/def"); |
| 120 checkMatch(["||com/abc"], "http://example.com/abc/def", "IMAGE", null, false
, "||com/abc"); | 120 checkMatch(["||com/abc"], "http://example.com/abc/def", "IMAGE", null, false
, null, "||com/abc"); |
| 121 checkMatch(["||mple.com/abc"], "http://example.com/abc/def", "IMAGE", null,
false, null); | 121 checkMatch(["||mple.com/abc"], "http://example.com/abc/def", "IMAGE", null,
false, null, null); |
| 122 checkMatch(["||.com/abc/def"], "http://example.com/abc/def", "IMAGE", null,
false, null); | 122 checkMatch(["||.com/abc/def"], "http://example.com/abc/def", "IMAGE", null,
false, null, null); |
| 123 checkMatch(["||http://example.com/"], "http://example.com/abc/def", "IMAGE",
null, false, null); | 123 checkMatch(["||http://example.com/"], "http://example.com/abc/def", "IMAGE",
null, false, null, null); |
| 124 checkMatch(["||example.com/abc/def|"], "http://example.com/abc/def", "IMAGE"
, null, false, "||example.com/abc/def|"); | 124 checkMatch(["||example.com/abc/def|"], "http://example.com/abc/def", "IMAGE"
, null, false, null, "||example.com/abc/def|"); |
| 125 checkMatch(["||com/abc/def|"], "http://example.com/abc/def", "IMAGE", null,
false, "||com/abc/def|"); | 125 checkMatch(["||com/abc/def|"], "http://example.com/abc/def", "IMAGE", null,
false, null, "||com/abc/def|"); |
| 126 checkMatch(["||example.com/abc|"], "http://example.com/abc/def", "IMAGE", nu
ll, false, null); | 126 checkMatch(["||example.com/abc|"], "http://example.com/abc/def", "IMAGE", nu
ll, false, null, null); |
| 127 checkMatch(["abc", "://abc/d", "asdf1234"], "http://abc/def", "IMAGE", null,
false, "://abc/d"); | 127 checkMatch(["abc", "://abc/d", "asdf1234"], "http://abc/def", "IMAGE", null,
false, null, "://abc/d"); |
| 128 checkMatch(["foo*://abc/d", "foo*//abc/de", "://abc/de", "asdf1234"], "http:
//abc/def", "IMAGE", null, false, "://abc/de"); | 128 checkMatch(["foo*://abc/d", "foo*//abc/de", "://abc/de", "asdf1234"], "http:
//abc/def", "IMAGE", null, false, null, "://abc/de"); |
| 129 checkMatch(["abc$third-party", "abc$~third-party", "ddd"], "http://abc/def",
"IMAGE", null, false, "abc$~third-party"); | 129 checkMatch(["abc$third-party", "abc$~third-party", "ddd"], "http://abc/def",
"IMAGE", null, false, null, "abc$~third-party"); |
| 130 checkMatch(["abc$third-party", "abc$~third-party", "ddd"], "http://abc/def",
"IMAGE", null, true, "abc$third-party"); | 130 checkMatch(["abc$third-party", "abc$~third-party", "ddd"], "http://abc/def",
"IMAGE", null, true, null, "abc$third-party"); |
| 131 checkMatch(["//abc/def$third-party", "//abc/def$~third-party", "//abc_def"],
"http://abc/def", "IMAGE", null, false, "//abc/def$~third-party"); | 131 checkMatch(["//abc/def$third-party", "//abc/def$~third-party", "//abc_def"],
"http://abc/def", "IMAGE", null, false, null, "//abc/def$~third-party"); |
| 132 checkMatch(["//abc/def$third-party", "//abc/def$~third-party", "//abc_def"],
"http://abc/def", "IMAGE", null, true, "//abc/def$third-party"); | 132 checkMatch(["//abc/def$third-party", "//abc/def$~third-party", "//abc_def"],
"http://abc/def", "IMAGE", null, true, null, "//abc/def$third-party"); |
| 133 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def"], "http://abc
/def", "IMAGE", null, true, "//abc/def"); | 133 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def"], "http://abc
/def", "IMAGE", null, true, null, "//abc/def"); |
| 134 checkMatch(["//abc/def", "abc$third-party", "abc$~third-party"], "http://abc
/def", "IMAGE", null, true, "//abc/def"); | 134 checkMatch(["//abc/def", "abc$third-party", "abc$~third-party"], "http://abc
/def", "IMAGE", null, true, null, "//abc/def"); |
| 135 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def$third-party"],
"http://abc/def", "IMAGE", null, true, "//abc/def$third-party"); | 135 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def$third-party"],
"http://abc/def", "IMAGE", null, true, null, "//abc/def$third-party"); |
| 136 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def$third-party"],
"http://abc/def", "IMAGE", null, false, "abc$~third-party"); | 136 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def$third-party"],
"http://abc/def", "IMAGE", null, false, null, "abc$~third-party"); |
| 137 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def$~third-party"]
, "http://abc/def", "IMAGE", null, true, "abc$third-party"); | 137 checkMatch(["abc$third-party", "abc$~third-party", "//abc/def$~third-party"]
, "http://abc/def", "IMAGE", null, true, null, "abc$third-party"); |
| 138 checkMatch(["abc$image", "abc$script", "abc$~image"], "http://abc/def", "IMA
GE", null, false, "abc$image"); | 138 checkMatch(["abc$image", "abc$script", "abc$~image"], "http://abc/def", "IMA
GE", null, false, null, "abc$image"); |
| 139 checkMatch(["abc$image", "abc$script", "abc$~script"], "http://abc/def", "SC
RIPT", null, false, "abc$script"); | 139 checkMatch(["abc$image", "abc$script", "abc$~script"], "http://abc/def", "SC
RIPT", null, false, null, "abc$script"); |
| 140 checkMatch(["abc$image", "abc$script", "abc$~image"], "http://abc/def", "OTH
ER", null, false, "abc$~image"); | 140 checkMatch(["abc$image", "abc$script", "abc$~image"], "http://abc/def", "OTH
ER", null, false, null, "abc$~image"); |
| 141 checkMatch(["//abc/def$image", "//abc/def$script", "//abc/def$~image"], "htt
p://abc/def", "IMAGE", null, false, "//abc/def$image"); | 141 checkMatch(["//abc/def$image", "//abc/def$script", "//abc/def$~image"], "htt
p://abc/def", "IMAGE", null, false, null, "//abc/def$image"); |
| 142 checkMatch(["//abc/def$image", "//abc/def$script", "//abc/def$~script"], "ht
tp://abc/def", "SCRIPT", null, false, "//abc/def$script"); | 142 checkMatch(["//abc/def$image", "//abc/def$script", "//abc/def$~script"], "ht
tp://abc/def", "SCRIPT", null, false, null, "//abc/def$script"); |
| 143 checkMatch(["//abc/def$image", "//abc/def$script", "//abc/def$~image"], "htt
p://abc/def", "OTHER", null, false, "//abc/def$~image"); | 143 checkMatch(["//abc/def$image", "//abc/def$script", "//abc/def$~image"], "htt
p://abc/def", "OTHER", null, false, null, "//abc/def$~image"); |
| 144 checkMatch(["abc$image", "abc$~image", "//abc/def"], "http://abc/def", "IMAG
E", null, false, "//abc/def"); | 144 checkMatch(["abc$image", "abc$~image", "//abc/def"], "http://abc/def", "IMAG
E", null, false, null, "//abc/def"); |
| 145 checkMatch(["//abc/def", "abc$image", "abc$~image"], "http://abc/def", "IMAG
E", null, false, "//abc/def"); | 145 checkMatch(["//abc/def", "abc$image", "abc$~image"], "http://abc/def", "IMAG
E", null, false, null, "//abc/def"); |
| 146 checkMatch(["abc$image", "abc$~image", "//abc/def$image"], "http://abc/def",
"IMAGE", null, false, "//abc/def$image"); | 146 checkMatch(["abc$image", "abc$~image", "//abc/def$image"], "http://abc/def",
"IMAGE", null, false, null, "//abc/def$image"); |
| 147 checkMatch(["abc$image", "abc$~image", "//abc/def$script"], "http://abc/def"
, "IMAGE", null, false, "abc$image"); | 147 checkMatch(["abc$image", "abc$~image", "//abc/def$script"], "http://abc/def"
, "IMAGE", null, false, null, "abc$image"); |
| 148 checkMatch(["abc$domain=foo.com", "abc$domain=bar.com", "abc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "foo.com", false, "abc$domain=foo.com"); | 148 checkMatch(["abc$domain=foo.com", "abc$domain=bar.com", "abc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "foo.com", false, null, "abc$domain=foo.
com"); |
| 149 checkMatch(["abc$domain=foo.com", "abc$domain=bar.com", "abc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "bar.com", false, "abc$domain=bar.com"); | 149 checkMatch(["abc$domain=foo.com", "abc$domain=bar.com", "abc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "bar.com", false, null, "abc$domain=bar.
com"); |
| 150 checkMatch(["abc$domain=foo.com", "abc$domain=bar.com", "abc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "baz.com", false, "abc$domain=~foo.com|~
bar.com"); | 150 checkMatch(["abc$domain=foo.com", "abc$domain=bar.com", "abc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "baz.com", false, null, "abc$domain=~foo
.com|~bar.com"); |
| 151 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "foo.com", false, "abc$domain=foo.com"); | 151 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "foo.com", false, null, "abc$domain=foo.
com"); |
| 152 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "bar.com", false, null); | 152 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "bar.com", false, null, null); |
| 153 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "baz.com", false, null); | 153 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://abc/def", "IMAGE", "baz.com", false, null, null); |
| 154 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://ccc/def", "IMAGE", "baz.com", false, "ccc$domain=~foo.com|~
bar.com"); | 154 checkMatch(["abc$domain=foo.com", "cba$domain=bar.com", "ccc$domain=~foo.com
|~bar.com"], "http://ccc/def", "IMAGE", "baz.com", false, null, "ccc$domain=~foo
.com|~bar.com"); |
| 155 checkMatch(["abc$sitekey=foo-publickey", "abc$sitekey=bar-publickey"], "http
://abc/def", "IMAGE", "foo.com", false, "foo-publickey", "abc$sitekey=foo-public
key"); |
| 156 checkMatch(["abc$sitekey=foo-publickey", "abc$sitekey=bar-publickey"], "http
://abc/def", "IMAGE", "bar.com", false, "bar-publickey", "abc$sitekey=bar-public
key"); |
| 157 checkMatch(["abc$sitekey=foo-publickey", "cba$sitekey=bar-publickey"], "http
://abc/def", "IMAGE", "bar.com", false, "bar-publickey", null); |
| 158 checkMatch(["abc$sitekey=foo-publickey", "cba$sitekey=bar-publickey"], "http
://abc/def", "IMAGE", "baz.com", false, null, null); |
| 159 checkMatch(["abc$sitekey=foo-publickey,domain=foo.com", "abc$sitekey=bar-pub
lickey,domain=bar.com"], "http://abc/def", "IMAGE", "foo.com", false, "foo-publi
ckey", "abc$sitekey=foo-publickey,domain=foo.com"); |
| 160 checkMatch(["abc$sitekey=foo-publickey,domain=foo.com", "abc$sitekey=bar-pub
lickey,domain=bar.com"], "http://abc/def", "IMAGE", "foo.com", false, "bar-publi
ckey", null); |
| 161 checkMatch(["abc$sitekey=foo-publickey,domain=foo.com", "abc$sitekey=bar-pub
lickey,domain=bar.com"], "http://abc/def", "IMAGE", "bar.com", false, "foo-publi
ckey", null); |
| 162 checkMatch(["abc$sitekey=foo-publickey,domain=foo.com", "abc$sitekey=bar-pub
lickey,domain=bar.com"], "http://abc/def", "IMAGE", "bar.com", false, "bar-publi
ckey", "abc$sitekey=bar-publickey,domain=bar.com"); |
| 155 }); | 163 }); |
| 156 | 164 |
| 157 test("Result cache checks", function() | 165 test("Result cache checks", function() |
| 158 { | 166 { |
| 159 let matcher = new CombinedMatcher(); | 167 let matcher = new CombinedMatcher(); |
| 160 matcher.add(Filter.fromText("abc$image")); | 168 matcher.add(Filter.fromText("abc$image")); |
| 161 matcher.add(Filter.fromText("abc$script")); | 169 matcher.add(Filter.fromText("abc$script")); |
| 162 matcher.add(Filter.fromText("abc$~image,~script,~document")); | 170 matcher.add(Filter.fromText("abc$~image,~script,~document")); |
| 163 matcher.add(Filter.fromText("cba$third-party")); | 171 matcher.add(Filter.fromText("cba$third-party")); |
| 164 matcher.add(Filter.fromText("cba$~third-party,~script")); | 172 matcher.add(Filter.fromText("cba$~third-party,~script")); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 179 cacheCheck(matcher, "http://fed", "IMAGE", null, false, "http://fed$~third-p
arty,~script"); | 187 cacheCheck(matcher, "http://fed", "IMAGE", null, false, "http://fed$~third-p
arty,~script"); |
| 180 cacheCheck(matcher, "http://fed", "IMAGE", null, true, "http://fed$third-par
ty"); | 188 cacheCheck(matcher, "http://fed", "IMAGE", null, true, "http://fed$third-par
ty"); |
| 181 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, false, "cba$~third-p
arty,~script"); | 189 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, false, "cba$~third-p
arty,~script"); |
| 182 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, true, "cba$third-par
ty"); | 190 cacheCheck(matcher, "http://abc_cba", "DOCUMENT", null, true, "cba$third-par
ty"); |
| 183 cacheCheck(matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script"); | 191 cacheCheck(matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script"); |
| 184 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, false, "http:
//fed$~third-party,~script"); | 192 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, false, "http:
//fed$~third-party,~script"); |
| 185 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, true, "http:/
/fed$third-party"); | 193 cacheCheck(matcher, "http://def?http://fed", "DOCUMENT", null, true, "http:/
/fed$third-party"); |
| 186 cacheCheck(matcher, "http://def?http://fed", "SCRIPT", null, false, "http://
def$script"); | 194 cacheCheck(matcher, "http://def?http://fed", "SCRIPT", null, false, "http://
def$script"); |
| 187 }); | 195 }); |
| 188 })(); | 196 })(); |
| OLD | NEW |