<!DOCTYPE html>
<body>
<div id=one><iframe></iframe></div>
<div id=two></div>
<div id=three></div>
<script src="../../resources/js-test-pre.js"></script>
<script>

description("Setting an iframe's src in a pagehide handler should not create a frame (nor a crash)");

var div1 = document.getElementById('one');
var div2 = document.getElementById('two');
var div3 = document.getElementById('three');
var subframe = document.querySelector('iframe');

subframe.contentWindow.onpagehide = function() {
    div2.appendChild(div1);
    subframe.src = 'javascript:void(0)';
    shouldBeNull("subframe.contentWindow");
};
subframe.remove();
div3.appendChild(subframe);
subframe.remove();
debug("did not crash");
</script>
<script src="../../resources/js-test-post.js"></script>
