OLD | NEW |
(Empty) | |
| 1 "use strict"; |
| 2 |
| 3 let {Filter, RegExpFilter} = require("../lib/filterClasses"); |
| 4 |
| 5 function testMatch(test, text, location, contentType, docDomain, thirdParty, sit
ekey, expected) |
| 6 { |
| 7 function testMatch_internal(text, location, contentType, docDomain, thirdParty
, sitekey, expected) |
| 8 { |
| 9 let filter = Filter.fromText(text); |
| 10 let result = filter.matches(location, RegExpFilter.typeMap[contentType], doc
Domain, thirdParty, sitekey); |
| 11 test.equal(result, expected, '"' + text + '".matches(' + location + ", " + c
ontentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-part
y") + ", " + (sitekey || "no-sitekey") + ")"); |
| 12 filter.delete() |
| 13 } |
| 14 testMatch_internal(text, location, contentType, docDomain, thirdParty, sitekey
, expected); |
| 15 if (!/^@@/.test(text)) |
| 16 testMatch_internal("@@" + text, location, contentType, docDomain, thirdParty
, sitekey, expected); |
| 17 } |
| 18 |
| 19 exports.testBasicFilters = function(test) |
| 20 { |
| 21 testMatch(test, "abc", "http://abc/adf", "IMAGE", null, false, null, true); |
| 22 testMatch(test, "abc", "http://ABC/adf", "IMAGE", null, false, null, true); |
| 23 testMatch(test, "abc", "http://abd/adf", "IMAGE", null, false, null, false); |
| 24 testMatch(test, "|abc", "http://abc/adf", "IMAGE", null, false, null, false); |
| 25 testMatch(test, "|http://abc", "http://abc/adf", "IMAGE", null, false, null, t
rue); |
| 26 testMatch(test, "abc|", "http://abc/adf", "IMAGE", null, false, null, false); |
| 27 testMatch(test, "abc/adf|", "http://abc/adf", "IMAGE", null, false, null, true
); |
| 28 testMatch(test, "||example.com/foo", "http://example.com/foo/bar", "IMAGE", nu
ll, false, null, true); |
| 29 testMatch(test, "||com/foo", "http://example.com/foo/bar", "IMAGE", null, fals
e, null, true); |
| 30 testMatch(test, "||mple.com/foo", "http://example.com/foo/bar", "IMAGE", null,
false, null, false); |
| 31 testMatch(test, "||/example.com/foo", "http://example.com/foo/bar", "IMAGE", n
ull, false, null, false); |
| 32 testMatch(test, "||example.com/foo/bar|", "http://example.com/foo/bar", "IMAGE
", null, false, null, true); |
| 33 testMatch(test, "||example.com/foo", "http://foo.com/http://example.com/foo/ba
r", "IMAGE", null, false, null, false); |
| 34 testMatch(test, "||example.com/foo|", "http://example.com/foo/bar", "IMAGE", n
ull, false, null, false); |
| 35 |
| 36 test.done(); |
| 37 }; |
| 38 |
| 39 exports.testSeparatorPlaceholders = function(test) |
| 40 { |
| 41 testMatch(test, "abc^d", "http://abc/def", "IMAGE", null, false, null, true); |
| 42 testMatch(test, "abc^e", "http://abc/def", "IMAGE", null, false, null, false); |
| 43 testMatch(test, "def^", "http://abc/def", "IMAGE", null, false, null, true); |
| 44 testMatch(test, "http://abc/d^f", "http://abc/def", "IMAGE", null, false, null
, false); |
| 45 testMatch(test, "http://abc/def^", "http://abc/def", "IMAGE", null, false, nul
l, true); |
| 46 testMatch(test, "^foo=bar^", "http://abc/?foo=bar", "IMAGE", null, false, null
, true); |
| 47 testMatch(test, "^foo=bar^", "http://abc/?a=b&foo=bar", "IMAGE", null, false,
null, true); |
| 48 testMatch(test, "^foo=bar^", "http://abc/?foo=bar&a=b", "IMAGE", null, false,
null, true); |
| 49 testMatch(test, "^foo=bar^", "http://abc/?notfoo=bar", "IMAGE", null, false, n
ull, false); |
| 50 testMatch(test, "^foo=bar^", "http://abc/?foo=barnot", "IMAGE", null, false, n
ull, false); |
| 51 testMatch(test, "^foo=bar^", "http://abc/?foo=bar%2Enot", "IMAGE", null, false
, null, false); |
| 52 testMatch(test, "||example.com^", "http://example.com/foo/bar", "IMAGE", null,
false, null, true); |
| 53 testMatch(test, "||example.com^", "http://example.company.com/foo/bar", "IMAGE
", null, false, null, false); |
| 54 testMatch(test, "||example.com^", "http://example.com:1234/foo/bar", "IMAGE",
null, false, null, true); |
| 55 testMatch(test, "||example.com^", "http://example.com.com/foo/bar", "IMAGE", n
ull, false, null, false); |
| 56 testMatch(test, "||example.com^", "http://example.com-company.com/foo/bar", "I
MAGE", null, false, null, false); |
| 57 testMatch(test, "||example.com^foo", "http://example.com/foo/bar", "IMAGE", nu
ll, false, null, true); |
| 58 testMatch(test, "||пример.ру^", "http://пример.ру/foo/bar", "IMAGE", null, fal
se, null, true); |
| 59 testMatch(test, "||пример.ру^", "http://пример.руководитель.ру/foo/bar", "IMAG
E", null, false, null, false); |
| 60 testMatch(test, "||пример.ру^", "http://пример.ру:1234/foo/bar", "IMAGE", null
, false, null, true); |
| 61 testMatch(test, "||пример.ру^", "http://пример.ру.ру/foo/bar", "IMAGE", null,
false, null, false); |
| 62 testMatch(test, "||пример.ру^", "http://пример.ру-ководитель.ру/foo/bar", "IMA
GE", null, false, null, false); |
| 63 testMatch(test, "||пример.ру^foo", "http://пример.ру/foo/bar", "IMAGE", null,
false, null, true); |
| 64 |
| 65 test.done(); |
| 66 }; |
| 67 |
| 68 exports.testWildcards = function(test) |
| 69 { |
| 70 testMatch(test, "abc*d", "http://abc/adf", "IMAGE", null, false, null, true); |
| 71 testMatch(test, "abc*d", "http://abcd/af", "IMAGE", null, false, null, true); |
| 72 testMatch(test, "abc*d", "http://abc/d/af", "IMAGE", null, false, null, true); |
| 73 testMatch(test, "abc*d", "http://dabc/af", "IMAGE", null, false, null, false); |
| 74 testMatch(test, "*abc", "http://abc/adf", "IMAGE", null, false, null, true); |
| 75 testMatch(test, "abc*", "http://abc/adf", "IMAGE", null, false, null, true); |
| 76 testMatch(test, "|*abc", "http://abc/adf", "IMAGE", null, false, null, true); |
| 77 testMatch(test, "abc*|", "http://abc/adf", "IMAGE", null, false, null, true); |
| 78 testMatch(test, "abc***d", "http://abc/adf", "IMAGE", null, false, null, true)
; |
| 79 |
| 80 test.done(); |
| 81 }; |
| 82 |
| 83 exports.testTypeOptions = function(test) |
| 84 { |
| 85 testMatch(test, "abc$image", "http://abc/adf", "IMAGE", null, false, null, tru
e); |
| 86 testMatch(test, "abc$other", "http://abc/adf", "IMAGE", null, false, null, fal
se); |
| 87 testMatch(test, "abc$other", "http://abc/adf", "OTHER", null, false, null, tru
e); |
| 88 testMatch(test, "abc$~other", "http://abc/adf", "OTHER", null, false, null, fa
lse); |
| 89 testMatch(test, "abc$script", "http://abc/adf", "IMAGE", null, false, null, fa
lse); |
| 90 testMatch(test, "abc$script", "http://abc/adf", "SCRIPT", null, false, null, t
rue); |
| 91 testMatch(test, "abc$~script", "http://abc/adf", "SCRIPT", null, false, null,
false); |
| 92 testMatch(test, "abc$stylesheet", "http://abc/adf", "IMAGE", null, false, null
, false); |
| 93 testMatch(test, "abc$stylesheet", "http://abc/adf", "STYLESHEET", null, false,
null, true); |
| 94 testMatch(test, "abc$~stylesheet", "http://abc/adf", "STYLESHEET", null, false
, null, false); |
| 95 testMatch(test, "abc$object", "http://abc/adf", "IMAGE", null, false, null, fa
lse); |
| 96 testMatch(test, "abc$object", "http://abc/adf", "OBJECT", null, false, null, t
rue); |
| 97 testMatch(test, "abc$~object", "http://abc/adf", "OBJECT", null, false, null,
false); |
| 98 testMatch(test, "abc$document", "http://abc/adf", "IMAGE", null, false, null,
false); |
| 99 testMatch(test, "abc$document", "http://abc/adf", "DOCUMENT", null, false, nul
l, true); |
| 100 testMatch(test, "abc$~document", "http://abc/adf", "DOCUMENT", null, false, nu
ll, false); |
| 101 testMatch(test, "abc$subdocument", "http://abc/adf", "IMAGE", null, false, nul
l, false); |
| 102 testMatch(test, "abc$subdocument", "http://abc/adf", "SUBDOCUMENT", null, fals
e, null, true); |
| 103 testMatch(test, "abc$~subdocument", "http://abc/adf", "SUBDOCUMENT", null, fal
se, null, false); |
| 104 testMatch(test, "abc$background", "http://abc/adf", "OBJECT", null, false, nul
l, false); |
| 105 testMatch(test, "abc$background", "http://abc/adf", "IMAGE", null, false, null
, true); |
| 106 testMatch(test, "abc$~background", "http://abc/adf", "IMAGE", null, false, nul
l, false); |
| 107 testMatch(test, "abc$xbl", "http://abc/adf", "IMAGE", null, false, null, false
); |
| 108 testMatch(test, "abc$xbl", "http://abc/adf", "XBL", null, false, null, true); |
| 109 testMatch(test, "abc$~xbl", "http://abc/adf", "XBL", null, false, null, false)
; |
| 110 testMatch(test, "abc$ping", "http://abc/adf", "IMAGE", null, false, null, fals
e); |
| 111 testMatch(test, "abc$ping", "http://abc/adf", "PING", null, false, null, true)
; |
| 112 testMatch(test, "abc$~ping", "http://abc/adf", "PING", null, false, null, fals
e); |
| 113 testMatch(test, "abc$xmlhttprequest", "http://abc/adf", "IMAGE", null, false,
null, false); |
| 114 testMatch(test, "abc$xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null
, false, null, true); |
| 115 testMatch(test, "abc$~xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", nul
l, false, null, false); |
| 116 testMatch(test, "abc$object-subrequest", "http://abc/adf", "IMAGE", null, fals
e, null, false); |
| 117 testMatch(test, "abc$object-subrequest", "http://abc/adf", "OBJECT_SUBREQUEST"
, null, false, null, true); |
| 118 testMatch(test, "abc$~object-subrequest", "http://abc/adf", "OBJECT_SUBREQUEST
", null, false, null, false); |
| 119 testMatch(test, "abc$dtd", "http://abc/adf", "IMAGE", null, false, null, false
); |
| 120 testMatch(test, "abc$dtd", "http://abc/adf", "DTD", null, false, null, true); |
| 121 testMatch(test, "abc$~dtd", "http://abc/adf", "DTD", null, false, null, false)
; |
| 122 |
| 123 testMatch(test, "abc$media", "http://abc/adf", "IMAGE", null, false, null, fal
se); |
| 124 testMatch(test, "abc$media", "http://abc/adf", "MEDIA", null, false, null, tru
e); |
| 125 testMatch(test, "abc$~media", "http://abc/adf", "MEDIA", null, false, null, fa
lse); |
| 126 |
| 127 testMatch(test, "abc$font", "http://abc/adf", "IMAGE", null, false, null, fals
e); |
| 128 testMatch(test, "abc$font", "http://abc/adf", "FONT", null, false, null, true)
; |
| 129 testMatch(test, "abc$~font", "http://abc/adf", "FONT", null, false, null, fals
e); |
| 130 |
| 131 testMatch(test, "abc$ping", "http://abc/adf", "IMAGE", null, false, null, fals
e); |
| 132 testMatch(test, "abc$ping", "http://abc/adf", "PING", null, false, null, true)
; |
| 133 testMatch(test, "abc$~ping", "http://abc/adf", "PING", null, false, null, fals
e); |
| 134 |
| 135 testMatch(test, "abc$image,script", "http://abc/adf", "IMAGE", null, false, nu
ll, true); |
| 136 testMatch(test, "abc$~image", "http://abc/adf", "IMAGE", null, false, null, fa
lse); |
| 137 testMatch(test, "abc$~script", "http://abc/adf", "IMAGE", null, false, null, t
rue); |
| 138 testMatch(test, "abc$~image,~script", "http://abc/adf", "IMAGE", null, false,
null, false); |
| 139 testMatch(test, "abc$~script,~image", "http://abc/adf", "IMAGE", null, false,
null, false); |
| 140 testMatch(test, "abc$~document,~script,~other", "http://abc/adf", "IMAGE", nul
l, false, null, true); |
| 141 testMatch(test, "abc$~image,image", "http://abc/adf", "IMAGE", null, false, nu
ll, true); |
| 142 testMatch(test, "abc$image,~image", "http://abc/adf", "IMAGE", null, false, nu
ll, false); |
| 143 testMatch(test, "abc$~image,image", "http://abc/adf", "SCRIPT", null, false, n
ull, true); |
| 144 testMatch(test, "abc$image,~image", "http://abc/adf", "SCRIPT", null, false, n
ull, false); |
| 145 testMatch(test, "abc$match-case", "http://abc/adf", "IMAGE", null, false, null
, true); |
| 146 testMatch(test, "abc$match-case", "http://ABC/adf", "IMAGE", null, false, null
, false); |
| 147 testMatch(test, "abc$~match-case", "http://abc/adf", "IMAGE", null, false, nul
l, true); |
| 148 testMatch(test, "abc$~match-case", "http://ABC/adf", "IMAGE", null, false, nul
l, true); |
| 149 testMatch(test, "abc$match-case,image", "http://abc/adf", "IMAGE", null, false
, null, true); |
| 150 testMatch(test, "abc$match-case,script", "http://abc/adf", "IMAGE", null, fals
e, null, false); |
| 151 testMatch(test, "abc$match-case,image", "http://ABC/adf", "IMAGE", null, false
, null, false); |
| 152 testMatch(test, "abc$match-case,script", "http://ABC/adf", "IMAGE", null, fals
e, null, false); |
| 153 testMatch(test, "abc$third-party", "http://abc/adf", "IMAGE", null, false, nul
l, false); |
| 154 testMatch(test, "abc$third-party", "http://abc/adf", "IMAGE", null, true, null
, true); |
| 155 testMatch(test, "abd$third-party", "http://abc/adf", "IMAGE", null, false, nul
l, false); |
| 156 testMatch(test, "abd$third-party", "http://abc/adf", "IMAGE", null, true, null
, false); |
| 157 testMatch(test, "abc$image,third-party", "http://abc/adf", "IMAGE", null, fals
e, null, false); |
| 158 testMatch(test, "abc$image,third-party", "http://abc/adf", "IMAGE", null, true
, null, true); |
| 159 testMatch(test, "abc$~image,third-party", "http://abc/adf", "IMAGE", null, fal
se, null, false); |
| 160 testMatch(test, "abc$~image,third-party", "http://abc/adf", "IMAGE", null, tru
e, null, false); |
| 161 testMatch(test, "abc$~third-party", "http://abc/adf", "IMAGE", null, false, nu
ll, true); |
| 162 testMatch(test, "abc$~third-party", "http://abc/adf", "IMAGE", null, true, nul
l, false); |
| 163 testMatch(test, "abd$~third-party", "http://abc/adf", "IMAGE", null, false, nu
ll, false); |
| 164 testMatch(test, "abd$~third-party", "http://abc/adf", "IMAGE", null, true, nul
l, false); |
| 165 testMatch(test, "abc$image,~third-party", "http://abc/adf", "IMAGE", null, fal
se, null, true); |
| 166 testMatch(test, "abc$image,~third-party", "http://abc/adf", "IMAGE", null, tru
e, null, false); |
| 167 testMatch(test, "abc$~image,~third-party", "http://abc/adf", "IMAGE", null, fa
lse, null, false); |
| 168 |
| 169 test.done(); |
| 170 }; |
| 171 |
| 172 exports.testRegularExpressions = function(test) |
| 173 { |
| 174 testMatch(test, "/abc/", "http://abc/adf", "IMAGE", null, false, null, true); |
| 175 testMatch(test, "/abc/", "http://abcd/adf", "IMAGE", null, false, null, true); |
| 176 testMatch(test, "*/abc/", "http://abc/adf", "IMAGE", null, false, null, true); |
| 177 testMatch(test, "*/abc/", "http://abcd/adf", "IMAGE", null, false, null, false
); |
| 178 testMatch(test, "/a\\wc/", "http://abc/adf", "IMAGE", null, false, null, true)
; |
| 179 testMatch(test, "/a\\wc/", "http://a1c/adf", "IMAGE", null, false, null, true)
; |
| 180 testMatch(test, "/a\\wc/", "http://a_c/adf", "IMAGE", null, false, null, true)
; |
| 181 testMatch(test, "/a\\wc/", "http://a%c/adf", "IMAGE", null, false, null, false
); |
| 182 |
| 183 test.done(); |
| 184 }; |
| 185 |
| 186 exports.textRegularExpressionsWithTypeOptions = function(test) |
| 187 { |
| 188 testMatch(test, "/abc/$image", "http://abc/adf", "IMAGE", null, false, null, t
rue); |
| 189 testMatch(test, "/abc/$image", "http://aBc/adf", "IMAGE", null, false, null, t
rue); |
| 190 testMatch(test, "/abc/$script", "http://abc/adf", "IMAGE", null, false, null,
false); |
| 191 testMatch(test, "/abc/$~image", "http://abcd/adf", "IMAGE", null, false, null,
false); |
| 192 testMatch(test, "/ab{2}c/$image", "http://abc/adf", "IMAGE", null, false, null
, false); |
| 193 testMatch(test, "/ab{2}c/$script", "http://abc/adf", "IMAGE", null, false, nul
l, false); |
| 194 testMatch(test, "/ab{2}c/$~image", "http://abcd/adf", "IMAGE", null, false, nu
ll, false); |
| 195 testMatch(test, "/abc/$third-party", "http://abc/adf", "IMAGE", null, false, n
ull, false); |
| 196 testMatch(test, "/abc/$third-party", "http://abc/adf", "IMAGE", null, true, nu
ll, true); |
| 197 testMatch(test, "/abc/$~third-party", "http://abc/adf", "IMAGE", null, false,
null, true); |
| 198 testMatch(test, "/abc/$~third-party", "http://abc/adf", "IMAGE", null, true, n
ull, false); |
| 199 testMatch(test, "/abc/$match-case", "http://abc/adf", "IMAGE", null, false, nu
ll, true); |
| 200 testMatch(test, "/abc/$match-case", "http://aBc/adf", "IMAGE", null, true, nul
l, false); |
| 201 testMatch(test, "/ab{2}c/$match-case", "http://abc/adf", "IMAGE", null, false,
null, false); |
| 202 testMatch(test, "/ab{2}c/$match-case", "http://aBc/adf", "IMAGE", null, true,
null, false); |
| 203 testMatch(test, "/abc/$~match-case", "http://abc/adf", "IMAGE", null, false, n
ull, true); |
| 204 testMatch(test, "/abc/$~match-case", "http://aBc/adf", "IMAGE", null, true, nu
ll, true); |
| 205 testMatch(test, "/ab{2}c/$~match-case", "http://abc/adf", "IMAGE", null, false
, null, false); |
| 206 testMatch(test, "/ab{2}c/$~match-case", "http://aBc/adf", "IMAGE", null, true,
null, false); |
| 207 |
| 208 test.done(); |
| 209 }; |
| 210 |
| 211 exports.testDomainRestrictions = function(test) |
| 212 { |
| 213 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com", tr
ue, null, true); |
| 214 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com.", t
rue, null, true); |
| 215 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "www.foo.com"
, true, null, true); |
| 216 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "www.foo.com.
", true, null, true); |
| 217 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "Foo.com", tr
ue, null, true); |
| 218 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "abc.def.foo.
com", true, null, true); |
| 219 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", "www.baz.com"
, true, null, false); |
| 220 testMatch(test, "abc$domain=foo.com", "http://abc/def", "IMAGE", null, true, n
ull, false); |
| 221 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "foo.
com", true, null, true); |
| 222 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "foo.
com.", true, null, true); |
| 223 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.
foo.com", true, null, true); |
| 224 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.
foo.com.", true, null, true); |
| 225 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "Foo.
com", true, null, true); |
| 226 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "abc.
def.foo.com", true, null, true); |
| 227 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.
baz.com", true, null, false); |
| 228 testMatch(test, "abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", null,
true, null, false); |
| 229 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "foo.
com", true, null, true); |
| 230 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "foo.
com.", true, null, true); |
| 231 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.
foo.com", true, null, true); |
| 232 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.
foo.com.", true, null, true); |
| 233 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "Foo.
com", true, null, true); |
| 234 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "abc.
def.foo.com", true, null, true); |
| 235 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.
baz.com", true, null, false); |
| 236 testMatch(test, "abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", null,
true, null, false); |
| 237 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "foo.com", t
rue, null, false); |
| 238 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "foo.com.",
true, null, false); |
| 239 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.foo.com
", true, null, false); |
| 240 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.foo.com
.", true, null, false); |
| 241 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "Foo.com", t
rue, null, false); |
| 242 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "abc.def.foo
.com", true, null, false); |
| 243 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.baz.com
", true, null, true); |
| 244 testMatch(test, "abc$domain=~foo.com", "http://abc/def", "IMAGE", null, true,
null, true); |
| 245 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "fo
o.com", true, null, false); |
| 246 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "fo
o.com.", true, null, false); |
| 247 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "ww
w.foo.com", true, null, false); |
| 248 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "ww
w.foo.com.", true, null, false); |
| 249 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "Fo
o.com", true, null, false); |
| 250 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "ab
c.def.foo.com", true, null, false); |
| 251 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "ww
w.baz.com", true, null, true); |
| 252 testMatch(test, "abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", nul
l, true, null, true); |
| 253 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "fo
o.com", true, null, false); |
| 254 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "fo
o.com.", true, null, false); |
| 255 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "ww
w.foo.com", true, null, false); |
| 256 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "ww
w.foo.com.", true, null, false); |
| 257 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "Fo
o.com", true, null, false); |
| 258 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "ab
c.def.foo.com", true, null, false); |
| 259 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "ww
w.baz.com", true, null, true); |
| 260 testMatch(test, "abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", nul
l, true, null, true); |
| 261 testMatch(test, "abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "foo
.com", true, null, true); |
| 262 testMatch(test, "abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "bar
.com", true, null, false); |
| 263 testMatch(test, "abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "baz
.com", true, null, false); |
| 264 testMatch(test, "abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE",
"foo.com", true, null, true); |
| 265 testMatch(test, "abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE",
"www.foo.com", true, null, true); |
| 266 testMatch(test, "abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE",
"bar.foo.com", true, null, false); |
| 267 testMatch(test, "abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE",
"www.bar.foo.com", true, null, false); |
| 268 testMatch(test, "abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE",
"baz.com", true, null, false); |
| 269 testMatch(test, "abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE",
"www.baz.com", true, null, false); |
| 270 testMatch(test, "abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "bar.com
", true, null, true); |
| 271 testMatch(test, "abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "bar.net
", true, null, false); |
| 272 testMatch(test, "abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "foo.com
", true, null, false); |
| 273 testMatch(test, "abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "foo.net
", true, null, false); |
| 274 testMatch(test, "abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "com", t
rue, null, true); |
| 275 testMatch(test, "abc$domain=foo.com", "http://ccc/def", "IMAGE", "foo.com", tr
ue, null, false); |
| 276 testMatch(test, "abc$domain=foo.com", "http://ccc/def", "IMAGE", "bar.com", tr
ue, null, false); |
| 277 testMatch(test, "abc$image,domain=foo.com", "http://abc/def", "IMAGE", "foo.co
m", true, null, true); |
| 278 testMatch(test, "abc$image,domain=foo.com", "http://abc/def", "IMAGE", "bar.co
m", true, null, false); |
| 279 testMatch(test, "abc$image,domain=foo.com", "http://abc/def", "OBJECT", "foo.c
om", true, null, false); |
| 280 testMatch(test, "abc$image,domain=foo.com", "http://abc/def", "OBJECT", "bar.c
om", true, null, false); |
| 281 testMatch(test, "abc$~image,domain=foo.com", "http://abc/def", "IMAGE", "foo.c
om", true, null, false); |
| 282 testMatch(test, "abc$~image,domain=foo.com", "http://abc/def", "IMAGE", "bar.c
om", true, null, false); |
| 283 testMatch(test, "abc$~image,domain=foo.com", "http://abc/def", "OBJECT", "foo.
com", true, null, true); |
| 284 testMatch(test, "abc$~image,domain=foo.com", "http://abc/def", "OBJECT", "bar.
com", true, null, false); |
| 285 testMatch(test, "abc$domain=foo.com,image", "http://abc/def", "IMAGE", "foo.co
m", true, null, true); |
| 286 testMatch(test, "abc$domain=foo.com,image", "http://abc/def", "IMAGE", "bar.co
m", true, null, false); |
| 287 testMatch(test, "abc$domain=foo.com,image", "http://abc/def", "OBJECT", "foo.c
om", true, null, false); |
| 288 testMatch(test, "abc$domain=foo.com,image", "http://abc/def", "OBJECT", "bar.c
om", true, null, false); |
| 289 testMatch(test, "abc$domain=foo.com,~image", "http://abc/def", "IMAGE", "foo.c
om", true, null, false); |
| 290 testMatch(test, "abc$domain=foo.com,~image", "http://abc/def", "IMAGE", "bar.c
om", true, null, false); |
| 291 testMatch(test, "abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "foo.
com", true, null, true); |
| 292 testMatch(test, "abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "bar.
com", true, null, false); |
| 293 |
| 294 test.done(); |
| 295 }; |
| 296 |
| 297 exports.testSitekeyRestrictions = function(test) |
| 298 { |
| 299 testMatch(test, "abc$sitekey=foo-publickey", "http://abc/def", "IMAGE", "foo.c
om", true, "foo-publickey", true); |
| 300 testMatch(test, "abc$sitekey=foo-publickey", "http://abc/def", "IMAGE", "foo.c
om", true, null, false); |
| 301 testMatch(test, "abc$sitekey=foo-publickey", "http://abc/def", "IMAGE", "foo.c
om", true, "bar-publickey", false); |
| 302 testMatch(test, "abc$sitekey=foo-publickey|bar-publickey", "http://abc/def", "
IMAGE", "foo.com", true, "foo-publickey", true); |
| 303 testMatch(test, "abc$sitekey=foo-publickey|bar-publickey", "http://abc/def", "
IMAGE", "foo.com", true, null, false); |
| 304 testMatch(test, "abc$sitekey=bar-publickey|foo-publickey", "http://abc/def", "
IMAGE", "foo.com", true, "foo-publickey", true); |
| 305 testMatch(test, "abc$sitekey=foo-publickey", "http://ccc/def", "IMAGE", "foo.c
om", true, "foo-publickey", false); |
| 306 testMatch(test, "abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def",
"IMAGE", "foo.com", true, "foo-publickey", true); |
| 307 testMatch(test, "abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def",
"IMAGE", "bar.com", true, "foo-publickey", false); |
| 308 testMatch(test, "abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def",
"IMAGE", "foo.com", true, "foo-publickey", false); |
| 309 testMatch(test, "abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def",
"IMAGE", "bar.com", true, "foo-publickey", true); |
| 310 |
| 311 test.done(); |
| 312 }; |
| 313 |
| 314 exports.testExceptionRules = function(test) |
| 315 { |
| 316 testMatch(test, "@@test", "http://test/", "DOCUMENT", null, false, null, false
); |
| 317 testMatch(test, "@@http://test*", "http://test/", "DOCUMENT", null, false, nul
l, false); |
| 318 testMatch(test, "@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, null,
false); |
| 319 testMatch(test, "@@test$document", "http://test/", "DOCUMENT", null, false, nu
ll, true); |
| 320 testMatch(test, "@@test$document,image", "http://test/", "DOCUMENT", null, fal
se, null, true); |
| 321 testMatch(test, "@@test$~image", "http://test/", "DOCUMENT", null, false, null
, false); |
| 322 testMatch(test, "@@test$~image,document", "http://test/", "DOCUMENT", null, fa
lse, null, true); |
| 323 testMatch(test, "@@test$document,~image", "http://test/", "DOCUMENT", null, fa
lse, null, true); |
| 324 testMatch(test, "@@test$document,domain=foo.com", "http://test/", "DOCUMENT",
"foo.com", false, null, true); |
| 325 testMatch(test, "@@test$document,domain=foo.com", "http://test/", "DOCUMENT",
"bar.com", false, null, false); |
| 326 testMatch(test, "@@test$document,domain=~foo.com", "http://test/", "DOCUMENT",
"foo.com", false, null, false); |
| 327 testMatch(test, "@@test$document,domain=~foo.com", "http://test/", "DOCUMENT",
"bar.com", false, null, true); |
| 328 testMatch(test, "@@test$document,sitekey=foo-publickey", "http://test/", "DOCU
MENT", "foo.com", false, "foo-publickey", true); |
| 329 testMatch(test, "@@test$document,sitekey=foo-publickey", "http://test/", "DOCU
MENT", "foo.com", false, null, false); |
| 330 |
| 331 test.done(); |
| 332 }; |
OLD | NEW |