Bug 847181: prune unused printing-related nsresult codes, make printing error codes available in Components.results, and improve English of printing error messages. r=smaug
authorZack Weinberg <zackw@panix.com>
Fri, 08 Mar 2013 21:45:14 -0500
changeset 124286 071aab148869265c6bb2faab13540b41d7449c1d
parent 124285 1125469c5134b7db29c0b8724195ff8c17997065
child 124287 e6d2b2cdbed423ca63e495d3b296c0e74d163f19
push id24329
push userzackw@panix.com
push dateSat, 09 Mar 2013 02:45:29 +0000
treeherdermozilla-inbound@071aab148869 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs847181
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 847181: prune unused printing-related nsresult codes, make printing error codes available in Components.results, and improve English of printing error messages. r=smaug
dom/locales/en-US/chrome/layout/printing.properties
js/xpconnect/src/xpc.msg
layout/printing/nsPrintEngine.cpp
widget/windows/nsDeviceContextSpecWin.cpp
xpcom/base/ErrorList.h
--- a/dom/locales/en-US/chrome/layout/printing.properties
+++ b/dom/locales/en-US/chrome/layout/printing.properties
@@ -1,73 +1,56 @@
 # 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/.
 
-# Page number formating
+# Page number formatting
 ## @page_number The current page number
 #LOCALIZATION NOTE (pageofpages): Do not translate %ld in the following line.
 # Place the word %ld where the page number and number of pages should be
 # The first %ld will receive the the page number
 pagenumber=%1$d
 
-# Page number formating
+# Page number formatting
 ## @page_number The current page number
 ## @page_total The total number of pages
 #LOCALIZATION NOTE (pageofpages): Do not translate %ld in the following line.
 # Place the word %ld where the page number and number of pages should be
 # The first %ld will receive the the page number
 # the second %ld will receive the total number of pages
 pageofpages=%1$d of %2$d
 
+noprinter=No printers available.
+PrintToFile=Print To File
 noPrintFilename.title=Filename is missing
-noPrintFilename.alert=You have selected "Print To: File", and the filename is empty!
-
-# File confirm
+noPrintFilename.alert=You have selected "Print To File", and the filename is empty!
 fileConfirm.exists=%S already exists.\nDo you want to replace it?
-
-# Print error codes
 print_error_dialog_title=Printer Error
 printpreview_error_dialog_title=Print Preview Error
-NS_ERROR_GFX_PRINTER_CMD_NOT_FOUND=There was a problem printing. The printer doesn't support a printing command.
-NS_ERROR_GFX_PRINTER_CMD_FAILURE=There was a problem printing. An instruction that was sent to the printer failed.
-NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE=There was a problem printing. No printer could be found.
-NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND=There was a problem printing. The printer could not be found.
-NS_ERROR_GFX_PRINTER_ACCESS_DENIED=There was a problem printing. Access to the printer was denied.
-NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE=There was a problem printing. Tried to set an invalid printer attribute.
-NS_ERROR_GFX_PRINTER_PRINTER_NOT_READY=There was a problem printing. The printer not ready.
-NS_ERROR_GFX_PRINTER_OUT_OF_PAPER=There was a problem printing. The printer is out of paper.
-NS_ERROR_GFX_PRINTER_PRINTER_IO_ERROR=There was a problem printing. Printer I/O error.
-NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE=There was a problem printing. The output file could not be opened.
-NS_ERROR_GFX_PRINTER_FILE_IO_ERROR=There was an error writing the printing output file.
-NS_ERROR_GFX_PRINTER_PRINTPREVIEW=There must be at least one printer available to show Print Preview.
-NS_ERROR_UNEXPECTED=There was an unexpected problem when printing.
-NS_ERROR_OUT_OF_MEMORY=There was a problem printing. There is not enough free memory to print.
-NS_ERROR_NOT_IMPLEMENTED=Some printing functionality is not implemented yet.
-NS_ERROR_NOT_AVAILABLE=Not available
+
+# Print error codes.
+#LOCALIZATION NOTE: Some of these are generic error codes which you may have
+# already translated a generic error message for.  Please do not reuse that
+# error message in this context; we want to be more specific when we know
+# the error has to do with printing.
+#
+# Any of these messages can be made print-preview-specific by adding a
+# _PP suffix to the label.
+NS_ERROR_FAILURE=An error occurred while printing.
+
 NS_ERROR_ABORT=The print job was aborted, or canceled.
-NS_ERROR_FAILURE=An unknown error occurred while printing.
-NS_ERROR_GFX_PRINTER_STARTDOC=Printing failed when starting the document.
-NS_ERROR_GFX_PRINTER_ENDDOC=Printing failed when completing the document.
-NS_ERROR_GFX_PRINTER_STARTPAGE=Printing failed when starting the page.
-NS_ERROR_GFX_PRINTER_ENDPAGE=Printing failed when completing the page.
-NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW=You cannot print while in print preview.
-NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED=There was a problem printing because the paper size you specified is not supported by your printer.
-NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED=There was a problem printing because the page orientation you specified is not supported by your printer.
-NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED=There was a problem printing because the print job requires color capabilities that your printer does not support.
-NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES=There was a problem printing because you requested too many copies.
-NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR=There was a problem printing. The printer driver is not properly configured.
-NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP=The browser cannot print preview right now.\nPlease try again when the page has finished loading.
-NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED=The page was replaced while you were trying to print.\nPlease try again.
-NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT=Either pluggable dialogs were not properly installed\nOr this GFX Toolkit no longer supports native Print Dialogs
-NS_ERROR_GFX_NO_PRINTROMPTSERVICE=The Printing Prompt Service is missing.
-NS_ERROR_GFX_PRINTER_NO_XUL=We are unable to Print or Print Preview this page.
-NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED=There was a problem printing because the plex mode you specified is not supported by your printer.
-NS_ERROR_GFX_PRINTER_DOC_IS_BUSY=The browser cannot print the document while it is being loaded.
-NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED=Printing is not implemented.
-NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE=The requested print module cannot be loaded.
-NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED=There was a problem printing because the resolution/quality mode you specified is not supported by your printer.
+NS_ERROR_NOT_AVAILABLE=Some printing functionality is not currently available.
+NS_ERROR_NOT_IMPLEMENTED=Some printing functionality is not implemented yet.
+NS_ERROR_OUT_OF_MEMORY=There is not enough free memory to print.
+NS_ERROR_UNEXPECTED=There was an unexpected problem while printing.
 
-# No printers available
-noprinter=No printers available.
-PrintToFile=Print To File
+NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE=No printers available.
+NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE_PP=No printers available, cannot show print preview.
+NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND=The selected printer could not be found.
+NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE=Failed to open output file for print to file.
+NS_ERROR_GFX_PRINTER_STARTDOC=Printing failed while starting the print job.
+NS_ERROR_GFX_PRINTER_ENDDOC=Printing failed while completing the print job.
+NS_ERROR_GFX_PRINTER_STARTPAGE=Printing failed while starting a new page.
+NS_ERROR_GFX_PRINTER_DOC_IS_BUSY=Cannot print this document yet, it is still being loaded.
+NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP=Cannot print-preview this document yet, it is still being loaded.
+NS_ERROR_GFX_PRINTER_NO_XUL=Printing XUL documents is not supported.
+
 # EOF.
-
--- a/js/xpconnect/src/xpc.msg
+++ b/js/xpconnect/src/xpc.msg
@@ -193,8 +193,18 @@ XPC_MSG_DEF(NS_ERROR_ILLEGAL_INPUT      
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_NOT_SIGNED          , "The JAR is not signed.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_MODIFIED_ENTRY      , "An entry in the JAR has been modified after the JAR was signed.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_UNSIGNED_ENTRY      , "An entry in the JAR has not been signed.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_ENTRY_MISSING       , "An entry is missing from the JAR file.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_WRONG_SIGNATURE     , "The JAR's signature is wrong.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_ENTRY_TOO_LARGE     , "An entry in the JAR is too large.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_ENTRY_INVALID       , "An entry in the JAR is invalid.")
 XPC_MSG_DEF(NS_ERROR_SIGNED_JAR_MANIFEST_INVALID    , "The JAR's manifest or signature file is invalid.")
+
+/* Codes for printing-related errors. */
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE , "No printers available.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND       , "The selected printer could not be found.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE  , "Failed to open output file for print to file.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_STARTDOC             , "Printing failed while starting the print job.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_ENDDOC               , "Printing failed while completing the print job.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_STARTPAGE            , "Printing failed while starting a new page.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY          , "Cannot print this document yet, it is still being loaded.")
+XPC_MSG_DEF(NS_ERROR_GFX_PRINTER_NO_XUL               , "Printing XUL documents is not supported.") // bugs 136185 & 240490
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -631,17 +631,18 @@ nsPrintEngine::DoCommonPrint(bool       
           }
         } else if (rv == NS_ERROR_NOT_IMPLEMENTED) {
           // This means the Dialog service was there,
           // but they choose not to implement this dialog and
           // are looking for default behavior from the toolkit
           rv = NS_OK;
         }
       } else {
-        rv = NS_ERROR_GFX_NO_PRINTROMPTSERVICE;
+        // No dialog service available
+        rv = NS_ERROR_NOT_IMPLEMENTED;
       }
     } else {
       // Call any code that requires a run of the event loop.
       rv = mPrt->mPrintSettings->SetupSilentPrinting();
     }
     // Check explicitly for abort because it's expected
     if (rv == NS_ERROR_ABORT) 
       return rv;
@@ -782,17 +783,17 @@ nsPrintEngine::PrintPreview(nsIPrintSett
   // (We can't Print Preview this document if it is still busy)
   nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
   NS_ENSURE_STATE(docShell);
 
   uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
   if (NS_FAILED(docShell->GetBusyFlags(&busyFlags)) ||
       busyFlags != nsIDocShell::BUSY_FLAGS_NONE) {
     CloseProgressDialog(aWebProgressListener);
-    ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP, false);
+    ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY, false);
     return NS_ERROR_FAILURE;
   }
 
   NS_ENSURE_STATE(aChildDOMWin);
   nsCOMPtr<nsIDOMDocument> doc;
   aChildDOMWin->GetDocument(getter_AddRefs(doc));
   NS_ENSURE_STATE(doc);
 
@@ -1566,103 +1567,88 @@ nsresult nsPrintEngine::CleanupOnFailure
   return aResult;
 
 }
 
 //---------------------------------------------------------------------
 void
 nsPrintEngine::ShowPrintErrorDialog(nsresult aPrintError, bool aIsPrinting)
 {
-
-  PR_PL(("nsPrintEngine::ShowPrintErrorDialog(nsresult aPrintError=%lx, bool aIsPrinting=%d)\n", (long)aPrintError, (int)aIsPrinting));
-
   nsAutoCString stringName;
+  nsXPIDLString msg, title;
+  nsresult rv = NS_OK;
 
   switch(aPrintError)
   {
 #define NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(nserr) case nserr: stringName.AssignLiteral(#nserr); break;
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_CMD_NOT_FOUND)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_CMD_FAILURE)
+
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE)
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_ACCESS_DENIED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PRINTER_NOT_READY)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_OUT_OF_PAPER)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PRINTER_IO_ERROR)
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_FILE_IO_ERROR)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PRINTPREVIEW)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_UNEXPECTED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_OUT_OF_MEMORY)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_NOT_IMPLEMENTED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_NOT_AVAILABLE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_ABORT)
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_STARTDOC)
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_ENDDOC)
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_STARTPAGE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_ENDPAGE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_NO_PRINTROMPTSERVICE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NO_XUL)   // Temporary code for Bug 136185 / bug 240490
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED)
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE)
-      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED)
-
+      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_NO_XUL)  // bug 136185 / bug 240490
+
+      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_ABORT)
+      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_NOT_AVAILABLE)
+      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_NOT_IMPLEMENTED)
+      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_OUT_OF_MEMORY)
+      NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_UNEXPECTED)
     default:
       NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE)
+
 #undef NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG
   }
 
-  PR_PL(("ShowPrintErrorDialog:  stringName='%s'\n", stringName.get()));
-
-  nsXPIDLString msg, title;
-  nsresult rv =
-    nsContentUtils::GetLocalizedString(nsContentUtils::ePRINTING_PROPERTIES,
-                                       stringName.get(), msg);
+  if (!aIsPrinting) {
+    // Try first with _PP suffix.
+    stringName.AppendLiteral("_PP");
+    rv = nsContentUtils::GetLocalizedString(
+             nsContentUtils::ePRINTING_PROPERTIES, stringName.get(), msg);
+    if (NS_FAILED(rv)) {
+      stringName.Truncate(stringName.Length() - 3);
+    }
+  }
+  if (aIsPrinting || NS_FAILED(rv)) {
+    rv = nsContentUtils::GetLocalizedString(
+             nsContentUtils::ePRINTING_PROPERTIES, stringName.get(), msg);
+  }
   if (NS_FAILED(rv)) {
-    PR_PL(("GetLocalizedString failed\n"));
     return;
   }
 
-  rv = nsContentUtils::GetLocalizedString(nsContentUtils::ePRINTING_PROPERTIES,
-      aIsPrinting ? "print_error_dialog_title"
-                  : "printpreview_error_dialog_title",
-      title);
-
-  nsCOMPtr<nsIWindowWatcher> wwatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
+  rv = nsContentUtils::GetLocalizedString(
+           nsContentUtils::ePRINTING_PROPERTIES,
+           aIsPrinting ? "print_error_dialog_title"
+                       : "printpreview_error_dialog_title",
+           title);
   if (NS_FAILED(rv)) {
-    PR_PL(("ShowPrintErrorDialog(): wwatch==nullptr\n"));
+    return;
+  }
+
+  nsCOMPtr<nsIWindowWatcher> wwatch =
+    do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
+  if (NS_FAILED(rv)) {
     return;
   }
 
   nsCOMPtr<nsIDOMWindow> active;
   wwatch->GetActiveWindow(getter_AddRefs(active));
 
   nsCOMPtr<nsIPrompt> dialog;
-  /* |GetNewPrompter| allows that |active| is |nullptr| 
+  /* |GetNewPrompter| allows that |active| is |nullptr|
    * (see bug 234982 ("nsPrintEngine::ShowPrintErrorDialog() fails in many cases")) */
   wwatch->GetNewPrompter(active, getter_AddRefs(dialog));
   if (!dialog) {
-    PR_PL(("ShowPrintErrorDialog(): dialog==nullptr\n"));
     return;
   }
 
   dialog->Alert(title.get(), msg.get());
-  PR_PL(("ShowPrintErrorDialog(): alert displayed successfully.\n"));
 }
 
 //-----------------------------------------------------------------
 //-- Section: Reflow Methods
 //-----------------------------------------------------------------
 
 nsresult
 nsPrintEngine::ReconstructAndReflow(bool doSetPixelScale)
--- a/widget/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/windows/nsDeviceContextSpecWin.cpp
@@ -360,24 +360,23 @@ CheckForPrintToFile(nsIPrintSettings* aP
   aPS->SetPrintToFile(toFile);
   if (toFile) {
     rv = GetFileNameForPrintSettings(aPS);
   }
   return rv;
 }
 
 //----------------------------------------------------------------------------------
-NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget, 
+NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget,
                                            nsIPrintSettings* aPrintSettings,
                                            bool aIsPrintPreview)
 {
   mPrintSettings = aPrintSettings;
 
-  nsresult rv = aIsPrintPreview ? NS_ERROR_GFX_PRINTER_PRINTPREVIEW : 
-                                  NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
+  nsresult rv = NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE;
   if (aPrintSettings) {
     nsCOMPtr<nsIPrintSettingsWin> psWin(do_QueryInterface(aPrintSettings));
     if (psWin) {
       PRUnichar* deviceName;
       PRUnichar* driverName;
       psWin->GetDeviceName(&deviceName); // creates new memory (makes a copy)
       psWin->GetDriverName(&driverName); // creates new memory (makes a copy)
 
--- a/xpcom/base/ErrorList.h
+++ b/xpcom/base/ErrorList.h
@@ -88,82 +88,33 @@
   ERROR(NS_BASE_STREAM_WOULD_BLOCK,     FAILURE(7)),
 #undef MODULE
 
 
   /* ======================================================================= */
   /* 3: NS_ERROR_MODULE_GFX */
   /* ======================================================================= */
 #define MODULE NS_ERROR_MODULE_GFX
-  /* error codes for printer device contexts */
-  /* Unix: print command (lp/lpr) not found */
-  ERROR(NS_ERROR_GFX_PRINTER_CMD_NOT_FOUND,               FAILURE(2)),
-  /* Unix: print command returned an error */
-  ERROR(NS_ERROR_GFX_PRINTER_CMD_FAILURE,                 FAILURE(3)),
   /* no printer available (e.g. cannot find _any_ printer) */
-  ERROR(NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE,        FAILURE(4)),
+  ERROR(NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE,        FAILURE(1)),
   /* _specified_ (by name) printer not found */
-  ERROR(NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND,              FAILURE(5)),
-  /* access to printer denied */
-  ERROR(NS_ERROR_GFX_PRINTER_ACCESS_DENIED,               FAILURE(6)),
-  /* invalid printer attribute (for example: unsupported paper size etc.) */
-  ERROR(NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE,           FAILURE(7)),
-  /* printer not "ready" (offline ?) */
-  ERROR(NS_ERROR_GFX_PRINTER_PRINTER_NOT_READY,           FAILURE(9)),
-  /* printer out of paper */
-  ERROR(NS_ERROR_GFX_PRINTER_OUT_OF_PAPER,                FAILURE(10)),
-  /* generic printer I/O error */
-  ERROR(NS_ERROR_GFX_PRINTER_PRINTER_IO_ERROR,            FAILURE(11)),
+  ERROR(NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND,              FAILURE(2)),
   /* print-to-file: could not open output file */
-  ERROR(NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE,         FAILURE(12)),
-  /* print-to-file: I/O error while printing to file */
-  ERROR(NS_ERROR_GFX_PRINTER_FILE_IO_ERROR,               FAILURE(13)),
-  /* print preview: needs at least one printer */
-  ERROR(NS_ERROR_GFX_PRINTER_PRINTPREVIEW,                FAILURE(14)),
+  ERROR(NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE,         FAILURE(3)),
   /* print: starting document */
-  ERROR(NS_ERROR_GFX_PRINTER_STARTDOC,                    FAILURE(15)),
+  ERROR(NS_ERROR_GFX_PRINTER_STARTDOC,                    FAILURE(4)),
   /* print: ending document */
-  ERROR(NS_ERROR_GFX_PRINTER_ENDDOC,                      FAILURE(16)),
+  ERROR(NS_ERROR_GFX_PRINTER_ENDDOC,                      FAILURE(5)),
   /* print: starting page */
-  ERROR(NS_ERROR_GFX_PRINTER_STARTPAGE,                   FAILURE(17)),
-  /* print: ending page */
-  ERROR(NS_ERROR_GFX_PRINTER_ENDPAGE,                     FAILURE(18)),
-  /* print: print while in print preview */
-  ERROR(NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW,         FAILURE(19)),
-  /* requested page size not supported by printer */
-  ERROR(NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED,    FAILURE(20)),
-  /* requested page orientation not supported */
-  ERROR(NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED,   FAILURE(21)),
-  /* requested colorspace not supported (like printing "color" on a
-     "grayscale"-only printer) */
-  ERROR(NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED,    FAILURE(22)),
-  /* too many copies requested */
-  ERROR(NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES,             FAILURE(23)),
-  /* driver configuration error */
-  ERROR(NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR,  FAILURE(24)),
-  /* The document is still being loaded, can't Print Preview */
-  ERROR(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP,              FAILURE(25)),
-  /* The document was asked to be destroyed while we were preparing printing */
-  ERROR(NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED,           FAILURE(26)),
-  /* Cannot Print or Print Preview XUL Documents */
-  ERROR(NS_ERROR_GFX_PRINTER_NO_XUL,                      FAILURE(27)),
-  /* The toolkit no longer supports the Print Dialog (for embedders) */
-  ERROR(NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT,           FAILURE(28)),
-  /* The was wasn't any Print Prompt service registered (this shouldn't happen) */
-  ERROR(NS_ERROR_GFX_NO_PRINTROMPTSERVICE,                FAILURE(29)),
-  /* requested plex mode not supported by printer */
-  ERROR(NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED,          FAILURE(30)),
+  ERROR(NS_ERROR_GFX_PRINTER_STARTPAGE,                   FAILURE(6)),
   /* The document is still being loaded */
-  ERROR(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY,                 FAILURE(31)),
-  /* Printing is not implemented */
-  ERROR(NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED,            FAILURE(32)),
-  /* Cannot load the matching print module */
-  ERROR(NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE,         FAILURE(33)),
-  /* requested resolution/quality mode not supported by printer */
-  ERROR(NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED,    FAILURE(34)),
+  ERROR(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY,                 FAILURE(7)),
+  /* Cannot Print or Print Preview XUL Documents (bug 136185 / bug 240490) */
+  ERROR(NS_ERROR_GFX_PRINTER_NO_XUL,                      FAILURE(8)),
+
   /* Font cmap is strangely structured - avoid this font! */
   ERROR(NS_ERROR_GFX_CMAP_MALFORMED,                      FAILURE(51)),
 #undef MODULE
 
 
   /* ======================================================================= */
   /* 6: NS_ERROR_MODULE_NETWORK */
   /* ======================================================================= */