Closed Bug 1676166 Opened 5 years ago Closed 5 years ago

Cannot print mailing list - "Uncaught TypeError: card.translateTo is not a function"

Categories

(Thunderbird :: Address Book, defect)

defect

Tracking

(thunderbird_esr78 fixed)

RESOLVED FIXED
85 Branch
Tracking Status
thunderbird_esr78 --- fixed

People

(Reporter: cmgaudry33, Assigned: cmgaudry33)

References

(Regression)

Details

(Keywords: regression, regressionwindow-wanted)

Attachments

(5 files, 2 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36

Steps to reproduce:

- Display Address books window
- Create a new directory
- Create a new mailing list in this address book
- Right click on this mailing list
- Click on Print menu
- Display the console

Actual results:

No mailing list printing but the following exception is thrown :

Uncaught TypeError: card.translateTo is not a function
    CreatePrintCardUrl chrome://messenger/content/addressbook/addressbook.js:489
    AbPrintCardInternal chrome://messenger/content/addressbook/addressbook.js:462
    AbPrintCard chrome://messenger/content/addressbook/addressbook.js:481
    oncommand chrome://messenger/content/addressbook/addressbook.xhtml:1

Expected results:

No exception and no printing because a mailing list cannot be convert to XML data for now.

Attached patch bug_1676166.diff (obsolete) — — Splinter Review

Avoid mailing list printing because it cannot be printed

confirming for 84.0a1 (2020-11-09) (64-bit)

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: "Uncaught TypeError: card.translateTo is not a function" exception while pring mailing list. → "Uncaught TypeError: card.translateTo is not a function" exception while printing mailing list.

Printing mailing list was working pretty well in TB 68. (regression)
Let's first find out what broke this.

Summary: "Uncaught TypeError: card.translateTo is not a function" exception while printing mailing list. → Cannot print mailing list - "Uncaught TypeError: card.translateTo is not a function"
Comment on attachment 9186659 [details] [diff] [review] bug_1676166.diff Review of attachment 9186659 [details] [diff] [review]: ----------------------------------------------------------------- Thanks! While this would do away with the TypeError, silently not printing mailing lists isn't much better. I think we should try to fix the problem, and try to make mailing lists print again. Maybe we can just add translateTo method to mailing list implementation. This was still working in TB 68 - let's find out how, and if we can fix this regression.
Attachment #9186659 - Flags: review-
Component: Untriaged → Address Book

I think the AddrBookDirectory class breaks some things, including its asCard method.
So a mailing list is no longer really usable as a nsIAbCard.

Anyway, on my side, I can overcome the problem by implementing a translateTo method on the nsIAbCard object returned by the AddrBookDirectory.asCard method, to manage the xml and base64xml type conversions. For the vcard type, it seems more complicated to me.

I was talking about AddrBookMailingList (not AddrBookDirectory ;-)

You just have to implement some function into the nsIAbCard returned by the AddrBookMailingList.asCard method.
A new patch is following.

Attached patch bug_1676166.diff (obsolete) — — Splinter Review
  • Restore the mail list printing feature.
  • Fix Bug 1676128 also.
Attachment #9186659 - Attachment is obsolete: true

For your information, this new translateTo method will return the same output that it is in Thunderbird 68.9.0.
To do so it is needed to manage some special entries in the new properties method.

Have a nice day !

Attached patch bug_1676166.diff — — Splinter Review

This patch can be applied to the daily release.

Attachment #9186937 - Attachment is obsolete: true
Assignee: nobody → chris.m.gaudry
Status: NEW → ASSIGNED

f?mkmelin to comment if this is the right approach code-wise, in general (note that the patch currently fails).

Screenshot of Print Preview Contact with patch attachment 9186945 [details] [diff] [review] applied.

This is probably an improvement, but:

  • Print still fails with errors.
  • The print layout does not have a bolded title (as in TB 68, see screenshot attachment 9186806 [details]), which looks especially relevant for mailing lists.

Console Errors with patch applied:

[fluent] Missing translations in en-US: progress. Localization.jsm:202:13
Uncaught (in promise) undefined
Uncaught TypeError: can't access property 0, window.arguments is undefined
loadRequestedUrl chrome://messenger/content/extensionPopup.js:53
onload chrome://messenger/content/extensionPopup.xhtml:1
extensionPopup.js:53:7
[fluent] Missing translations in en-US: progress. Localization.jsm:202:13
Uncaught (in promise) undefined

Without the patch, it fails with:

Uncaught TypeError: card.translateTo is not a function
CreatePrintCardUrl chrome://messenger/content/addressbook/addressbook.js:418
AbPrintCardInternal chrome://messenger/content/addressbook/addressbook.js:391
AbPrintCard chrome://messenger/content/addressbook/addressbook.js:410
oncommand chrome://messenger/content/addressbook/addressbook.xhtml:1
addressbook.js:418:48

Attachment #9189543 - Flags: review-
Attachment #9189543 - Flags: feedback?(mkmelin+mozilla)

Magnus, is it only the Fluent error which makes this fail?

Attachment #9189543 - Flags: review- → feedback-
Attachment #9189543 - Flags: feedback?(mkmelin+mozilla) → feedback?(geoff)

Comment on attachment 9186945 [details] [diff] [review]
bug_1676166.diff

This is fine except that for trunk, generateQI now has string arguments. And for some reason the end of translateTo differs from the same function in AddrBookCard.

Attachment #9186945 - Flags: feedback+
Attachment #9189543 - Flags: feedback?(geoff)
Attachment #9189543 - Flags: feedback-

FWIW I don't know why printing on trunk is broken. Calendar is also affected but printing messages is not.

Patch updated to take into account the signature of the ChromeUtils.generateQI method.
This patch can be applied to the trunk.

Attachment #9190499 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9190499 [details] [diff] [review] bug_1676166_trunk.diff Review of attachment 9190499 [details] [diff] [review]: ----------------------------------------------------------------- Will let Geoff review as he's worked a bunch on this code.
Attachment #9190499 - Flags: review?(mkmelin+mozilla) → review?(geoff)

Not in 78.5.1 but it should be fixed in 78 branch too.

Comment on attachment 9190499 [details] [diff] [review]
bug_1676166_trunk.diff

[Approval Request Comment]
Regression caused by (bug #): bug 1572324
User impact if declined: Printing a mailing list doesn't work
Testing completed (on c-c, etc.): Landing now
Risk to taking this patch (and alternatives if risky): Not risky

Attachment #9190499 - Flags: review?(geoff)
Attachment #9190499 - Flags: review+
Attachment #9190499 - Flags: approval-comm-beta?

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/6ec072801722
Fix "Uncaught TypeError: card.translateTo is not a function" exception while printing mailing list. r=darktrojan

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

Thanks Chris. FYI, the r= part of the commit message is the reviewer, not you! You can leave that part out altogether when submitting patches and we'll add it when landing.

Target Milestone: --- → 85 Branch

Comment on attachment 9190499 [details] [diff] [review]
bug_1676166_trunk.diff

[Triage Comment]
We didn't do another beta, so no beta uplift - this will be in beta 85

Attachment #9190499 - Flags: approval-comm-beta? → approval-comm-beta-

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: no mailing list printing
Testing completed (on c-c, etc.): tested on modified 78.6.0 release
Risk to taking this patch (and alternatives if risky): not risky

Attachment #9193284 - Flags: review?(mkmelin+mozilla)
Attachment #9193284 - Flags: approval-comm-esr78?
Attachment #9193284 - Flags: review?(mkmelin+mozilla) → review?(geoff)
Attachment #9193284 - Flags: review?(geoff) → review+

Comment on attachment 9193284 [details] [diff] [review]
bug_1676166_esr78.diff

[Triage Comment]
Approved for esr78

Attachment #9193284 - Flags: approval-comm-esr78? → approval-comm-esr78+

Uplift note: The provided esr78 version is corrupt somehow: abort: bad hunk #1: incomplete hunk. Patch was applied by mangling the trunk version with the generateQI calls from the esr78 version.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: