<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
description("Removing animated use target indirectly from the document should not cause crash.");
function loadedSVGToBeMoved()
{
debug("loaded SVG to be moved");
moveFromOtherToLocal();
}
var count = 0;
function moveFromOtherToLocal()
{
if (++count > 3)
finishJSTest();
var source = document.getElementById("otherWindow").contentDocument;
var defs = source.getElementById("defs");
var target = document.getElementById("localWindow");
target.appendChild(defs);
debug("other -> local");
window.requestAnimationFrame(moveFromLocalToOther);
}
function moveFromLocalToOther()
{
var source = document.getElementById("localWindow");
var defs = source.getElementById("defs");
var target = document.getElementById("otherWindow").contentDocument.documentElement;
target.appendChild(defs);
debug("local -> other");
window.requestAnimationFrame(moveFromOtherToLocal);
}
</script>
<iframe id="otherWindow" src="resources/svg-with-animate-use.svg" onload="loadedSVGToBeMoved()"></iframe>
<svg id="localWindow">
<use xlink:href="#template" />
</svg>
<p>Test pass if no crash.</p>