3 <p>Tests for
<a href=
"http://bugs.webkit.org/show_bug.cgi?id=3420">bug
3420</a>:
4 XMLHttpRequest does not handle set-cookie headers.
</p>
5 <div id=
"result">FAIL: test script didn't run.
</div>
8 function clearCookies()
10 req
= new XMLHttpRequest
;
11 req
.open("POST", "resources/get-set-cookie.cgi?clear=1", false);
14 function getAndSetCookies()
16 req
= new XMLHttpRequest
;
17 req
.open("POST", "resources/get-set-cookie.cgi", false);
19 return req
.responseText
;
21 function setResult(result
)
23 document
.getElementById("result").firstChild
.data
= result
;
26 if (window
.testRunner
)
27 testRunner
.dumpAsText();
30 var response
= getAndSetCookies();
31 if (response
&& response
.match(/.*WK-test=1.*/)) {
32 setResult("FAIL: The cookie still present after clear. clearCookies() failed. Must be a bug in the test!");
34 var response
= getAndSetCookies();
35 if (response
.match(/.*WK-test-secure=1.*/))
36 setResult("FAIL: a secure cookie was sent via HTTP");
37 else if (response
.match(/.*WK-test=1.*/))
40 setResult("FAIL: the cookie was not set");