summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/cookies/resources/third-party-cookie-relaxing-iframe.html
blob: d16964ee0cf7d52700135c0491f8b541c7ca1545 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html>
<script src="resetCookies.js"></script>
<script>
resetCookies();

if (window.layoutTestController)
    layoutTestController.dumpAsText();

window.onmessage = function(evt)
{
    if (evt.data == "showCookies") {
        showCookies();
        return;
    } else if (evt.data.split(" ")[0] == "sendXHR") {
        sendXHR(evt.data.split(" ")[1]);
        return;
    } else if (evt.data == "resetCookiesAndNotifyDone") {
        resetCookiesAndNotifyDone();
        return;
    } else
        alert("Unknown message.");
}

var stage = 1;
function showCookies()
{
    alert("Test stage " + stage++ + " document.cookie is: " + document.cookie);
    parent.window.postMessage("done", "*");    
}

function sendXHR(queryCommand)
{
    var baseurl = "http://localhost:8000/cookies/resources/cookie-utility.php";
    var url = queryCommand ? baseurl + "?queryfunction=" + queryCommand : baseurl;
    alert(url);
    var req = new XMLHttpRequest();
    req.open('GET', url, false);
    req.send();

    if (req.status == 200)
        alert("XHR response - " + req.responseText);
    else
        alert("xhr error");
    
    parent.window.postMessage("done", "*");    
}

function resetCookiesAndNotifyDone()
{
    resetCookies();
    if (window.layoutTestController)
        layoutTestController.notifyDone();
}

</script>
<body>
HELLO THERE
</body>
</html>