Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: timelapse
Fetching contributors…

Cannot retrieve contributors at this time

91 lines (81 sloc) 3.403 kB
<html>
<head>
<script src="../http/tests/inspector/inspector-test.js"></script>
<script>
function test() {
var cookies = [
createCookie("insecureOnlyWebkit", "1234567890", false, "webkit.org", "/"),
createCookie("insecureAllWebkit", "1234567890123456", false, ".webkit.org", "/"),
createCookie("insecureAllWebkitPath", "1234567890123456", false, ".webkit.org", "/path"),
createCookie("secureOnlyWebkitPath", "bar", true, "webkit.org", "/path"),
createCookie("secureAllWebkit", "foo", true, ".webkit.org", "/"),
createCookie("secureAllWebkitPath", "foo", true, ".webkit.org", "/path"),
createCookie("insecureOnlyWebkitPort", "1234567890", false, "webkit.org", "/", 80),
createCookie("insecureAllWebkitPort", "1234567890123456", false, ".webkit.org", "/", 80),
createCookie("insecureAllWebkitPathPort", "1234567890123456", false, ".webkit.org", "/path", 80),
createCookie("secureOnlyWebkitPathPort", "bar", true, "webkit.org", "/path", 80),
createCookie("secureAllWebkitPort", "foo", true, ".webkit.org", "/", 80),
createCookie("secureAllWebkitPathPort", "foo", true, ".webkit.org", "/path", 80),
createCookie("nonMatching1", "bar", false, "webkit.zoo", "/"),
createCookie("nonMatching2", "bar", false, "webkit.org", "/badPath"),
createCookie("nonMatching3", "bar", true, ".moo.com", "/")
];
var resourceURLs = [
"http://webkit.org", // 0
"http://www.webkit.org:81", // 1
"http://webkit.org/path", // 2
"http://www.webkit.org/path", // 3
"https://webkit.org/", // 4
"https://www.webkit.org/", // 5
"https://webkit.org:81/path", // 6
"https://www.webkit.org/path", // 7
"http://webkit.org:80", // 8
"http://www.webkit.org:80", // 9
"http://webkit.org:80/path", // 10
"http://www.webkit.org:80/path", // 11
"https://webkit.org:80/", // 12
"https://www.webkit.org:80/", // 13
"https://webkit.org:80/path", // 14
"https://www.webkit.org:80/path", // 15
"http://www.boo.com:80", // 16
"https://www.boo.com:80/path", // 17
"http://www.moo.com:80/", // 18
"http://www.boo.com:80", // 19
"https://www.boo.com:80/path", // 20
"http://www.moo.com:80/" // 21
];
var result = [];
for (var i = 0; i < cookies.length; ++i) {
var cookieResult = [];
for (var j = 0; j < resourceURLs.length; ++j) {
if (WebInspector.Cookies.cookieMatchesResourceURL(cookies[i], resourceURLs[j]))
cookieResult.push(j);
}
InspectorTest.addResult("[" + cookieResult + "]");
}
InspectorTest.completeTest();
function createCookie(name, value, secure, domain, path, port)
{
var protocolCookie = {
name: name,
value: value,
domain: domain,
port: port,
path: path,
expires: "Thu Jan 01 1970 00:00:00 GMT",
size: name.length + value.length,
httpOnly: false,
secure: secure,
session: true
};
return WebInspector.Cookies.buildCookieProtocolObject(protocolCookie);
}
}
</script>
</head>
<body onload="runTest()">
<p>
Tests that cookies are matched up with resources correctly.
</p>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.