<!doctype html>
<html>
<script src = "/resources/testharness.js"></script>
<script src = "/resources/testharnessreport.js"></script>
<iframe src="resources/empty.html"></iframe>
<script>
async_test((test) => {
const iframe = document.querySelector('iframe');
iframe.addEventListener('load', () => {
const url = 'ws://127.0.0.1:8880/server-close';
const ws = new iframe.contentWindow.WebSocket(url);
ws.onclose = () => {
iframe.remove();
test.done();
};
});
}, 'Destroying the frame in the close event handler should not lead to crash.');
</script>
</html>