cross-frame-iframe-for-history-put-test.html 1.31 KB
Newer Older
weinig@apple.com's avatar
weinig@apple.com committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<html>
<head>
    <script src="cross-frame-access.js"></script>
    <script>
        var backOld;
        var forwardOld;
        var goOld;
        var toStringOld;
        var lengthOld;

        receiver = function(e)
        {
            if (e.data == "settingValuesComplete")
                setCheck();
        }
        document.addEventListener('message', receiver, false);

        window.onload = function()
        {
            backOld = window.history.back;
            forwardOld = window.history.forward;
            goOld = window.history.go;
            toStringOld = window.history.toString;
            lengthOld = window.history.length;

            window.parent.postMessage("storedOldValuesComplete");
        }

        setCheck = function()
        {
            log("\n----- tests for putting window.history and its properties -----\n");

            shouldBe("window.history.back", "backOld");
            shouldBe("window.history.forward", "forwardOld");
            shouldBe("window.history.go", "goOld");
            shouldBe("window.history.toString", "toStringOld");
            shouldBe("window.history.length", "lengthOld", true);

            if (window.layoutTestController)
                layoutTestController.notifyDone();
        }
    </script>
</head>
<body>
    <pre id="console"></pre>
</body>
</html>