Bug 1274079, ensure that after dispatching beforeprint, we have still valid ContentViewer to print, r=bz

--HG--
extra : rebase_source : c07cf7794d48d4f9b52b2646c18099a33bbea788
This commit is contained in:
Olli Pettay 2016-08-02 21:41:51 +03:00
parent 86f360cd93
commit c8587c2d07

View File

@ -3728,6 +3728,9 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
nsAutoPtr<nsPrintEventDispatcher> beforeAndAfterPrint(
new nsPrintEventDispatcher(doc));
NS_ENSURE_STATE(!GetIsPrinting());
// beforeprint event may have caused ContentViewer to be shutdown.
NS_ENSURE_STATE(mContainer);
NS_ENSURE_STATE(mDeviceContext);
if (!mPrintEngine) {
mPrintEngine = new nsPrintEngine();