a-click-handler-with-null-browsing-context-crash.html (892B)
1 <!DOCTYPE html> 2 <title>HTMLAnchorElement.onclick with null browsing context</title> 3 <link rel="author" title="Nate Chapin" href="mailto:japhet@chromium.org"> 4 <link rel="help" href="https://html.spec.whatwg.org/C/#the-a-element"> 5 <link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1083721"> 6 <meta name="assert" content="An <a> from a discarded browsing context that is cloned into a new document should not crash when clicked"/> 7 <body> 8 <iframe id="i" src="resources/a-onclick-handler-iframe.html"></iframe> 9 <script> 10 window.onload = () => { 11 var range = i.contentDocument.createRange(); 12 range.selectNodeContents(i.contentDocument.body); 13 i.remove(); 14 15 // Clone the <a> into this document, and ensure clicking it does not crash. 16 document.body.appendChild(range.cloneContents()); 17 var a = document.getElementsByTagName('a')[0]; 18 a.click(); 19 }; 20 </script> 21 </body>