diff --git a/layout/printing/nsPrintJob.cpp b/layout/printing/nsPrintJob.cpp index e7657f7ac8ea5..b8316551c79d9 100644 --- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -578,8 +578,16 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview, nsCOMPtr pps( do_QueryInterface(aWebProgressListener)); mProgressDialogIsShown = pps != nullptr; + + mIsCreatingPrintPreview = true; + + // ensures docShell tree navigation in frozen + SetIsPrintPreview(true); } else { mProgressDialogIsShown = false; + + // ensures docShell tree navigation in frozen + SetIsPrinting(true); } // Grab the new instance with local variable to guarantee that it won't be @@ -606,9 +614,6 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview, // to mPrtPreview once we've finish creating the print preview. We must // clear mPtrPreview so that code will use mPtr until that happens. mPrtPreview = nullptr; - - mIsCreatingPrintPreview = true; - SetIsPrintPreview(true); } // Create a print session and let the print settings know about it. @@ -687,10 +692,6 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview, return NS_ERROR_FAILURE; } - if (!aIsPrintPreview) { - SetIsPrinting(true); - } - // XXX This isn't really correct... if (!printData->mPrintObject->mDocument || !printData->mPrintObject->mDocument->GetRootElement())