<html manifest="xhr-foreign-resource-2.manifest">
<body>
<div id=result></div>
<script>
function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

function cached()
{
    applicationCache.onnoupdate = null;
    applicationCache.oncached = null;
    
    // simple.txt is only listed s a resource in main frame's manifest, so loading should fail.
    try {
        var req = new XMLHttpRequest;
        req.open("GET", "simple.txt", false);
        req.send("");
        log("FAIL");
        log("applicationCache.status = " + applicationCache.status);
        parent.postMessage("FAIL", "*");
    } catch (ex) {
        log("Frame OK");
        parent.postMessage("SUCCESS", "*");
    }
}

applicationCache.onnoupdate = cached;
applicationCache.oncached = cached;

applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
</script>
</body>
</html>
