Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/svg/as-image/adopt-while-async-svg-load-is-in-progress-crash.html |
| diff --git a/third_party/WebKit/LayoutTests/svg/as-image/adopt-while-async-svg-load-is-in-progress-crash.html b/third_party/WebKit/LayoutTests/svg/as-image/adopt-while-async-svg-load-is-in-progress-crash.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..978a354768e2950c8590dbc4e059d10d39546b8a |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/svg/as-image/adopt-while-async-svg-load-is-in-progress-crash.html |
| @@ -0,0 +1,34 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +var t = async_test("Garbage collection of ImageResourceContent while " + |
| + "asynchronous loading of SVG is in progress " + |
| + "shouldn't crash. crbug.com/726220"); |
| +var img; |
| + |
| +function step1() { |
| + setTimeout(t.step_func(step2), 0); |
| + |
| + // 1. Creating an <img> element with SVG of which loading is not completed |
| + // synchronously. |
| + img = document.createElement('img'); |
| + img.src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><foreignObject><body xmlns="http://www.w3.org/1999/xhtml"><marquee></marquee></body></foreignObject></svg>'; |
| + document.body.appendChild(img); |
| + assert_false(img.complete); |
| +} |
| + |
| +function step2() { |
| + // 2. Adopt the <img> to a new document. |
| + newdoc = document.implementation.createDocument("svg", null); |
| + newdoc.adoptNode(img); |
| + |
| + // 3. Do garbage collection. The oold ImageResourceContent is garbage |
| + // collected while async SVG loading is still in progress. |
| + gc(); |
| + |
| + 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.
|
| +} |
| + |
| +</script> |
| +<body onload="setTimeout(t.step_func(step1), 0)"></body> |