Home | History | Annotate | Download | only in appcache
      1 <html manifest="resources/foreign-fallback.manifest">
      2 <body>
      3 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=44406">bug 44406</a>:
      4 Application Cache crash when a fallback document has a manifest URL.</p>
      5 <div id="result">Testing...</div>
      6 <script>
      7 if (window.layoutTestController) {
      8     layoutTestController.waitUntilDone();
      9     layoutTestController.dumpAsText();
     10 }
     11 
     12 
     13 applicationCache.addEventListener('cached', test, false);
     14 applicationCache.addEventListener('noupdate', test, false);
     15 
     16 function test()
     17 {
     18     var ifr = document.createElement("iframe");
     19     ifr.setAttribute("src", "resources/foreign-fallback/does-not-exist.html");
     20     document.body.appendChild(ifr);
     21 
     22     // I couldn't find any event that would fire on frame loading failure, so let's poll.
     23     setTimeout(frameDone, 100);
     24 }
     25 
     26 function frameDone()
     27 {
     28     try {
     29         var frameContent = frames[0].document.documentElement.innerHTML;
     30         if (frameContent.match("Not Found"))
     31             document.getElementById("result").innerHTML = "PASS";
     32         else if (frameContent.match("FAIL"))
     33             document.getElementById("result").innerHTML = "FAIL";
     34         else
     35             throw "Try again";
     36 
     37         if (window.layoutTestController)
     38             layoutTestController.notifyDone();
     39     } catch (ex) {
     40         // Not done yet.
     41         setTimeout(frameDone, 100);
     42     }
     43 }
     44 
     45 </script>
     46 <p>The frame below should display a Not Found error - the fallback entry is foreign, so it shouldn't be used for main resource.</p>
     47 </body>
     48 </html>
     49