Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / misc / async-script-removed.html
blob6e3227515c0e5feb84ed3e2cbe81fcd46a6e4f54
1 <html>
2 <head>
3 <script>
4 if (window.testRunner) {
5 testRunner.dumpAsText();
6 testRunner.waitUntilDone();
9 function log(msg) {
10 document.getElementById("log").innerHTML += msg;
12 </script>
13 </head>
14 <body>
15 <div>
16 <p>
17 Test that a synchronous script tag is executed in the right order, even if it's
18 removed from the document before it was loaded.
19 </p>
20 <p>
21 This test passes if the number "4123" is displayed below.
22 </p>
23 </div>
24 <div id="log"></div>
25 <script>
26 // All these scripts should be executed after the next script tag.
27 var s1 = document.createElement("script");
28 s1.src = "resources/delayed-log.php?delay=3&msg=1";
29 s1.async = false;
30 document.body.appendChild(s1);
32 var s2 = document.createElement("script");
33 s2.src = "resources/delayed-log.php?delay=2&msg=2";
34 s2.async = false;
35 document.body.appendChild(s2);
37 var s3 = document.createElement("script");
38 s3.src = "resources/delayed-log.php?delay=1&msg=3&done=1";
39 s3.async = false;
40 document.body.appendChild(s3);
42 // s1 should still execute, and it should execute before s2 and s3.
43 document.body.removeChild(s1);
44 </script>
45 <script>log("4");</script>
46 </body>
47 </html>