Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLScriptElement / script-reexecution.html
blobd7bce7e421631a2d5e057d8cb999288925db0089
1 <html>
2 <head>
3 <script type="text/javascript">
4 function pass() {
5 var contentElement = document.getElementById(test);
7 if (contentElement.textContent == 'PASS') {
8 contentElement.textContent = 'FAIL';
9 } else if (contentElement.textContent == 'FAIL') {
10 contentElement.textContent = 'PASS';
14 function test() {
15 if (window.testRunner) {
16 testRunner.dumpAsText();
17 testRunner.waitUntilDone();
20 test = "p1";
21 var e1 = document.createElement("script");
22 e1.textContent = pass.toString() + " pass();";
23 document.getElementsByTagName("head")[0].appendChild(e1);
24 document.getElementsByTagName("head")[0].removeChild(e1);
26 test = "p2";
27 document.getElementsByTagName("head")[0].appendChild(e1);
28 document.getElementsByTagName("head")[0].removeChild(e1);
30 test = "p3";
31 e3 = document.createElement("script");
32 e3.src = "resources/script-reexecution-pass.js";
33 e3.onload = function() { finish(); };
34 document.getElementsByTagName("head")[0].appendChild(e3);
37 function finish() {
38 test = "p4";
40 e3.onload = "";
41 document.getElementsByTagName("head")[0].removeChild(e3);
42 document.getElementsByTagName("head")[0].appendChild(e3);
44 if (window.testRunner)
45 testRunner.notifyDone();
47 </script>
48 </head>
49 <body onload="test()">
50 <p>Created script element, script data passed as text content, appended: <span id="p1">FAIL</span></p>
51 <p>Removed element, readd element, remove again, script shouldn't have executed:<span id="p2">PASS</span></p>
52 <p>Created script element, loading external script content, appended: <span id="p3">FAIL</span></p>
53 <p>Removed element, readd element, script shouldn't have executed: <span id="p4">PASS</span></p>
54 </body>
55 </html>