<script>
(function() {

if (location.hash == "#stop")
    return;

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

blankWindow = open(location + "#stop");
blankWindow.onload = function() {
    blankFunc = blankWindow.Function;
    blankWindow.opener = null;
    blankWindow.eval("location = 'about:blank'");

    setTimeout(function() {
        blankFunc = blankFunc("return window.Function")();
        if (!blankFunc && window.testRunner) {
            testRunner.notifyDone()
            return;
        }
        blankFunc("alertFunc", "(" + function() {
            targetWindow = open("http://localhost:8080/security/resources/post-done-to-opener.html");
            targetFunc = targetWindow.Function;
            this.alertFunc = alertFunc;

            targetWindow.addEventListener("load", function() {
                alertFunc(targetFunc("return document.documentElement.innerHTML")());
            });
        } + ")()")( function(s) { alert(s) });
    }, 0);
}

window.addEventListener('message', function(evt) {
    if (evt.data == 'done') {
        if (window.testRunner)
            testRunner.notifyDone();
    }
});

})();
</script>
This test passes if it doesn't alert something ugly.
