Chromium Code Reviews| Index: LayoutTests/http/tests/media/video-in-iframe-crash.html |
| diff --git a/LayoutTests/http/tests/media/video-in-iframe-crash.html b/LayoutTests/http/tests/media/video-in-iframe-crash.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a99260a131d54b51f2678c50c921640e13309dfb |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/media/video-in-iframe-crash.html |
| @@ -0,0 +1,64 @@ |
| +<!doctype html> |
| +<html> |
| + <script src="../../media-resources/video-test.js"></script> |
| + <script> |
| + function getNextURL() |
| + { |
| + var url = location.href; |
| + var queryIndex = url.indexOf("?"); |
| + var loadCount = 1; |
| + if (queryIndex >= 0) { |
| + loadCount = parseInt(url.substring(queryIndex + 1)); |
| + |
| + // Enforce an arbitrary reload limit that is high enough to trigger previosly observed crashes. |
| + if (loadCount >= 20) |
| + return ""; |
| + |
| + url = url.substring(0, queryIndex); |
| + } |
| + |
| + //consoleWrite("Load " + loadCount); |
|
abarth-chromium
2013/10/01 19:49:19
Please remove commented out code.
acolwell GONE FROM CHROMIUM
2013/10/01 22:02:04
Done.
|
| + return url + "?" + (loadCount + 1); |
| + } |
| + |
| + function reloadPage() |
| + { |
| + var url = getNextURL(); |
| + if (url.length == 0) { |
| + endTest(); |
| + return; |
| + } |
| + location.href = url; |
| + } |
| + |
| + window.setTimeout(reloadPage, Math.random() * 100); |
|
abarth-chromium
2013/10/01 19:49:19
Please don't call Math.random() in a test. Just p
acolwell GONE FROM CHROMIUM
2013/10/01 22:02:04
Done. This test was based on the ClusterFuzz test
|
| + |
| + function start() |
| + { |
| + iframe = document.createElement("iframe"); |
| + iframe.src = "../../media-resources/resources/frame_size_change.webm"; |
|
abarth-chromium
2013/10/01 19:49:19
This is new to me, but I assume this works..
acolwell GONE FROM CHROMIUM
2013/10/01 22:02:04
It's how we include stuff from the media/ director
|
| + document.getElementById("store_div").appendChild(iframe); |
| + window.setTimeout(moveIframeBodyIntoDocumentBody, Math.random()*100); |
| + } |
| + |
| + function moveIframeBodyIntoDocumentBody() |
| + { |
| + iframeContentDocument = iframe.contentDocument; |
| + iframeDocumentElement = iframeContentDocument.documentElement; |
| + |
| + iframeContentDocument.onreadystatechange = function(e) |
| + { |
| + // Attempts to move the document body back into the iframe document. |
| + iframeDocumentElement.innerHTML = document.documentElement; |
| + } |
| + |
| + // Moves the iframe body into the current document. |
| + document.body.appendChild(iframeContentDocument.firstChild); |
| + } |
| + |
| + </script> |
| + <body onload="start()"> |
| + <p>Tests that moving a <video> in and out of an iframe does not trigger a crash.</p> |
| + <div id="store_div"></div> |
| + </body> |
| +</html> |