Bug 1432651 part 3 - Stop using nsIPrintSession::GetRemotePrintJob in nsPrintingProxy. r=bobowen
This makes nsPrintingProxy::ShowProgress get the RemotePrintJobChild from the
current nsPrintJob (indirectly via the new
nsIWebBrowserPrint::GetRemotePrintJob API).
MozReview-Commit-ID: JXYNZ3QHFRe
--- a/toolkit/components/printingui/ipc/nsPrintingProxy.cpp
+++ b/toolkit/components/printingui/ipc/nsPrintingProxy.cpp
@@ -164,22 +164,24 @@ nsPrintingProxy::ShowProgress(mozIDOMWin
RefPtr<PrintProgressDialogChild> dialogChild =
new PrintProgressDialogChild(openDialogObserver, printSettings);
SendPPrintProgressDialogConstructor(dialogChild);
// Get the RemotePrintJob if we have one available.
RefPtr<mozilla::layout::RemotePrintJobChild> remotePrintJob;
- if (printSettings) {
- nsCOMPtr<nsIPrintSession> printSession;
- nsresult rv = printSettings->GetPrintSession(getter_AddRefs(printSession));
- if (NS_SUCCEEDED(rv) && printSession) {
- printSession->GetRemotePrintJob(getter_AddRefs(remotePrintJob));
+ {
+ nsCOMPtr<nsIWebBrowserPrint> wbp = webBrowserPrint;
+ if (!wbp) {
+ wbp = do_GetInterface(parent);
+ MOZ_ASSERT(wbp,
+ "How are we printing for a document without an nsDocumentViewer?");
}
+ remotePrintJob = wbp->GetRemotePrintJob();
}
// NOTE: We set notifyOnOpen to true unconditionally. If the parent process
// would get `false` for notifyOnOpen, then it will synthesize a notification
// which will be sent asynchronously down to the child.
*notifyOnOpen = true;
mozilla::Unused << SendShowProgress(pBrowser, dialogChild, remotePrintJob,
isForPrinting);