chromium/third_party/blink/web_tests/fast/frames/modifications-in-subtree-unload.html

<!DOCTYPE html>

<p>
    This tests that you can append children to a subtree that's being removed
    from inside of an unload handler on a frame in that subtree.
</p>

<div><iframe src="about:blank"></iframe></div>

<script>
div = document.querySelector("div");
iframe = document.querySelector("iframe");
iframe.contentWindow.onunload = function() {
    try {
        div.appendChild(document.createElement('span'));
        document.body.appendChild(document.createTextNode('PASS'));
    } catch (e) {
        document.body.appendChild(document.createTextNode('FAIL: ' + e));
    }
};

div.parentNode.removeChild(div);
</script>