Closed Bug 1669772 Opened 5 years ago Closed 5 years ago

Stop calling nsPrintSettingsService::GetDefaultPrintSettingsForPrinting in nsGlobalWindowOuter::PrintOuter

Categories

(Core :: Printing: Setup, defect, P2)

defect

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: jwatt, Assigned: emilio)

Details

(Whiteboard: [print2020_v83])

Attachments

(1 file)

nsPrintSettingsService::GetDefaultPrintSettingsForPrinting gets a settings object that may well have completely different settings to what the print preview/print will set. Using that to get a settings object in nsGlobalWindowOuter::PrintOuter to pass to nsPrintJob::Print/PrintPreview isn't great.

It's not possible to get the same settings object at this point in the code as will be chosen by the frontend code, because our sandboxing goals mean that we can't be accessing nsIPrinterList in the content process.

Ideally I think the code would be refactored so that we only do the static cloning under nsGlobalWindowOuter::PrintOuter, and do not try to reflow the document until the print preview/print on the parent side takes ownership of the temporary docshell and then passes a settings object over to the content process via nsFrameLoader::Print/PrintPreview.

Emilio, would you be able to take a look at this?

Flags: needinfo?(emilio)

The comment should be self-descriptive. We keep cloning the doc sync and
the UI will preview that doc, so it works out nicely and we do less
work.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

So like this? I don't think this is observable/testable, but let me know if you think it is and I can try to add a test.

Flags: needinfo?(emilio)

Yeah, that's great. Thanks!

(And no, I don't think this is testable.)

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3a31ce80459a Don't do a silly print preview from window.print() with the new tab modal UI. r=jwatt
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
Whiteboard: [print2020_v84] → [print2020_v83]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: