Bug 1671131 - Port bug 1669925: Fix printing. r=mkmelin a=wsmwk
authorPing Chen <remotenonsense@gmail.com>
Tue, 20 Oct 2020 13:52:23 +0900
changeset 40165 679d5554749cc4cf10ca2d3749ac2e232d4deac0
parent 40164 bb46efe763d1a47fbb056ff2433ab864ab0ca1e8
child 40166 c051ee7a21c18a12be1a057e6b87e5c84ea395bd
push id2810
push userthunderbird@calypsoblue.org
push dateWed, 21 Oct 2020 01:27:40 +0000
treeherdercomm-beta@c051ee7a21c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, wsmwk
bugs1671131, 1669925
Bug 1671131 - Port bug 1669925: Fix printing. r=mkmelin a=wsmwk
common/src/viewSource.xhtml
editor/ui/composer/content/ComposerCommands.js
mail/base/content/mailWindow.js
mail/components/compose/content/MsgComposeCommands.js
mailnews/base/content/msgPrintEngine.js
--- a/common/src/viewSource.xhtml
+++ b/common/src/viewSource.xhtml
@@ -47,17 +47,17 @@
   <script src="chrome://messenger/content/viewSource.js"/>
   <script src="chrome://messenger/content/viewZoomOverlay.js"/>
   <script src="chrome://global/content/editMenuOverlay.js"/>
 
   <stringbundle id="viewSourceBundle" src="chrome://messenger/locale/viewSource.properties"/>
 
   <command id="cmd_savePage" oncommand="ViewSourceSavePage();"/>
   <command id="cmd_print" oncommand="PrintUtils.printWindow(gBrowser.browsingContext);"/>
-  <command id="cmd_printpreview" oncommand="PrintUtils.printPreview(PrintPreviewListener);"/>
+  <command id="cmd_printpreview" oncommand="PrintUtils.printPreview("viewSource", "PrintPreviewListener);"/>
   <command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
   <command id="cmd_close" oncommand="window.close();"/>
   <command id="cmd_find"
            oncommand="document.getElementById('FindToolbar').onFindCommand();"/>
   <command id="cmd_findAgain"
            oncommand="document.getElementById('FindToolbar').onFindAgainCommand(false);"/>
   <command id="cmd_findPrevious"
            oncommand="document.getElementById('FindToolbar').onFindAgainCommand(true);"/>
--- a/editor/ui/composer/content/ComposerCommands.js
+++ b/editor/ui/composer/content/ComposerCommands.js
@@ -2514,17 +2514,17 @@ var nsPrintPreviewCommand = {
 
   getCommandStateParams(aCommand, aParams, aRefCon) {},
   doCommandParams(aCommand, aParams, aRefCon) {},
 
   doCommand(aCommand) {
     // In editor.js
     SetEditMode(gPreviousNonSourceDisplayMode);
     try {
-      PrintUtils.printPreview(PrintPreviewListener);
+      PrintUtils.printPreview("editor", PrintPreviewListener);
     } catch (e) {}
   },
 };
 
 var nsPrintSetupCommand = {
   isCommandEnabled(aCommand, dummy) {
     return true; // we can always do this
   },
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -747,16 +747,17 @@ nsBrowserAccess.prototype = {
     aTriggeringPrincipal,
     aCsp,
     aSkipLoad
   ) {
     const nsIBrowserDOMWindow = Ci.nsIBrowserDOMWindow;
 
     if (aWhere == nsIBrowserDOMWindow.OPEN_PRINT_BROWSER) {
       let browser = PrintUtils.startPrintWindow(
+        "mailWindow",
         aOpenWindowInfo.parent,
         aOpenWindowInfo
       );
       return browser ? browser.browsingContext : null;
     }
 
     let isExternal = !!(aFlags & nsIBrowserDOMWindow.OPEN_EXTERNAL);
     if (isExternal && aURI && aURI.schemeIs("chrome")) {
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -2586,17 +2586,17 @@ function DoCommandClose() {
 }
 
 function DoCommandPrint() {
   let browser = GetCurrentEditorElement();
   PrintUtils.printWindow(browser.browsingContext);
 }
 
 function DoCommandPrintPreview() {
-  PrintUtils.printPreview(PrintPreviewListener);
+  PrintUtils.printPreview("MsgComposeCommands", PrintPreviewListener);
 }
 
 /**
  * Locks/Unlocks the window widgets while a message is being saved/sent.
  * Locking means to disable all possible items in the window so that
  * the user can't click/activate anything.
  *
  * @param aDisable  true = lock the window. false = unlock the window.
--- a/mailnews/base/content/msgPrintEngine.js
+++ b/mailnews/base/content/msgPrintEngine.js
@@ -78,17 +78,17 @@ function setPPTitle(aTitle) {
     title = msgBundle.getFormattedString("PreviewTitle", [title, brandStr]);
   }
   document.title = title;
 }
 
 // Pref listener constants
 var gStartupPPObserver = {
   observe(subject, topic, prefName) {
-    PrintUtils.printPreview(PrintPreviewListener);
+    PrintUtils.printPreview("msgPrintEngine", PrintPreviewListener);
   },
 };
 
 function ReplaceWithSelection() {
   if (!printOpener.content) {
     return;
   }