blob: 6e3227515c0e5feb84ed3e2cbe81fcd46a6e4f54 [file] [log] [blame]
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(msg) {
document.getElementById("log").innerHTML += msg;
}
</script>
</head>
<body>
<div>
<p>
Test that a synchronous script tag is executed in the right order, even if it's
removed from the document before it was loaded.
</p>
<p>
This test passes if the number "4123" is displayed below.
</p>
</div>
<div id="log"></div>
<script>
// All these scripts should be executed after the next script tag.
var s1 = document.createElement("script");
s1.src = "resources/delayed-log.php?delay=3&msg=1";
s1.async = false;
document.body.appendChild(s1);
var s2 = document.createElement("script");
s2.src = "resources/delayed-log.php?delay=2&msg=2";
s2.async = false;
document.body.appendChild(s2);
var s3 = document.createElement("script");
s3.src = "resources/delayed-log.php?delay=1&msg=3&done=1";
s3.async = false;
document.body.appendChild(s3);
// s1 should still execute, and it should execute before s2 and s3.
document.body.removeChild(s1);
</script>
<script>log("4");</script>
</body>
</html>