1 <html> 2 <body> 3 <p>Test that offline applications' main resources are not affected by URL hashes.</p> 4 <p>Should say SUCCESS:</p> 5 <div id=result></div> 6 7 <script> 8 if (window.layoutTestController) { 9 layoutTestController.dumpAsText(); 10 layoutTestController.waitUntilDone(); 11 } 12 13 function log(message) 14 { 15 document.getElementById("result").innerHTML += message + "<br>"; 16 } 17 18 function setNetworkEnabled(state) 19 { 20 var req = new XMLHttpRequest; 21 req.open("GET", "/resources/network-simulator.php?command=" + (state ? "connect" : "disconnect"), false); 22 req.send(""); 23 } 24 25 function frameCreated() 26 { 27 if (stage == 0) { 28 stage = 1; 29 setNetworkEnabled(false); 30 var ifr = document.createElement("iframe"); 31 ifr.setAttribute("src", "/resources/network-simulator.php?path=/appcache/resources/main-resource-hash-frame.html#bar"); 32 document.body.appendChild(ifr); 33 } else { 34 log("SUCCESS"); 35 setNetworkEnabled(true); 36 if (window.layoutTestController) 37 layoutTestController.notifyDone() 38 } 39 } 40 41 window.addEventListener("message", frameCreated, false); 42 43 var stage = 0; 44 setNetworkEnabled(true); 45 var ifr = document.createElement("iframe"); 46 ifr.setAttribute("src", "/resources/network-simulator.php?path=/appcache/resources/main-resource-hash-frame.html#foo"); 47 document.body.appendChild(ifr); 48 49 </script> 50 </body> 51 </html> 52