4 <script src=
"../../resources/js-test.js"></script>
6 <body onload=
"runTest()">
7 <p>Test to NOT restore form state to a form with autocomplete=off.
</p>
8 <div id=
"console"></div>
10 <input id=emptyOnFirstVisit
>
12 <form action=
"data:text/html,<script>history.back()</script>" id
=form1 autocomplete
=off
>
13 <input name
=user id
=input1
>
14 <textarea name
=comment id
=textarea1
></textarea
>
15 <select name
=os id
=select1
><option
>Mac
<option
>Windows
<option
>BSD
</select
>
17 <form action
="data:text/html,<script>history.back()</script>" id
=form2
>
18 <input name
=user id
=input2
>
19 <textarea name
=comment id
=textarea2
></textarea
>
20 <select name
=os id
=select2
><option
>Mac
<option
>Windows
<option
>BSD
</select
>
28 var parent
= document
.getElementById('parent');
29 var state
= document
.getElementById('emptyOnFirstVisit');
32 if (window
.testRunner
)
33 testRunner
.waitUntilDone();
34 state
.value
= 'visited';
36 document
.getElementById('input1').value
= 'value1';
37 document
.getElementById('textarea1').value
= 'nice';
38 document
.getElementById('select1').value
= 'Windows';
39 document
.getElementById('input2').value
= 'value2';
40 document
.getElementById('textarea2').value
= 'good';
41 document
.getElementById('select2').value
= 'BSD';
42 // Submit form in a timeout to make sure that we create a new back/forward list item.
43 setTimeout(function() {document
.getElementById('form2').submit();}, 0);
46 debug('Controls in the first form should have their default values:');
47 shouldBe('document.getElementById("input1").value', '""');
48 shouldBe('document.getElementById("textarea1").value', '""');
49 shouldBe('document.getElementById("select1").value', '"Mac"');
50 debug('Controls in the second form should have edited values:');
51 shouldBe('document.getElementById("input2").value', '"value2"');
52 shouldBe('document.getElementById("textarea2").value', '"good"');
53 shouldBe('document.getElementById("select2").value', '"BSD"');
54 if (window
.testRunner
)
55 testRunner
.notifyDone();