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

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

var childWindow;
var propertiesToVerify = [];

function insertExpectedResult(path, expected)
{
    var property = path.join(".");
    propertiesToVerify.push({"path": path.slice(0), "property": property, "expected": expected});
}

function runTest()
{
    description("Tests property access on a cached DOMWindow after the associated frame is no longer in a web page. Test should not crash and properties should be set to reasonable defaults as appropriate.");
    var frame = document.getElementById("test_frame");
    childWindow = frame.contentWindow;
    collectProperties(document.getElementById("src_frame").contentWindow);
    frame.parentNode.removeChild(frame);
    for (var i = 0; i < propertiesToVerify.length; ++i) {
      // It's ok if the property no longer exists.
      if (pathExists(childWindow, propertiesToVerify[i].path))
        shouldBe("childWindow." + propertiesToVerify[i].property, propertiesToVerify[i].expected);
    }
    finishJSTest();
}
</script>
</head>
<body onload="runTest()">
<iframe id="src_frame"></iframe>
<iframe id="test_frame" src="about:blank"></iframe>
</body>
</html>