Setting checkbox.disabled to false when it already is false clears the value for the checkbox when reloading

RESOLVED FIXED in mozilla1.8alpha4

Status

()

P2
major
RESOLVED FIXED
14 years ago
14 years ago

People

(Reporter: u80, Assigned: bzbarsky)

Tracking

Trunk
mozilla1.8alpha4
x86
All
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9
Build Identifier: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.7) Gecko/20040614 Firefox/0.9

We have a webpage with a input checkbox that is checked via HTML. In the
onLoad-handler, we set checkbox.disabled to false even though it already is
false. When the page is loaded the first time the checkbox appears checked, but
if you reload the page, the checkbox is unchecked.

This problem has been found in Firefox 0.9 on Windows NT, Mozilla 1.6, 1.7 and
1.8 Alpha as well as Mozilla 1.6 from Debian testing on Linux. 

Reproducible: Always
Steps to Reproduce:
1. Load the attached testcase (coming up)
2. Verify that the checkbox is checked.
3. Press the reload button

Actual Results:  
4. The checkbox is no longer checked

Expected Results:  
4. The checkbox should still be checked.

This bug has the potential to cause dataloss, since if you do submit without
noticing that the checkbox has been unchecked, bad things can happen.
(Reporter)

Comment 1

14 years ago
Created attachment 158955 [details]
Testcase as described in the original bugreport
(Reporter)

Comment 2

14 years ago
Created attachment 158959 [details]
Variant of the previous attachment that validates correctly

The original testcase is not valid HTML. This one is. There is no difference in
behaviour from the original testcase.
Attachment #158955 - Attachment is obsolete: true
(Assignee)

Comment 3

14 years ago
The problem here is that the checkbox doesn't set its "checked" state if state
was restored.  In this case state was restored because there was "disabled"
state.  But the checkbox doesn't save its checked state in the history if its
checked value is the default.  So we never end up setting it checked.

Possible options here:

1)  Save the checked value no matter what (undoing part of the fix for bug
    62713)
2)  Save the checked value if it's changed or if we're storing something else in
    the state.
3)  Redefine the return value of RestoreState() to indicate something about
    whether "checked" was restored...

#3 is probably the least intrusive and least memory-intensive, but will we ever
care about getting other information out through that return value?

jst?  Thoughts?
Severity: normal → major
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 5

14 years ago
Comment on attachment 159447 [details] [diff] [review]
Patch

jst, would you take a look?
Attachment #159447 - Flags: superreview?(jst)
Attachment #159447 - Flags: review?(jst)
Comment on attachment 159447 [details] [diff] [review]
Patch

r+sr=jst
Attachment #159447 - Flags: superreview?(jst)
Attachment #159447 - Flags: superreview+
Attachment #159447 - Flags: review?(jst)
Attachment #159447 - Flags: review+
(Assignee)

Updated

14 years ago
Assignee: general → bzbarsky
Priority: -- → P2
Target Milestone: --- → mozilla1.8alpha4
(Assignee)

Comment 7

14 years ago
Fixed for 1.8a4.
Status: NEW → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.