chromium/third_party/blink/web_tests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated.html

<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/window-property-collector.js"></script>
<script>
var jsTestIsAsync = true;

var frame;
var oldChildWindow;
var newChildWindow;
var propertiesToVerify = [];

function insertExpectedResult(path, expected)
{
    var propertyPath = getPropertyPath(path, path.length);
    propertiesToVerify.push({'property': "oldChildWindow." + propertyPath, 'expected': "newChildWindow." + propertyPath});
}

function runTest()
{
    frame = document.getElementById("test_frame");
    description("Tests property access on a cached DOMWindow after the associated frame is navigated. Test should not crash and properties read from the cached DOMWindow should be identical to properties through the 'current' DOMWindow.");
    oldChildWindow = frame.contentWindow;
    collectProperties(document.getElementById("src_frame").contentWindow);
    frame.onload = testFrameLoaded;
    frame.src = 'about:blank';
}

function testFrameLoaded()
{
    if (frame) {
        newChildWindow = frame.contentWindow;
        for (var i = 0; i < propertiesToVerify.length; ++i)
            shouldBe(propertiesToVerify[i].property, propertiesToVerify[i].expected);
        finishJSTest();
    }
}
</script>
</head>
<body onload="runTest()">
<iframe id="src_frame"></iframe>
<iframe id="test_frame" src="data:text/plain,"></iframe>
</body>
</html>