<html>
<body onload='test()'>
    <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        var w;

        function test()
        {
            w = window.open("resources/opened-window.html");
            w.myProp = "1";
            w.document.myProp = "2";
        }

        // Called from the opened window.
        function concludeTest()
        {
            var c = document.getElementById('console');
            c.innerHTML = "window retains early properties: " + ((w.myProp && w.myProp=='1') ? "PASS" : "FAIL") + "<br>";  
            c.innerHTML +="document does not retain early properties: " + ((w.document.myProp) ? "FAIL" : "PASS") + "<br>";

            w.close();
            setTimeout(doneHandler, 1);
            function doneHandler() {
                if (w.closed) {
                    if (window.testRunner)
                        testRunner.notifyDone();
                    return;
                }

                setTimeout(doneHandler, 1);
            }

        }
    </script>
    Test setting window properties right after window.open()
    <div id='console'>FAIL, test did not run</div>
</body>
</html>
