Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Satchel Test for Form Submisstion Field Cap</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="satchel_common.js"></script> |
michael@0 | 7 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 8 | </head> |
michael@0 | 9 | <body> |
michael@0 | 10 | <p id="display"></p> |
michael@0 | 11 | <div id="content" style="display: none"> |
michael@0 | 12 | <!-- |
michael@0 | 13 | Test for bug 492701. |
michael@0 | 14 | Only change field # numInputFields (= MAX_FIELDS_SAVED + 1) |
michael@0 | 15 | and test that it is actually saved and the other (unmodified) ones are not. |
michael@0 | 16 | --> |
michael@0 | 17 | <form id="form1" onsubmit="return checkSubmit(1)"> |
michael@0 | 18 | <input type="text" name="test1" value="1"> |
michael@0 | 19 | <input type="text" name="test2" value="2"> |
michael@0 | 20 | <input type="text" name="test3" value="3"> |
michael@0 | 21 | <input type="text" name="test4" value="4"> |
michael@0 | 22 | <input type="text" name="test5" value="5"> |
michael@0 | 23 | <input type="text" name="test6" value="6"> |
michael@0 | 24 | <input type="text" name="test7" value="7"> |
michael@0 | 25 | <input type="text" name="test8" value="8"> |
michael@0 | 26 | <input type="text" name="test9" value="9"> |
michael@0 | 27 | <input type="text" name="test10" value="10"> |
michael@0 | 28 | <input type="text" name="test11" value="11"> |
michael@0 | 29 | <input type="text" name="test12" value="12"> |
michael@0 | 30 | <input type="text" name="test13" value="13"> |
michael@0 | 31 | <input type="text" name="test14" value="14"> |
michael@0 | 32 | <input type="text" name="test15" value="15"> |
michael@0 | 33 | <input type="text" name="test16" value="16"> |
michael@0 | 34 | <input type="text" name="test17" value="17"> |
michael@0 | 35 | <input type="text" name="test18" value="18"> |
michael@0 | 36 | <input type="text" name="test19" value="19"> |
michael@0 | 37 | <input type="text" name="test20" value="20"> |
michael@0 | 38 | <input type="text" name="test21" value="21"> |
michael@0 | 39 | <input type="text" name="test22" value="22"> |
michael@0 | 40 | <input type="text" name="test23" value="23"> |
michael@0 | 41 | <input type="text" name="test24" value="24"> |
michael@0 | 42 | <input type="text" name="test25" value="25"> |
michael@0 | 43 | <input type="text" name="test26" value="26"> |
michael@0 | 44 | <input type="text" name="test27" value="27"> |
michael@0 | 45 | <input type="text" name="test28" value="28"> |
michael@0 | 46 | <input type="text" name="test29" value="29"> |
michael@0 | 47 | <input type="text" name="test30" value="30"> |
michael@0 | 48 | <input type="text" name="test31" value="31"> |
michael@0 | 49 | <input type="text" name="test32" value="32"> |
michael@0 | 50 | <input type="text" name="test33" value="33"> |
michael@0 | 51 | <input type="text" name="test34" value="34"> |
michael@0 | 52 | <input type="text" name="test35" value="35"> |
michael@0 | 53 | <input type="text" name="test36" value="36"> |
michael@0 | 54 | <input type="text" name="test37" value="37"> |
michael@0 | 55 | <input type="text" name="test38" value="38"> |
michael@0 | 56 | <input type="text" name="test39" value="39"> |
michael@0 | 57 | <input type="text" name="test40" value="40"> |
michael@0 | 58 | <input type="text" name="test41" value="41"> |
michael@0 | 59 | <input type="text" name="test42" value="42"> |
michael@0 | 60 | <input type="text" name="test43" value="43"> |
michael@0 | 61 | <input type="text" name="test44" value="44"> |
michael@0 | 62 | <input type="text" name="test45" value="45"> |
michael@0 | 63 | <input type="text" name="test46" value="46"> |
michael@0 | 64 | <input type="text" name="test47" value="47"> |
michael@0 | 65 | <input type="text" name="test48" value="48"> |
michael@0 | 66 | <input type="text" name="test49" value="49"> |
michael@0 | 67 | <input type="text" name="test50" value="50"> |
michael@0 | 68 | <input type="text" name="test51" value="51"> |
michael@0 | 69 | <input type="text" name="test52" value="52"> |
michael@0 | 70 | <input type="text" name="test53" value="53"> |
michael@0 | 71 | <input type="text" name="test54" value="54"> |
michael@0 | 72 | <input type="text" name="test55" value="55"> |
michael@0 | 73 | <input type="text" name="test56" value="56"> |
michael@0 | 74 | <input type="text" name="test57" value="57"> |
michael@0 | 75 | <input type="text" name="test58" value="58"> |
michael@0 | 76 | <input type="text" name="test59" value="59"> |
michael@0 | 77 | <input type="text" name="test60" value="60"> |
michael@0 | 78 | <input type="text" name="test61" value="61"> |
michael@0 | 79 | <input type="text" name="test62" value="62"> |
michael@0 | 80 | <input type="text" name="test63" value="63"> |
michael@0 | 81 | <input type="text" name="test64" value="64"> |
michael@0 | 82 | <input type="text" name="test65" value="65"> |
michael@0 | 83 | <input type="text" name="test66" value="66"> |
michael@0 | 84 | <input type="text" name="test67" value="67"> |
michael@0 | 85 | <input type="text" name="test68" value="68"> |
michael@0 | 86 | <input type="text" name="test69" value="69"> |
michael@0 | 87 | <input type="text" name="test70" value="70"> |
michael@0 | 88 | <input type="text" name="test71" value="71"> |
michael@0 | 89 | <input type="text" name="test72" value="72"> |
michael@0 | 90 | <input type="text" name="test73" value="73"> |
michael@0 | 91 | <input type="text" name="test74" value="74"> |
michael@0 | 92 | <input type="text" name="test75" value="75"> |
michael@0 | 93 | <input type="text" name="test76" value="76"> |
michael@0 | 94 | <input type="text" name="test77" value="77"> |
michael@0 | 95 | <input type="text" name="test78" value="78"> |
michael@0 | 96 | <input type="text" name="test79" value="79"> |
michael@0 | 97 | <input type="text" name="test80" value="80"> |
michael@0 | 98 | <input type="text" name="test81" value="81"> |
michael@0 | 99 | <input type="text" name="test82" value="82"> |
michael@0 | 100 | <input type="text" name="test83" value="83"> |
michael@0 | 101 | <input type="text" name="test84" value="84"> |
michael@0 | 102 | <input type="text" name="test85" value="85"> |
michael@0 | 103 | <input type="text" name="test86" value="86"> |
michael@0 | 104 | <input type="text" name="test87" value="87"> |
michael@0 | 105 | <input type="text" name="test88" value="88"> |
michael@0 | 106 | <input type="text" name="test89" value="89"> |
michael@0 | 107 | <input type="text" name="test90" value="90"> |
michael@0 | 108 | <input type="text" name="test91" value="91"> |
michael@0 | 109 | <input type="text" name="test92" value="92"> |
michael@0 | 110 | <input type="text" name="test93" value="93"> |
michael@0 | 111 | <input type="text" name="test94" value="94"> |
michael@0 | 112 | <input type="text" name="test95" value="95"> |
michael@0 | 113 | <input type="text" name="test96" value="96"> |
michael@0 | 114 | <input type="text" name="test97" value="97"> |
michael@0 | 115 | <input type="text" name="test98" value="98"> |
michael@0 | 116 | <input type="text" name="test99" value="99"> |
michael@0 | 117 | <input type="text" name="test100" value="100"> |
michael@0 | 118 | <input type="text" name="test101" value="101"> |
michael@0 | 119 | <button type="submit">Submit</button> |
michael@0 | 120 | </form> |
michael@0 | 121 | |
michael@0 | 122 | </div> |
michael@0 | 123 | <pre id="test"> |
michael@0 | 124 | <script class="testbody" type="text/javascript"> |
michael@0 | 125 | |
michael@0 | 126 | var numSubmittedForms = 0; |
michael@0 | 127 | var numInputFields = 101; |
michael@0 | 128 | |
michael@0 | 129 | function checkInitialState() { |
michael@0 | 130 | countEntries(null, null, |
michael@0 | 131 | function (num) { |
michael@0 | 132 | ok(!num, "checking for initially empty storage"); |
michael@0 | 133 | startTest(); |
michael@0 | 134 | }); |
michael@0 | 135 | } |
michael@0 | 136 | |
michael@0 | 137 | function startTest() { |
michael@0 | 138 | // Fill in values for the various fields. We could just set the <input>'s |
michael@0 | 139 | // value attribute, but we don't save default form values (and we want to |
michael@0 | 140 | // ensure unsaved values are because of autocomplete=off or whatever). |
michael@0 | 141 | $_(1, "test" + numInputFields).value = numInputFields + " changed"; |
michael@0 | 142 | |
michael@0 | 143 | // submit the first form. |
michael@0 | 144 | var button = getFormSubmitButton(1); |
michael@0 | 145 | button.click(); |
michael@0 | 146 | } |
michael@0 | 147 | |
michael@0 | 148 | // Make sure that the first (numInputFields - 1) were not saved (as they were not changed). |
michael@0 | 149 | // Call done() when finished. |
michael@0 | 150 | function checkCountEntries(formNum, index, done) |
michael@0 | 151 | { |
michael@0 | 152 | countEntries("test" + index, index, |
michael@0 | 153 | function (num) { |
michael@0 | 154 | ok(!num, "checking unsaved value " + index); |
michael@0 | 155 | if (index < numInputFields) { |
michael@0 | 156 | checkCountEntries(formNum, index + 1, done); |
michael@0 | 157 | } |
michael@0 | 158 | else { |
michael@0 | 159 | done(formNum); |
michael@0 | 160 | } |
michael@0 | 161 | }); |
michael@0 | 162 | } |
michael@0 | 163 | |
michael@0 | 164 | // Called by each form's onsubmit handler. |
michael@0 | 165 | function checkSubmit(formNum) { |
michael@0 | 166 | ok(true, "form " + formNum + " submitted"); |
michael@0 | 167 | numSubmittedForms++; |
michael@0 | 168 | |
michael@0 | 169 | // make sure that the field # numInputFields was saved |
michael@0 | 170 | checkForSave("test" + numInputFields, numInputFields + " changed", "checking saved value " + numInputFields); |
michael@0 | 171 | |
michael@0 | 172 | checkCountEntries(formNum, 1, checkSubmitCounted); |
michael@0 | 173 | |
michael@0 | 174 | return false; // cancel current form submission |
michael@0 | 175 | } |
michael@0 | 176 | |
michael@0 | 177 | function checkSubmitCounted(formNum) { |
michael@0 | 178 | is(numSubmittedForms, 1, "Ensuring all forms were submitted."); |
michael@0 | 179 | SimpleTest.finish(); |
michael@0 | 180 | return false; |
michael@0 | 181 | } |
michael@0 | 182 | |
michael@0 | 183 | window.onload = checkInitialState; |
michael@0 | 184 | |
michael@0 | 185 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 186 | |
michael@0 | 187 | </script> |
michael@0 | 188 | </pre> |
michael@0 | 189 | </body> |
michael@0 | 190 | </html> |