Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <script> | |
| 5 var t = async_test("Garbage collection of ImageResourceContent while " + | |
| 6 "asynchronous loading of SVG is in progress " + | |
| 7 "shouldn't crash. crbug.com/726220"); | |
| 8 var img; | |
| 9 | |
| 10 function step1() { | |
| 11 setTimeout(t.step_func(step2), 0); | |
| 12 | |
| 13 // 1. Creating an <img> element with SVG of which loading is not completed | |
| 14 // synchronously. | |
| 15 img = document.createElement('img'); | |
| 16 img.src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><foreignOb ject><body xmlns="http://www.w3.org/1999/xhtml"><marquee></marquee></body></fore ignObject></svg>'; | |
| 17 document.body.appendChild(img); | |
| 18 assert_false(img.complete); | |
| 19 } | |
| 20 | |
| 21 function step2() { | |
| 22 // 2. Adopt the <img> to a new document. | |
| 23 newdoc = document.implementation.createDocument("svg", null); | |
| 24 newdoc.adoptNode(img); | |
| 25 | |
| 26 // 3. Do garbage collection. The oold ImageResourceContent is garbage | |
| 27 // collected while async SVG loading is still in progress. | |
| 28 gc(); | |
| 29 | |
| 30 setTimeout(t.step_func_done(function() {}), 100); | |
|
fs
2017/05/26 08:28:36
Nit: Don't need an empty function here. (Can just
hiroshige
2017/05/26 18:44:58
Done.
| |
| 31 } | |
| 32 | |
| 33 </script> | |
| 34 <body onload="setTimeout(t.step_func(step1), 0)"></body> | |
| OLD | NEW |