Closed Bug 311507 Opened 20 years ago Closed 12 years ago

form state incorrect after minor DOM change and reload

Categories

(Core :: DOM: Navigation, defect)

x86
All
defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: desire2learn, Assigned: almasry.mina)

References

(Blocks 1 open bug)

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 Using the example HTML below, you can easily reproduce this bug. It occurs with all form elements, but this example uses radio buttons. When a form element is removed from the DOM and the page is reloaded, the state of all the form elements on the page is off by one. In the case of the radio buttons in this example, the radio button that is "checked" changes (moves up) each time. <html> <head> <script> function Body_Load() { var holder = document.getElementById( "testdiv" ); var item = document.getElementById( "inputthing" ); holder.removeChild( item ); } </script> </head> <body onload="Body_Load();"> <form> <div id="testdiv"> <input type=input value=boo id="inputthing"> </div> <input type="radio" name="test" value="1"> <input type="radio" name="test" value="2"> <input type="radio" name="test" value="3"> <input type="radio" name="test" value="4"> </form> </body> </html> Reproducible: Always Steps to Reproduce: 1. Load the above example. 2. Select the last radio button (or any of them). 3. Reload the page. Actual Results: The radio button which was checked is no longer checked. Instead, the form element that appears before it in the DOM receives its state. The same behaviour occurs with checkboxes, edits, etc. Expected Results: The radio button which was selected should still be selected after the page reloads.
Whiteboard: DUPEME
Probably closely related to 364382
This seems basically the same problem as bug 140697, marking a dependency for now.
Status: UNCONFIRMED → NEW
Component: Form Manager → History: Session
Depends on: 140697
Ever confirmed: true
Keywords: testcase
OS: Windows XP → All
Product: Firefox → Core
QA Contact: form.manager → history.session
Version: unspecified → Trunk
Component: History: Session → Document Navigation
QA Contact: history.session → docshell
Blocks: 364382
Target Milestone: --- → mozilla2.0
Target Milestone: mozilla2.0 → ---
So it seems like we could fix this in GenerateStateKey by using the control name followed by the control's index in form.elements[name] as needed instead of the control's name in the form followed by the control name, no? Jonas, smaug, do you see any obvious problems with that?
Whiteboard: DUPEME
Bug 660549 has more discussion on this. Long story short, we should be generating the same state key at the same time for both save and restore, which means generating the key during pageload, which is when restore happens.
Depends on: 660549
Depends on: 737851
The attached test case WFM. Might have been fixed with bug 737851
Yes. This got fixed on the day bug 737851 landed.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Assignee: nobody → malmasry
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: