Closed Bug 890507 Opened 12 years ago Closed 9 years ago

clean up mailnews/base/prefs/content/AccountManager.js::setFormElementValue function

Categories

(MailNews Core :: Account Manager, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 51.0

People

(Reporter: aceman, Assigned: aceman)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #881694 comment 7 +++ neil@parkwaycc.co.uk 2013-07-05 15:56:55 CEST So, this function (mailnews/base/prefs/content/AccountManager.js::setFormElementValue) makes very little sense, unfortunately it was written like this in 1999 and just monkeypatched every time. * The defaultValue and defaultChecked properties have never existed. (The author may have been thinking of HTML input elements.) * null compares == to undefined so there is no point comparing twice. * Nobody passes undefined these days anyway. * The function gets called for some radio buttons even though it also gets called for the radiogroup that chooses the value. The code here fortuitously avoids changing the radio's value in this case. So I would really appreciate it if someone was to clean the code up.
Summary: Namespace text fields are not properly cleared when opened for multiple accounts → clean up mailnews/base/prefs/content/AccountManager.js::setFormElementValue function
Attached patch patchSplinter Review
This does what Neil proposes. The last point is solved by removing wsm_persist from some <radio>s and even <radiogroup>s (autosync and retention) because those are stored and restored via their own dedicated code and so it looks like they do not need to go through the PageFormElements infrastructure.
Attachment #8776280 - Flags: review?(mkmelin+mozilla)
Comment on attachment 8776280 [details] [diff] [review] patch Review of attachment 8776280 [details] [diff] [review]: ----------------------------------------------------------------- ::: mailnews/base/prefs/content/AccountManager.js @@ +1415,1 @@ > formElement.value = value; these 4 lines could be just formElement.value = value || ""; ::: mailnews/base/prefs/content/am-offline.xul @@ +59,3 @@ > label="&allAutosync.label;" oncommand="onAutosyncChange();"/> > <hbox flex="1" align="center"> > + <radio id="useAutosync.ByAge" accesskey="&ageAutosync.accesskey;" trailing space, remove while you're there @@ +122,3 @@ > label="&retentionKeepAll.label;" oncommand="onCheckKeepMsg();"/> > <hbox flex="1" align="center"> > + <radio id="retention.keepNewMsg" accesskey="&retentionKeepRecent.accesskey;" trailing space
Attachment #8776280 - Flags: review?(mkmelin+mozilla) → review+
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 51.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: