Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 90 lines (80 sloc) 3.31 kb
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
1 <html>
2 <head>
1e03aad @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
4 <script>
5
dcd8956 @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
6 function test() {
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
7
8 var cookies = [
dcd8956 @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
9 createCookie("insecureOnlyWebkit", "1234567890", false, "webkit.org", "/"),
10 createCookie("insecureAllWebkit", "1234567890123456", false, ".webkit.org", "/"),
11 createCookie("insecureAllWebkitPath", "1234567890123456", false, ".webkit.org", "/path"),
12 createCookie("secureOnlyWebkitPath", "bar", true, "webkit.org", "/path"),
13 createCookie("secureAllWebkit", "foo", true, ".webkit.org", "/"),
14 createCookie("secureAllWebkitPath", "foo", true, ".webkit.org", "/path"),
15 createCookie("insecureOnlyWebkitPort", "1234567890", false, "webkit.org", "/", 80),
16 createCookie("insecureAllWebkitPort", "1234567890123456", false, ".webkit.org", "/", 80),
17 createCookie("insecureAllWebkitPathPort", "1234567890123456", false, ".webkit.org", "/path", 80),
18 createCookie("secureOnlyWebkitPathPort", "bar", true, "webkit.org", "/path", 80),
19 createCookie("secureAllWebkitPort", "foo", true, ".webkit.org", "/", 80),
20 createCookie("secureAllWebkitPathPort", "foo", true, ".webkit.org", "/path", 80),
21 createCookie("nonMatching1", "bar", false, "webkit.zoo", "/"),
22 createCookie("nonMatching2", "bar", false, "webkit.org", "/badPath"),
23 createCookie("nonMatching3", "bar", true, ".moo.com", "/")
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
24 ];
25
26 var resourceURLs = [
27 "http://webkit.org", // 0
28 "http://www.webkit.org:81", // 1
29 "http://webkit.org/path", // 2
30 "http://www.webkit.org/path", // 3
31 "https://webkit.org/", // 4
32 "https://www.webkit.org/", // 5
33 "https://webkit.org:81/path", // 6
34 "https://www.webkit.org/path", // 7
35
36 "http://webkit.org:80", // 8
37 "http://www.webkit.org:80", // 9
38 "http://webkit.org:80/path", // 10
39 "http://www.webkit.org:80/path", // 11
40 "https://webkit.org:80/", // 12
41 "https://www.webkit.org:80/", // 13
42 "https://webkit.org:80/path", // 14
43 "https://www.webkit.org:80/path", // 15
44
45 "http://www.boo.com:80", // 16
46 "https://www.boo.com:80/path", // 17
47 "http://www.moo.com:80/", // 18
48 "http://www.boo.com:80", // 19
49 "https://www.boo.com:80/path", // 20
50 "http://www.moo.com:80/" // 21
51 ];
52
53 var result = [];
54 for (var i = 0; i < cookies.length; ++i) {
55 var cookieResult = [];
56 for (var j = 0; j < resourceURLs.length; ++j) {
57 if (WebInspector.Cookies.cookieMatchesResourceURL(cookies[i], resourceURLs[j]))
58 cookieResult.push(j);
59 }
dcd8956 @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
60 InspectorTest.addResult("[" + cookieResult + "]");
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
61 }
dcd8956 @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
62 InspectorTest.completeTest();
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
63
dcd8956 @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
64 function createCookie(name, value, secure, domain, path, port)
65 {
66 return {
67 name: name,
68 value: value,
69 domain: domain,
70 port: port,
71 path: path,
72 expires: "Thu Jan 01 1970 00:00:00 GMT",
73 size: name.length + value.length,
74 httpOnly: false,
75 secure: secure,
76 session: true
77 };
78 }
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
79 }
80 </script>
81 </head>
82
dcd8956 @repenaxa 2011-02-14 Pavel Feldman <pfeldman@chromium.org>
repenaxa authored
83 <body onload="runTest()">
4b33c94 @eseidel 2009-12-08 Alexander Pavlov <apavlov@chromium.org>
eseidel authored
84 <p>
85 Tests that cookies are matched up with resources correctly.
86 </p>
87
88 </body>
89 </html>
Something went wrong with that request. Please try again.