Using From field's "customize from address" breaks saving and sending
Categories
(Thunderbird :: Message Compose Window, defect)
Tracking
(thunderbird68+ fixed, thunderbird69 fixed)
People
(Reporter: ben+mozilla, Assigned: darktrojan)
References
Details
(Keywords: dogfood, regression)
Attachments
(3 files, 3 obsolete files)
6.99 KB,
patch
|
darktrojan
:
review+
|
Details | Diff | Splinter Review |
7.08 KB,
patch
|
Details | Diff | Splinter Review | |
2.61 KB,
patch
|
darktrojan
:
review+
jorgk-bmo
:
approval-comm-beta+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0
Steps to reproduce:
- Open the message compose window (ctrl+n)
- At this stage, save the message (ctrl+s) to confirm that saving currently works
- In the "From:" dropdown menu, choose "Customize From Address..."
- Add at least one character to the From field's current value
- De-select the "From" field (e.g. click into main message body textarea)
- Attempt to save the message again (ctrl+s)
- Click "Send" to attempt to send the message
Actual results:
Steps 6 and 7 fail. After a manual change is made to the From address, saving the message does nothing (the message isn't updated in the Drafts folder). Sending the message also does nothing (the message is never sent).
Other notes:
- After re-selecting a known account in the "From" dropdown menu, saving and sending functionality is restored
- A current workaround is to save the message (with ctrl+s) before de-selecting the "From" field. After doing this, the bug won't occur on deselect.
- Exact version: 67.0b1 (32-bit)
Expected results:
The message should have been saved, and sent, successfully.
Comment 1•5 years ago
|
||
Thanks for reporting. I can confirm the issue in TB 67 beta.
When I save or send the draft after editing the From:, I get this error in the console:
TypeError: identityList.selectedItem is null
MsgComposeCommands.js:4032:3
getCurrentIdentityKey chrome://messenger/content/messengercompose/MsgComposeCommands.js:4032
getCurrentIdentity chrome://messenger/content/messengercompose/MsgComposeCommands.js:4040
GenericSendMessage chrome://messenger/content/messengercompose/MsgComposeCommands.js:3273
SaveAsDraft chrome://messenger/content/messengercompose/MsgComposeCommands.js:3513
Save chrome://messenger/content/messengercompose/MsgComposeCommands.js:3493
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:704
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:915
goDoCommand chrome://global/content/globalOverlay.js:81
oncommand chrome://messenger/content/messengercompose/messengercompose.xul:1
An error occurred executing the cmd_saveDefault command: [Exception... "[JavaScript Error: "identityList.selectedItem is null" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 4032}]'[JavaScript Error: "identityList.selectedItem is null" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 4032}]' when calling method: [nsIController::doCommand]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: chrome://global/content/globalOverlay.js :: goDoCommand :: line 81" data: yes]
Looks like the de-XBL team have broken the editable menu list.
Comment 2•5 years ago
|
||
The error that is being thrown, comes from https://searchfox.org/comm-central/source/mail/base/content/mailWidgets.js#629 . When I tried to look back to Bug 1524457 and Bug 1524497 to see the earlier code for the change, I couldn't find the part of patch which has the xbl equivalent code for _change event. Probably Geoff would know.
Comment 3•5 years ago
|
||
I have at least part of a patch, still investigating if it's complete.
Updated•5 years ago
|
Comment 4•5 years ago
|
||
This fixes it. Unfortunately, I notice other things that are wrong too now, and this patch is basically wrong too. Looks like The mutation observer is supposed to take care of this, but we override it so it doesn't.t
Comment 5•5 years ago
|
||
The real fix.
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
Comment on attachment 9062731 [details] [diff] [review] bug1542667_custom_from_broken.patch Review of attachment 9062731 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/base/content/mailWidgets.js @@ +641,5 @@ > > + if (!this.menupopup) { > + this.appendChild(MozXULElement.parseXULToFragment(`<menupopup />`)); > + } > + Bad white-space. @@ +652,4 @@ > } > > disconnectedCallback() { > + // Override. Unlike super we never do n re-setup in connectedCallback, Typo. @@ +657,2 @@ > } > + More bad white-space.
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/5039009bbaed
Fix menulist-editable to have correct selectedItem. r=darktrojan CLOSED TREE DONTBUILD
Comment 8•5 years ago
|
||
Landed with trailing spaces removed and typo fixed. Since the tree is closed, here's a try together with some other stuff:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=fe90a2c95c01254e441d8fc0196b06f9ca7e6bc6
Updated•5 years ago
|
Comment 9•5 years ago
|
||
Looks like this caused a test failure:
TEST-UNEXPECTED-FAIL | /builds/worker/workspace/build/tests/mozmill/composition/test-draft-identity.js | test-draft-identity.js::test_draft_identity_selection
which shows on all platforms. Log says:
13:26:02 INFO - EXCEPTION: identityList.selectedItem is null
13:26:02 INFO - at: MsgComposeCommands.js line 3994
13:26:02 INFO - getCurrentAccountKey MsgComposeCommands.js:3994 3
13:26:02 INFO - checkCompIdentity test-draft-identity.js:108 28
13:26:02 INFO - test_draft_identity_selection test-draft-identity.js:178 5
Can you address this quickly before I back it out?
Comment 10•5 years ago
|
||
I think I see the problem. Checking the solution now.
Comment 11•5 years ago
|
||
This should be the fix.
(I added a desc property for the tests too so one could see which was failing.)
At least in my build locally the customize functionality is now very odd even without the previous patch: only one identity listed until you click the customize - and then they all get listed. I didn't see that when testing earlier on a few days old tree, so something must have changed.
Assignee | ||
Comment 12•5 years ago
|
||
I've had a closer look at this and I don't think it's right. Changing the value of one of the existing items when typing in the textbox feels like the wrong thing to do. In fact, if there's no selected item when typing:
JavaScript error: chrome://messenger/content/mailWidgets.js, line 635: TypeError: this.selectedItem is null
It might seem to work okay for the identity header but in the general case it doesn't.
Assignee | ||
Comment 13•5 years ago
|
||
Sorry, the previous comment refers to this solution as a whole, including the first patch.
Comment 14•5 years ago
|
||
Just to clarify this even further: Geoff suggested to back out the first patch:
01:08:34 - jorgk: oh, well, if you say the 1st patch was wrong already, I might as well take it out
01:09:45 - darktrojan: no tests were fixed by landing the first patch were there?
01:09:58 - jorgk: right
01:10:04 - jorgk: no tests were fixed
01:10:06 - darktrojan: yeah, take it out
Updated•5 years ago
|
Assignee | ||
Comment 15•5 years ago
|
||
In fact, this has busted the test mail/base/test/browser/browser_menulist.js
, which I had forgotten even existed.
Comment 16•5 years ago
|
||
Backout by geoff@darktrojan.net: https://hg.mozilla.org/comm-central/rev/d9dfeb170a29 Backed out changeset 5039009bbaed for causing test failures
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 18•5 years ago
|
||
Thanks for reporting and fixing this.
This is a major bug. I'd rather have a real bug fixed and a test failure than working tests and real bugs. Could we land this and then fix the test?
Updated•5 years ago
|
Comment 21•5 years ago
|
||
This is broken for over two months now damaging TB 67 beta and TB 68 beta. Geoff, can you finish this off. Magnus hasn't dedicated time to this in seven(!!) weeks.
Comment 22•5 years ago
|
||
+1 I need this for my daily communication. Adding dogfood.
Assignee | ||
Comment 23•5 years ago
|
||
This feels very simple, so I may have missed something, but I can't think what. Anyway, it does seem to work.
Comment 24•5 years ago
|
||
Comment on attachment 9073516 [details] [diff] [review] 1542667-custom-compose-1.diff Review of attachment 9073516 [details] [diff] [review]: ----------------------------------------------------------------- Yeah, it is a pity we have 'value', 'accountkey', 'identitykey' attributes on the listitems and from those only 'value' is automatically copied to the menulist when a selection is made. Maybe we could investigate if all are really needed. Or we could stuff all of them into 'value' (with a separator) and then this event listening wouldn't be needed. But in the current patch, do we still needed getting the attribute values from identityElement.selectedItem (instead of the the menulist), at and around of https://searchfox.org/comm-central/rev/7999bf7768ee8b6bd57deef0c87080938ec77c75/mail/components/compose/content/MsgComposeCommands.js#5507 ?
Comment 25•5 years ago
|
||
Yeah, it is a pity we have 'value', 'accountkey', 'identitykey' attributes on the listitems and from those only 'value' is automatically copied to the menulist when a selection is made.
Well, that's normal. But menulist.selectedItem.get...
should work. Why exactly does return identityList.selectedItem.getAttribute("accountkey");
not work? That should normally work. It does not rely on properties to be copied on selection.
Comment 26•5 years ago
|
||
(In reply to Ben Bucksch (:BenB) from comment #25)
Yeah, it is a pity we have 'value', 'accountkey', 'identitykey' attributes on the listitems and from those only 'value' is automatically copied to the menulist when a selection is made.
Well, that's normal.
Yes it is normal in the way that it is designed to only copy 'value'. So we shouldn't attach more attributes if that doesn't really work and needs special hooks on top.
But
menulist.selectedItem.get...
should work. Why exactly doesreturn identityList.selectedItem.getAttribute("accountkey");
not work? That should normally work. It does not rely on properties to be copied on selection.
It may be that once we set a new value on the editable menulist, and it calls the 'value' setter internally, https://searchfox.org/comm-central/rev/7999bf7768ee8b6bd57deef0c87080938ec77c75/mozilla/toolkit/content/widgets/menulist.js#116, then .selectedItem becomes null as the value no longer represents any of the items in the list. So the patch seems to go in the right direction of not relying on .selectedItem. We shouldn't need it ever, if we get all 3 attributes/value on the menulist automatically.
Comment 27•5 years ago
|
||
selectedItem.
goes to the original element and should have all properties you attached to the item. It should work and seems like the right solution. To me, the right direction would be to only use identityList.selectedItem.getAttribute('accountkey')
and never try to mess with the identityList.value
. If setting identityList.value
messes up selectedItem, then the fix would be to not set it, no? Or do you absolutely need to set it, e.g. for the edited text case? But in the edited case, you wouldn't need the account and identity key from the item, would you?
Comment 28•5 years ago
|
||
Oh, I think I see the problem. The old behavior was that the widget would store the identity that I had selected before I selected "customize From...". I would send from whatever account was selected before.
But that's completely invisible state and too subtle. I think it would be fine to drop back to whatever account was selected when the composer first opened, i.e. the account and identity of the email that I reply to.
I think that would solve your issue.
Assignee | ||
Comment 29•5 years ago
|
||
But in the current patch, do we still needed getting the attribute values from identityElement.selectedItem (instead of the the menulist), at and around of
https://searchfox.org/comm-central/rev/7999bf7768ee8b6bd57deef0c87080938ec77c75/mail/components/compose/content/MsgComposeCommands.js#5507 ?
Probably not, but that's a better place to make the change I'm making than in another listener.
Comment 30•5 years ago
|
||
Comment on attachment 9062731 [details] [diff] [review] bug1542667_custom_from_broken.patch Review of attachment 9062731 [details] [diff] [review]: ----------------------------------------------------------------- Seems to work. There are problems with the MozMenulistEditable implementation though. It's reusing the super mAttributeObserve for a different purpose. But super will swap that around when changing selection, and "our" observer would no longer do anything.
Comment 31•5 years ago
|
||
Comment on attachment 9073697 [details] [diff] [review] 1542667-custom-compose-2.diff Review of attachment 9073697 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/components/compose/content/MsgComposeCommands.js @@ +4076,5 @@ > > function getCurrentIdentityKey() { > // Get the identity key. > let identityList = GetMsgIdentityElement(); > + return identityList.getAttribute("identitykey"); gCurrentIdentity.key?
Updated•5 years ago
|
Assignee | ||
Comment 32•5 years ago
|
||
If we'd had this one line in the first place this bug probably wouldn't have happened.
Assignee | ||
Updated•5 years ago
|
Updated•5 years ago
|
Comment 33•5 years ago
|
||
Comment on attachment 9074384 [details] [diff] [review] 1542667-custom-compose-3.diff Review of attachment 9074384 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/components/compose/content/MsgComposeCommands.js @@ +5501,4 @@ > if (identityElement.selectedItem) { > + // Set the identity key value on the menu list. > + idKey = identityElement.selectedItem.getAttribute("identitykey"); > + identityElement.setAttribute("identitykey", idKey); Is anything reading the identitykey on the menulist now? I haven't spotted any user left.
Comment 34•5 years ago
|
||
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/a32a7dd50791
Copy selected identity's attributes when customising the From address. r=mkmelin
Comment 35•5 years ago
•
|
||
This reminds me of the discussion in ...
EDIT: Jolly good, "Form History Control" managed to play another trick on me and posted an undesired comment. Well, since the damage is done, I guess I was going to say that is reminded me of the discussion in bug 1524457 (or maybe elsewhere), where there was also a long discussion about how to fix this best. I find comment #30 disconcerting where Magnus claims that some problems in the editable menu list still exist.
Comment 36•5 years ago
|
||
Will fix the problems in bug 1562130.
Comment 37•5 years ago
|
||
Description
•