From 913d6b76eeb484f8743c653ca7939f0fec257505 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Wed, 29 May 2019 10:42:14 +0100 Subject: [PATCH] Bug 1557687. Remove nsPrintData::mDocWasToBeDestroyed. r=bobowen This shows that this variable has never been read going back all the way to the original Mercurial import in 2007: hg grep -f --diff mDocWasToBeDestroyed layout/printing/ns* Differential Revision: https://phabricator.services.mozilla.com/D34143 --HG-- extra : rebase_source : c14a51dab1825e26fb8031d291d2c69e78931c84 extra : amend_source : 73794b07d703987db8d2eb49dd97d74b1a9be325 --- layout/printing/nsPrintData.cpp | 1 - layout/printing/nsPrintData.h | 12 ++---------- layout/printing/nsPrintJob.cpp | 9 --------- layout/printing/nsPrintJob.h | 3 ++- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/layout/printing/nsPrintData.cpp b/layout/printing/nsPrintData.cpp index 4b19405d8e2e..fcf1b0857883 100644 --- a/layout/printing/nsPrintData.cpp +++ b/layout/printing/nsPrintData.cpp @@ -33,7 +33,6 @@ nsPrintData::nsPrintData(ePrintDataType aType) mOnStartSent(false), mIsAborted(false), mPreparingForPrint(false), - mDocWasToBeDestroyed(false), mShrinkToFit(false), mNumPrintablePages(0), mNumPagesPrinted(0), diff --git a/layout/printing/nsPrintData.h b/layout/printing/nsPrintData.h index 17738dd5c1e9..fb7936fb622d 100644 --- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -31,13 +31,6 @@ class PrintPreviewUserEventSuppressor; // mPreparingForPrint - indicates that we have started Printing but // have not gone to the timer to start printing the pages. It gets turned // off right before we go to the timer. -// -// mDocWasToBeDestroyed - Gets set when "someone" tries to unload the document -// while we were prparing to Print. This typically happens if a user starts -// to print while a page is still loading. If they start printing and pause -// at the print dialog and then the page comes in, we then abort printing -// because the document is no longer stable. -// //------------------------------------------------------------------------ class nsPrintData { typedef mozilla::PrintPreviewUserEventSuppressor @@ -77,9 +70,8 @@ class nsPrintData { bool mIsIFrameSelected; bool mIsParentAFrameSet; bool mOnStartSent; - bool mIsAborted; // tells us the document is being aborted - bool mPreparingForPrint; // see comments above - bool mDocWasToBeDestroyed; // see comments above + bool mIsAborted; // tells us the document is being aborted + bool mPreparingForPrint; // see comments above bool mShrinkToFit; int32_t mNumPrintablePages; int32_t mNumPagesPrinted; diff --git a/layout/printing/nsPrintJob.cpp b/layout/printing/nsPrintJob.cpp index d8b31052658f..98c3d520cdab 100644 --- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -630,15 +630,6 @@ nsresult nsPrintJob::Initialize(nsIDocumentViewerPrint* aDocViewerPrint, return NS_OK; } -//------------------------------------------------------- -bool nsPrintJob::CheckBeforeDestroy() { - if (mPrt && mPrt->mPreparingForPrint) { - mPrt->mDocWasToBeDestroyed = true; - return true; - } - return false; -} - //------------------------------------------------------- nsresult nsPrintJob::Cancel() { if (mPrt && mPrt->mPrintSettings) { diff --git a/layout/printing/nsPrintJob.h b/layout/printing/nsPrintJob.h index e7936e1631b2..76c5a7df19b7 100644 --- a/layout/printing/nsPrintJob.h +++ b/layout/printing/nsPrintJob.h @@ -208,7 +208,8 @@ class nsPrintJob final : public nsIObserver, nsAString& aTitle, nsAString& aURLStr, eDocTitleDefault aDefType); - bool CheckBeforeDestroy(); + bool CheckBeforeDestroy() const { return mPrt && mPrt->mPreparingForPrint; } + nsresult Cancel(); mozilla::PresShell* GetPrintPreviewPresShell() {