Bug 1661751 Comment 14 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Thanks, saahbs!  That's really helpful. 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 ` // We didn't find a good match. Take the first paper size` case
 (2) Our collection of paper sizes is probably empty
 (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?
Thanks, saahbs!  That's really helpful. 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?

Back to Bug 1661751 Comment 14