Index: third_party/WebKit/LayoutTests/http/tests/misc/tests-finishing-simultaneously.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/misc/tests-finishing-simultaneously.html b/third_party/WebKit/LayoutTests/http/tests/misc/tests-finishing-simultaneously.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d08e60abddb3db99aaba4ad59b9f924528125bd1 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/http/tests/misc/tests-finishing-simultaneously.html |
@@ -0,0 +1,47 @@ |
+<script> |
+// This is a regresion test for a layout test harness crash that was |
+// covered by https://crbug.com/716085#c10. |
+ |
+// The test creates 2 subframes, each cross-origin from the main frame and from |
+// each other. Once all the subframes report (via postMessage("subframe is |
+// loaded"...)) that they are ready, the main frame asks them to nearly |
+// simultaneously call testRunner.notifyDone() (from 2 separate OOPIF processes |
+// under --site-per-process mode). This used to crash the layout tests harness. |
+ |
+function addFrame(uri) { |
+ var f = document.createElement('iframe'); |
+ f.src = uri; |
+ document.body.appendChild(f); |
+} |
+ |
+var loaded_frames = 0; |
+function onLoad() { |
+ if (parent === self) { |
+ document.body.innerText = 'Main frame'; |
+ testRunner.waitUntilDone(); |
+ testRunner.dumpAsText(); |
+ testRunner.dumpChildFramesAsText(); |
+ |
+ window.addEventListener("message", function(event) { |
+ loaded_frames = loaded_frames + 1; |
+ if (loaded_frames == 2) { // All subframes are ready? |
+ for (var i = 0; i < window.frames.length; i++) { |
+ window.frames[i].postMessage("notify done", "*"); |
+ } |
+ } |
+ }, false); |
+ |
+ addFrame("https://localhost:8443/misc/tests-finishing-simultaneously.html"); |
+ addFrame("http://localhost:8000/misc/tests-finishing-simultaneously.html"); |
+ } else { |
+ document.body.innerText = 'Subframe: ' + location.href; |
+ window.addEventListener("message", function(event) { |
+ testRunner.notifyDone(); |
+ }, false); |
+ parent.postMessage("subframe is loaded", "*"); |
+ } |
+} |
+</script> |
+<body onload="onLoad()"> |
+</body> |
+ |