<body onload="test(); crash();">
    <div id="parent"></div>
    <script>
        var parent = document.getElementById("parent");

        function test()
        {
            if (window.testRunner)
                testRunner.dumpAsText();

            var script = document.createElement("script");
            script.appendChild(document.createTextNode("document.body.removeChild(parent);"));
            var iframe = document.createElement("iframe");
            var container = document.createElement("div");
            container.appendChild(script);
            container.appendChild(iframe);
            parent.appendChild(container);
            parent = null;
        }

        function crash()
        {
            if (window.GCController) {
                GCController.collect();
                document.body.appendChild(document.createElement("div"));
            }
        }
    </script>
    <p>
        Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13792">bug 13792</a>.
    </p>
    <p>
        To test manually, close this Safari window, click the &ldquo;Garbage Collect JavaScript Objects&rdquo; button in the Caches window, and then open a new Safari window. The browser should not crash.
    </p>
</body>
