summaryrefslogtreecommitdiffstats
path: root/dom/ipc/BrowserChild.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/ipc/BrowserChild.cpp')
-rw-r--r--dom/ipc/BrowserChild.cpp62
1 files changed, 53 insertions, 9 deletions
diff --git a/dom/ipc/BrowserChild.cpp b/dom/ipc/BrowserChild.cpp
index bdd10fdcb2..3d1f399edb 100644
--- a/dom/ipc/BrowserChild.cpp
+++ b/dom/ipc/BrowserChild.cpp
@@ -2342,7 +2342,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvPrintPreview(
/* aListener = */ nullptr, docShellToCloneInto,
nsGlobalWindowOuter::IsPreview::Yes,
nsGlobalWindowOuter::IsForWindowDotPrint::No,
- std::move(aCallback), IgnoreErrors());
+ std::move(aCallback), nullptr, IgnoreErrors());
#endif
return IPC_OK();
}
@@ -2359,8 +2359,9 @@ mozilla::ipc::IPCResult BrowserChild::RecvExitPrintPreview() {
return IPC_OK();
}
-mozilla::ipc::IPCResult BrowserChild::RecvPrint(
- const MaybeDiscardedBrowsingContext& aBc, const PrintData& aPrintData) {
+mozilla::ipc::IPCResult BrowserChild::CommonPrint(
+ const MaybeDiscardedBrowsingContext& aBc, const PrintData& aPrintData,
+ RefPtr<BrowsingContext>* aCachedBrowsingContext) {
#ifdef NS_PRINTING
if (NS_WARN_IF(aBc.IsNullOrDiscarded())) {
return IPC_OK();
@@ -2389,12 +2390,12 @@ mozilla::ipc::IPCResult BrowserChild::RecvPrint(
IgnoredErrorResult rv;
RefPtr printJob = static_cast<RemotePrintJobChild*>(
aPrintData.remotePrintJob().AsChild());
- outerWindow->Print(printSettings, printJob,
- /* aListener = */ nullptr,
- /* aWindowToCloneInto = */ nullptr,
- nsGlobalWindowOuter::IsPreview::No,
- nsGlobalWindowOuter::IsForWindowDotPrint::No,
- /* aPrintPreviewCallback = */ nullptr, rv);
+ outerWindow->Print(
+ printSettings, printJob,
+ /* aListener = */ nullptr,
+ /* aWindowToCloneInto = */ nullptr, nsGlobalWindowOuter::IsPreview::No,
+ nsGlobalWindowOuter::IsForWindowDotPrint::No,
+ /* aPrintPreviewCallback = */ nullptr, aCachedBrowsingContext, rv);
if (NS_WARN_IF(rv.Failed())) {
return IPC_OK();
}
@@ -2403,6 +2404,49 @@ mozilla::ipc::IPCResult BrowserChild::RecvPrint(
return IPC_OK();
}
+mozilla::ipc::IPCResult BrowserChild::RecvPrint(
+ const MaybeDiscardedBrowsingContext& aBc, const PrintData& aPrintData,
+ bool aReturnStaticClone, PrintResolver&& aResolve) {
+#ifdef NS_PRINTING
+ RefPtr<BrowsingContext> browsingContext;
+ auto result = CommonPrint(aBc, aPrintData,
+ aReturnStaticClone ? &browsingContext : nullptr);
+ aResolve(browsingContext);
+ return result;
+#else
+ aResolve(nullptr);
+ return IPC_OK();
+#endif
+}
+
+mozilla::ipc::IPCResult BrowserChild::RecvPrintClonedPage(
+ const MaybeDiscardedBrowsingContext& aBc, const PrintData& aPrintData,
+ const MaybeDiscardedBrowsingContext& aClonedBc) {
+#ifdef NS_PRINTING
+ if (aClonedBc.IsNullOrDiscarded()) {
+ return IPC_OK();
+ }
+ RefPtr<BrowsingContext> clonedBc = aClonedBc.get();
+ return CommonPrint(aBc, aPrintData, &clonedBc);
+#else
+ return IPC_OK();
+#endif
+}
+
+mozilla::ipc::IPCResult BrowserChild::RecvDestroyPrintClone(
+ const MaybeDiscardedBrowsingContext& aCachedPage) {
+#ifdef NS_PRINTING
+ if (aCachedPage) {
+ RefPtr<nsPIDOMWindowOuter> window = aCachedPage->GetDOMWindow();
+ if (NS_WARN_IF(!window)) {
+ return IPC_OK();
+ }
+ window->Close();
+ }
+#endif
+ return IPC_OK();
+}
+
mozilla::ipc::IPCResult BrowserChild::RecvUpdateNativeWindowHandle(
const uintptr_t& aNewHandle) {
#if defined(XP_WIN) && defined(ACCESSIBILITY)