Bug 1088070 - Instantiate print settings from the content process instead of the parent
So this is blocking bug 1090448.
And I need to be particularly careful so that I don't accidentally re-open
this bug
.
So the thing I want to be able to do is use PPrinting to send the print
settings up from the content process and save them in the parent
process.
Originally, I thought about providing an nsIPrintSettingsService proxy,
and that might be a good idea long-term, but it kinda screws me because
I use the native nsIPrintSettingsService to get the nsIPrintSettings /
nsIPrintOptions that I need to do the printing on the content side. :(
So, idea - have the nsPrintOptionsImpl (which implements the
savePrintSettingsToPrefs stuff) detect if it's in the content process.
If so, forward the call to nsPrintingProxy.
Let's do a PoC.
Yes. Yes, this works. Ok, it's sloppy, but it'll work.
Rename nsPrintingPromptServiceProxy to nsPrintingProxy
Create a createInstance method on nsPrintingPromptService to get a static instance
Use NS_SINGLETON factory thing to register nsPrintingPromptService
Have nsPrintOptionsImpl notice that we're in the content process, and
call into mozilla::ipc::PrintingProxy to send the printing information
over.
Figure out release of the static nsPrintingProxy
Ah, ClearOnShutdown looks like what I need.
So some infra red on those Windows machines, but I feel confident. Pushing...
Hm. Bounced. Turns out I need to wrap the stuff in getPrintSettings
with a try/catch, just like we do in printUtils.js. Otherwise, we fail
out during the test. The test is kinda bullshit anyways, since print
preview is inaccessible on OS X anyways, but whatever. Parity.
This actually positions us nicely for future work to send more
stuff through PrintingProxy in the child process. Eventually, we'll
probably accomplish all printing in the parent process, and just remote
it all through PrintingProxy.