blob: 46368647b1552be849f02329f46e99829e925c27 [file] [log] [blame]
<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.dumpChildFrames();
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>