Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / media / video-in-iframe-crash.html
blobc65b47ab1880fdc691eac3bc6a5a2adce17c892f
1 <!doctype html>
2 <html>
3 <script src="../../media-resources/video-test.js"></script>
4 <script>
5 function getNextURL()
7 var url = location.href;
8 var queryIndex = url.indexOf("?");
9 var loadCount = 1;
10 if (queryIndex >= 0) {
11 loadCount = parseInt(url.substring(queryIndex + 1));
13 // Enforce an arbitrary reload limit that is high enough to trigger previosly observed crashes.
14 if (loadCount >= 10)
15 return "";
17 url = url.substring(0, queryIndex);
20 return url + "?" + (loadCount + 1);
23 function reloadPage()
25 var url = getNextURL();
26 if (url.length == 0) {
27 endTest();
28 return;
30 location.href = url;
33 function start()
35 iframe = document.createElement("iframe");
36 iframe.src = "../../media-resources/resources/frame_size_change.webm";
37 document.getElementById("store_div").appendChild(iframe);
38 window.setTimeout(moveIframeBodyIntoDocumentBody, 20);
41 function moveIframeBodyIntoDocumentBody()
43 var iframeContentDocument = iframe.contentDocument;
44 var iframeDocumentElement = iframeContentDocument.documentElement;
46 iframeContentDocument.onreadystatechange = function(e)
48 // Attempts to move the document body back into the iframe document.
49 iframeContentDocument.appendChild(iframeDocumentElement);
52 // Moves the iframe body into the current document.
53 document.body.appendChild(iframeContentDocument.firstChild);
54 reloadPage();
57 </script>
58 <body onload="start()">
59 <p>Tests that moving a &lt;video&gt; in and out of an iframe does not trigger a crash.</p>
60 <div id="store_div"></div>
61 </body>
62 </html>