summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/loader/form-state-restore-with-frames.html
blob: 90ad073e96a6ff29ab3972e3a66247984e2cec48 (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
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<head>
<script src="../../resources/js-test.js"></script>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
</head>
<body onload="startTest()">
<input name="name1" id="input1">
<iframe id="frame1" src="resources/form-state-restore-with-frames-1.html">
</iframe>
<form id="form1" action="data:text/html,&lt;script>history.back();&lt;/script>">
<input type="submit">
</form>

<script>
function $(id) {
    return document.getElementById(id);
}
function frame$(frame, id) {
    return frame.contentDocument.getElementById(id);
}

function startTest() {
    if ($('input1').value == 'visited') {
        shouldBeEqualToString('frame$($("frame1"), "input2").value', 'value2');
        shouldBeEqualToString('frame$(frame$($("frame1"), "frame2"), "input3").value', 'value3');
        finishJSTest();
    } else {
        setTimeout(function() {
            $('input1').value = 'visited';
            frame$($('frame1'), 'input2').value = 'value2';
            frame$(frame$($('frame1'), 'frame2'), 'input3').value = 'value3';
            $('form1').submit();
        }, 0);
    }
}

jsTestIsAsync = true;
</script>
</body>