<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.testRunner) {
    testRunner.dumpAsText()
    testRunner.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.py")) {
        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.testRunner)
        testRunner.notifyDone();
}

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

</script>
</html>
