set-location-after-close.html 791 Bytes
Newer Older
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
<html>
<body>
This tests opens a new window, sets a timeout to close it, then sets a timeout to navigate it via window.location.
We pass if we don't crash when setting the location of the already closed window.
<script>
if (window.layoutTestController) {
    layoutTestController.dumpAsText();
    layoutTestController.setCanOpenWindows();
    layoutTestController.waitUntilDone();
}

var w = window.open('resources/set-location-after-close-new-window.html');

window.addEventListener("message", processMessage, false);

function processMessage(event) {
    if (event.data == "opened")
        w.close();
    else if (event.data == "closed") {
        w.location = '';
        if (window.layoutTestController)
            layoutTestController.notifyDone();
    }
}
</script>
</body>
</html>