Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / prerender / prerender_xhr_put.html
bloba5c4b7eab2663b256c4b4793993dfe0782e5c75a
1 <html>
2 <head>
3 <script>
4 var pageWasPrerendered = false;
6 // Make sure plugin was not loaded while prerendering.
7 function DidPrerenderPass() {
8 pageWasPrerendered = true;
9 return true;
12 // Make sure DidPrerenderPass() was called first. Otherwise, the page was
13 // most likely reloaded instead of using the prerendered page.
14 function DidDisplayPass() {
15 return pageWasPrerendered;
18 function do_xhr() {
19 var xhr = new XMLHttpRequest();
20 xhr.onreadystatechange = function() {
21 if(xhr.readyState == 4) {
22 if(xhr.status == 200) {
23 document.getElementById("dynamic").innerHTML =
24 "Received:" + xhr.responseText;
25 } else {
26 document.getElementById("dynamic").innerHTML =
27 "Error code: " + xhr.status;
32 xhr.open("PUT", "prerender_xhr_put.html", true);
33 xhr.setRequestHeader("Content-Type", "text/plain");
34 xhr.send("test");
37 // Fire the XHR after onload so to consistently abort after
38 // webkitprerenderload, rather than racily abort on one side or the
39 // other.
40 window.onload = setTimeout.bind(null, do_xhr);
41 </script>
42 </head>
43 <body>
44 <div id="dynamic">
45 Waiting for XHR response.
46 </div>
47 </body>
48 </html>