[upstream] In Compose window, if a PDf is joined and clicked to open, Thunderbird launches Firefox instead of Evince
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mozilla Thunderbird |
In Progress
|
Unknown
|
|||
thunderbird (Ubuntu) |
Confirmed
|
Low
|
Unassigned |
Bug Description
In Thunderbird on Ubuntu Gnome, I set Evince as default program to open pdf files from Thunderbird.
In received messages, and those saved on "Sent" folder, it works perfectly.
But in the "Compose" window: if I add a pdf file to the message, and double-click on it to open and verify it, Thunderbird always uses Firefox to show it.
In case Firefox is not installed (has been removed), I have an error message telling there is not associated application for pdf files and to go to Preferences - where Evince is already and still defined as default.
It happens since many months and bug is still present in Thunderbird 102 / Ubuntu 22.10 beta.
It's not the same as bug 234349 as here, it's not an URL file but directly a pdf joined in a mail.
tags: | added: upstream |
summary: |
- In Compose window, if a PDf is joined and clicked to open, Thunderbird - launches Firefox instead of Evince + [upstream] In Compose window, if a PDf is joined and clicked to open, + Thunderbird launches Firefox instead of Evince |
Changed in thunderbird (Ubuntu): | |
status: | New → Confirmed |
Changed in thunderbird: | |
status: | Unknown → In Progress |
## Steps to Reproduce
Compose or Edit a message with a pdf attachment.
Open the pdf attachment (through double click or context menu).
## Result
Get popup message
```
You have chosen to open:
<file>.pdf
which is: HTML document
```
So the type is HTML, which means you'll likely get a recommendation to open in a browser, rather than the default pdf reader.
Also get the printed error message
``` //pdf.js/ PdfStreamConver ter.jsm, line 140: TypeError: can't access property "getInterface", requestor is null
JavaScript error: resource:
```
*Note: opening attachments when viewing a message (not composition), in either a tab or a separate window works fine.*
## Expected
The file to be treated as a PDF and no error message.
## Origin?
Looking in `PdfStreamConve rter.jsm` , the error is from `getDOMWindow` (https:/ /searchfox. org/mozilla- central/ rev/9ae77e4ce33 78bd683ac9a86b7 29ea6b6bd22cb8/ toolkit/ components/ pdfjs/content/ PdfStreamConver ter.jsm# 136), which is called by `proxy. onStopRequest` . The problem seems to be that both `aChannel. notificationCal lbacks` and `aChannel. loadGroup. notificationCal lbacks` are `null`.
*Note: opening an attachment in a viewed message (not composing), does not seem to pass through the same code.*
On the the thunderbird side, I've tracked down the trigger for the error to `openURI` in `MsgComposeComm ands.js` (https:/ /searchfox. org/comm- central/ rev/9bc3ba14800 90c4e89d5152e45 8f19c79b3d6ac4/ mail/components /compose/ content/ MsgComposeComma nds.js# 7171).
I couldn't really pinpoint the origin much beyond this because the code is passing through interfaces (and probably between c++ and javascript), and I'm not familiar enough to navigate this.
#### Why is it treated as HTML instead?
I think the reason the document is treated as as HTML is a side effect of the JavaScript error. Also in `PdfStreamConve rter.jsm` , the `onStartRequest` method changes the `contentType` from `application/pdf` to `text/html` (https:/ /searchfox. org/mozilla- central/ rev/9ae77e4ce33 78bd683ac9a86b7 29ea6b6bd22cb8/ toolkit/ components/ pdfjs/content/ PdfStreamConver ter.jsm# 1231). Supposedly, this is done to break some loop. My guess is that it is meant to be set back to `application/pdf` during `onStopRequest`, but this method errors before it can do so.