Changeset 123178 in webkit
- Timestamp:
- Jul 19, 2012 9:48:17 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r123174 r123178 1 2012-07-19 Kent Tamura <tkent@chromium.org> 2 3 Form state restore: Need to identify a form by its content 4 https://bugs.webkit.org/show_bug.cgi?id=91209 5 6 Reviewed by Hajime Morita. 7 8 * fast/forms/state-restore-broken-state-expected.txt: 9 Updated for the serialized format change. 10 * fast/forms/state-restore-per-form-expected.txt: 11 * fast/forms/state-restore-per-form.html: 12 - Add a control to #form2 before 'additionalControl' 13 We can't identify this form if the second named control is changed. 14 - Add test cases of webkit.org/b/91209#c0. 15 1 16 2012-07-19 Jeff Timanus <twiz@chromium.org> 2 17 -
trunk/LayoutTests/fast/forms/state-restore-broken-state-expected.txt
r123066 r123178 1 CONSOLE MESSAGE: line 5: Generated state: [state-restore-broken-state-2.html #0,1,name1,text,1,modified]1 CONSOLE MESSAGE: line 5: Generated state: [state-restore-broken-state-2.html [name1 ] #0,1,name1,text,1,modified] 2 2 The value was modified in the first load of state-restore-broken-state-1.html, but it should not be restored because the state-restore-broken-state-2.html breaks the state. 3 3 -
trunk/LayoutTests/fast/forms/state-restore-per-form-expected.txt
r123066 r123178 17 17 FAIL $("form3-outer2").value should be form3-outer2-modified. Was form2-outer2-modified. 18 18 FAIL $("form2-outer2").value should be form2-outer2-modified. Was initial. 19 20 Controls in forms with an identical action URL. These forms were reordered: 21 PASS $("aaa_input1").value is "aaa_input1-modified" 22 PASS $("ccc_input1").value is "ccc_input1-modified" 19 23 PASS successfullyParsed is true 20 24 -
trunk/LayoutTests/fast/forms/state-restore-per-form.html
r123066 r123178 28 28 var sameActionForm1 = '<form action="http://example.com/foo.cgi' + query + '#bar" id=form2>' + 29 29 '<input value=initial id=form2-control1 name=common-name1>' + 30 '<input value=initial id=form2-control2 name=name2>' + 30 31 additionalControl + 31 32 '</form>'; … … 35 36 '<input value=initial id=form3-control2 name=common-name1>' + 36 37 '</form>'; 38 39 var reorderedFormA = '<form action="PostAction" method="POST">' + 40 '<input type="hidden" name="task" value="AAA">' + 41 '<input name="aaa_input1" value=initial id=aaa_input1>' + 42 '<input name="aaa_input2" value=initial>' + 43 '</form>'; 44 var reorderedFormB = '<form action="PostAction" method="POST">' + 45 '<input type="hidden" name="task" value="BBB">' + 46 '<input name="bbb_input1" value=initial id=bbb_input1>' + 47 '<input name="bbb_input2" value=initial>' + 48 '</form>'; 49 var reorderedFormC = '<form action="PostAction" method="POST">' + 50 '<input type="hidden" name="task" value="CCC">' + 51 '<input name="ccc_input1" value=initial id=ccc_input1>' + 52 '<input name="ccc_input2" value=initial>' + 53 '</form>'; 54 var reorderedSameActionForms = stage == 1 ? reorderedFormA + reorderedFormB + reorderedFormC : reorderedFormC + reorderedFormA; 37 55 38 56 var afterForms = (stage == 1 ? '' : '<input value=initial id=noowner2 name=after>') + … … 44 62 (stage == 1 ? backForm + sameActionForm1 : sameActionForm1 + backForm) + 45 63 sameActionForm2 + 64 reorderedSameActionForms + 46 65 afterForms); 47 66 } … … 65 84 $('form2-outer2').value = 'form2-outer2-modified'; 66 85 $('form3-outer2').value = 'form3-outer2-modified'; 86 $('aaa_input1').value = 'aaa_input1-modified'; 87 $('bbb_input1').value = 'bbb_input1-modified'; 88 $('ccc_input1').value = 'ccc_input1-modified'; 67 89 $('form1').submit(); 68 90 }, 0); … … 91 113 shouldBeEqualToString('$("form3-outer2").value', 'form3-outer2-modified'); 92 114 shouldBeEqualToString('$("form2-outer2").value', 'form2-outer2-modified'); 115 116 debug('\nControls in forms with an identical action URL. These forms were reordered:'); 117 shouldBeEqualToString('$("aaa_input1").value', 'aaa_input1-modified'); 118 shouldBeEqualToString('$("ccc_input1").value', 'ccc_input1-modified'); 93 119 94 120 $('parent').innerHTML = ''; -
trunk/Source/WebCore/ChangeLog
r123175 r123178 1 2012-07-19 Kent Tamura <tkent@chromium.org> 2 3 Form state restore: Need to identify a form by its content 4 https://bugs.webkit.org/show_bug.cgi?id=91209 5 6 Reviewed by Hajime Morita. 7 8 Add names of the first two controls of a form to its formKey 9 string. By this change, we can correctly restore states to 10 reordered forms like webkit.org/b/91209#c0. 11 12 Tests: Added test cases to fast/forms/state-restore-per-form.html. 13 14 * html/FormController.cpp: 15 (WebCore::recordFormStructure): 16 Append at most two name attribute values. 17 (WebCore::createKey): Insert a string built by recordFromStructure(). 18 (WebCore::formStateSignature): Bump the version. 19 1 20 2012-07-19 Wei James <james.wei@intel.com> 2 21 -
trunk/Source/WebCore/html/FormController.cpp
r123066 r123178 283 283 }; 284 284 285 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilder& builder) 286 { 287 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 288 const size_t namedControlsToBeRecorded = 2; 289 const Vector<FormAssociatedElement*>& controls = form.associatedElements(); 290 builder.append(" ["); 291 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) { 292 if (!controls[i]->isFormControlElementWithState()) 293 continue; 294 HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(controls[i]); 295 if (!ownerFormForState(*control)) 296 continue; 297 AtomicString name = control->name(); 298 if (name.isEmpty()) 299 continue; 300 namedControls++; 301 builder.append(name); 302 builder.append(" "); 303 } 304 builder.append("]"); 305 } 306 285 307 static inline AtomicString createKey(HTMLFormElement* form, unsigned index) 286 308 { … … 293 315 if (!actionURL.isEmpty()) 294 316 builder.append(actionURL.string()); 317 318 recordFormStructure(*form, builder); 319 295 320 builder.append(" #"); 296 321 builder.append(String::number(index)); … … 345 370 // attribute value of a form control. The following string literal should 346 371 // contain some characters which are rarely used for name attribute values. 347 DEFINE_STATIC_LOCAL(String, signature, ("\n\r?% WebKit serialized form state version 6\n\r=&"));372 DEFINE_STATIC_LOCAL(String, signature, ("\n\r?% WebKit serialized form state version 7 \n\r=&")); 348 373 return signature; 349 374 }
Note: See TracChangeset
for help on using the changeset viewer.