Closed Bug 1620206 Opened 4 years ago Closed 4 years ago

Account Manager: S/MIME cert selection not saved if closing

Categories

(Thunderbird :: Account Manager, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 75.0

People

(Reporter: KaiE, Assigned: khushil324)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

You need a configured S/MIME certificate to reproduce this bug.

Open account manager
Security tab

If certs are selected, press clear on both.
If no certs are selected, make a selection

Close the account manager tab
Restart Thunderbird
Open the account manager tab

Expected result: The last configuration change to the S/MIME certs is still active

Actual result: The last change was ignored, still shows previous state

Workaround:
Click a different account manager tab prior to closing the prefs.

Question:
Is there a JS function that we must call after the selection is made, to make the change immediately persistent?

I expect more issues like this. Aceman and I have discussed issue surrounding this at length when the AM was already in a tab in bug 1096006 for a while and there was a lot of code that made sure values were saved and consistency checks were run when switching panes in the AM, switching tabs or closing the AM tab.

There are no longer "ok/cancel" buttons for account manager prefs.

I conclude that any click/change inside account manager is supposed to be immediately persistent, right?

If yes, then all JS code in account manager that updates elements/flags needs to immediately call a save function, right?

There is a lot of fine-print to this, see the bug I mentioned.

Pinging Richard to see if he can handle it, otherwise I can take care of it as a priority early next week.

Flags: needinfo?(richard.marti)

I will take this as I know the problem.

Assignee: nobody → khushil324
Flags: needinfo?(richard.marti)

(In reply to Khushil Mistry [:khushil324] from comment #5)

I will take this as I know the problem.

Sweet, thank you so much!

(In reply to Kai Engert (:KaiE:) from comment #2)

There are no longer "ok/cancel" buttons for account manager prefs.

I conclude that any click/change inside account manager is supposed to be immediately persistent, right?

If yes, then all JS code in account manager that updates elements/flags needs to immediately call a save function, right?

We have assigned onchange/oncommand listener to all the input elements (checkbox, input, menulist, textarea, radiogroup, and richlistbox) in Account Manager Tab: https://searchfox.org/comm-central/source/mailnews/base/prefs/content/AccountManager.js#150

So we have onchange listener assigned to all the input elements in "Security" tab. But here, we are directly assigning a value to input like input.value = "xyz" through javascript which will not trigger onchange function.

To save the settings, we need to dispatch an event: window.dispatchEvent(new CustomEvent("prefchange")); which will trigger the changes globally.

So, whenever we are directly assigning value to input, we need to dispatch a "prefchange" event at the right place.

Attachment #9131733 - Flags: review?(mkmelin+mozilla)
Status: NEW → ASSIGNED

Khushil, thanks a lot, the change to mailnews/extensions/smime/content/am-smime.js works for me!

Note we don't need the change to mail/extensions/openpgp/content/ui/am-enigprefs.js - that file is currently inactive, and I'm going to remove it in bug 1603809.

The subset of Khushil's patch that we need.

Attachment #9131733 - Attachment is obsolete: true
Attachment #9131733 - Flags: review?(mkmelin+mozilla)
Attachment #9131757 - Flags: review+

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/09cf06df9f5d
Account Manager: S/MIME cert selection not saved if closing. r=kaie DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 75.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: