• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html manifest="resources/main-resource-redirect.manifest">
2<body>
3<p>Test that application cache is consulted again after a redirect response.</p>
4<div id="result">Testing...</div>
5<script>
6if (window.layoutTestController) {
7    layoutTestController.waitUntilDone();
8    layoutTestController.dumpAsText();
9}
10
11function setNetworkEnabled(state)
12{
13    var req = new XMLHttpRequest;
14    req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false);
15    req.send("");
16}
17
18function test()
19{
20    applicationCache.oncached = null;
21    applicationCache.onnoupdate = null;
22    setNetworkEnabled(false);
23    var ifr = document.createElement("iframe");
24    ifr.setAttribute("src", "resources/main-resource-redirect-frame.php");
25    document.body.appendChild(ifr);
26}
27
28function done()
29{
30    if (window.layoutTestController)
31        layoutTestController.notifyDone();
32    setNetworkEnabled(true);
33}
34
35applicationCache.oncached=test;
36applicationCache.onnoupdate=test;
37applicationCache.onerror = function() { setNetworkEnabled(true); window.location.reload(); }
38</script>
39</body>
40