168 fail("Missing a cookie on port 80"); |
168 fail("Missing a cookie on port 80"); |
169 } |
169 } |
170 if (isIn(clst, "myCookie8=")) { |
170 if (isIn(clst, "myCookie8=")) { |
171 fail("A cookie with an invalid port list was returned"); |
171 fail("A cookie with an invalid port list was returned"); |
172 } |
172 } |
|
173 |
|
174 // Test httpOnly flag (CR# 6873543) |
|
175 lst.clear(); |
|
176 map.clear(); |
|
177 cm.getCookieStore().removeAll(); |
|
178 lst.add("myCookie11=httpOnlyTest; httpOnly"); |
|
179 map.put("Set-Cookie", lst); |
|
180 uri = new URI("http://www.sun.com/"); |
|
181 cm.put(uri, map); |
|
182 m = cm.get(uri, emptyMap); |
|
183 clst = m.get("Cookie"); |
|
184 // URI scheme was http: so we should get the cookie |
|
185 if (!isIn(clst, "myCookie11=")) { |
|
186 fail("Missing cookie with httpOnly flag"); |
|
187 } |
|
188 uri = new URI("javascript://www.sun.com/"); |
|
189 m = cm.get(uri, emptyMap); |
|
190 clst = m.get("Cookie"); |
|
191 // URI scheme was neither http or https so we shouldn't get the cookie |
|
192 if (isIn(clst, "myCookie11=")) { |
|
193 fail("Should get the cookie with httpOnly when scheme is javascript:"); |
|
194 } |
173 } |
195 } |
174 |
196 |
175 private static boolean isIn(List<String> lst, String cookie) { |
197 private static boolean isIn(List<String> lst, String cookie) { |
176 if (lst == null || lst.isEmpty()) { |
198 if (lst == null || lst.isEmpty()) { |
177 return false; |
199 return false; |