Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / inspector / cookie-resource-match.html
blob8ee06d135c01e1ccf2689495a51e749a61a315a2
1 <html>
2 <head>
3 <script src="inspector-test.js"></script>
4 <script>
6 function doit() {
7 function callback(result)
9 for (var i = 0; i < result.length; ++i)
10 output("[" + result[i] + "]");
11 notifyDone();
13 evaluateInWebInspector("frontend_doitAndDump", callback);
16 function frontend_doitAndDump()
18 var cookies = [
19 frontend_createCookie("insecureOnlyWebkit", "1234567890", false, "webkit.org", "/"),
20 frontend_createCookie("insecureAllWebkit", "1234567890123456", false, ".webkit.org", "/"),
21 frontend_createCookie("insecureAllWebkitPath", "1234567890123456", false, ".webkit.org", "/path"),
22 frontend_createCookie("secureOnlyWebkitPath", "bar", true, "webkit.org", "/path"),
23 frontend_createCookie("secureAllWebkit", "foo", true, ".webkit.org", "/"),
24 frontend_createCookie("secureAllWebkitPath", "foo", true, ".webkit.org", "/path"),
25 frontend_createCookie("insecureOnlyWebkitPort", "1234567890", false, "webkit.org", "/", 80),
26 frontend_createCookie("insecureAllWebkitPort", "1234567890123456", false, ".webkit.org", "/", 80),
27 frontend_createCookie("insecureAllWebkitPathPort", "1234567890123456", false, ".webkit.org", "/path", 80),
28 frontend_createCookie("secureOnlyWebkitPathPort", "bar", true, "webkit.org", "/path", 80),
29 frontend_createCookie("secureAllWebkitPort", "foo", true, ".webkit.org", "/", 80),
30 frontend_createCookie("secureAllWebkitPathPort", "foo", true, ".webkit.org", "/path", 80),
31 frontend_createCookie("nonMatching1", "bar", false, "webkit.zoo", "/"),
32 frontend_createCookie("nonMatching2", "bar", false, "webkit.org", "/badPath"),
33 frontend_createCookie("nonMatching3", "bar", true, ".moo.com", "/")
36 var resourceURLs = [
37 "http://webkit.org", // 0
38 "http://www.webkit.org:81", // 1
39 "http://webkit.org/path", // 2
40 "http://www.webkit.org/path", // 3
41 "https://webkit.org/", // 4
42 "https://www.webkit.org/", // 5
43 "https://webkit.org:81/path", // 6
44 "https://www.webkit.org/path", // 7
46 "http://webkit.org:80", // 8
47 "http://www.webkit.org:80", // 9
48 "http://webkit.org:80/path", // 10
49 "http://www.webkit.org:80/path", // 11
50 "https://webkit.org:80/", // 12
51 "https://www.webkit.org:80/", // 13
52 "https://webkit.org:80/path", // 14
53 "https://www.webkit.org:80/path", // 15
55 "http://www.boo.com:80", // 16
56 "https://www.boo.com:80/path", // 17
57 "http://www.moo.com:80/", // 18
58 "http://www.boo.com:80", // 19
59 "https://www.boo.com:80/path", // 20
60 "http://www.moo.com:80/" // 21
63 var result = [];
64 for (var i = 0; i < cookies.length; ++i) {
65 var cookieResult = [];
66 for (var j = 0; j < resourceURLs.length; ++j) {
67 if (WebInspector.Cookies.cookieMatchesResourceURL(cookies[i], resourceURLs[j]))
68 cookieResult.push(j);
70 result.push(cookieResult);
72 return result;
75 function frontend_createCookie(name, value, secure, domain, path, port)
77 return {
78 name: name,
79 value: value,
80 domain: domain,
81 port: port,
82 path: path,
83 expires: "Thu Jan 01 1970 00:00:00 GMT",
84 size: name.length + value.length,
85 httpOnly: false,
86 secure: secure,
87 session: true
91 </script>
92 </head>
94 <body onload="onload()">
95 <p>
96 Tests that cookies are matched up with resources correctly.
97 </p>
99 </body>
100 </html>