<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner)
    testRunner.dumpAsText();

function runTest()
{
    var iframeElement = document.getElementById('iframe1');
    var iframeDocument = iframeElement.contentDocument;
    var iframeDocumentRoot = iframeDocument.documentElement;

    var selection = window.getSelection();
    var range = document.createRange();
    selection.addRange(range);
    range.selectNode(iframeDocumentRoot);
    selection.addRange(range);
    iframeDocument.removeChild(iframeDocumentRoot);
}
</script>
</head>
<body>
Test passes if it does not crash.
<iframe id="iframe1" onload="runTest()"></iframe>
</body>
</html>
