Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/tests/regexpFilters_matching.js

Issue 6612283790721024: Issue 698 - Added tests for $sitekey option (Closed)
Patch Set: Created Dec. 11, 2014, 2:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/tests/policy.js ('k') | chrome/content/tests/signatures.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 function testMatch(text, location, contentType, docDomain, thirdParty, sitekey , expected)
6 { 6 {
7 function testMatch_internal(text, location, contentType, docDomain, thirdPar ty, expected) 7 function testMatch_internal(text, location, contentType, docDomain, thirdPar ty, sitekey, expected)
8 { 8 {
9 let filter = Filter.fromText(text); 9 let filter = Filter.fromText(text);
10 let result = filter.matches(location, contentType, docDomain, thirdParty); 10 let result = filter.matches(location, contentType, docDomain, thirdParty, sitekey);
11 equal(!!result, expected, '"' + text + '".matches(' + location + ", " + co ntentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party ") + ")"); 11 equal(!!result, expected, '"' + text + '".matches(' + location + ", " + co ntentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party ") + ", " + (sitekey || "no-sitekey") + ")");
12 } 12 }
13 testMatch_internal(text, location, contentType, docDomain, thirdParty, expec ted); 13 testMatch_internal(text, location, contentType, docDomain, thirdParty, sitek ey, expected);
14 if (!/^@@/.test(text)) 14 if (!/^@@/.test(text))
15 testMatch_internal("@@" + text, location, contentType, docDomain, thirdPar ty, expected); 15 testMatch_internal("@@" + text, location, contentType, docDomain, thirdPar ty, sitekey, expected);
16 } 16 }
17 17
18 test("Basic filters", function() 18 test("Basic filters", function()
19 { 19 {
20 testMatch("abc", "http://abc/adf", "IMAGE", null, false, true); 20 testMatch("abc", "http://abc/adf", "IMAGE", null, false, null, true);
21 testMatch("abc", "http://ABC/adf", "IMAGE", null, false, true); 21 testMatch("abc", "http://ABC/adf", "IMAGE", null, false, null, true);
22 testMatch("abc", "http://abd/adf", "IMAGE", null, false, false); 22 testMatch("abc", "http://abd/adf", "IMAGE", null, false, null, false);
23 testMatch("|abc", "http://abc/adf", "IMAGE", null, false, false); 23 testMatch("|abc", "http://abc/adf", "IMAGE", null, false, null, false);
24 testMatch("|http://abc", "http://abc/adf", "IMAGE", null, false, true); 24 testMatch("|http://abc", "http://abc/adf", "IMAGE", null, false, null, true) ;
25 testMatch("abc|", "http://abc/adf", "IMAGE", null, false, false); 25 testMatch("abc|", "http://abc/adf", "IMAGE", null, false, null, false);
26 testMatch("abc/adf|", "http://abc/adf", "IMAGE", null, false, true); 26 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); 27 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); 28 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); 29 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); 30 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); 31 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); 32 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); 33 testMatch("||example.com/foo|", "http://example.com/foo/bar", "IMAGE", null, false, null, false);
34 }); 34 });
35 35
36 test("Separator placeholders", function() 36 test("Separator placeholders", function()
37 { 37 {
38 testMatch("abc^d", "http://abc/def", "IMAGE", null, false, true); 38 testMatch("abc^d", "http://abc/def", "IMAGE", null, false, null, true);
39 testMatch("abc^e", "http://abc/def", "IMAGE", null, false, false); 39 testMatch("abc^e", "http://abc/def", "IMAGE", null, false, null, false);
40 testMatch("def^", "http://abc/def", "IMAGE", null, false, true); 40 testMatch("def^", "http://abc/def", "IMAGE", null, false, null, true);
41 testMatch("http://abc/d^f", "http://abc/def", "IMAGE", null, false, false); 41 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); 42 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); 43 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 ); 44 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 ); 45 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 ); 46 testMatch("^foo=bar^", "http://abc/?notfoo=bar", "IMAGE", null, false, null, false);
47 testMatch("^foo=bar^", "http://abc/?foo=barnot", "IMAGE", null, false, false ); 47 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); 48 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); 49 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); 50 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); 51 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); 52 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); 53 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); 54 testMatch("||example.com^foo", "http://example.com/foo/bar", "IMAGE", null, false, null, true);
55 testMatch("||пример.ру^", "http://пример.ру/foo/bar", "IMAGE", null, false, true); 55 testMatch("||пример.ру^", "http://пример.ру/foo/bar", "IMAGE", null, false, null, true);
56 testMatch("||пример.ру^", "http://пример.руководитель.ру/foo/bar", "IMAGE", null, false, false); 56 testMatch("||пример.ру^", "http://пример.руководитель.ру/foo/bar", "IMAGE", null, false, null, false);
57 testMatch("||пример.ру^", "http://пример.ру:1234/foo/bar", "IMAGE", null, fa lse, true); 57 testMatch("||пример.ру^", "http://пример.ру:1234/foo/bar", "IMAGE", null, fa lse, null, true);
58 testMatch("||пример.ру^", "http://пример.ру.ру/foo/bar", "IMAGE", null, fals e, false); 58 testMatch("||пример.ру^", "http://пример.ру.ру/foo/bar", "IMAGE", null, fals e, null, false);
59 testMatch("||пример.ру^", "http://пример.ру-ководитель.ру/foo/bar", "IMAGE", null, false, false); 59 testMatch("||пример.ру^", "http://пример.ру-ководитель.ру/foo/bar", "IMAGE", null, false, null, false);
60 testMatch("||пример.ру^foo", "http://пример.ру/foo/bar", "IMAGE", null, fals e, true); 60 testMatch("||пример.ру^foo", "http://пример.ру/foo/bar", "IMAGE", null, fals e, null, true);
61 }); 61 });
62 62
63 test("Wildcard matching", function() 63 test("Wildcard matching", function()
64 { 64 {
65 testMatch("abc*d", "http://abc/adf", "IMAGE", null, false, true); 65 testMatch("abc*d", "http://abc/adf", "IMAGE", null, false, null, true);
66 testMatch("abc*d", "http://abcd/af", "IMAGE", null, false, true); 66 testMatch("abc*d", "http://abcd/af", "IMAGE", null, false, null, true);
67 testMatch("abc*d", "http://abc/d/af", "IMAGE", null, false, true); 67 testMatch("abc*d", "http://abc/d/af", "IMAGE", null, false, null, true);
68 testMatch("abc*d", "http://dabc/af", "IMAGE", null, false, false); 68 testMatch("abc*d", "http://dabc/af", "IMAGE", null, false, null, false);
69 testMatch("*abc", "http://abc/adf", "IMAGE", null, false, true); 69 testMatch("*abc", "http://abc/adf", "IMAGE", null, false, null, true);
70 testMatch("abc*", "http://abc/adf", "IMAGE", null, false, true); 70 testMatch("abc*", "http://abc/adf", "IMAGE", null, false, null, true);
71 testMatch("|*abc", "http://abc/adf", "IMAGE", null, false, true); 71 testMatch("|*abc", "http://abc/adf", "IMAGE", null, false, null, true);
72 testMatch("abc*|", "http://abc/adf", "IMAGE", null, false, true); 72 testMatch("abc*|", "http://abc/adf", "IMAGE", null, false, null, true);
73 testMatch("abc***d", "http://abc/adf", "IMAGE", null, false, true); 73 testMatch("abc***d", "http://abc/adf", "IMAGE", null, false, null, true);
74 }); 74 });
75 75
76 test("Type options", function() 76 test("Type options", function()
77 { 77 {
78 testMatch("abc$image", "http://abc/adf", "IMAGE", null, false, true); 78 testMatch("abc$image", "http://abc/adf", "IMAGE", null, false, null, true);
79 testMatch("abc$other", "http://abc/adf", "IMAGE", null, false, false); 79 testMatch("abc$other", "http://abc/adf", "IMAGE", null, false, null, false);
80 testMatch("abc$other", "http://abc/adf", "OTHER", null, false, true); 80 testMatch("abc$other", "http://abc/adf", "OTHER", null, false, null, true);
81 testMatch("abc$~other", "http://abc/adf", "OTHER", null, false, false); 81 testMatch("abc$~other", "http://abc/adf", "OTHER", null, false, null, false) ;
82 testMatch("abc$script", "http://abc/adf", "IMAGE", null, false, false); 82 testMatch("abc$script", "http://abc/adf", "IMAGE", null, false, null, false) ;
83 testMatch("abc$script", "http://abc/adf", "SCRIPT", null, false, true); 83 testMatch("abc$script", "http://abc/adf", "SCRIPT", null, false, null, true) ;
84 testMatch("abc$~script", "http://abc/adf", "SCRIPT", null, false, false); 84 testMatch("abc$~script", "http://abc/adf", "SCRIPT", null, false, null, fals e);
85 testMatch("abc$stylesheet", "http://abc/adf", "IMAGE", null, false, false); 85 testMatch("abc$stylesheet", "http://abc/adf", "IMAGE", null, false, null, fa lse);
86 testMatch("abc$stylesheet", "http://abc/adf", "STYLESHEET", null, false, tru e); 86 testMatch("abc$stylesheet", "http://abc/adf", "STYLESHEET", null, false, nul l, true);
87 testMatch("abc$~stylesheet", "http://abc/adf", "STYLESHEET", null, false, fa lse); 87 testMatch("abc$~stylesheet", "http://abc/adf", "STYLESHEET", null, false, nu ll, false);
88 testMatch("abc$object", "http://abc/adf", "IMAGE", null, false, false); 88 testMatch("abc$object", "http://abc/adf", "IMAGE", null, false, null, false) ;
89 testMatch("abc$object", "http://abc/adf", "OBJECT", null, false, true); 89 testMatch("abc$object", "http://abc/adf", "OBJECT", null, false, null, true) ;
90 testMatch("abc$~object", "http://abc/adf", "OBJECT", null, false, false); 90 testMatch("abc$~object", "http://abc/adf", "OBJECT", null, false, null, fals e);
91 testMatch("abc$document", "http://abc/adf", "IMAGE", null, false, false); 91 testMatch("abc$document", "http://abc/adf", "IMAGE", null, false, null, fals e);
92 testMatch("abc$document", "http://abc/adf", "DOCUMENT", null, false, true); 92 testMatch("abc$document", "http://abc/adf", "DOCUMENT", null, false, null, t rue);
93 testMatch("abc$~document", "http://abc/adf", "DOCUMENT", null, false, false) ; 93 testMatch("abc$~document", "http://abc/adf", "DOCUMENT", null, false, null, false);
94 testMatch("abc$subdocument", "http://abc/adf", "IMAGE", null, false, false); 94 testMatch("abc$subdocument", "http://abc/adf", "IMAGE", null, false, null, f alse);
95 testMatch("abc$subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, t rue); 95 testMatch("abc$subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, n ull, true);
96 testMatch("abc$~subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, false); 96 testMatch("abc$~subdocument", "http://abc/adf", "SUBDOCUMENT", null, false, null, false);
97 testMatch("abc$background", "http://abc/adf", "OBJECT", null, false, false); 97 testMatch("abc$background", "http://abc/adf", "OBJECT", null, false, null, f alse);
98 testMatch("abc$background", "http://abc/adf", "IMAGE", null, false, true); 98 testMatch("abc$background", "http://abc/adf", "IMAGE", null, false, null, tr ue);
99 testMatch("abc$~background", "http://abc/adf", "IMAGE", null, false, false); 99 testMatch("abc$~background", "http://abc/adf", "IMAGE", null, false, null, f alse);
100 testMatch("abc$xbl", "http://abc/adf", "IMAGE", null, false, false); 100 testMatch("abc$xbl", "http://abc/adf", "IMAGE", null, false, null, false);
101 testMatch("abc$xbl", "http://abc/adf", "XBL", null, false, true); 101 testMatch("abc$xbl", "http://abc/adf", "XBL", null, false, null, true);
102 testMatch("abc$~xbl", "http://abc/adf", "XBL", null, false, false); 102 testMatch("abc$~xbl", "http://abc/adf", "XBL", null, false, null, false);
103 testMatch("abc$ping", "http://abc/adf", "IMAGE", null, false, false); 103 testMatch("abc$ping", "http://abc/adf", "IMAGE", null, false, null, false);
104 testMatch("abc$ping", "http://abc/adf", "PING", null, false, true); 104 testMatch("abc$ping", "http://abc/adf", "PING", null, false, null, true);
105 testMatch("abc$~ping", "http://abc/adf", "PING", null, false, false); 105 testMatch("abc$~ping", "http://abc/adf", "PING", null, false, null, false);
106 testMatch("abc$xmlhttprequest", "http://abc/adf", "IMAGE", null, false, fals e); 106 testMatch("abc$xmlhttprequest", "http://abc/adf", "IMAGE", null, false, null , false);
107 testMatch("abc$xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, fa lse, true); 107 testMatch("abc$xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, fa lse, null, true);
108 testMatch("abc$~xmlhttprequest", "http://abc/adf", "XMLHTTPREQUEST", null, f alse, false); 108 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); 109 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); 110 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); 111 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); 112 testMatch("abc$dtd", "http://abc/adf", "IMAGE", null, false, null, false);
113 testMatch("abc$dtd", "http://abc/adf", "DTD", null, false, true); 113 testMatch("abc$dtd", "http://abc/adf", "DTD", null, false, null, true);
114 testMatch("abc$~dtd", "http://abc/adf", "DTD", null, false, false); 114 testMatch("abc$~dtd", "http://abc/adf", "DTD", null, false, null, false);
115 115
116 testMatch("abc$media", "http://abc/adf", "IMAGE", null, false, false); 116 testMatch("abc$media", "http://abc/adf", "IMAGE", null, false, null, false);
117 testMatch("abc$media", "http://abc/adf", "MEDIA", null, false, true); 117 testMatch("abc$media", "http://abc/adf", "MEDIA", null, false, null, true);
118 testMatch("abc$~media", "http://abc/adf", "MEDIA", null, false, false); 118 testMatch("abc$~media", "http://abc/adf", "MEDIA", null, false, null, false) ;
119 119
120 testMatch("abc$font", "http://abc/adf", "IMAGE", null, false, false); 120 testMatch("abc$font", "http://abc/adf", "IMAGE", null, false, null, false);
121 testMatch("abc$font", "http://abc/adf", "FONT", null, false, true); 121 testMatch("abc$font", "http://abc/adf", "FONT", null, false, null, true);
122 testMatch("abc$~font", "http://abc/adf", "FONT", null, false, false); 122 testMatch("abc$~font", "http://abc/adf", "FONT", null, false, null, false);
123 123
124 testMatch("abc$image,script", "http://abc/adf", "IMAGE", null, false, true); 124 testMatch("abc$image,script", "http://abc/adf", "IMAGE", null, false, null, true);
125 testMatch("abc$~image", "http://abc/adf", "IMAGE", null, false, false); 125 testMatch("abc$~image", "http://abc/adf", "IMAGE", null, false, null, false) ;
126 testMatch("abc$~script", "http://abc/adf", "IMAGE", null, false, true); 126 testMatch("abc$~script", "http://abc/adf", "IMAGE", null, false, null, true) ;
127 testMatch("abc$~image,~script", "http://abc/adf", "IMAGE", null, false, fals e); 127 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); 128 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); 129 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); 130 testMatch("abc$~image,image", "http://abc/adf", "IMAGE", null, false, null, true);
131 testMatch("abc$image,~image", "http://abc/adf", "IMAGE", null, false, false) ; 131 testMatch("abc$image,~image", "http://abc/adf", "IMAGE", null, false, null, false);
132 testMatch("abc$~image,image", "http://abc/adf", "SCRIPT", null, false, true) ; 132 testMatch("abc$~image,image", "http://abc/adf", "SCRIPT", null, false, null, true);
133 testMatch("abc$image,~image", "http://abc/adf", "SCRIPT", null, false, false ); 133 testMatch("abc$image,~image", "http://abc/adf", "SCRIPT", null, false, null, false);
134 testMatch("abc$match-case", "http://abc/adf", "IMAGE", null, false, true); 134 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); 135 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); 136 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); 137 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); 138 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); 139 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); 140 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); 141 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); 142 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); 143 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); 144 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); 145 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); 146 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); 147 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); 148 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); 149 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); 150 testMatch("abc$~third-party", "http://abc/adf", "IMAGE", null, false, null, true);
151 testMatch("abc$~third-party", "http://abc/adf", "IMAGE", null, true, false); 151 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) ; 152 testMatch("abd$~third-party", "http://abc/adf", "IMAGE", null, false, null, false);
153 testMatch("abd$~third-party", "http://abc/adf", "IMAGE", null, true, false); 153 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); 154 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); 155 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); 156 testMatch("abc$~image,~third-party", "http://abc/adf", "IMAGE", null, false, null, false);
157 }); 157 });
158 158
159 test("Regular expressions", function() 159 test("Regular expressions", function()
160 { 160 {
161 testMatch("/abc/", "http://abc/adf", "IMAGE", null, false, true); 161 testMatch("/abc/", "http://abc/adf", "IMAGE", null, false, null, true);
162 testMatch("/abc/", "http://abcd/adf", "IMAGE", null, false, true); 162 testMatch("/abc/", "http://abcd/adf", "IMAGE", null, false, null, true);
163 testMatch("*/abc/", "http://abc/adf", "IMAGE", null, false, true); 163 testMatch("*/abc/", "http://abc/adf", "IMAGE", null, false, null, true);
164 testMatch("*/abc/", "http://abcd/adf", "IMAGE", null, false, false); 164 testMatch("*/abc/", "http://abcd/adf", "IMAGE", null, false, null, false);
165 testMatch("/a\\wc/", "http://abc/adf", "IMAGE", null, false, true); 165 testMatch("/a\\wc/", "http://abc/adf", "IMAGE", null, false, null, true);
166 testMatch("/a\\wc/", "http://a1c/adf", "IMAGE", null, false, true); 166 testMatch("/a\\wc/", "http://a1c/adf", "IMAGE", null, false, null, true);
167 testMatch("/a\\wc/", "http://a_c/adf", "IMAGE", null, false, true); 167 testMatch("/a\\wc/", "http://a_c/adf", "IMAGE", null, false, null, true);
168 testMatch("/a\\wc/", "http://a%c/adf", "IMAGE", null, false, false); 168 testMatch("/a\\wc/", "http://a%c/adf", "IMAGE", null, false, null, false);
169 }); 169 });
170 170
171 test("Regular expressions with type options", function() 171 test("Regular expressions with type options", function()
172 { 172 {
173 testMatch("/abc/$image", "http://abc/adf", "IMAGE", null, false, true); 173 testMatch("/abc/$image", "http://abc/adf", "IMAGE", null, false, null, true) ;
174 testMatch("/abc/$image", "http://aBc/adf", "IMAGE", null, false, true); 174 testMatch("/abc/$image", "http://aBc/adf", "IMAGE", null, false, null, true) ;
175 testMatch("/abc/$script", "http://abc/adf", "IMAGE", null, false, false); 175 testMatch("/abc/$script", "http://abc/adf", "IMAGE", null, false, null, fals e);
176 testMatch("/abc/$~image", "http://abcd/adf", "IMAGE", null, false, false); 176 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); 177 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); 178 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) ; 179 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 ); 180 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, false, null, false);
181 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, true, true); 181 testMatch("/abc/$third-party", "http://abc/adf", "IMAGE", null, true, null, true);
182 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, false, true ); 182 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, false, null , true);
183 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, true, false ); 183 testMatch("/abc/$~third-party", "http://abc/adf", "IMAGE", null, true, null, false);
184 testMatch("/abc/$match-case", "http://abc/adf", "IMAGE", null, false, true); 184 testMatch("/abc/$match-case", "http://abc/adf", "IMAGE", null, false, null, true);
185 testMatch("/abc/$match-case", "http://aBc/adf", "IMAGE", null, true, false); 185 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); 186 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); 187 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) ; 188 testMatch("/abc/$~match-case", "http://abc/adf", "IMAGE", null, false, null, true);
189 testMatch("/abc/$~match-case", "http://aBc/adf", "IMAGE", null, true, true); 189 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); 190 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); 191 testMatch("/ab{2}c/$~match-case", "http://aBc/adf", "IMAGE", null, true, nul l, false);
192 }); 192 });
193 193
194 test("Domain restrictions", function() 194 test("Domain restrictions", function()
195 { 195 {
196 testMatch("abc$domain=foo.com", "http://abc/def", "IMAGE", "foo.com", true, true); 196 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); 197 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); 198 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); 199 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); 200 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); 201 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); 202 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 ); 203 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); 204 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); 205 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); 206 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); 207 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); 208 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); 209 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); 210 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); 211 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); 212 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); 213 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); 214 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); 215 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); 216 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); 217 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); 218 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); 219 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); 220 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); 221 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); 222 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); 223 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); 224 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); 225 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); 226 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 ); 227 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); 228 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); 229 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); 230 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); 231 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); 232 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); 233 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); 234 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); 235 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); 236 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); 237 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); 238 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); 239 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); 240 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); 241 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); 242 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); 243 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); 244 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); 245 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); 246 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); 247 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); 248 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); 249 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); 250 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); 251 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); 252 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); 253 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); 254 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); 255 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); 256 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); 257 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); 258 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); 259 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); 260 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); 261 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); 262 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); 263 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); 264 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); 265 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); 266 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); 267 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); 268 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); 269 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); 270 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); 271 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); 272 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); 273 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); 274 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); 275 testMatch("abc$domain=foo.com,~image", "http://abc/def", "OBJECT", "bar.com" , true, null, false);
276 });
277
278 test("Sitekey restrictions", function()
279 {
280 testMatch("abc$sitekey=foo-publickey", "http://abc/def", "IMAGE", "foo.com", true, "foo-publickey", true);
281 testMatch("abc$sitekey=foo-publickey", "http://abc/def", "IMAGE", "foo.com", true, null, false);
282 testMatch("abc$sitekey=foo-publickey", "http://abc/def", "IMAGE", "foo.com", true, "bar-publickey", false);
283 testMatch("abc$sitekey=foo-publickey|bar-publickey", "http://abc/def", "IMAG E", "foo.com", true, "foo-publickey", true);
284 testMatch("abc$sitekey=foo-publickey|bar-publickey", "http://abc/def", "IMAG E", "foo.com", true, null, false);
285 testMatch("abc$sitekey=bar-publickey|foo-publickey", "http://abc/def", "IMAG E", "foo.com", true, "foo-publickey", true);
286 testMatch("abc$sitekey=foo-publickey", "http://ccc/def", "IMAGE", "foo.com", true, "foo-publickey", false);
287 testMatch("abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def", "IMA GE", "foo.com", true, "foo-publickey", true);
288 testMatch("abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def", "IMA GE", "bar.com", true, "foo-publickey", false);
289 testMatch("abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def", "IM AGE", "foo.com", true, "foo-publickey", false);
290 testMatch("abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def", "IM AGE", "bar.com", true, "foo-publickey", true);
291 testMatch("abc$domain=bar.com,sitekey=foo-publickey", "http://abc/def", "IMA GE", "foo.com", true, "foo-publickey", false);
292 testMatch("abc$domain=bar.com,sitekey=foo-publickey", "http://abc/def", "IMA GE", "bar.com", true, "foo-publickey", true);
Wladimir Palant 2014/12/11 15:57:47 Nit: the last two tests are redundant, they test t
276 }); 293 });
277 294
278 test("Exception rules", function() 295 test("Exception rules", function()
279 { 296 {
280 testMatch("@@test", "http://test/", "DOCUMENT", null, false, false); 297 testMatch("@@test", "http://test/", "DOCUMENT", null, false, null, false);
281 testMatch("@@http://test*", "http://test/", "DOCUMENT", null, false, true); 298 testMatch("@@http://test*", "http://test/", "DOCUMENT", null, false, null, t rue);
282 testMatch("@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, true); 299 testMatch("@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, null, tru e);
283 testMatch("@@test$document", "http://test/", "DOCUMENT", null, false, true); 300 testMatch("@@test$document", "http://test/", "DOCUMENT", null, false, null, true);
284 testMatch("@@test$document,image", "http://test/", "DOCUMENT", null, false, true); 301 testMatch("@@test$document,image", "http://test/", "DOCUMENT", null, false, null, true);
285 testMatch("@@test$~image", "http://test/", "DOCUMENT", null, false, false); 302 testMatch("@@test$~image", "http://test/", "DOCUMENT", null, false, null, fa lse);
286 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false, true); 303 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false, null, true);
287 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false, true); 304 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); 305 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); 306 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); 307 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); 308 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba r.com", false, null, true);
309 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT ", "foo.com", false, "foo-publickey", true);
310 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT ", "foo.com", false, null, false);
292 }); 311 });
293 })(); 312 })();
OLDNEW
« no previous file with comments | « chrome/content/tests/policy.js ('k') | chrome/content/tests/signatures.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld