Closed Bug 1656708 Opened 4 years ago Closed 4 years ago

Printing from composition fails: Uncaught TypeError: can't access property "printWindow", PrintUtils is undefined

Categories

(MailNews Core :: Printing, defect)

defect

Tracking

(thunderbird_esr78 unaffected)

RESOLVED DUPLICATE of bug 1654548
Tracking Status
thunderbird_esr78 --- unaffected

People

(Reporter: thomas8, Unassigned)

References

Details

(Keywords: regression)

+++ This bug was initially created as a clone of Bug #1654548 +++

Printing composition window of Daily 81.0a1 (2020-07-30) (64-bit) seems to fail in a different way than Bug 1654548 (no response), but maybe related.
TB 78.1.0 (64-bit) is not affected.

Alice, can you confirm if this is also regressed by bug 1652627 (see your regressionwindow in Bug 1654548 Comment 4)?

Uncaught TypeError: can't access property "printWindow", PrintUtils is undefined
DoCommandPrint chrome://messenger/content/messengercompose/MsgComposeCommands.js:2567
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1012
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1157
goDoCommand chrome://global/content/globalOverlay.js:101
oncommand chrome://messenger/content/messengercompose/messengercompose.xhtml:1
MsgComposeCommands.js:2567:3

An error occurred executing the cmd_print command: [Exception... "[JavaScript Error: "can't access property "printWindow", PrintUtils is undefined" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 2567}]'[JavaScript Error: "can't access property "printWindow", PrintUtils is undefined" {file: "chrome://messenger/content/messengercompose/MsgComposeCommands.js" line: 2567}]' when calling method: [nsIController::doCommand]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: chrome://global/content/globalOverlay.js :: goDoCommand :: line 101" data: yes] globalOverlay.js:104

With my patch attachment 9167489 [details] [diff] [review] from Bug 1654548 the error messages are different:

Uncaught TypeError: topBrowser.print is not a function
printWindow chrome://global/content/printUtils.js:192
DoCommandPrint chrome://messenger/content/messengercompose/MsgComposeCommands.js:2567
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1012
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1157
goDoCommand chrome://global/content/globalOverlay.js:101
oncommand chrome://messenger/content/messengercompose/messengercompose.xhtml:1
printUtils.js:192:16

An error occurred executing the cmd_print command: [Exception... "[JavaScript Error: "topBrowser.print is not a function" {file: "chrome://global/content/printUtils.js" line: 192}]'[JavaScript Error: "topBrowser.print is not a function" {file: "chrome://global/content/printUtils.js" line: 192}]' when calling method: [nsIController::doCommand]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: chrome://global/content/globalOverlay.js :: goDoCommand :: line 101" data: yes] globalOverlay.js:104

Depends on: tkprint820

^^ ni? wrt regressionwindow per comment 1, probably already known to you

Flags: needinfo?(alice0775)

(In reply to Thomas D. from comment #0)

+++ This bug was initially created as a clone of Bug #1654548 +++

Printing composition window of Daily 81.0a1 (2020-07-30) (64-bit) seems to fail in a different way than Bug 1654548 (no response), but maybe related.
TB 78.1.0 (64-bit) is not affected.

Alice, can you confirm if this is also regressed by bug 1652627 (see your regressionwindow in Bug 1654548 Comment 4)?

Yes, I got same regression window.

Flags: needinfo?(alice0775)

(In reply to Thomas D. from comment #0)

Uncaught TypeError: can't access property "printWindow", PrintUtils is undefined
DoCommandPrint chrome://messenger/content/messengercompose/MsgComposeCommands.js:2567
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1012
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1157
goDoCommand chrome://global/content/globalOverlay.js:101
oncommand chrome://messenger/content/messengercompose/messengercompose.xhtml:1
MsgComposeCommands.js:2567:3

I don't see how PrintUtils being undefined could be caused by the same bug (bug 1652627), even if it has the same regression range.

Looking at:

https://searchfox.org/comm-central/source/suite/mailnews/components/compose/content/MsgComposeCommands.js

it seems that file does not import printUtils.js but uses the PrintUtils object, which looks like it would result in exactly this issue. But that's the Suite version of that file. Surely Thunderbird is using:

https://searchfox.org/comm-central/source/mail/components/compose/content/MsgComposeCommands.js

Right at the top of that file there is some sort of comment about importing printUtils.js - it's unclear to me whether those comments are some sort of preprocessing instruction that actually results in those files being imported or not though.

(In reply to Thomas D. from comment #0)

Uncaught TypeError: topBrowser.print is not a function
printWindow chrome://global/content/printUtils.js:192
DoCommandPrint chrome://messenger/content/messengercompose/MsgComposeCommands.js:2567
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1012
doCommand chrome://messenger/content/messengercompose/MsgComposeCommands.js:1157
goDoCommand chrome://global/content/globalOverlay.js:101
oncommand chrome://messenger/content/messengercompose/messengercompose.xhtml:1
printUtils.js:192:16

topBrowser.print should be calling this function FWIW (unless Thunderbird is doing something different than Firefox):

https://searchfox.org/comm-central/rev/99c1bf8e0ab1b423c97b726357f41ef6860d5f3b/mozilla/toolkit/content/widgets/browser-custom-element.js#1713

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.