Closed Bug 1636730 Opened 4 years ago Closed 4 years ago

Stop saving print settings in JavaScript code

Categories

(Core :: Printing: Setup, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

(Whiteboard: [print2020_v78])

Attachments

(1 file)

There are two sources of triggers for initiating a print and opening the print dialog:

  1. UI "Print" menu items/Ctrl-P, which triggers PrintingChild.print
  2. window.print, which triggers nsGlobalWindowOuter::PrintOuter

Both PrintingChild.print and nsGlobalWindowOuter::PrintOuter have their own code to call SavePrintSettingsToPrefs to persist the print settings after triggering the print.

I think we should remove the SavePrintSettingsToPrefs calls from these methods and instead have a single call in nsPrintingPromptService::ShowPrintDialog just after the nsIPrintDialogService::Show call returns, so long as the user didn't cancel the dialog (the returned error code is a success code).

My immediate reason for wanting to do this is because it makes refactoring PrintingChild code to get rid of the message passing implementation (part of the Fission work) easier. But I think it's the correct thing to do anyway. As soon as a user confirms some print settings they should really be accepted and saved, I think.

It may be that moving the save all the way back to nsPrintingPromptService::ShowPrintDialog is more risk than we want to take at the moment while we're trying to keep risk low while so many people around the world are working from home. In that case we could centralize the save in nsPrintJob::Print.

Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/autoland/rev/b0216ee8d221
Centralize saving of the print setting the user chooses from the print dialog. r=bobowen
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
Blocks: 1638143
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: