Bug 1432651 part 7 - Remove nsIPrintSession and all the code that uses it. r=bobowen draft
authorJonathan Watt <jwatt@jwatt.org>
Tue, 23 Jan 2018 23:48:40 +0000
changeset 723870 4a1b3f278ec8a5820926685a155677c9f4af3fff
parent 723869 7d27e90e480280994bbbc9ff08a9ae63e5a3f0db
child 746978 4b79a9eaebb58fd30d12c787817d99ded683caae
push id96561
push userjwatt@jwatt.org
push dateTue, 23 Jan 2018 23:51:24 +0000
reviewersbobowen
bugs1432651
milestone60.0a1
Bug 1432651 part 7 - Remove nsIPrintSession and all the code that uses it. r=bobowen MozReview-Commit-ID: FeUTWc23YXA
dom/ipc/TabChild.cpp
layout/printing/nsPrintJob.cpp
toolkit/components/printingui/ipc/nsPrintingProxy.cpp
widget/android/nsWidgetFactory.cpp
widget/cocoa/nsWidgetFactory.mm
widget/gtk/nsWidgetFactory.cpp
widget/moz.build
widget/nsIPrintSession.idl
widget/nsIPrintSettings.idl
widget/nsPrintSession.cpp
widget/nsPrintSession.h
widget/nsPrintSettingsImpl.cpp
widget/nsPrintSettingsService.cpp
widget/nsWidgetsCID.h
widget/windows/nsWidgetFactory.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -128,17 +128,16 @@
 #include "mozilla/Telemetry.h"
 #include "nsIDocShellLoadInfo.h"
 
 #ifdef XP_WIN
 #include "mozilla/plugins/PluginWidgetChild.h"
 #endif
 
 #ifdef NS_PRINTING
-#include "nsIPrintSession.h"
 #include "nsIPrintSettings.h"
 #include "nsIPrintSettingsService.h"
 #include "nsIWebBrowserPrint.h"
 #endif
 
 #define BROWSER_ELEMENT_CHILD_SCRIPT \
     NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js")
 
@@ -2503,23 +2502,16 @@ TabChild::RecvPrint(const uint64_t& aOut
 
   nsCOMPtr<nsIPrintSettings> printSettings;
   nsresult rv =
     printSettingsSvc->GetNewPrintSettings(getter_AddRefs(printSettings));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return IPC_OK();
   }
 
-  nsCOMPtr<nsIPrintSession>  printSession =
-    do_CreateInstance("@mozilla.org/gfx/printsession;1", &rv);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return IPC_OK();
-  }
-
-  printSettings->SetPrintSession(printSession);
   printSettingsSvc->DeserializeToPrintSettings(aPrintData, printSettings);
   rv = webBrowserPrint->PrintInternal(printSettings, nullptr,
          static_cast<RemotePrintJobChild*>(aPrintData.remotePrintJobChild()));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return IPC_OK();
   }
 
 #endif
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -21,17 +21,16 @@
 #include "nsError.h"
 
 #include "nsView.h"
 #include <algorithm>
 
 // Print Options
 #include "nsIPrintSettings.h"
 #include "nsIPrintSettingsService.h"
-#include "nsIPrintSession.h"
 #include "nsGfxCIID.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 
 static const char sPrintSettingsServiceContractID[] = "@mozilla.org/gfx/printsettings-service;1";
 
@@ -703,38 +702,22 @@ nsPrintJob::DoCommonPrint(bool          
       do_QueryInterface(mDocViewerPrint);
     if (viewer) {
       viewer->SetTextZoom(1.0f);
       viewer->SetFullZoom(1.0f);
       viewer->SetMinFontSize(0);
     }
   }
 
-  // Create a print session and let the print settings know about it.
-  // Don't overwrite an existing print session.
-  // The print settings hold an nsWeakPtr to the session so it does not
-  // need to be cleared from the settings at the end of the job.
-  // XXX What lifetime does the printSession need to have?
-  nsCOMPtr<nsIPrintSession> printSession;
   bool remotePrintJobListening = false;
-  if (!aIsPrintPreview) {
-    rv = printData->mPrintSettings->GetPrintSession(
-                                      getter_AddRefs(printSession));
-    if (NS_FAILED(rv) || !printSession) {
-      printSession = do_CreateInstance("@mozilla.org/gfx/printsession;1", &rv);
-      NS_ENSURE_SUCCESS(rv, rv);
-      printData->mPrintSettings->SetPrintSession(printSession);
-    }
-
-    if (printData->mRemotePrintJob) {
-      // If we have a RemotePrintJob add it to the print progress listeners,
-      // so it can forward to the parent.
-      printData->mPrintProgressListeners.AppendElement(printData->mRemotePrintJob);
-      remotePrintJobListening = true;
-    }
+  if (!aIsPrintPreview && printData->mRemotePrintJob) {
+    // If we have a RemotePrintJob add it to the print progress listeners,
+    // so it can forward to the parent.
+    printData->mPrintProgressListeners.AppendElement(printData->mRemotePrintJob);
+    remotePrintJobListening = true;
   }
 
   if (aWebProgressListener != nullptr) {
     printData->mPrintProgressListeners.AppendObject(aWebProgressListener);
   }
 
   // Get the currently focused window and cache it
   // because the Print Dialog will "steal" focus and later when you try
--- a/toolkit/components/printingui/ipc/nsPrintingProxy.cpp
+++ b/toolkit/components/printingui/ipc/nsPrintingProxy.cpp
@@ -9,17 +9,16 @@
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/layout/RemotePrintJobChild.h"
 #include "mozilla/Unused.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIPrintingPromptService.h"
-#include "nsIPrintSession.h"
 #include "nsPIDOMWindow.h"
 #include "nsPrintSettingsService.h"
 #include "nsServiceManagerUtils.h"
 #include "PrintDataUtils.h"
 #include "PrintProgressDialogChild.h"
 #include "PrintSettingsDialogChild.h"
 
 using namespace mozilla;
--- a/widget/android/nsWidgetFactory.cpp
+++ b/widget/android/nsWidgetFactory.cpp
@@ -15,17 +15,16 @@
 #include "nsLookAndFeel.h"
 #include "nsAppShellSingleton.h"
 #include "nsScreenManagerAndroid.h"
 
 #include "nsIdleServiceAndroid.h"
 #include "nsClipboard.h"
 #include "nsClipboardHelper.h"
 #include "nsTransferable.h"
-#include "nsPrintSession.h"
 #include "nsPrintSettingsServiceAndroid.h"
 #include "nsDeviceContextAndroid.h"
 #include "nsHTMLFormatConverter.h"
 #include "nsXULAppAPI.h"
 #include "nsAndroidProtocolHandler.h"
 
 #include "nsToolkitCompsCID.h"
 #include "AndroidAlerts.h"
@@ -33,17 +32,16 @@
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerAndroid)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceAndroid, nsIdleServiceAndroid::GetInstance)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceAndroid, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecAndroid)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidBridge)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidProtocolHandler)
 
 #include "GfxInfo.h"
 namespace mozilla {
 namespace widget {
@@ -78,17 +76,16 @@ NS_DEFINE_NAMED_CID(NS_WINDOW_CID);
 NS_DEFINE_NAMED_CID(NS_CHILD_CID);
 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID);
 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID);
 NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
 NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
 NS_DEFINE_NAMED_CID(NS_ANDROIDBRIDGE_CID);
 NS_DEFINE_NAMED_CID(NS_ANDROIDPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
 
 static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
@@ -97,17 +94,16 @@ static const mozilla::Module::CIDEntry k
   { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
   { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerAndroidConstructor },
   { &kNS_THEMERENDERER_CID, false, nullptr, nsNativeThemeAndroidConstructor },
   { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceAndroidConstructor },
   { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
   { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
   { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
   { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintSettingsServiceAndroidConstructor },
-  { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
   { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecAndroidConstructor },
   { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
   { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
   { &kNS_ANDROIDBRIDGE_CID, false, nullptr, nsAndroidBridgeConstructor },
   { &kNS_ANDROIDPROTOCOLHANDLER_CID, false, nullptr, nsAndroidProtocolHandlerConstructor },
   { &kNS_SYSTEMALERTSSERVICE_CID, false, nullptr, mozilla::widget::AndroidAlertsConstructor },
   { nullptr }
 };
@@ -118,17 +114,16 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/widget/appshell/android;1", &kNS_APPSHELL_CID },
   { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID },
   { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID },
   { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
   { "@mozilla.org/widget/transferable;1", &kNS_TRANSFERABLE_CID },
   { "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID },
   { "@mozilla.org/widget/clipboardhelper;1", &kNS_CLIPBOARDHELPER_CID },
   { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
-  { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
   { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
   { "@mozilla.org/widget/htmlformatconverter;1", &kNS_HTMLFORMATCONVERTER_CID },
   { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
   { "@mozilla.org/android/bridge;1", &kNS_ANDROIDBRIDGE_CID },
   { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "android", &kNS_ANDROIDPROTOCOLHANDLER_CID },
   { NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID },
   { nullptr }
 };
--- a/widget/cocoa/nsWidgetFactory.mm
+++ b/widget/cocoa/nsWidgetFactory.mm
@@ -32,17 +32,16 @@
 #include "nsSound.h"
 #include "nsIdleServiceX.h"
 #include "NativeKeyBindings.h"
 #include "OSXNotificationCenter.h"
 
 #include "nsDeviceContextSpecX.h"
 #include "nsPrintSettingsServiceX.h"
 #include "nsPrintDialogX.h"
-#include "nsPrintSession.h"
 #include "nsToolkitCompsCID.h"
 
 #include "mozilla/widget/ScreenManager.h"
 
 using namespace mozilla;
 using namespace mozilla::widget;
 
 static nsresult
@@ -72,17 +71,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPi
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSound)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransferable)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecX)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceX, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceX, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIdleServiceX, nsIdleServiceX::GetInstance)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ScreenManager, ScreenManager::GetAddRefedSingleton)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(OSXNotificationCenter, Init)
 
 #include "nsMenuBarX.h"
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNativeMenuServiceX)
 
 #include "nsBidiKeyboard.h"
@@ -122,17 +120,16 @@ NS_DEFINE_NAMED_CID(NS_TRANSFERABLE_CID)
 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
 NS_DEFINE_NAMED_CID(NS_CLIPBOARDHELPER_CID);
 NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
 NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID);
 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
-NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_NATIVEMENUSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_MACDOCKSUPPORT_CID);
 NS_DEFINE_NAMED_CID(NS_MACWEBAPPUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_STANDALONENATIVEMENU_CID);
@@ -158,17 +155,16 @@ static const mozilla::Module::CIDEntry k
   { &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor,
     mozilla::Module::MAIN_PROCESS_ONLY },
   { &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor,
     mozilla::Module::MAIN_PROCESS_ONLY },
   { &kNS_THEMERENDERER_CID, false, NULL, nsNativeThemeCocoaConstructor },
   { &kNS_SCREENMANAGER_CID, false, NULL, ScreenManagerConstructor,
     mozilla::Module::MAIN_PROCESS_ONLY },
   { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor },
-  { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor },
   { &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintSettingsServiceXConstructor },
   { &kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceXConstructor },
   { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceXConstructor },
   { &kNS_SYSTEMALERTSSERVICE_CID, false, NULL, OSXNotificationCenterConstructor },
   { &kNS_NATIVEMENUSERVICE_CID, false, NULL, nsNativeMenuServiceXConstructor },
   { &kNS_MACDOCKSUPPORT_CID, false, NULL, nsMacDockSupportConstructor },
   { &kNS_MACWEBAPPUTILS_CID, false, NULL, nsMacWebAppUtilsConstructor },
   { &kNS_STANDALONENATIVEMENU_CID, false, NULL, nsStandaloneNativeMenuConstructor },
@@ -196,17 +192,16 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID,
     mozilla::Module::MAIN_PROCESS_ONLY },
   { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID,
     mozilla::Module::MAIN_PROCESS_ONLY },
   { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID },
   { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
     mozilla::Module::MAIN_PROCESS_ONLY },
   { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
-  { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
   { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
   { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
   { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
   { "@mozilla.org/system-alerts-service;1", &kNS_SYSTEMALERTSSERVICE_CID },
   { "@mozilla.org/widget/nativemenuservice;1", &kNS_NATIVEMENUSERVICE_CID },
   { "@mozilla.org/widget/macdocksupport;1", &kNS_MACDOCKSUPPORT_CID },
   { "@mozilla.org/widget/mac-web-app-utils;1", &kNS_MACWEBAPPUTILS_CID },
   { "@mozilla.org/widget/standalonenativemenu;1", &kNS_STANDALONENATIVEMENU_CID },
--- a/widget/gtk/nsWidgetFactory.cpp
+++ b/widget/gtk/nsWidgetFactory.cpp
@@ -30,17 +30,16 @@
 #include "nsFilePicker.h"
 #include "nsSound.h"
 #include "nsBidiKeyboard.h"
 #include "nsGTKToolkit.h"
 #include "WakeLockListener.h"
 
 #ifdef NS_PRINTING
 #include "nsPrintSettingsServiceGTK.h"
-#include "nsPrintSession.h"
 #include "nsDeviceContextSpecG.h"
 #endif
 
 #include "nsImageToPixbuf.h"
 #include "nsPrintDialogGTK.h"
 
 #if defined(MOZ_X11)
 #include "nsIdleServiceGTK.h"
@@ -113,17 +112,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxI
 }
 }
 #endif
 
 #ifdef NS_PRINTING
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecGTK)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceGTK, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorGTK)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceGTK, Init)
 #endif
 
 static nsresult
 nsFilePickerConstructor(nsISupports *aOuter, REFNSIID aIID,
                         void **aResult)
 {
   *aResult = nullptr;
@@ -212,17 +210,16 @@ NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_HTMLFORMATCONVERTER_CID);
 NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
 NS_DEFINE_NAMED_CID(NS_SCREENMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_THEMERENDERER_CID);
 #ifdef NS_PRINTING
 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
-NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_IMAGE_TO_PIXBUF_CID);
 #if defined(MOZ_X11)
 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
 #endif
@@ -247,17 +244,16 @@ static const mozilla::Module::CIDEntry k
     { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
     { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
     { &kNS_SCREENMANAGER_CID, false, nullptr, ScreenManagerConstructor,
       Module::MAIN_PROCESS_ONLY },
     { &kNS_THEMERENDERER_CID, false, nullptr, nsNativeThemeGTKConstructor },
 #ifdef NS_PRINTING
     { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintSettingsServiceGTKConstructor },
     { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorGTKConstructor },
-    { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
     { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecGTKConstructor },
     { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceGTKConstructor },
 #endif
     { &kNS_IMAGE_TO_PIXBUF_CID, false, nullptr, nsImageToPixbufConstructor },
 #if defined(MOZ_X11)
     { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGTKConstructor },
     { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
 #endif
@@ -284,17 +280,16 @@ static const mozilla::Module::ContractID
     { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID,
       Module::MAIN_PROCESS_ONLY },
     { "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
       Module::MAIN_PROCESS_ONLY },
     { "@mozilla.org/chrome/chrome-native-theme;1", &kNS_THEMERENDERER_CID },
 #ifdef NS_PRINTING
     { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
     { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
-    { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
     { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
     { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
 #endif
     { "@mozilla.org/widget/image-to-gdk-pixbuf;1", &kNS_IMAGE_TO_PIXBUF_CID },
 #if defined(MOZ_X11)
     { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
     { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
 #endif
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -99,17 +99,16 @@ XPIDL_SOURCES += [
     'nsIDragSession.idl',
     'nsIFilePicker.idl',
     'nsIFormatConverter.idl',
     'nsIGfxInfo.idl',
     'nsIGfxInfoDebug.idl',
     'nsIIdleService.idl',
     'nsIIdleServiceInternal.idl',
     'nsIPrinterEnumerator.idl',
-    'nsIPrintSession.idl',
     'nsIPrintSettings.idl',
     'nsIPrintSettingsService.idl',
     'nsIScreen.idl',
     'nsIScreenManager.idl',
     'nsISound.idl',
     'nsITransferable.idl',
 ]
 
@@ -214,17 +213,16 @@ if CONFIG['OS_ARCH'] == 'Linux':
 
 if CONFIG['MOZ_XUL'] and CONFIG['NS_PRINTING']:
     EXPORTS += [
         'nsDeviceContextSpecProxy.h',
         'nsPrintSettingsService.h',
     ]
     UNIFIED_SOURCES += [
         'nsDeviceContextSpecProxy.cpp',
-        'nsPrintSession.cpp',
         'nsPrintSettingsService.cpp',
     ]
 
 # nsBaseWidget.cpp needs to be built separately because of name clashes in the OS X headers
 # nsBaseDragService.cpp moved out of UNIFIED to fix xgill crash (bug 1259850) after moving widget/ContentHelper -> apz/util/TouchActionHelper
 SOURCES += [
     'nsBaseDragService.cpp',
     'nsBaseWidget.cpp',
deleted file mode 100644
--- a/widget/nsIPrintSession.idl
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-/**
- * nsIPrintSession
- *
- * Stores data pertaining only to a single print job. This
- * differs from nsIPrintSettings, which stores data which may
- * be valid across a number of jobs.
- *
- * The creation of a component which implements this interface
- * will begin the session. Likewise, destruction of that object
- * will end the session.
- * 
- * @status
- */
-
-%{ C++
-namespace mozilla {
-namespace layout {
-class RemotePrintJobChild;
-}
-}
-%}
-
-[ptr] native RemotePrintJobChildPtr(mozilla::layout::RemotePrintJobChild);
-
-[uuid(424ae4bb-10ca-4f35-b84e-eab893322df4)]
-
-interface nsIPrintSession : nsISupports
-{
-  /**
-   * The remote print job is used for printing via the parent process.
-   */
-  [noscript] attribute RemotePrintJobChildPtr remotePrintJob;
-};
--- a/widget/nsIPrintSettings.idl
+++ b/widget/nsIPrintSettings.idl
@@ -12,18 +12,16 @@
 %}
 
 /**
  * Native types
  */
   [ref] native nsNativeIntMarginRef(nsIntMargin);
   [ref] native IntegerArray(nsTArray<int32_t>);
   
-interface nsIPrintSession;
-
 /**
  * Simplified graphics interface for JS rendering.
  */
 [scriptable, uuid(ecc5cbad-57fc-4731-b0bd-09e865bd62ad)]
 
 interface nsIPrintSettings : nsISupports
 {
   /**
@@ -155,21 +153,16 @@ interface nsIPrintSettings : nsISupports
    */
     nsIPrintSettings clone();
 
   /**
    * Assigns the internal values from the "in" arg to the current object
    */
     void assign(in nsIPrintSettings aPS);
 
-  /**
-   * Data Members
-   */
-  [noscript] attribute nsIPrintSession printSession; /* We hold a weak reference */
-
   attribute long    startPageRange;    
   attribute long    endPageRange;    
 
   /**
    * The edge measurements define the positioning of the headers
    * and footers on the page. They're measured as an offset from
    * the "unwriteable margin" (described below).
    */
deleted file mode 100644
--- a/widget/nsPrintSession.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsPrintSession.h"
-
-#include "mozilla/layout/RemotePrintJobChild.h"
-
-typedef mozilla::layout::RemotePrintJobChild RemotePrintJobChild;
-
-//*****************************************************************************
-//***    nsPrintSession
-//*****************************************************************************
-
-NS_IMPL_ISUPPORTS(nsPrintSession, nsIPrintSession, nsISupportsWeakReference)
-                             
-//-----------------------------------------------------------------------------
-nsPrintSession::nsPrintSession()
-{
-}
-
-//-----------------------------------------------------------------------------
-nsPrintSession::~nsPrintSession()
-{
-}
-
-//-----------------------------------------------------------------------------
-nsresult nsPrintSession::Init()
-{
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsPrintSession::GetRemotePrintJob(RemotePrintJobChild** aRemotePrintJob)
-{
-  MOZ_ASSERT(aRemotePrintJob);
-  RefPtr<RemotePrintJobChild> result = mRemotePrintJob;
-  result.forget(aRemotePrintJob);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsPrintSession::SetRemotePrintJob(RemotePrintJobChild* aRemotePrintJob)
-{
-  mRemotePrintJob = aRemotePrintJob;
-  return NS_OK;
-}
deleted file mode 100644
--- a/widget/nsPrintSession.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsPrintSession_h__
-#define nsPrintSession_h__
-
-#include "nsIPrintSession.h" 
-
-#include "mozilla/RefPtr.h"
-#include "nsWeakReference.h"
-
-namespace mozilla {
-namespace layout {
-class RemotePrintJobChild;
-}
-}
-
-
-//*****************************************************************************
-//***    nsPrintSession
-//*****************************************************************************
-
-class nsPrintSession : public nsIPrintSession,
-                       public nsSupportsWeakReference
-{
-  virtual ~nsPrintSession();
-
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIPRINTSESSION
-
-  nsPrintSession();
-  
-  virtual nsresult Init();
-
-private:
-  RefPtr<mozilla::layout::RemotePrintJobChild> mRemotePrintJob;
-};
-
-#endif // nsPrintSession_h__
--- a/widget/nsPrintSettingsImpl.cpp
+++ b/widget/nsPrintSettingsImpl.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsPrintSettingsImpl.h"
 #include "nsReadableUtils.h"
-#include "nsIPrintSession.h"
 #include "mozilla/RefPtr.h"
 
 #define DEFAULT_MARGIN_WIDTH 0.5
 
 NS_IMPL_ISUPPORTS(nsPrintSettings, nsIPrintSettings)
 
 nsPrintSettings::nsPrintSettings() :
   mPrintOptions(0L),
@@ -63,44 +62,16 @@ nsPrintSettings::nsPrintSettings(const n
 {
   *this = aPS;
 }
 
 nsPrintSettings::~nsPrintSettings()
 {
 }
 
-NS_IMETHODIMP nsPrintSettings::GetPrintSession(nsIPrintSession **aPrintSession)
-{
-  NS_ENSURE_ARG_POINTER(aPrintSession);
-  *aPrintSession = nullptr;
-  
-  nsCOMPtr<nsIPrintSession> session = do_QueryReferent(mSession);
-  if (!session)
-    return NS_ERROR_NOT_INITIALIZED;
-  *aPrintSession = session;
-  NS_ADDREF(*aPrintSession);
-  return NS_OK;
-}
-NS_IMETHODIMP nsPrintSettings::SetPrintSession(nsIPrintSession *aPrintSession)
-{
-  // Clearing it by passing nullptr is not allowed. That's why we
-  // use a weak ref so that it doesn't have to be cleared.
-  NS_ENSURE_ARG(aPrintSession);
-  
-  mSession = do_GetWeakReference(aPrintSession);
-  if (!mSession) {
-    // This may happen if the implementation of this object does
-    // not support weak references - programmer error.
-    NS_ERROR("Could not get a weak reference from aPrintSession");
-    return NS_ERROR_FAILURE;
-  }
-  return NS_OK;
-}
-
 NS_IMETHODIMP nsPrintSettings::GetStartPageRange(int32_t *aStartPageRange)
 {
   //NS_ENSURE_ARG_POINTER(aStartPageRange);
   *aStartPageRange = mStartPageNum;
   return NS_OK;
 }
 NS_IMETHODIMP nsPrintSettings::SetStartPageRange(int32_t aStartPageRange)
 {
--- a/widget/nsPrintSettingsService.cpp
+++ b/widget/nsPrintSettingsService.cpp
@@ -7,17 +7,16 @@
 
 #include "mozilla/embedding/PPrinting.h"
 #include "mozilla/layout/RemotePrintJobChild.h"
 #include "mozilla/RefPtr.h"
 #include "nsIPrinterEnumerator.h"
 #include "nsPrintingProxy.h"
 #include "nsReadableUtils.h"
 #include "nsPrintSettingsImpl.h"
-#include "nsIPrintSession.h"
 #include "nsServiceManagerUtils.h"
 
 #include "nsArray.h"
 #include "nsIDOMWindow.h"
 #include "nsIDialogParamBlock.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIWindowWatcher.h"
@@ -198,22 +197,16 @@ nsPrintSettingsService::SerializeToPrint
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintSettingsService::DeserializeToPrintSettings(const PrintData& data,
                                                    nsIPrintSettings* settings)
 {
-  nsCOMPtr<nsIPrintSession> session;
-  nsresult rv = settings->GetPrintSession(getter_AddRefs(session));
-  if (NS_SUCCEEDED(rv) && session) {
-    session->SetRemotePrintJob(
-      static_cast<RemotePrintJobChild*>(data.remotePrintJobChild()));
-  }
   settings->SetStartPageRange(data.startPageRange());
   settings->SetEndPageRange(data.endPageRange());
 
   settings->SetEdgeTop(data.edgeTop());
   settings->SetEdgeLeft(data.edgeLeft());
   settings->SetEdgeBottom(data.edgeBottom());
   settings->SetEdgeRight(data.edgeRight());
 
--- a/widget/nsWidgetsCID.h
+++ b/widget/nsWidgetsCID.h
@@ -165,20 +165,16 @@
 #define NS_PRINTSETTINGSSERVICE_CID \
 { 0x841387c8, 0x72e6, 0x484b, \
 { 0x92, 0x96, 0xbf, 0x6e, 0xea, 0x80, 0xd5, 0x8a } }
 
 #define NS_PRINTER_ENUMERATOR_CID \
 { 0xa6cf9129, 0x15b3, 0x11d2, \
 { 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
 
-#define NS_PRINTSESSION_CID \
-{ 0x2f977d53, 0x5485, 0x11d4, \
-{ 0x87, 0xe2, 0x00, 0x10, 0xa4, 0xe7, 0x5e, 0xf2 } }
-
 #define NS_PRINTDIALOGSERVICE_CID \
 { 0x06beec76, 0xa183, 0x4d9f, \
 { 0x85, 0xdd, 0x08, 0x5f, 0x26, 0xda, 0x56, 0x5a } }
 
 #define NS_GFXINFO_CID \
 { 0xd755a760, 0x9f27, 0x11df, \
 { 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66, 0x42, 0x42 } }
 
--- a/widget/windows/nsWidgetFactory.cpp
+++ b/widget/windows/nsWidgetFactory.cpp
@@ -46,17 +46,16 @@
 #include "JumpListItem.h"
 
 #include "WindowsUIUtils.h"
 
 #ifdef NS_PRINTING
 #include "nsDeviceContextSpecWin.h"
 #include "nsPrintDialogWin.h"
 #include "nsPrintSettingsServiceWin.h"
-#include "nsPrintSession.h"
 #endif
 
 using namespace mozilla;
 using namespace mozilla::widget;
 
 static nsresult
 WindowConstructor(nsISupports *aOuter, REFNSIID aIID,
                   void **aResult)
@@ -137,17 +136,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransfe
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLFormatConverter)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
 NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarPreviewCallback)
 #ifdef NS_PRINTING
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceWin, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSettingsServiceWin, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceContextSpecWin)
 #endif
 
 namespace mozilla {
 namespace widget {
 // This constructor should really be shared with all platforms.
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(GfxInfo, Init)
 }
@@ -176,17 +174,16 @@ NS_DEFINE_NAMED_CID(NS_WIN_JUMPLISTSHORT
 NS_DEFINE_NAMED_CID(NS_WINDOWS_UIUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
 NS_DEFINE_NAMED_CID(NS_TASKBARPREVIEWCALLBACK_CID);
 #ifdef NS_PRINTING
 NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
-NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_DEVICE_CONTEXT_SPEC_CID);
 #endif
 
 
 static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
   { &kNS_WINDOW_CID, false, nullptr, WindowConstructor },
   { &kNS_CHILD_CID, false, nullptr, ChildWindowConstructor },
   { &kNS_FILEPICKER_CID, false, nullptr, FilePickerConstructor, Module::MAIN_PROCESS_ONLY },
@@ -211,17 +208,16 @@ static const mozilla::Module::CIDEntry k
   { &kNS_WINDOWS_UIUTILS_CID, false, nullptr, WindowsUIUtilsConstructor },
   { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor, Module::MAIN_PROCESS_ONLY },
   { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor, Module::MAIN_PROCESS_ONLY },
   { &kNS_TASKBARPREVIEWCALLBACK_CID, false, nullptr, TaskbarPreviewCallbackConstructor },
 #ifdef NS_PRINTING
   { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceWinConstructor, Module::MAIN_PROCESS_ONLY },
   { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintSettingsServiceWinConstructor },
   { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorWinConstructor },
-  { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
   { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecWinConstructor },
 #endif
   { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
   { "@mozilla.org/widgets/window/win;1", &kNS_WINDOW_CID },
   { "@mozilla.org/widgets/child_window/win;1", &kNS_CHILD_CID },
@@ -246,17 +242,16 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/windows-ui-utils;1", &kNS_WINDOWS_UIUTILS_CID },
   { "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::MAIN_PROCESS_ONLY },
   { "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID, Module::MAIN_PROCESS_ONLY },
   { "@mozilla.org/widget/taskbar-preview-callback;1", &kNS_TASKBARPREVIEWCALLBACK_CID },
 #ifdef NS_PRINTING
   { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
   { "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
   { "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
-  { "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },
   { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
 #endif
   { nullptr }
 };
 
 static void
 nsWidgetWindowsModuleDtor()
 {