Closed Bug 1669631 Opened 4 years ago Closed 4 years ago

Firefox print dialog doesn't get past throbber & "Preparing Preview", with error console showing "Uncaught (in promise) TypeError: can't access property "id", matchedPaper is undefined"

Categories

(Toolkit :: Printing, defect, P1)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1663503
Tracking Status
firefox-esr78 --- unaffected
firefox81 --- unaffected
firefox82 --- fixed
firefox83 --- fixed

People

(Reporter: dholbert, Unassigned)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [print2020_v82])

I'm spinning this off from bug 1661751, for what seems to be a newly reported regression in Firefox 82.

Quoting the relevant comments:

(Quoting to saahbs from bug 1661751 comment #4)

I have the same problem [print dialog doesn't get past throbber] on Linux on firefox from aurora channel. I noticed around 82.b0?? but it could have been earlier - I usually don't print from within Firefox.

Steps to repro:

  1. file -> print
  2. before it displays any options, it shows a spinner and doesn't make progress (so no option to try to print to a pdf).

My printing works otherwise (cups with default class pointing to a sole printer).

See screenshot at: http://www.saahbs.net/temp/0ea3c5/firefox-borked-printing.png

Hitting ESC does allow to return to browsing.

Creating a fresh profile and starting it with --safe-mode also repros.

And a later comment, checking the error console:
(Quoting to saahbs from bug 1661751 comment #13)

I was able to repro on 82.0b7 with print.tab_modal.enable = true.

I get the new preview UI, it is blank with a spinner and makes no progress.

Here is the error message when attempting to print example.com:

Uncaught (in promise) TypeError: can't access property "id", matchedPaper is undefined
refreshSettings chrome://global/content/print.js:434
init chrome://global/content/print.js:250
async* chrome://global/content/print.js:85
EventListener.handleEvent* chrome://global/content/print.js:82
print.js:434:9

I posted some analysis:
(Quoting Daniel Holbert [:dholbert] from bug 1661751 comment #14)

That points to this snippet of code in current trunk (it's identical to the code in beta, though the line number is a bit different):
https://searchfox.org/mozilla-central/rev/1a973762afcbc5066f73f1508b0c846872fe3952/toolkit/components/printing/content/print.js#423-438

It looks like in your case:
(1) We're hitting the clause that says // We didn't find a good match. Take the first paper size
(2) ...but our collection of paper sizes is probably empty for some reason.
(3) So the matchedPaper = Object.values(...)[0] ends up with undefined
(4) So matchedPaper.id ends up throwing an exception, and we never finish preparing the print dialog.

sfoster, it looks like you've worked on that snippet of code -- would you mind taking a look here and adding some sort of error-handling code for the case where the Object.values(...) expression returns an empty collection and matchedPaper ends up undefined?

ni=sfoster per above.

Note: from code inspection (and from the timeline of when saahbs first noticed this), it looks to me like this is a regression from Bug 1663669. The "matchedPaper" usage here was added in that bug, as a rewrite of some older code, and that older code doesn't seem to have had this problem of using matchedPaper without having first checking it for truthiness.

--> Tentatively flagging as regression

Flags: needinfo?(sfoster)

(This feels like a P1, since the UI ends up completely broken/unreachable. Ideally we should get a fix uplifted to 82 for benefit of whatever users might get opted in to this new UI in that release.)

Priority: -- → P1
Whiteboard: [print2020_v82]

This is bug 1663503, the patch was just merged to beta/82 a few hours ago: https://bugzilla.mozilla.org/show_bug.cgi?id=1663503#c61

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(sfoster)
Resolution: --- → DUPLICATE
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.