Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <p>Passes if it doesn't crash and the child is not in the id map</p> | |
| 2 <p id="result"></p> | |
| 3 | |
| 4 <script> | |
| 5 function gc() | |
|
adamk
2014/07/24 21:35:59
Please include ../../resources/gc.js instead of ro
esprehn
2014/07/24 22:50:18
done.
| |
| 6 { | |
| 7 var a = []; | |
| 8 for (var i = 0; i < 300000; ++i) | |
| 9 a.push("AAAA"); | |
| 10 } | |
| 11 | |
| 12 if (window.testRunner) | |
| 13 testRunner.dumpAsText(); | |
| 14 | |
| 15 var script = document.createElement("script"); | |
| 16 script.type = "dont-execute"; | |
| 17 script.textContent = "script.remove()"; | |
| 18 child = document.createElement("div"); | |
| 19 child.id = "child"; | |
| 20 script.appendChild(child); | |
| 21 | |
| 22 // The script won't execute here because the type is invalid, but it also won't | |
| 23 // get marked as being already run, so changing the children later will run it. | |
| 24 document.documentElement.appendChild(script); | |
| 25 | |
| 26 // Per the spec setting the type has no effect | |
| 27 script.type = ""; | |
| 28 | |
| 29 // but changing the children *will* execute the script now that the type is | |
| 30 // is valid. | |
| 31 child.remove(); | |
| 32 | |
| 33 child = null; | |
| 34 gc(); | |
| 35 | |
| 36 var child = document.getElementById("child"); | |
| 37 document.getElementById("result").textContent = child ? "FAIL" : "PASS"; | |
| 38 </script> | |
| OLD | NEW |