Bug 301560, print() from modal dialog crashes browser [@ nsPrintEngine::ShowPrintProgress], r+sr=bz, a=blocking1.9+

This commit is contained in:
Olli.Pettay@helsinki.fi 2007-11-12 04:17:23 -08:00
Родитель 1482c03244
Коммит eddad205bb
1 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -139,6 +139,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIWebBrowserChrome.h"
#include "nsIDocShell.h"
#include "nsIBaseWindow.h"
#include "nsIFrameDebug.h"
@ -971,6 +972,21 @@ nsPrintEngine::ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify)
nsPIDOMWindow *domWin = mDocument->GetWindow();
if (!domWin) return;
nsCOMPtr<nsIDocShellTreeItem> docShellItem =
do_QueryInterface(domWin->GetDocShell());
if (!docShellItem) return;
nsCOMPtr<nsIDocShellTreeOwner> owner;
docShellItem->GetTreeOwner(getter_AddRefs(owner));
nsCOMPtr<nsIWebBrowserChrome> browserChrome = do_GetInterface(owner);
if (!browserChrome) return;
PRBool isModal = PR_TRUE;
browserChrome->IsWindowModal(&isModal);
if (isModal) {
// Showing a print progress dialog when printing a modal window
// isn't supported. See bug 301560.
return;
}
nsCOMPtr<nsIWebProgressListener> printProgressListener;
nsCOMPtr<nsIWebBrowserPrint> wbp(do_QueryInterface(mDocViewerPrint));