3 <script src=
"../http/tests/inspector/inspector-test.js"></script>
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", "/")
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
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
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
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
]))
60 InspectorTest
.addResult("[" + cookieResult
+ "]");
62 InspectorTest
.completeTest();
64 function createCookie(name
, value
, secure
, domain
, path
, port
)
66 var protocolCookie
= {
72 expires
: "Thu Jan 01 1970 00:00:00 GMT",
73 size
: name
.length
+ value
.length
,
76 firstPartyOnly
: false,
79 return WebInspector
.Cookies
._parseProtocolCookie(WebInspector
.targetManager
.mainTarget(), protocolCookie
);
85 <body onload=
"runTest()">
87 Tests that cookies are matched up with resources correctly.