Closed Bug 1662665 Opened 4 years ago Closed 3 years ago

move nsMessengerContentHandler.cpp functionality into MessengerContentHandler.jsm

Categories

(Thunderbird :: General, task, P3)

Tracking

(thunderbird_esr78 wontfix, thunderbird_esr91 wontfix, thunderbird84 wontfix)

RESOLVED FIXED
97 Branch
Tracking Status
thunderbird_esr78 --- wontfix
thunderbird_esr91 --- wontfix
thunderbird84 --- wontfix

People

(Reporter: mkmelin, Assigned: rnons)

Details

Attachments

(1 file, 5 obsolete files)

We have two messengercontenthandlers now. The remaining stuff in the .cpp one should be moved to MessengerContentHandler.jsm

https://searchfox.org/comm-central/source/mailnews/base/src/nsMessengerContentHandler.cpp

https://searchfox.org/comm-central/source/mail/components/MessengerContentHandler.jsm

This will make it easier to do ports of BrowserContentHandler.jsm functionality: https://searchfox.org/comm-central/source/mozilla/browser/components/BrowserContentHandler.jsm
E.g. showWhatsNewPage() should be handled there, like in it's browser equivalence.

Assignee: nobody → khushil324
Status: NEW → ASSIGNED
Comment on attachment 9186636 [details] [diff] [review] Bug-1662665_move-nsMessengerContentHandler-into-MessengerContentHandler-0.patch Review of attachment 9186636 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/components/MessengerContentHandler.jsm @@ +111,2 @@ > > var listener = { please add @implements {nsIURIContentListener} @@ +111,5 @@ > > var listener = { > doContent(ctype, preferred, request, handler) { > + let uri = request.URI; > + if (uri) { There's always going to be a uri @@ +145,5 @@ > + "chrome://messenger/content/messageWindow.xhtml", > + "_blank", > + "all,chrome,dialog=no,status,toolbar", > + request.URI > + ); this is the same for if-else so move it there. But what about not mailnewsurl, not file? I think nothing should happen then? ::: mail/components/compose/content/MsgComposeCommands.js @@ +6931,5 @@ > + let queryPart = mailnewsurl.query.replace( > + "type=message/rfc822", > + "type=application/x-message-display" > + ); > + request.URI = mailnewsurl would use the local uri variable you have there for these, and pass that in
Attachment #9186636 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9187640 [details] [diff] [review] Bug-1662665_move-nsMessengerContentHandler-into-MessengerContentHandler-1.patch Review of attachment 9187640 [details] [diff] [review]: ----------------------------------------------------------------- Why does it now have to be in two places? ::: mail/components/MessengerContentHandler.jsm @@ +109,4 @@ > > loadgroup.groupObserver = loadlistener; > > + // @implements {nsIURIContentListener} please add to attachmentopener as well ::: mail/components/compose/content/MsgComposeCommands.js @@ +6921,5 @@ > .setQuery(newQuery) > .finalize(); > } > + let uri = request.URI; > + if (uri) { uri will always be set, I'd imagine? @@ +6943,5 @@ > + "all,chrome,dialog=no,status,toolbar", > + request.URI > + ); > + } else { > + if (uri.scheme == "file") { like for the other cased, else if, and then use a common open uri
Attachment #9187640 - Flags: review?(mkmelin+mozilla)

(In reply to Magnus Melin [:mkmelin] from comment #4)

Why does it now have to be in two places?

I have inlined it at two places where we are using the MessengerContentHandler from C++. Now, it's more of a javascript function.

Attachment #9187640 - Attachment is obsolete: true
Attachment #9187646 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9187646 [details] [diff] [review] Bug-1662665_move-nsMessengerContentHandler-into-MessengerContentHandler-2.patch Review of attachment 9187646 [details] [diff] [review]: ----------------------------------------------------------------- Shouldn't MessengerContentHandler implement nsIContentHandler, and then you don't need the duplication in js?

Previously, we are using it as a util function only by calling nsMessengerContentHandler.handleContent. And we are using it in the openURI function which is used by the MessengerContentHandler only. So it will be a kind of recursion: https://searchfox.org/comm-central/source/mail/components/MessengerContentHandler.jsm#73,114-117,146,148,176,181,577,581,588
We can do one thing, create a util function and use at both the places.

Comment on attachment 9187646 [details] [diff] [review] Bug-1662665_move-nsMessengerContentHandler-into-MessengerContentHandler-2.patch Review of attachment 9187646 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/components/MessengerContentHandler.jsm @@ +109,4 @@ > > loadgroup.groupObserver = loadlistener; > > + // @implements {nsIURIContentListener} jsdoc style please /** @implements {nsIURIContentListener} */ Otherwise it wouldn't get into automatically generated documentation ::: mail/components/compose/content/MsgComposeCommands.js @@ +6903,4 @@ > } // if one attachment selected > } > > +// @implements {nsIURIContentListener} same here
Attachment #9187646 - Flags: review?(mkmelin+mozilla)
Attachment #9187646 - Attachment is obsolete: true
Attachment #9188070 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9188070 [details] [diff] [review] Bug-1662665_move-nsMessengerContentHandler-into-MessengerContentHandler-3.patch Review of attachment 9188070 [details] [diff] [review]: ----------------------------------------------------------------- ::: mail/components/compose/content/MsgComposeCommands.js @@ +6903,5 @@ > } // if one attachment selected > } > > +/** > + * @implements {nsIURIContentListener} would add also @see {MessengerContentHandler} @@ +6931,5 @@ > + let queryPart = mailnewsurl.query.replace( > + "type=message/rfc822", > + "type=application/x-message-display" > + ); > + request.URI = mailnewsurl for consistency with the other impl, use uri, here and the two places below
Attachment #9188070 - Flags: review?(mkmelin+mozilla) → review+
Target Milestone: --- → 85 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/8587f3e2dbbf
move nsMessengerContentHandler.cpp functionality into MessengerContentHandler.jsm. r=mkmelin

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

This broke these tests that try to open an email attachment, so I've backed it out:

mail/test/browser/attachment/browser_attachment.js
mail/test/browser/composition/browser_forwardedEmlActions.js
mail/test/browser/message-header/browser_phishingBar.js

We've lost registration of the nsIURIContentListener, so opening an attachment goes straight to the external helper app service.

Backout:
https://hg.mozilla.org/comm-central/rev/8444d32fb2784a3b015029090fa7c4b74396d661

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Geoff, any thoughts on how to approach this?

Flags: needinfo?(geoff)

Looks like you should be able to do it with a components.conf. Some examples.

Flags: needinfo?(geoff)

Ping, maybe you can finish this off at some point

Assignee: khushil324 → remotenonsense
Attachment #9188137 - Attachment is obsolete: true

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/f033e1b873da
Merge nsMessengerContentHandler.cpp into MessengerContentHandler.jsm. r=mkmelin

Status: REOPENED → RESOLVED
Closed: 4 years ago3 years ago
Resolution: --- → FIXED
Target Milestone: 85 Branch → 97 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: