chromium/third_party/blink/web_tests/fast/frames/detached-shadow-frame.html

<!DOCTYPE html>

<body>

<script src="../../resources/js-test.js"></script>

<script>
description('Should not be able to create an iframe with a loaded contentDocument that is not in the document tree.');

container = document.body.appendChild(document.createElement("div"));
helperDiv = container.appendChild(document.createElement("div"));
helperFrame = container.appendChild(document.createElement("iframe"));

helperFrame.contentWindow.onunload = function() {
    shadowRoot = helperDiv.attachShadow({mode: 'open'});
    innerFrame = shadowRoot.appendChild(document.createElement("iframe"));
};

document.body.removeChild(container);

shouldBe('innerFrame.contentDocument', 'null');
</script>