The real fix is to enable the printing of XUL docs, which is what is crashing.

The best we can do right now is not print XUL Docs. This patch checks to see if
it is a XUL document and if it is it idsplay a dialog and and doesn't Print or
Print Preview.
Bug 136185 r=dcone sr=attinasi
This commit is contained in:
rods%netscape.com 2002-04-11 00:45:11 +00:00
parent 6afe706be3
commit 56c0612f03
4 changed files with 34 additions and 0 deletions

View File

@ -105,6 +105,7 @@
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIXULDocument.h" // Temporary code for Bug 136185
#include "nsIChromeRegistry.h"
@ -5891,6 +5892,13 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings)
{
if (mIsDoingPrinting) return NS_ERROR_FAILURE;
// Temporary code for Bug 136185
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (xulDoc) {
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_NO_XUL, PR_FALSE);
return NS_OK;
}
// Get the webshell for this documentviewer
nsCOMPtr<nsIWebShell> webContainer(do_QueryInterface(mContainer));
// Get the DocShell and see if it is busy
@ -6262,6 +6270,12 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
gDumpLOFileNameCnt = 0;
#endif
// Temporary code for Bug 136185
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (xulDoc) {
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_NO_XUL);
return NS_OK;
}
nsresult rv = NS_ERROR_FAILURE;
@ -6713,6 +6727,7 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT)
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_PRINTER_NO_XUL) // Temporary code for Bug 136185
default:
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE)

View File

@ -135,6 +135,9 @@ typedef void * nsNativeDeviceContext;
/* The document was asked to be destroyed while we were preparing printing */
#define NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+26)
/* Cannot Print or Print Preview XUL Documents */
#define NS_ERROR_GFX_PRINTER_NO_XUL \
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27)
/**

View File

@ -105,6 +105,7 @@
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIXULDocument.h" // Temporary code for Bug 136185
#include "nsIChromeRegistry.h"
@ -5891,6 +5892,13 @@ DocumentViewerImpl::PrintPreview(nsIPrintSettings* aPrintSettings)
{
if (mIsDoingPrinting) return NS_ERROR_FAILURE;
// Temporary code for Bug 136185
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (xulDoc) {
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_NO_XUL, PR_FALSE);
return NS_OK;
}
// Get the webshell for this documentviewer
nsCOMPtr<nsIWebShell> webContainer(do_QueryInterface(mContainer));
// Get the DocShell and see if it is busy
@ -6262,6 +6270,12 @@ DocumentViewerImpl::Print(nsIPrintSettings* aPrintSettings,
gDumpLOFileNameCnt = 0;
#endif
// Temporary code for Bug 136185
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
if (xulDoc) {
ShowPrintErrorDialog(NS_ERROR_GFX_PRINTER_NO_XUL);
return NS_OK;
}
nsresult rv = NS_ERROR_FAILURE;
@ -6713,6 +6727,7 @@ DocumentViewerImpl::ShowPrintErrorDialog(nsresult aPrintError, PRBool aIsPrintin
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT)
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_PRINTER_NO_XUL) // Temporary code for Bug 136185
default:
NS_ERROR_TO_LOCALIZED_PRINT_ERROR_MSG(NS_ERROR_FAILURE)

View File

@ -80,6 +80,7 @@ NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR=There was a problem printing. Th
NS_ERROR_GFX_PRINTER_XPRINT_BROKEN_XPRT=A broken version of the X print server (Xprt) has been detected. Note that printing using this Xprt server may not work properly. Please contact the server vendor for a fixed version.
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_PRINTER_NO_XUL=We are unable to Print or Print Preview this page.
# No printers available
noprinter=No printers available.
# EOF.