gecko-dev/layout/printing
Masayuki Nakano b3926cc517 Bug 1391645 - Make nsPrintEngine::SetupToPrintContent() proceed with the print even when mPrt->mPrintObject->mPresShell and mPrt->mPrintObject->mPresContext are nullptr but mIsCreatingPrintPreview is false r=dholbert
Bug 1376693 added a null-check to bail from print operations if
mPresShell/mPresContext are null, to avoid some null-deref crashes.  However,
it turns out it's possible for these variables to be null under normal
conditions -- for example, when nsPrintEngine is printing documents,
mPrt->mPrintObject->mPresShell and mPrt->mPrintObject->mPresShell can be nullptr
if the document has <frameset> element and it's printing only content of a
<frame> element or all <frame> elements separately.

This special frameset-printing mode can cause these variables to be null;
however, the crash occurred only when mIsCreatingPrintPreview is true.  So,
we should check the variables only when it's true.

Fortunately:
    * the null-deref crashes that Bug 1376693 wanted to avoid were all in code
      that we only visit when mIsCreatingPrintPreview is true (i.e. during print
      preview).
    * this special frameset-printing mode (which causes these variables to be
      null) _cannot be used during print preview_.

So, we can avoid the print-preview-specific crashes without breaking
frameset-printing by simply making our null-check bail-out conditional on
mIsCreatingPrintPreview.

MozReview-Commit-ID: FJ3ynrXTxnI

--HG--
extra : rebase_source : 788ab55840c725dc401007b605c035c053049edf
2017-08-21 14:56:07 +09:00
..
crashtests Bug 1382327 - (reftest) Rename reftest-print to reftest-paged. r=dbaron 2017-07-26 22:53:46 -07:00
ipc Bug 1359490 - add an event loop spinning abstraction function; r=gerald 2017-05-15 09:34:19 -04:00
PrintTranslator.cpp Bug 1376026 - fix plumbing of DWrite parameters for Skia fonts to not depend on gfxPlatform. r=jrmuizel 2017-06-30 14:09:05 -04:00
PrintTranslator.h Bug 1376026 - fix plumbing of DWrite parameters for Skia fonts to not depend on gfxPlatform. r=jrmuizel 2017-06-30 14:09:05 -04:00
moz.build
nsIPrintProgress.idl
nsIPrintProgressParams.idl
nsIPrintStatusFeedback.idl
nsPagePrintTimer.cpp Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm 2017-07-26 16:13:35 +08:00
nsPagePrintTimer.h Bug 1354443 part.2 nsPrintEngine::Disconnect() should clear mPrintObj r=dholbert 2017-04-27 17:17:20 +09:00
nsPrintData.cpp Bug 1386600 - Change nsIStringBundle methods to return |AString| instead of |wstring|. r=emk,sr=dbaron. 2017-08-04 14:40:52 +10:00
nsPrintData.h Bug 1386600 - Change nsIStringBundle methods to return |AString| instead of |wstring|. r=emk,sr=dbaron. 2017-08-04 14:40:52 +10:00
nsPrintEngine.cpp Bug 1391645 - Make nsPrintEngine::SetupToPrintContent() proceed with the print even when mPrt->mPrintObject->mPresShell and mPrt->mPrintObject->mPresContext are nullptr but mIsCreatingPrintPreview is false r=dholbert 2017-08-21 14:56:07 +09:00
nsPrintEngine.h Bug 1354443 part.1-1 Make nsPrintData refcountable r=dholbert 2017-05-09 17:08:20 +09:00
nsPrintObject.cpp Bug 1342994 Part 2 - Use UniquePtr to replace explicit new/delete and non-owing pointers in printing APIs. r=dholbert 2017-03-06 16:28:20 +08:00
nsPrintObject.h Bug 1342994 Part 2 - Use UniquePtr to replace explicit new/delete and non-owing pointers in printing APIs. r=dholbert 2017-03-06 16:28:20 +08:00
nsPrintPreviewListener.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
nsPrintPreviewListener.h