Skip to content

Commit

Permalink
Bug 1652318. Freeze docshell tree navigation at the same time for bot…
Browse files Browse the repository at this point in the history
…h print and print preview. r=bobowen

I specifically want to move this to happen before the static clone is made, in
preparation for splitting out the static clone logic from DoCommonPrint.

Differential Revision: https://phabricator.services.mozilla.com/D83260
  • Loading branch information
jwatt committed Jul 12, 2020
1 parent 683a0aa commit 6afa57b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions layout/printing/nsPrintJob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,16 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
nsCOMPtr<nsIPrintingPromptService> 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
Expand All @@ -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.
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 6afa57b

Please sign in to comment.