summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/parser/document-open-in-unload.html
blob: be6aa514de70d1883dd4754d00a7399319e1d487 (plain)
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
<!DOCTYPE html>
<body>
<script src='../../resources/js-test.js'></script>
<script>
description('document.write inside onunload handler should not cause crash.');
jsTestIsAsync = true;

window.onload = function() {
    var iframe = document.createElement('iframe');
    var loadCount = 0;
    iframe.addEventListener('load', function() {
        ++ loadCount;
        if (loadCount == 1) {
            debug('iframe loaded successfully');
            iframe.src = 'about:blank';
        }
    });
    window.addEventListener('message', function() {
        shouldBe('"Done"', 'event.data');
        debug('iframe unloaded successfully');
        document.body.removeChild(iframe);
        finishJSTest();
    });

    iframe.src = 'resources/document-open-in-unload-inner.html';
    document.body.appendChild(iframe);
}
</script>
<p>Test passes if it doesn't crash</p>
</body>