summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/resources/access-via-redirect.html
blob: 510f8416b266d7c7343c8629366ae832b8c92e9e (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
<html manifest="access-via-redirect.manifest">

<p>This tests that the start of redirect chain doesn't get into an application cache if the end of the chain has a manifest.</p>
<p id="result">FAILURE</p>

<script>
if (window.layoutTestController) {
    layoutTestController.dumpAsText()
    layoutTestController.waitUntilDone();
}

function canLoad(url)
{
    try {
        var req = new XMLHttpRequest();
        req.open("GET", url, false);
        req.send("");
        return true;
    } catch (e) {
        return false;
    }
}

function cached()
{
    if (canLoad("/appcache/access-via-redirect.php")) {
        document.getElementById('result').innerHTML = "FAILURE: Start of redirect chain is in cache."
        return;
    }
   
    if (!canLoad("access-via-redirect.html")) {
        document.getElementById('result').innerHTML = "FAILURE: Could not load main resource from cache."
        return;
    }
        
    document.getElementById('result').innerHTML = "SUCCESS"
    
    if (window.layoutTestController)
        layoutTestController.notifyDone();
}

applicationCache.addEventListener('cached', cached, false);
applicationCache.addEventListener('noupdate', cached, false);

</script>
</html>