chromium/third_party/blink/web_tests/fast/dom/Document/open-with-pending-load.html

<script>
if (window.testRunner)
    testRunner.dumpAsText();
    
function runTest() {
    var result = document.getElementById('result');
    
    var text = document.getElementById('iframe').contentDocument.documentElement.outerText;
    if (text == 'REPLACED')
        result.innerHTML = 'SUCCESS';
    else
        result.innerHTML = 'FAILURE - Got "' + text + '"';
}

</script>
<body>
<div>This tests that calling document.open on a document that has a pending load correctly cancels the load</div>
<div id="result"></div>
<script language="JavaScript" type="text/javascript">
document.write('<iframe id="iframe" src="data:text/html,Should not be seen" onload="runTest()"></iframe>')
var oRTE = frames[0].document; 
oRTE.open("text/html","replace");
oRTE.write("REPLACED");
oRTE.close();
</script>
</body>