Closed Bug 14247 Opened 25 years ago Closed 25 years ago

Checkbox in dialogs don't work

Categories

(SeaMonkey :: UI Design, defect, P3)

x86
Windows NT
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: morse, Assigned: davidm)

Details

Set preferences so that you get warning each time a cookie is set.  Then go
visit your favorite cookie-dispensing site (e.g., home.netscape.com).  Warning
box comes up containing a checkbox for remembering the decision.  Check the box.
Then reply with either OK or cancel.  At this point the cookperm.txt file should
be created with the decision you made written in it.  But there is no such file.
Furthermore, regardless of the decision you made, you will keep getting warnings
as new cookies come in for this site.  All this implies that your decision was
not remembered, in spite of the fact that you checked off the box.

But fear not, I already know what the problem is and will be checking it in as
soon as the tree goes green.
While waiting for the tree to go green (that could take a while), let me
describe what the problem is.  The code in commonDialogs.js that gets invoked
when you either check the box or remove the check from the box is the following:

function onCheckboxClick()
{
      var element = document.getElementById("checkbox" );
      param.SetInt( 1, element.checked );
}

This code assumes that the value of element.checked has already been updated and
so it thinks that it is putting the updated value into integer number 1 (i.e.,
the integer corresponding to the state of the checkbox).  But from my testing,
it appears that element.checked has not yet been updated at this time.  So a
safer thing to do is simply toggle the value in integer number 1 by doing the
following:

function onCheckboxClick()
{
	param.SetInt( 1, 1 - param.GetInt( 1 ) );
}
I wonder if this changed when the switch from native to gfx widgets occured? I
don't pretend to know what the correct behavior is. I just work here.
for what is worth I prefer
	var newValue = param.GetInt( 1 ) ? 0 : 1;
just because I am paranoid about someone passing in a value that isn't 1 or 0.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fix is now checked in.  Closing out bug
Good point.  How about this for conciseness (no new variable needed):

   param.SetInt( 1, (param.GetInt( 1 ) ? 0 : 1 ));

I've already checked in the other fix but I'll change it right now to be this
fix instead.
Status: RESOLVED → VERIFIED
I was able to verify this as fixed using the 1999111016 build under NT. I:
- Changed pref as instructed
- Restarted the browser
- Went to expedia.com; accepted cookie
- Ticked box to remember this decision
- Selected Start | Find | Files or Folders
- Searched for cookperm.txt
The file was found as expected. Marking verified.
Changing component to XP Apps. (HTML Dialogs is going away.)
Component: HTML Dialogs → XPApps
Product: Core → Mozilla Application Suite
You need to log in before you can comment on or make changes to this bug.