| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 (function() | 1 (function() |
| 2 { | 2 { |
| 3 module("Matching of blocking filters", {setup: prepareFilterComponents, teardo wn: restoreFilterComponents}); | 3 module("Matching of blocking filters", {setup: prepareFilterComponents, teardo wn: restoreFilterComponents}); |
| 4 | 4 |
| 5 function testMatch(text, location, contentType, docDomain, thirdParty, expecte d) | 5 let publickeys = { |
| 6 { | 6 /* |
| 7 function testMatch_internal(text, location, contentType, docDomain, thirdPar ty, expected) | 7 -----BEGIN RSA PRIVATE KEY----- |
| 8 MIIBOgIBAAJBANLNgMGCl6kc3QE/73/ESBsuhzCNQWApqWS1nKVWf+RjDTiF80LD | |
| 9 2TiTdQhlW9mlWsDDbttsDlEcCmPVz6H3OUMCAwEAAQJBALo/ZSYTqsl4ve7vvTwG | |
| 10 gKq7ZihIdV1wEcDwELGoBiESo87zl//7q2q9/7VE3dB3Qp6uZMLtxVvXzF8bh074 | |
| 11 OuECIQDzzenwgPVMtg6OjMtZBAB95oKaTzd+x/8JienKW4edEQIhAN1Y+vlB/waB | |
| 12 miRjGMrsOQDHhUbxyL6NXaPfxYlosYETAiBg0M9qgztl+BH1x7FkqvMrC+OnNXf7 | |
| 13 L552gj7F7ez/kQIgOBNhyaHxlNlijpNYZZhAvLTPS/DXFYdE0M5RAgW26mcCIDrR | |
| 14 fi2xaM2NqJQCmyshtNmDxW2FCrtrQn1n0211WCEe | |
| 15 -----END RSA PRIVATE KEY----- | |
| 16 */ | |
| 17 foo: "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLNgMGCl6kc3QE/73/ESBsuhzCNQWApqWS1nK VWf+RjDTiF80LD2TiTdQhlW9mlWsDDbttsDlEcCmPVz6H3OUMCAwEAAQ", | |
| 18 /* | |
| 19 -----BEGIN RSA PRIVATE KEY----- | |
| 20 MIIBOgIBAAJBALlKJGIBHYU3rIWyGmiwUgK1BUUomSBgLzSngoE7gBc7mqgCsEbj | |
| 21 f9EJ5AvQIM1x7MhVsD5djpqHLcjiQlZFXfECAwEAAQJABEK7MXG7HwwXsH9W8h9T | |
| 22 03IcK+nyE3eCvmA3tQcMO/x93imcBdNiz7ev09wGIPDN3Kmauf70/QnjebuDSV9A | |
| 23 XQIhAN57+YUwDdGccxqZyj+wRuU5pA1rltIDBQByBLRGd6YjAiEA1TPE2PdWrSsp | |
| 24 S6VZoRPWIEebfH/ufWZEFfYKDwP9qtsCIEk3JSr2YGXNhXeIiq0g1oPSzzD3af+c | |
| 25 rMWzv+aPlgpfAiAvtSLiTg6GN3dJJxn0UmUC2iMv68ypIN4xb9n2XDVCKwIhAJkd | |
| 26 evN4qUcg1kCeQ4LZ5F4WUus+4kd2+Y1nnYQbOrE9 | |
| 27 -----END RSA PRIVATE KEY----- | |
| 28 */ | |
| 29 bar: "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALlKJGIBHYU3rIWyGmiwUgK1BUUomSBgLzSngo E7gBc7mqgCsEbjf9EJ5AvQIM1x7MhVsD5djpqHLcjiQlZFXfECAwEAAQ" | |
|
Wladimir Palant
2014/09/10 21:55:06
Here as well: given that the keys aren't actually
Thomas Greiner
2014/12/11 14:33:55
Done.
| |
| 30 }; | |
| 31 | |
| 32 function beautifyKeys(str) | |
| 33 { | |
| 34 if (typeof str != "string") | |
| 35 return str; | |
| 36 | |
| 37 return str.replace(publickeys.foo, "foo-publickey", "g") | |
| 38 .replace(publickeys.bar, "bar-publickey", "g"); | |
| 39 } | |
| 40 | |
| 41 function testMatch(text, location, contentType, docDomain, thirdParty, sitekey , expected) | |
| 42 { | |
| 43 function testMatch_internal(text, location, contentType, docDomain, thirdPar ty, sitekey, expected) | |
| 8 { | 44 { |
| 9 let filter = Filter.fromText(text); | 45 let filter = Filter.fromText(text); |
| 10 let result = filter.matches(location, contentType, docDomain, thirdParty); | 46 let result = filter.matches(location, contentType, docDomain, thirdParty, sitekey); |
| 11 equal(!!result, expected, '"' + text + '".matches(' + location + ", " + co ntentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party ") + ")"); | 47 equal(!!result, expected, '"' + beautifyKeys(text) + '".matches(' + locati on + ", " + contentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ", " + (sitekey ? beautifyKeys(sitekey) : "no-sitekey") + ")" ); |
| 12 } | 48 } |
| 13 testMatch_internal(text, location, contentType, docDomain, thirdParty, expec ted); | 49 testMatch_internal(text, location, contentType, docDomain, thirdParty, sitek ey, expected); |
| 14 if (!/^@@/.test(text)) | 50 if (!/^@@/.test(text)) |
| 15 testMatch_internal("@@" + text, location, contentType, docDomain, thirdPar ty, expected); | 51 testMatch_internal("@@" + text, location, contentType, docDomain, thirdPar ty, sitekey, expected); |
| 16 } | 52 } |
| 17 | 53 |
| 18 test("Basic filters", function() | 54 test("Basic filters", function() |
| 19 { | 55 { |
| 20 testMatch("abc", "http://abc/adf", "IMAGE", null, false, true); | 56 testMatch("abc", "http://abc/adf", "IMAGE", null, false, null, true); |
| 21 testMatch("abc", "http://ABC/adf", "IMAGE", null, false, true); | 57 testMatch("abc", "http://ABC/adf", "IMAGE", null, false, null, true); |
| 22 testMatch("abc", "http://abd/adf", "IMAGE", null, false, false); | 58 testMatch("abc", "http://abd/adf", "IMAGE", null, false, null, false); |
| 23 testMatch("|abc", "http://abc/adf", "IMAGE", null, false, false); | 59 testMatch("|abc", "http://abc/adf", "IMAGE", null, false, null, false); |
| 24 testMatch("|http://abc", "http://abc/adf", "IMAGE", null, false, true); | 60 testMatch("|http://abc", "http://abc/adf", "IMAGE", null, false, null, true) ; |
| 25 testMatch("abc|", "http://abc/adf", "IMAGE", null, false, false); | 61 testMatch("abc|", "http://abc/adf", "IMAGE", null, false, null, false); |
| 26 testMatch("abc/adf|", "http://abc/adf", "IMAGE", null, false, true); | 62 testMatch("abc/adf|", "http://abc/adf", "IMAGE", null, false, null, true); |
| 27 testMatch("||example.com/foo", "http://example.com/foo/bar", "IMAGE", null, false, true); | 63 testMatch("||example.com/foo", "http://example.com/foo/bar", "IMAGE", null, false, null, true); |
| 28 testMatch("||com/foo", "http://example.com/foo/bar", "IMAGE", null, false, t rue); | 64 testMatch("||com/foo", "http://example.com/foo/bar", "IMAGE", null, false, n ull, true); |
| 29 testMatch("||mple.com/foo", "http://example.com/foo/bar", "IMAGE", null, fal se, false); | 65 testMatch("||mple.com/foo", "http://example.com/foo/bar", "IMAGE", null, fal se, null, false); |
| 30 testMatch("||/example.com/foo", "http://example.com/foo/bar", "IMAGE", null, false, false); | 66 testMatch("||/example.com/foo", "http://example.com/foo/bar", "IMAGE", null, false, null, false); |
| 31 testMatch("||example.com/foo/bar|", "http://example.com/foo/bar", "IMAGE", n ull, false, true); | 67 testMatch("||example.com/foo/bar|", "http://example.com/foo/bar", "IMAGE", n ull, false, null, true); |
| 32 testMatch("||example.com/foo", "http://foo.com/http://example.com/foo/bar", "IMAGE", null, false, false); | 68 testMatch("||example.com/foo", "http://foo.com/http://example.com/foo/bar", "IMAGE", null, false, null, false); |
| 33 testMatch("||example.com/foo|", "http://example.com/foo/bar", "IMAGE", null, false, false); | 69 testMatch("||example.com/foo|", "http://example.com/foo/bar", "IMAGE", null, false, null, false); |
| 34 }); | 70 }); |
| 35 | 71 |
| 36 test("Separator placeholders", function() | 72 test("Separator placeholders", function() |
| 37 { | 73 { |
| 38 testMatch("abc^d", "http://abc/def", "IMAGE", null, false, true); | 74 testMatch("abc^d", "http://abc/def", "IMAGE", null, false, null, true); |
| 39 testMatch("abc^e", "http://abc/def", "IMAGE", null, false, false); | 75 testMatch("abc^e", "http://abc/def", "IMAGE", null, false, null, false); |
| 40 testMatch("def^", "http://abc/def", "IMAGE", null, false, true); | 76 testMatch("def^", "http://abc/def", "IMAGE", null, false, null, true); |
| 41 testMatch("http://abc/d^f", "http://abc/def", "IMAGE", null, false, false); | 77 testMatch("http://abc/d^f", "http://abc/def", "IMAGE", null, false, null, fa lse); |
| 42 testMatch("http://abc/def^", "http://abc/def", "IMAGE", null, false, true); | 78 testMatch("http://abc/def^", "http://abc/def", "IMAGE", null, false, null, t rue); |
| 43 testMatch("^foo=bar^", "http://abc/?foo=bar", "IMAGE", null, false, true); | 79 testMatch("^foo=bar^", "http://abc/?foo=bar", "IMAGE", null, false, null, tr ue); |
| 44 testMatch("^foo=bar^", "http://abc/?a=b&foo=bar", "IMAGE", null, false, true ); | 80 testMatch("^foo=bar^", "http://abc/?a=b&foo=bar", "IMAGE", null, false, null , true); |
| 45 testMatch("^foo=bar^", "http://abc/?foo=bar&a=b", "IMAGE", null, false, true ); | 81 testMatch("^foo=bar^", "http://abc/?foo=bar&a=b", "IMAGE", null, false, null , true); |
| 46 testMatch("^foo=bar^", "http://abc/?notfoo=bar", "IMAGE", null, false, false ); | 82 testMatch("^foo=bar^", "http://abc/?notfoo=bar", "IMAGE", null, false, null, false); |
| 47 testMatch("^foo=bar^", "http://abc/?foo=barnot", "IMAGE", null, false, false ); | 83 testMatch("^foo=bar^", "http://abc/?foo=barnot", "IMAGE", null, false, null, false); |
| 48 testMatch("^foo=bar^", "http://abc/?foo=bar%2Enot", "IMAGE", null, false, fa lse); | 84 testMatch("^foo=bar^", "http://abc/?foo=bar%2Enot", "IMAGE", null, false, nu ll, false); |
| 49 testMatch("||example.com^", "http://example.com/foo/bar", "IMAGE", null, fal se, true); | 85 testMatch("||example.com^", "http://example.com/foo/bar", "IMAGE", null, fal se, null, true); |
| 50 testMatch("||example.com^", "http://example.company.com/foo/bar", "IMAGE", n ull, false, false); | 86 testMatch("||example.com^", "http://example.company.com/foo/bar", "IMAGE", n ull, false, null, false); |
| 51 testMatch("||example.com^", "http://example.com:1234/foo/bar", "IMAGE", null , false, true); | 87 testMatch("||example.com^", "http://example.com:1234/foo/bar", "IMAGE", null , false, null, true); |
| 52 testMatch("||example.com^", "http://example.com.com/foo/bar", "IMAGE", null, false, false); | 88 testMatch("||example.com^", "http://example.com.com/foo/bar", "IMAGE", null, false, null, false); |
| 53 testMatch("||example.com^", "http://example.com-company.com/foo/bar", "IMAGE ", null, false, false); | 89 testMatch("||example.com^", "http://example.com-company.com/foo/bar", "IMAGE ", null, false, null, false); |
| 54 testMatch("||example.com^foo", "http://example.com/foo/bar", "IMAGE", null, false, true); | 90 testMatch("||example.com^foo", "http://example.com/foo/bar", "IMAGE", null, false, null, true); |
| 55 testMatch("||пример.ру^", "http://пример.ру/foo/bar", "IMAGE", null, false, true); | 91 testMatch("||пример.ру^", "http://пример.ру/foo/bar", "IMAGE", null, false, null, true); |
| 56 testMatch("||пример.ру^", "http://пример.руководитель.ру/foo/bar", "IMAGE", null, false, false); | 92 testMatch("||пример.ру^", "http://пример.руководитель.ру/foo/bar", "IMAGE", null, false, null, false); |
| 57 testMatch("||пример.ру^", "http://пример.ру:1234/foo/bar", "IMAGE", null, fa lse, true); | 93 testMatch("||пример.ру^", "http://пример.ру:1234/foo/bar", "IMAGE", null, fa lse, null, true); |
| 58 testMatch("||пример.ру^", "http://пример.ру.ру/foo/bar", "IMAGE", null, fals e, false); | 94 testMatch("||пример.ру^", "http://пример.ру.ру/foo/bar", "IMAGE", null, fals e, null, false); |
| 59 testMatch("||пример.ру^", "http://пример.ру-ководитель.ру/foo/bar", "IMAGE", null, false, false); | 95 testMatch("||пример.ру^", "http://пример.ру-ководитель.ру/foo/bar", "IMAGE", null, false, null, false); |
| 60 testMatch("||пример.ру^foo", "http://пример.ру/foo/bar", "IMAGE", null, fals e, true); | 96 testMatch("||пример.ру^foo", "http://пример.ру/foo/bar", "IMAGE", null, fals e, null, true); |
| 61 }); | 97 }); |
| 62 | 98 |
| 63 test("Wildcard matching", function() | 99 test("Wildcard matching", function() |
| 64 { | 100 { |
| 65 testMatch("abc*d", "http://abc/adf", "IMAGE", null, false, true); | 101 testMatch("abc*d", "http://abc/adf", "IMAGE", null, false, null, true); |
| 66 testMatch("abc*d", "http://abcd/af", "IMAGE", null, false, true); | 102 testMatch("abc*d", "http://abcd/af", "IMAGE", null, false, null, true); |
| 67 testMatch("abc*d", "http://abc/d/af", "IMAGE", null, false, true); | 103 testMatch("abc*d", "http://abc/d/af", "IMAGE", null, false, null, true); |
| 68 testMatch("abc*d", "http://dabc/af", "IMAGE", null, false, false); | 104 testMatch("abc*d", "http://dabc/af", "IMAGE", null, false, null, false); |
| 69 testMatch("*abc", "http://abc/adf", "IMAGE", null, false, true); | 105 testMatch("*abc", "http://abc/adf", "IMAGE", null, false, null, true); |
| 70 testMatch("abc*", "http://abc/adf", "IMAGE", null, false, true); | 106 testMatch("abc*", "http://abc/adf", "IMAGE", null, false, null, true); |
| 71 testMatch("|*abc", "http://abc/adf", "IMAGE", null, false, true); | 107 testMatch("|*abc", "http://abc/adf", "IMAGE", null, false, null, true); |
| 72 testMatch("abc*|", "http://abc/adf", "IMAGE", null, false, true); | 108 testMatch("abc*|", "http://abc/adf", "IMAGE", null, false, null, true); |
| 73 testMatch("abc***d", "http://abc/adf", "IMAGE", null, false, true); | 109 testMatch("abc***d", "http://abc/adf", "IMAGE", null, false, null, true); |
| 74 }); | 110 }); |
| 75 | 111 |
| 76 test("Type options", function() | 112 test("Type options", function() |
| 77 { | 113 { |
| 78 testMatch("abc$image", "http://abc/adf", "IMAGE", null, false, true); | 114 testMatch("abc$image", "http://abc/adf", "IMAGE", null, false, null, true); |
| 79 testMatch("abc$other", "http://abc/adf", "IMAGE", null, false, false); | 115 testMatch("abc$other", "http://abc/adf", "IMAGE", null, false, null, false); |
| 80 testMatch("abc$other", "http://abc/adf", "OTHER", null, false, true); | 116 testMatch("abc$other", "http://abc/adf", "OTHER", null, false, null, true); |
| 81 testMatch("abc$~other", "http://abc/adf", "OTHER", null, false, false); | 117 testMatch("abc$~other", "http://abc/adf", "OTHER", null, false, null, false) ; |
| 82 testMatch("abc$script", "http://abc/adf", "IMAGE", null, false, false); | 118 testMatch("abc$script", "http://abc/adf", "IMAGE", null, false, null, false) ; |
| 83 testMatch("abc$script", "http://abc/adf", "SCRIPT", null, false, true); | 119 testMatch("abc$script", "http://abc/adf", "SCRIPT", null, false, null, true) ; |
| 84 testMatch("abc$~script", "http://abc/adf", "SCRIPT", null, false, false); | 120 testMatch("abc$~script", "http://abc/adf", "SCRIPT", null, false, null, fals e); |
| 85 testMatch("abc$stylesheet", "http://abc/adf", "IMAGE", null, false, false); | 121 testMatch("abc$stylesheet", "http://abc/adf", "IMAGE", null, false, null, fa lse); |
| 86 testMatch("abc$stylesheet", "http://abc/adf", "STYLESHEET", null, false, tru e); | 122 testMatch("abc$stylesheet", "http://abc/adf", "STYLESHEET", null, false, nul l, true); |
| 87 testMatch("abc$~stylesheet", "http://abc/adf", "STYLESHEET", null, false, fa lse); | 123 testMatch("abc$~stylesheet", "http://abc/adf", "STYLESHEET", null, false, nu ll, false); |
| 88 testMatch("abc$object", "http://abc/adf", "IMAGE", null, false, false); | 124 testMatch("abc$object", "http://abc/adf", "IMAGE", null, false, null, false) ; |
| 89 testMatch("abc$object", "http://abc/adf", "OBJECT", null, false, true); | 125 testMatch("abc$object", "http://abc/adf", "OBJECT", null, false, null, true) ; |
| 90 testMatch("abc$~object", "http://abc/adf", "OBJECT", null, false, false); | 126 testMatch("abc$~object", "http://abc/adf", "OBJECT", null, false, null, fals e); |
| 91 testMatch("abc$document", "http://abc/adf", "IMAGE", null, false, false); | 127 testMatch("abc$document", "http://abc/adf", "IMAGE", null, false, null, fals e); |
| 92 testMatch("abc$document", "http://abc/adf", "DOCUMENT", null, false, true); | 128 testMatch("abc$document", "http://abc/adf", "DOCUMENT", null, false, null, t rue); |
| 93 testMatch("abc$~document", "http://abc/adf", "DOCUMENT", null, false, false) ; | 129 testMatch("abc$~document", "http://abc/adf", "DOCUMENT", null, false, null, false); |
| 94 testMatch("abc$subdocument", "http://abc/adf", "IMAGE", null, false, false); | 130 testMatch("abc$subdocument", "http://abc/adf", "IMAGE", null, false, null, f alse); |
| 95 testMatch("abc$subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, t rue); | 131 testMatch("abc$subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, n ull, true); |
| 96 testMatch("abc$~subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, false); | 132 testMatch("abc$~subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, null, false); |
| 97 testMatch("abc$background", "http://abc/adf", "OBJECT", null, false, false); | 133 testMatch("abc$background", "http://abc/adf", "OBJECT", null, false, null, f alse); |
| 98 testMatch("abc$background", "http://abc/adf", "IMAGE", null, false, true); | 134 testMatch("abc$background", "http://abc/adf", "IMAGE", null, false, null, tr ue); |
| 99 testMatch("abc$~background", "http://abc/adf", "IMAGE", null, false, false); | 135 testMatch("abc$~background", "http://abc/adf", "IMAGE", null, false, null, f alse); |
| 100 testMatch("abc$xbl", "http://abc/adf", "IMAGE", null, false, false); | 136 testMatch("abc$xbl", "http://abc/adf", "IMAGE", null, false, null, false); |
| 101 testMatch("abc$xbl", "http://abc/adf", "XBL", null, false, true); | 137 testMatch("abc$xbl", "http://abc/adf", "XBL", null, false, null, true); |
| 102 testMatch("abc$~xbl", "http://abc/adf", "XBL", null, false, false); | 138 testMatch("abc$~xbl", "http://abc/adf", "XBL", null, false, null, false); |
| 103 testMatch("abc$ping", "http://abc/adf", "IMAGE", null, false, false); | 139 testMatch("abc$ping", "http://abc/adf", "IMAGE", null, false, null, false); |
| 104 testMatch("abc$ping", "http://abc/adf", "PING", null, false, true); | 140 testMatch("abc$ping", "http://abc/adf", "PING", null, false, null, true); |
| 105 testMatch("abc$~ping", "http://abc/adf", "PING", null, false, false); | 141 testMatch("abc$~ping", "http://abc/adf", "PING", null, false, null, false); |
| 106 testMatch("abc$xmlhttprequest", "http://abc/adf", "IMAGE", null, false, fals e); | 142 testMatch("abc$xmlhttprequest", "http://abc/adf", "IMAGE", null, false, null , false); |
| 107 testMatch("abc$xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, fa lse, true); | 143 testMatch("abc$xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, fa lse, null, true); |
| 108 testMatch("abc$~xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, f alse, false); | 144 testMatch("abc$~xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, f alse, null, false); |
| 109 testMatch("abc$object-subrequest", "http://abc/adf", "IMAGE", null, false, f alse); | 145 testMatch("abc$object-subrequest", "http://abc/adf", "IMAGE", null, false, n ull, false); |
| 110 testMatch("abc$object-subrequest", "http://abc/adf", "OBJECT_SUBREQUEST", nu ll, false, true); | 146 testMatch("abc$object-subrequest", "http://abc/adf", "OBJECT_SUBREQUEST", nu ll, false, null, true); |
| 111 testMatch("abc$~object-subrequest", "http://abc/adf", "OBJECT_SUBREQUEST", n ull, false, false); | 147 testMatch("abc$~object-subrequest", "http://abc/adf", "OBJECT_SUBREQUEST", n ull, false, null, false); |
| 112 testMatch("abc$dtd", "http://abc/adf", "IMAGE", null, false, false); | 148 testMatch("abc$dtd", "http://abc/adf", "IMAGE", null, false, null, false); |
| 113 testMatch("abc$dtd", "http://abc/adf", "DTD", null, false, true); | 149 testMatch("abc$dtd", "http://abc/adf", "DTD", null, false, null, true); |
| 114 testMatch("abc$~dtd", "http://abc/adf", "DTD", null, false, false); | 150 testMatch("abc$~dtd", "http://abc/adf", "DTD", null, false, null, false); |
| 115 | 151 |
| 116 testMatch("abc$media", "http://abc/adf", "IMAGE", null, false, false); | 152 testMatch("abc$media", "http://abc/adf", "IMAGE", null, false, null, false); |
| 117 testMatch("abc$media", "http://abc/adf", "MEDIA", null, false, true); | 153 testMatch("abc$media", "http://abc/adf", "MEDIA", null, false, null, true); |
| 118 testMatch("abc$~media", "http://abc/adf", "MEDIA", null, false, false); | 154 testMatch("abc$~media", "http://abc/adf", "MEDIA", null, false, null, false) ; |
| 119 | 155 |
| 120 testMatch("abc$font", "http://abc/adf", "IMAGE", null, false, false); | 156 testMatch("abc$font", "http://abc/adf", "IMAGE", null, false, null, false); |
| 121 testMatch("abc$font", "http://abc/adf", "FONT", null, false, true); | 157 testMatch("abc$font", "http://abc/adf", "FONT", null, false, null, true); |
| 122 testMatch("abc$~font", "http://abc/adf", "FONT", null, false, false); | 158 testMatch("abc$~font", "http://abc/adf", "FONT", null, false, null, false); |
| 123 | 159 |
| 124 testMatch("abc$image,script", "http://abc/adf", "IMAGE", null, false, true); | 160 testMatch("abc$image,script", "http://abc/adf", "IMAGE", null, false, null, true); |
| 125 testMatch("abc$~image", "http://abc/adf", "IMAGE", null, false, false); | 161 testMatch("abc$~image", "http://abc/adf", "IMAGE", null, false, null, false) ; |
| 126 testMatch("abc$~script", "http://abc/adf", "IMAGE", null, false, true); | 162 testMatch("abc$~script", "http://abc/adf", "IMAGE", null, false, null, true) ; |
| 127 testMatch("abc$~image,~script", "http://abc/adf", "IMAGE", null, false, fals e); | 163 testMatch("abc$~image,~script", "http://abc/adf", "IMAGE", null, false, null , false); |
| 128 testMatch("abc$~script,~image", "http://abc/adf", "IMAGE", null, false, fals e); | 164 testMatch("abc$~script,~image", "http://abc/adf", "IMAGE", null, false, null , false); |
| 129 testMatch("abc$~document,~script,~other", "http://abc/adf", "IMAGE", null, f alse, true); | 165 testMatch("abc$~document,~script,~other", "http://abc/adf", "IMAGE", null, f alse, null, true); |
| 130 testMatch("abc$~image,image", "http://abc/adf", "IMAGE", null, false, true); | 166 testMatch("abc$~image,image", "http://abc/adf", "IMAGE", null, false, null, true); |
| 131 testMatch("abc$image,~image", "http://abc/adf", "IMAGE", null, false, false) ; | 167 testMatch("abc$image,~image", "http://abc/adf", "IMAGE", null, false, null, false); |
| 132 testMatch("abc$~image,image", "http://abc/adf", "SCRIPT", null, false, true) ; | 168 testMatch("abc$~image,image", "http://abc/adf", "SCRIPT", null, false, null, true); |
| 133 testMatch("abc$image,~image", "http://abc/adf", "SCRIPT", null, false, false ); | 169 testMatch("abc$image,~image", "http://abc/adf", "SCRIPT", null, false, null, false); |
| 134 testMatch("abc$match-case", "http://abc/adf", "IMAGE", null, false, true); | 170 testMatch("abc$match-case", "http://abc/adf", "IMAGE", null, false, null, tr ue); |
| 135 testMatch("abc$match-case", "http://ABC/adf", "IMAGE", null, false, false); | 171 testMatch("abc$match-case", "http://ABC/adf", "IMAGE", null, false, null, fa lse); |
| 136 testMatch("abc$~match-case", "http://abc/adf", "IMAGE", null, false, true); | 172 testMatch("abc$~match-case", "http://abc/adf", "IMAGE", null, false, null, t rue); |
| 137 testMatch("abc$~match-case", "http://ABC/adf", "IMAGE", null, false, true); | 173 testMatch("abc$~match-case", "http://ABC/adf", "IMAGE", null, false, null, t rue); |
| 138 testMatch("abc$match-case,image", "http://abc/adf", "IMAGE", null, false, tr ue); | 174 testMatch("abc$match-case,image", "http://abc/adf", "IMAGE", null, false, nu ll, true); |
| 139 testMatch("abc$match-case,script", "http://abc/adf", "IMAGE", null, false, f alse); | 175 testMatch("abc$match-case,script", "http://abc/adf", "IMAGE", null, false, n ull, false); |
| 140 testMatch("abc$match-case,image", "http://ABC/adf", "IMAGE", null, false, fa lse); | 176 testMatch("abc$match-case,image", "http://ABC/adf", "IMAGE", null, false, nu ll, false); |
| 141 testMatch("abc$match-case,script", "http://ABC/adf", "IMAGE", null, false, f alse); | 177 testMatch("abc$match-case,script", "http://ABC/adf", "IMAGE", null, false, n ull, false); |
| 142 testMatch("abc$third-party", "http://abc/adf", "IMAGE", null, false, false); | 178 testMatch("abc$third-party", "http://abc/adf", "IMAGE", null, false, null, f alse); |
| 143 testMatch("abc$third-party", "http://abc/adf", "IMAGE", null, true, true); | 179 testMatch("abc$third-party", "http://abc/adf", "IMAGE", null, true, null, tr ue); |
| 144 testMatch("abd$third-party", "http://abc/adf", "IMAGE", null, false, false); | 180 testMatch("abd$third-party", "http://abc/adf", "IMAGE", null, false, null, f alse); |
| 145 testMatch("abd$third-party", "http://abc/adf", "IMAGE", null, true, false); | 181 testMatch("abd$third-party", "http://abc/adf", "IMAGE", null, true, null, fa lse); |
| 146 testMatch("abc$image,third-party", "http://abc/adf", "IMAGE", null, false, f alse); | 182 testMatch("abc$image,third-party", "http://abc/adf", "IMAGE", null, false, n ull, false); |
| 147 testMatch("abc$image,third-party", "http://abc/adf", "IMAGE", null, true, tr ue); | 183 testMatch("abc$image,third-party", "http://abc/adf", "IMAGE", null, true, nu ll, true); |
| 148 testMatch("abc$~image,third-party", "http://abc/adf", "IMAGE", null, false, false); | 184 testMatch("abc$~image,third-party", "http://abc/adf", "IMAGE", null, false, null, false); |
| 149 testMatch("abc$~image,third-party", "http://abc/adf", "IMAGE", null, true, f alse); | 185 testMatch("abc$~image,third-party", "http://abc/adf", "IMAGE", null, true, n ull, false); |
| 150 testMatch("abc$~third-party", "http://abc/adf", "IMAGE", null, false, true); | 186 testMatch("abc$~third-party", "http://abc/adf", "IMAGE", null, false, null, true); |
| 151 testMatch("abc$~third-party", "http://abc/adf", "IMAGE", null, true, false); | 187 testMatch("abc$~third-party", "http://abc/adf", "IMAGE", null, true, null, f alse); |
| 152 testMatch("abd$~third-party", "http://abc/adf", "IMAGE", null, false, false) ; | 188 testMatch("abd$~third-party", "http://abc/adf", "IMAGE", null, false, null, false); |
| 153 testMatch("abd$~third-party", "http://abc/adf", "IMAGE", null, true, false); | 189 testMatch("abd$~third-party", "http://abc/adf", "IMAGE", null, true, null, f alse); |
| 154 testMatch("abc$image,~third-party", "http://abc/adf", "IMAGE", null, false, true); | 190 testMatch("abc$image,~third-party", "http://abc/adf", "IMAGE", null, false, null, true); |
| 155 testMatch("abc$image,~third-party", "http://abc/adf", "IMAGE", null, true, f alse); | 191 testMatch("abc$image,~third-party", "http://abc/adf", "IMAGE", null, true, n ull, false); |
| 156 testMatch("abc$~image,~third-party", "http://abc/adf", "IMAGE", null, false, false); | 192 testMatch("abc$~image,~third-party", "http://abc/adf", "IMAGE", null, false, null, false); |
| 157 }); | 193 }); |
| 158 | 194 |
| 159 test("Regular expressions", function() | 195 test("Regular expressions", function() |
| 160 { | 196 { |
| 161 testMatch("/abc/", "http://abc/adf", "IMAGE", null, false, true); | 197 testMatch("/abc/", "http://abc/adf", "IMAGE", null, false, null, true); |
| 162 testMatch("/abc/", "http://abcd/adf", "IMAGE", null, false, true); | 198 testMatch("/abc/", "http://abcd/adf", "IMAGE", null, false, null, true); |
| 163 testMatch("*/abc/", "http://abc/adf", "IMAGE", null, false, true); | 199 testMatch("*/abc/", "http://abc/adf", "IMAGE", null, false, null, true); |
| 164 testMatch("*/abc/", "http://abcd/adf", "IMAGE", null, false, false); | 200 testMatch("*/abc/", "http://abcd/adf", "IMAGE", null, false, null, false); |
| 165 testMatch("/a\\wc/", "http://abc/adf", "IMAGE", null, false, true); | 201 testMatch("/a\\wc/", "http://abc/adf", "IMAGE", null, false, null, true); |
| 166 testMatch("/a\\wc/", "http://a1c/adf", "IMAGE", null, false, true); | 202 testMatch("/a\\wc/", "http://a1c/adf", "IMAGE", null, false, null, true); |
| 167 testMatch("/a\\wc/", "http://a_c/adf", "IMAGE", null, false, true); | 203 testMatch("/a\\wc/", "http://a_c/adf", "IMAGE", null, false, null, true); |
| 168 testMatch("/a\\wc/", "http://a%c/adf", "IMAGE", null, false, false); | 204 testMatch("/a\\wc/", "http://a%c/adf", "IMAGE", null, false, null, false); |
| 169 }); | 205 }); |
| 170 | 206 |
| 171 test("Regular expressions with type options", function() | 207 test("Regular expressions with type options", function() |
| 172 { | 208 { |
| 173 testMatch("/abc/$image", "http://abc/adf", "IMAGE", null, false, true); | 209 testMatch("/abc/$image", "http://abc/adf", "IMAGE", null, false, null, true) ; |
| 174 testMatch("/abc/$image", "http://aBc/adf", "IMAGE", null, false, true); | 210 testMatch("/abc/$image", "http://aBc/adf", "IMAGE", null, false, null, true) ; |
| 175 testMatch("/abc/$script", "http://abc/adf", "IMAGE", null, false, false); | 211 testMatch("/abc/$script", "http://abc/adf", "IMAGE", null, false, null, fals e); |
| 176 testMatch("/abc/$~image", "http://abcd/adf", "IMAGE", null, false, false); | 212 testMatch("/abc/$~image", "http://abcd/adf", "IMAGE", null, false, null, fal se); |
| 177 testMatch("/ab{2}c/$image", "http://abc/adf", "IMAGE", null, false, false); | 213 testMatch("/ab{2}c/$image", "http://abc/adf", "IMAGE", null, false, null, fa lse); |
| 178 testMatch("/ab{2}c/$script", "http://abc/adf", "IMAGE", null, false, false); | 214 testMatch("/ab{2}c/$script", "http://abc/adf", "IMAGE", null, false, null, f alse); |
| 179 testMatch("/ab{2}c/$~image", "http://abcd/adf", "IMAGE", null, false, false) ; | 215 testMatch("/ab{2}c/$~image", "http://abcd/adf", "IMAGE", null, false, null, false); |
| 180 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, false, false ); | 216 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, false, null, false); |
| 181 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, true, true); | 217 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, true, null, true); |
| 182 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, false, true ); | 218 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, false, null , true); |
| 183 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, true, false ); | 219 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, true, null, false); |
| 184 testMatch("/abc/$match-case", "http://abc/adf", "IMAGE", null, false, true); | 220 testMatch("/abc/$match-case", "http://abc/adf", "IMAGE", null, false, null, true); |
| 185 testMatch("/abc/$match-case", "http://aBc/adf", "IMAGE", null, true, false); | 221 testMatch("/abc/$match-case", "http://aBc/adf", "IMAGE", null, true, null, f alse); |
| 186 testMatch("/ab{2}c/$match-case", "http://abc/adf", "IMAGE", null, false, fal se); | 222 testMatch("/ab{2}c/$match-case", "http://abc/adf", "IMAGE", null, false, nul l, false); |
| 187 testMatch("/ab{2}c/$match-case", "http://aBc/adf", "IMAGE", null, true, fals e); | 223 testMatch("/ab{2}c/$match-case", "http://aBc/adf", "IMAGE", null, true, null , false); |
| 188 testMatch("/abc/$~match-case", "http://abc/adf", "IMAGE", null, false, true) ; | 224 testMatch("/abc/$~match-case", "http://abc/adf", "IMAGE", null, false, null, true); |
| 189 testMatch("/abc/$~match-case", "http://aBc/adf", "IMAGE", null, true, true); | 225 testMatch("/abc/$~match-case", "http://aBc/adf", "IMAGE", null, true, null, true); |
| 190 testMatch("/ab{2}c/$~match-case", "http://abc/adf", "IMAGE", null, false, fa lse); | 226 testMatch("/ab{2}c/$~match-case", "http://abc/adf", "IMAGE", null, false, nu ll, false); |
| 191 testMatch("/ab{2}c/$~match-case", "http://aBc/adf", "IMAGE", null, true, fal se); | 227 testMatch("/ab{2}c/$~match-case", "http://aBc/adf", "IMAGE", null, true, nul l, false); |
| 192 }); | 228 }); |
| 193 | 229 |
| 194 test("Domain restrictions", function() | 230 test("Domain restrictions", function() |
| 195 { | 231 { |
| 196 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, true); | 232 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, null, true); |
| 197 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com.", true, true); | 233 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com.", true, null, true); |
| 198 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "www.foo.com", tr ue, true); | 234 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "www.foo.com", tr ue, null, true); |
| 199 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "www.foo.com.", t rue, true); | 235 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "www.foo.com.", t rue, null, true); |
| 200 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "Foo.com", true, true); | 236 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "Foo.com", true, null, true); |
| 201 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "abc.def.foo.com" , true, true); | 237 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "abc.def.foo.com" , true, null, true); |
| 202 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "www.baz.com", tr ue, false); | 238 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "www.baz.com", tr ue, null, false); |
| 203 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", null, true, false ); | 239 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", null, true, null, false); |
| 204 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "foo.com" , true, true); | 240 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "foo.com" , true, null, true); |
| 205 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "foo.com. ", true, true); | 241 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "foo.com. ", true, null, true); |
| 206 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.foo. com", true, true); | 242 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.foo. com", true, null, true); |
| 207 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.foo. com.", true, true); | 243 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.foo. com.", true, null, true); |
| 208 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "Foo.com" , true, true); | 244 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "Foo.com" , true, null, true); |
| 209 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "abc.def. foo.com", true, true); | 245 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "abc.def. foo.com", true, null, true); |
| 210 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.baz. com", true, false); | 246 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", "www.baz. com", true, null, false); |
| 211 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", null, tru e, false); | 247 testMatch("abc$domain=foo.com|bar.com", "http://abc/def", "IMAGE", null, tru e, null, false); |
| 212 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "foo.com" , true, true); | 248 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "foo.com" , true, null, true); |
| 213 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "foo.com. ", true, true); | 249 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "foo.com. ", true, null, true); |
| 214 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.foo. com", true, true); | 250 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.foo. com", true, null, true); |
| 215 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.foo. com.", true, true); | 251 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.foo. com.", true, null, true); |
| 216 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "Foo.com" , true, true); | 252 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "Foo.com" , true, null, true); |
| 217 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "abc.def. foo.com", true, true); | 253 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "abc.def. foo.com", true, null, true); |
| 218 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.baz. com", true, false); | 254 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", "www.baz. com", true, null, false); |
| 219 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", null, tru e, false); | 255 testMatch("abc$domain=bar.com|foo.com", "http://abc/def", "IMAGE", null, tru e, null, false); |
| 220 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "foo.com", true, false); | 256 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "foo.com", true, null, false); |
| 221 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "foo.com.", true , false); | 257 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "foo.com.", true , null, false); |
| 222 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.foo.com", t rue, false); | 258 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.foo.com", t rue, null, false); |
| 223 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.foo.com.", true, false); | 259 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.foo.com.", true, null, false); |
| 224 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "Foo.com", true, false); | 260 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "Foo.com", true, null, false); |
| 225 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "abc.def.foo.com ", true, false); | 261 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "abc.def.foo.com ", true, null, false); |
| 226 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.baz.com", t rue, true); | 262 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", "www.baz.com", t rue, null, true); |
| 227 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", null, true, true ); | 263 testMatch("abc$domain=~foo.com", "http://abc/def", "IMAGE", null, true, null , true); |
| 228 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "foo.co m", true, false); | 264 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "foo.co m", true, null, false); |
| 229 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "foo.co m.", true, false); | 265 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "foo.co m.", true, null, false); |
| 230 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "www.fo o.com", true, false); | 266 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "www.fo o.com", true, null, false); |
| 231 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "www.fo o.com.", true, false); | 267 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "www.fo o.com.", true, null, false); |
| 232 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "Foo.co m", true, false); | 268 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "Foo.co m", true, null, false); |
| 233 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "abc.de f.foo.com", true, false); | 269 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "abc.de f.foo.com", true, null, false); |
| 234 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "www.ba z.com", true, true); | 270 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", "www.ba z.com", true, null, true); |
| 235 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", null, t rue, true); | 271 testMatch("abc$domain=~foo.com|~bar.com", "http://abc/def", "IMAGE", null, t rue, null, true); |
| 236 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "foo.co m", true, false); | 272 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "foo.co m", true, null, false); |
| 237 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "foo.co m.", true, false); | 273 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "foo.co m.", true, null, false); |
| 238 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "www.fo o.com", true, false); | 274 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "www.fo o.com", true, null, false); |
| 239 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "www.fo o.com.", true, false); | 275 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "www.fo o.com.", true, null, false); |
| 240 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "Foo.co m", true, false); | 276 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "Foo.co m", true, null, false); |
| 241 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "abc.de f.foo.com", true, false); | 277 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "abc.de f.foo.com", true, null, false); |
| 242 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "www.ba z.com", true, true); | 278 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", "www.ba z.com", true, null, true); |
| 243 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", null, t rue, true); | 279 testMatch("abc$domain=~bar.com|~foo.com", "http://abc/def", "IMAGE", null, t rue, null, true); |
| 244 testMatch("abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "foo.com ", true, true); | 280 testMatch("abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "foo.com ", true, null, true); |
| 245 testMatch("abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "bar.com ", true, false); | 281 testMatch("abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "bar.com ", true, null, false); |
| 246 testMatch("abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "baz.com ", true, false); | 282 testMatch("abc$domain=foo.com|~bar.com", "http://abc/def", "IMAGE", "baz.com ", true, null, false); |
| 247 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "foo .com", true, true); | 283 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "foo .com", true, null, true); |
| 248 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "www .foo.com", true, true); | 284 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "www .foo.com", true, null, true); |
| 249 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "bar .foo.com", true, false); | 285 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "bar .foo.com", true, null, false); |
| 250 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "www .bar.foo.com", true, false); | 286 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "www .bar.foo.com", true, null, false); |
| 251 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "baz .com", true, false); | 287 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "baz .com", true, null, false); |
| 252 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "www .baz.com", true, false); | 288 testMatch("abc$domain=foo.com|~bar.foo.com", "http://abc/def", "IMAGE", "www .baz.com", true, null, false); |
| 253 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "bar.com", t rue, true); | 289 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "bar.com", t rue, null, true); |
| 254 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "bar.net", t rue, false); | 290 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "bar.net", t rue, null, false); |
| 255 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "foo.com", t rue, false); | 291 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "foo.com", t rue, null, false); |
| 256 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "foo.net", t rue, false); | 292 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "foo.net", t rue, null, false); |
| 257 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "com", true, true); | 293 testMatch("abc$domain=com|~foo.com", "http://abc/def", "IMAGE", "com", true, null, true); |
| 258 testMatch("abc$domain=foo.com", "http://ccc/def", "IMAGE", "foo.com", true, false); | 294 testMatch("abc$domain=foo.com", "http://ccc/def", "IMAGE", "foo.com", true, null, false); |
| 259 testMatch("abc$domain=foo.com", "http://ccc/def", "IMAGE", "bar.com", true, false); | 295 testMatch("abc$domain=foo.com", "http://ccc/def", "IMAGE", "bar.com", true, null, false); |
| 260 testMatch("abc$image,domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, true); | 296 testMatch("abc$image,domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, null, true); |
| 261 testMatch("abc$image,domain=foo.com", "http://abc/def", "IMAGE", "bar.com", true, false); | 297 testMatch("abc$image,domain=foo.com", "http://abc/def", "IMAGE", "bar.com", true, null, false); |
| 262 testMatch("abc$image,domain=foo.com", "http://abc/def", "OBJECT", "foo.com", true, false); | 298 testMatch("abc$image,domain=foo.com", "http://abc/def", "OBJECT", "foo.com", true, null, false); |
| 263 testMatch("abc$image,domain=foo.com", "http://abc/def", "OBJECT", "bar.com", true, false); | 299 testMatch("abc$image,domain=foo.com", "http://abc/def", "OBJECT", "bar.com", true, null, false); |
| 264 testMatch("abc$~image,domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, false); | 300 testMatch("abc$~image,domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, null, false); |
| 265 testMatch("abc$~image,domain=foo.com", "http://abc/def", "IMAGE", "bar.com", true, false); | 301 testMatch("abc$~image,domain=foo.com", "http://abc/def", "IMAGE", "bar.com", true, null, false); |
| 266 testMatch("abc$~image,domain=foo.com", "http://abc/def", "OBJECT", "foo.com" , true, true); | 302 testMatch("abc$~image,domain=foo.com", "http://abc/def", "OBJECT", "foo.com" , true, null, true); |
| 267 testMatch("abc$~image,domain=foo.com", "http://abc/def", "OBJECT", "bar.com" , true, false); | 303 testMatch("abc$~image,domain=foo.com", "http://abc/def", "OBJECT", "bar.com" , true, null, false); |
| 268 testMatch("abc$domain=foo.com,image", "http://abc/def", "IMAGE", "foo.com", true, true); | 304 testMatch("abc$domain=foo.com,image", "http://abc/def", "IMAGE", "foo.com", true, null, true); |
| 269 testMatch("abc$domain=foo.com,image", "http://abc/def", "IMAGE", "bar.com", true, false); | 305 testMatch("abc$domain=foo.com,image", "http://abc/def", "IMAGE", "bar.com", true, null, false); |
| 270 testMatch("abc$domain=foo.com,image", "http://abc/def", "OBJECT", "foo.com", true, false); | 306 testMatch("abc$domain=foo.com,image", "http://abc/def", "OBJECT", "foo.com", true, null, false); |
| 271 testMatch("abc$domain=foo.com,image", "http://abc/def", "OBJECT", "bar.com", true, false); | 307 testMatch("abc$domain=foo.com,image", "http://abc/def", "OBJECT", "bar.com", true, null, false); |
| 272 testMatch("abc$domain=foo.com,~image", "http://abc/def", "IMAGE", "foo.com", true, false); | 308 testMatch("abc$domain=foo.com,~image", "http://abc/def", "IMAGE", "foo.com", true, null, false); |
| 273 testMatch("abc$domain=foo.com,~image", "http://abc/def", "IMAGE", "bar.com", true, false); | 309 testMatch("abc$domain=foo.com,~image", "http://abc/def", "IMAGE", "bar.com", true, null, false); |
| 274 testMatch("abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "foo.com" , true, true); | 310 testMatch("abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "foo.com" , true, null, true); |
| 275 testMatch("abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "bar.com" , true, false); | 311 testMatch("abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "bar.com" , true, null, false); |
| 312 }); | |
| 313 | |
| 314 test("Sitekey restrictions", function() | |
| 315 { | |
| 316 testMatch("abc$sitekey=" + publickeys.foo, "http://abc/def", "IMAGE", "foo.c om", true, publickeys.foo, true); | |
| 317 testMatch("abc$sitekey=" + publickeys.foo, "http://abc/def", "IMAGE", "foo.c om", true, null, false); | |
|
Wladimir Palant
2014/09/10 21:55:06
What about the scenario where the sitekey is prese
Thomas Greiner
2014/12/11 14:33:55
Done.
| |
| 318 testMatch("abc$sitekey=" + publickeys.foo + "|" + publickeys.bar, "http://ab c/def", "IMAGE", "foo.com", true, publickeys.foo, true); | |
| 319 testMatch("abc$sitekey=" + publickeys.foo + "|" + publickeys.bar, "http://ab c/def", "IMAGE", "foo.com", true, null, false); | |
| 320 testMatch("abc$sitekey=" + publickeys.bar + "|" + publickeys.foo, "http://ab c/def", "IMAGE", "foo.com", true, publickeys.foo, true); | |
| 321 testMatch("abc$sitekey=" + publickeys.foo, "http://ccc/def", "IMAGE", "foo.c om", true, publickeys.foo, false); | |
| 322 testMatch("abc$image,sitekey=" + publickeys.foo, "http://abc/def", "IMAGE", "foo.com", true, publickeys.foo, true); | |
| 323 testMatch("abc$image,sitekey=" + publickeys.foo, "http://abc/def", "OBJECT", "foo.com", true, publickeys.foo, false); | |
| 324 testMatch("abc$~image,sitekey=" + publickeys.foo, "http://abc/def", "IMAGE", "foo.com", true, publickeys.foo, false); | |
| 325 testMatch("abc$~image,sitekey=" + publickeys.foo, "http://abc/def", "OBJECT" , "foo.com", true, publickeys.foo, true); | |
| 326 testMatch("abc$sitekey=" + publickeys.foo + ",image", "http://abc/def", "IMA GE", "foo.com", true, publickeys.foo, true); | |
| 327 testMatch("abc$sitekey=" + publickeys.foo + ",image", "http://abc/def", "OBJ ECT", "foo.com", true, publickeys.foo, false); | |
| 328 testMatch("abc$sitekey=" + publickeys.foo + ",~image", "http://abc/def", "IM AGE", "foo.com", true, publickeys.foo, false); | |
| 329 testMatch("abc$sitekey=" + publickeys.foo + ",~image", "http://abc/def", "OB JECT", "foo.com", true, publickeys.foo, true); | |
|
Wladimir Palant
2014/09/10 21:55:06
This should test how the sitekeys get along with d
Thomas Greiner
2014/12/11 14:33:55
Done. Let me know if it makes sense to also includ
| |
| 276 }); | 330 }); |
| 277 | 331 |
| 278 test("Exception rules", function() | 332 test("Exception rules", function() |
| 279 { | 333 { |
| 280 testMatch("@@test", "http://test/", "DOCUMENT", null, false, false); | 334 testMatch("@@test", "http://test/", "DOCUMENT", null, false, null, false); |
| 281 testMatch("@@http://test*", "http://test/", "DOCUMENT", null, false, true); | 335 testMatch("@@http://test*", "http://test/", "DOCUMENT", null, false, null, t rue); |
| 282 testMatch("@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, true); | 336 testMatch("@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, null, tru e); |
| 283 testMatch("@@test$document", "http://test/", "DOCUMENT", null, false, true); | 337 testMatch("@@test$document", "http://test/", "DOCUMENT", null, false, null, true); |
| 284 testMatch("@@test$document,image", "http://test/", "DOCUMENT", null, false, true); | 338 testMatch("@@test$document,image", "http://test/", "DOCUMENT", null, false, null, true); |
| 285 testMatch("@@test$~image", "http://test/", "DOCUMENT", null, false, false); | 339 testMatch("@@test$~image", "http://test/", "DOCUMENT", null, false, null, fa lse); |
| 286 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false, true); | 340 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false, null, true); |
| 287 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false, true); | 341 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false, null, true); |
| 288 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "foo .com", false, true); | 342 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "foo .com", false, null, true); |
| 289 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "bar .com", false, false); | 343 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "bar .com", false, null, false); |
| 290 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "fo o.com", false, false); | 344 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "fo o.com", false, null, false); |
| 291 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba r.com", false, true); | 345 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba r.com", false, null, true); |
| 346 testMatch("@@test$document,sitekey=" + publickeys.foo, "http://test/", "DOCU MENT", "foo.com", false, publickeys.foo, true); | |
| 347 testMatch("@@test$document,sitekey=" + publickeys.foo, "http://test/", "DOCU MENT", "foo.com", false, null, false); | |
| 292 }); | 348 }); |
| 293 })(); | 349 })(); |
| OLD | NEW |