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

const image = document.createElement('img');
document.body.appendChild(image);
const selection = window.getSelection();
const image2 = document.createElement('img');
const div = document.createElement('div');
document.body.appendChild(div);
const shadow = div.attachShadow({
    mode: "open",
});
shadow.appendChild(image2);
if (window.internals) {
    internals.setSelectionWithoutValidation(shadow, 0, image, 2);
    document.execCommand("copy");

    const p = document.createElement('p');
    p.innerHTML = "This test PASS if it does not crash."
    document.body.appendChild(p);
}
</script>
