<html>
<head>
    <script src="/js-test-resources/js-test-pre.js"></script>
    <script src="resources/cross-frame-access.js"></script>
    <script>
        description("Tests [[Delete]] for cross origin Window / Location.");
        jsTestIsAsync = true;

        if (window.testRunner)
            testRunner.dumpChildFramesAsText();

        receiver = function(e)
        {
            if (e.data == "setValuesComplete")
                deleteTest();
            if (e.data == "checkValuesComplete")
                finishJSTest();
        }
        addEventListener('message', receiver, false);

        deleteTest = function()
        {
            targetWindow = frames[0];

            shouldThrowErrorName("delete targetWindow.existingProperty", "SecurityError");
            shouldThrowErrorName("delete targetWindow.name", "SecurityError");
            shouldThrowErrorName("delete targetWindow[1]", "SecurityError");
            shouldThrowErrorName("delete targetWindow.location.existingProperty", "SecurityError");
            shouldThrowErrorName("delete targetWindow.location.host", "SecurityError");
            shouldThrowErrorName("delete targetWindow.location[1]", "SecurityError");

            targetWindow.postMessage("deletingValuesComplete", "*");
        }
    </script>
</head>
<body>
    <iframe src="http://localhost:8000/security/resources/cross-frame-iframe-for-delete-test.html"></iframe>
    <pre id="console"></pre>
    <script src="/js-test-resources/js-test-post.js"></script>
</body>
</html>
