Closed Bug 1661510 Opened 5 years ago Closed 5 years ago

Encrypted Reply Drafts loose "Re:" prefix

Categories

(MailNews Core :: Security: OpenPGP, defect, P2)

Tracking

(thunderbird_esr78+ fixed, thunderbird83 fixed)

RESOLVED FIXED
84 Branch
Tracking Status
thunderbird_esr78 + fixed
thunderbird83 --- fixed

People

(Reporter: patrick, Assigned: lasana)

Details

Attachments

(1 file, 4 obsolete files)

Reply to an encrypted message. Subject has Re: prefix. Save draft. Close message.

Go to drafts folder, edit draft. Result: Re: prefix is lost.

Note: Maybe the encrypted message already needs to be a reply.

Component: Security → Security: OpenPGP
Product: Thunderbird → MailNews Core

This seems to be a regression from bug 1633251. The p≡p team have fixed it in the p≡p add-on adding this line of code to the spot where the subject is prepared: if (msgHdr.flags & Ci.nsMsgMessageFlags.HasRe) hdrSubject = "Re: " + hdrSubject;

The equivalent spot in the Thunderbird code base would most likely at a call site of fixMessageSubject
https://searchfox.org/comm-central/rev/1bcbe36ec43f68f5fa52028adf43cd11e0389cd0/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js#3159
at a location where the message header of the draft is available.

Priority: -- → P2
Assignee: nobody → lasana
Status: NEW → ASSIGNED
Attached patch 1661510.patch (obsolete) — Splinter Review

Changes setOriginalSubject to detect when gMsgCompose.type is a draft with the HasRe flag.

Attachment #9182445 - Flags: review?(mkmelin+mozilla)
Attachment #9182445 - Flags: review?(mkmelin+mozilla)
Attachment #9182445 - Attachment is obsolete: true
Attached patch 1661510.patch (obsolete) — Splinter Review

The test I wrote errors on windows, not quite sure why.

Attachment #9182495 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9182495 [details] [diff] [review] 1661510.patch Review of attachment 9182495 [details] [diff] [review]: ----------------------------------------------------------------- Looks pretty ok, but need the test to pass of course. For try runs, what you sent doesn't run the mac tests (so pointless). It did use to work, but haven't for some time... Now you can use "-all" to get all when you need it, like, or use the task_config way hg qnew -m "try: -b o -p all -u all --artifact" try && hg push -f -r tip cc-try && hg qpop && hg qdelete try ::: mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js @@ +536,5 @@ > + * otherwise it is only updated for the > + * following nsIMsgCompTypes: Draft,Template, > + * EditTemplate,ForwardInline, > + * ForwardAttachement or EditAsNew. > + */ would prefer for long lines, just wrap and indent by two more ::: mail/test/browser/openpgp/browser_composeWindow.js @@ +64,5 @@ > + getTestFilePath( > + "data/keys/alice@openpgp.example-0xf231550c4f47e38e-secret.asc" > + ) > + ) > + ); maybe here assert that you do get an id. This task doesn't seeem to use any Assert at all. Mochitest usually doesn't allow one to have a test like that (which "doesn't do anything"), so I'm surprised. @@ +96,5 @@ > + // Delete the messages we saved to drafts. > + registerCleanupFunction( > + async () => > + new Promise(resolve => { > + let msgs = []; just use let msgs = [...draftsFolder.msgDatabase.EnumerateMessages()]; @@ +104,5 @@ > + msgs.push(enumerator.getNext().QueryInterface(Ci.nsIMsgDBHdr)); > + } > + > + draftsFolder.deleteMessages( > + window.toXPCOMArray(msgs, Ci.nsIMutableArray), please don't prefix it with window. But do put an var { toXPCOMArray } = ChromeUtils.import( "resource:///modules/iteratorUtils.jsm" ); at the top of the file @@ +144,5 @@ > + select_click_row(0); > + open_selected_message(); > + > + let draftWindow = await draftWindowPromise; > + wait_for_window_focused(draftWindow); might want to use let focus = BrowserTestUtils.waitForEvent(draftWindow, "focus", true); and then await focus.
Attachment #9182495 - Flags: review?(mkmelin+mozilla)
Attached patch 1661510v2.patch (obsolete) — Splinter Review

The failure on OSX seems to be related to librnp not initializing properly. Not sure why but that's probably beyond the scope of this patch.

Attachment #9182495 - Attachment is obsolete: true
Attachment #9183299 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9183299 [details] [diff] [review] 1661510v2.patch Review of attachment 9183299 [details] [diff] [review]: ----------------------------------------------------------------- Looks good! r=mkmelin ::: mail/test/browser/openpgp/browser.ini @@ +8,5 @@ > mailnews.start_page.url=about:blank > subsuite = thunderbird > support-files = data/** > > +[browser_composeWindow.js] I'm sure we'll have many tests for the compose window, so please rename it to something more distinct. Like browser_openpgpDrafts.js ::: mail/test/browser/openpgp/browser_composeWindow.js @@ +66,5 @@ > + ) > + ) > + ); > + > + Assert.ok(id != null, "private key id received"); Nit: prefer falsy/truthy checks, so just Assert.ok(id, "private key id received");
Attachment #9183299 - Flags: review?(mkmelin+mozilla) → review+

It's probably best do do a try run without artifact to see there's no real problem for the test

Target Milestone: --- → 84 Branch
Attached patch 1661510v3.patch (obsolete) — Splinter Review

Renamed the file etc.

Attachment #9183299 - Attachment is obsolete: true
Attachment #9183743 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9183743 [details] [diff] [review] 1661510v3.patch Review of attachment 9183743 [details] [diff] [review]: ----------------------------------------------------------------- LGTM, with one nit. r=mkmelin ::: mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js @@ +540,4 @@ > const CT = Ci.nsIMsgCompType; > let subjElem = document.getElementById("msgSubject"); > let prefix = ""; > + let prefixIsRe = false; Can we change this variable name to "isReply"
Attachment #9183743 - Flags: review?(mkmelin+mozilla) → review+
Attached patch 1661510v4.patchSplinter Review

Variable renamed.

Attachment #9183743 - Attachment is obsolete: true
Attachment #9183772 - Flags: review?(mkmelin+mozilla)
Attachment #9183772 - Flags: review?(mkmelin+mozilla) → review+

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/d55a97e68cc7
Keep "Re:" prefix when editing a draft reply to encrypted message. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED

Comment on attachment 9183772 [details] [diff] [review]
1661510v4.patch

[Approval Request Comment]
User impact if declined: drafts lose Re: if they had one
Testing completed (on c-c, etc.): on c-c
Risk to taking this patch (and alternatives if risky): not risky, has test

Attachment #9183772 - Flags: approval-comm-esr78?
Attachment #9183772 - Flags: approval-comm-beta?

Comment on attachment 9183772 [details] [diff] [review]
1661510v4.patch

[Triage Comment]
Approved for beta

Attachment #9183772 - Flags: approval-comm-beta? → approval-comm-beta+

Comment on attachment 9183772 [details] [diff] [review]
1661510v4.patch

[Triage Comment]
Approved for esr78

Attachment #9183772 - Flags: approval-comm-esr78? → approval-comm-esr78+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: