Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: LayoutTests/http/tests/media/video-in-iframe-crash.html

Issue 25362002: Block load event dispatching on old document when an HTMLMediaElement is moved between documents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 &lt;video&gt; in and out of an iframe does not trigger a crash.</p>
+ <div id="store_div"></div>
+ </body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/http/tests/media/video-in-iframe-crash-expected.txt » ('j') | Source/core/html/HTMLMediaElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698