Closed Bug 1843628 Opened 2 years ago Closed 2 years ago

Printing issues with HTML E-Mail (only email headers and big whitespace on first page)

Categories

(Thunderbird :: General, defect, P1)

Thunderbird 115

Tracking

(thunderbird_esr115 fixed, thunderbird117 fixed)

RESOLVED FIXED
118 Branch
Tracking Status
thunderbird_esr115 --- fixed
thunderbird117 --- fixed

People

(Reporter: mirco.iseli, Assigned: babolivier)

References

(Regression, )

Details

(Keywords: regression, testcase)

Attachments

(4 files)

Steps to reproduce:

Try to Print out HTML E-mail

Actual results:

When I try to print an email, most of the time the resulting print will have the "Subject", "From", Date" and "To" on one page and the body of the email on the next page.

Version: 15 Branch → Thunderbird 115

Micro, thanks for the research. I am not able to reproduce with beta or 115. Can you supply a testcase message that fails? Save it from thunderbird to a .eml files, and use "attach new file" to this bug report.

I see at https://www.reddit.com/r/Thunderbird/comments/155hcm0/printing_issues_thunderbird_115/ you cited a workaround "Change the view to HTML simplified"

See Also: → 1833764

Comment on attachment 9345221 [details]
Jährliche Wartung - JPL LERF Jean-Pierre <jp.lerf@gravograph.ch> - 2023-07-14 1602.eml

Sure, here is an email where I have the problem

Thanks for the testcase. I can reproduce this.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(mkmelin+mozilla)
Duplicate of this bug: 1844509
Component: Untriaged → General

We also have this problem with 115.0.1 now - we found a culprit: Outlook - just sending a simple (HTML) mail with two lines of text from Outlook and trying to print the received mail in Thunderbird results in this behaviour. (Setting to simplified HTML circumvents the issue, but that page is then no longer correctly formatted of course).

These examples are just a few of the reports

Severity: -- → S3
Flags: needinfo?(alessandro)
Keywords: regression, testcase
Priority: -- → P1

Gentle ping to Brendan to see if he can investigate this.

Flags: needinfo?(alessandro) → needinfo?(brendan)
Assignee: nobody → brendan
Flags: needinfo?(brendan)

I can confirm this. It's working in 102
Regressed from 2022-12-12 to 2022-12-15

https://hg.mozilla.org/comm-central/pushloghtml?startdate=2022-12-12+10%3A00&enddate=2022-12-15+14%3A00
https://hg.mozilla.org/mozilla-central/pushloghtml?startdate=2022-12-12+10%3A00&enddate=2022-12-15+14%3A00

Especially these look very suspicious
345c10ab15d2dde7c3a0ff0b79c504b7c8d1697e Jonathan Watt — Bug 1805477 - Prevent pages-per-sheet on macOS being double applied by system print dialog. r=dholbert
4d41c789765df2b93bbd333fc1fb09519173cd65 Jonathan Watt — Bug 1755974 - Fix Linux system print dialog to take the pages-per-sheet from print preview. r=dholbert

There is also
27f1702b315cff91726014f347463ba01c697dfa Jonathan Watt — Bug 1805716 - Stop overwriting the print settings passed to nsIPrintDialogService::showPrintDialog with saved prefs. r=dholbert

Flags: needinfo?(mkmelin+mozilla)
Summary: Printing issues with HTML E-Mail → Printing issues with HTML E-Mail (only email headers and big whitespace on first page)

I didn't share this here, but thought it would be a helpful addition to the previous comment: as part of my ongoing investigation I've noticed that this regression seems to have been introduced in 2022-12-13. 20221212095103 (109.0a1) is the last daily build without it, 20221213103526 (110.0a1) is the first daily build with it.

According to mozregression (and some manual validation) these are the pushes that might have introduced the regression:

https://hg.mozilla.org/comm-central/pushloghtml?fromchange=fdfb7eff1ad4dd1e0eee3b204b30ada40744b9b6&tochange=e470d79066fb99178b0aa02a218913b214a33beb
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d9b14b6b3a524e622cff771d8074baa88895f8f1&tochange=bd78e2e5b1fe852424cf7c035580e44de70ac135

So it's very likely due to a m-c push changing something under our feet. I'm continuing to investigate.

Especially these look very suspicious
345c10ab15d2dde7c3a0ff0b79c504b7c8d1697e Jonathan Watt — Bug 1805477 - Prevent pages-per-sheet on macOS being double applied by system print dialog. r=dholbert
4d41c789765df2b93bbd333fc1fb09519173cd65 Jonathan Watt — Bug 1755974 - Fix Linux system print dialog to take the pages-per-sheet from print preview. r=dholbert

There is also
27f1702b315cff91726014f347463ba01c697dfa Jonathan Watt — Bug 1805716 - Stop overwriting the print settings passed to nsIPrintDialogService::showPrintDialog with saved prefs. r=dholbert

Just to be sure, I went and check those three and I don't think any of those is our culprit here, since backing them out (and subsequently building TB) doesn't eliminate the bug.

Attached image 117.0b1-print.jpg

Confirm same problem in beta 117.0b1
This issue is also being reported in the Support Forum
https://support.mozilla.org/en-US/questions/1420091

Current workaround is to set 'View' > 'Message Body as ' > 'Simple HTML'

In error console I get this line when I attempt to print using 'Original html'

Layout was forced before the page was fully loaded. If stylesheets are not yet loaded this may cause a flash of unstyled content. print.html

clicked on print.html
image shows error console

After chatting with Geoff on Thursday we identified that the cause of this bug (at least with the test case that has been submitted here) is the use of the page CSS property, support for which was introduced in Firefox 110.0 (which is likely why this issue started happening with the first 110.0 beta). This typically isn't an issue for Firefox, but it's an issue for Thunderbird since we add some HTML (the headers table) before the email's body, so the rendering code puts both on different pages. I'm currently looking into what the best way to fix this bug should be.

Good detective work! Probably you should add a css override to messageBody.css like

@media print {
  * { page: auto !important; }
}

Also, seems messageBody.css should be using a shared file with platform overrides if there are any differences in the files (see e.g. feedSubscribe.css for correct usage)

Regressed by: 1787947

Ahah! I was looking at doing something like this but I forgot !important was a thing - this does the trick, thanks!

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

Also, seems messageBody.css should be using a shared file with platform overrides if there are any differences in the files (see e.g. feedSubscribe.css for correct usage)

Yes, I definitely agree. I'll try to take care of this as well now since I'm in the area.

Status: NEW → ASSIGNED

Pushed by brendan@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/b4437d961ce6
Mutualise messageBody.css, and ignore CSS named pages when printing. r=mkmelin

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

will patch also apply cleanly to 115?

Flags: needinfo?(brendan)
Target Milestone: --- → 117 Branch

(In reply to Wayne Mery (:wsmwk) from comment #19)

will patch also apply cleanly to 115?

I believe so. I'll file the uplift requests once the CI for this push has completed without raising issues about it.

Flags: needinfo?(brendan)
Target Milestone: 117 Branch → 118 Branch

Comment on attachment 9348141 [details]
Bug 1843628 - Mutualise messageBody.css, and ignore CSS named pages when printing. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #): bug 1787947
User impact if declined: Printing an email which style uses named pages will result in the email's headers and body being printed on separate pages
Testing completed (on c-c, etc.): On c-c
Risk to taking this patch (and alternatives if risky): Should be fairly low risk, as the patch is mostly changed files that haven't been changed since before 115.0, and the functional change is covered by a test.

Attachment #9348141 - Flags: approval-comm-esr115?
Attachment #9348141 - Flags: approval-comm-beta?

Comment on attachment 9348141 [details]
Bug 1843628 - Mutualise messageBody.css, and ignore CSS named pages when printing. r=#thunderbird-reviewers

[Triage Comment]
Approved for beta (coming next Monday)
Approved for esr115 even though it's not yet on beta - I'll test the nightly and if there are complications we will respin 115.1.1

Thanks for the tests

Attachment #9348141 - Flags: approval-comm-esr115?
Attachment #9348141 - Flags: approval-comm-esr115+
Attachment #9348141 - Flags: approval-comm-beta?
Attachment #9348141 - Flags: approval-comm-beta+
Duplicate of this bug: 1848594
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: