mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 12:15:33 +00:00
dda86cd70e
--HG-- extra : rebase_source : d635a4f39c587d4d381b486dd63de747865b77a2
50 lines
1.6 KiB
HTML
50 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>EventSource: credentials</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="log"></div>
|
|
<script>
|
|
var crossdomain = location.href
|
|
.replace('://', '://www2.')
|
|
.replace(/\/[^\/]*$/, '/')
|
|
|
|
function testCookie(desc, success, props, id) {
|
|
var test = async_test(document.title + ': credentials ' + desc)
|
|
test.step(function() {
|
|
var source = new EventSource(crossdomain + "resources/cors-cookie.py?ident=" + id, props)
|
|
|
|
source.onmessage = test.step_func(function(e) {
|
|
if(e.data.indexOf("first") == 0) {
|
|
assert_equals(e.data, "first NO_COOKIE", "cookie status")
|
|
}
|
|
else if(e.data.indexOf("second") == 0) {
|
|
if (success)
|
|
assert_equals(e.data, "second COOKIE", "cookie status")
|
|
else
|
|
assert_equals(e.data, "second NO_COOKIE", "cookie status")
|
|
|
|
source.close()
|
|
test.done()
|
|
}
|
|
else {
|
|
assert_unreached("unrecognized data returned: " + e.data)
|
|
source.close()
|
|
test.done()
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
testCookie('enabled', true, { withCredentials: true }, '1_' + new Date().getTime())
|
|
testCookie('disabled', false, { withCredentials: false }, '2_' + new Date().getTime())
|
|
testCookie('default', false, { }, '3_' + new Date().getTime())
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|