зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1399787 - Part 14. Prevent RemotePrintJobChild using ipc calls after the channel was destroyed. r=jwatt
If in the future nsDeviceContextSpecWin::BeginDocument was to return NS_ERROR_FAILURE, then the channel between RemotePrintJobParent and RemotePrintJobChild will be close at [1]. RemotePrintJobChild keep using ipc calls after the channel is broken and hits assertions. PS: We always hits this assertion by forcing nsDeviceContextSpecWin::BeginDocument returning NS_ERROR_FAILURE. It's not relative to the change we made in previous patches. [1] https://hg.mozilla.org/mozilla-central/file/b186fddce27f/layout/printing/ipc/RemotePrintJobParent.cpp#l44 MozReview-Commit-ID: 79mZBf301nb --HG-- extra : rebase_source : 6b84da35fdc96ae8161552fe5d0764b0c2c0f3ee extra : intermediate-source : 88df2caad42694dd77f2a518ea8d460d6c88b8c6 extra : source : b920088860904c5d28f3dd2f6eda790dc09be003
This commit is contained in:
Родитель
b76d64f617
Коммит
2f6efc5efb
|
@ -71,7 +71,9 @@ RemotePrintJobChild::ProcessPage()
|
|||
MOZ_ASSERT(mPagePrintTimer);
|
||||
|
||||
mPagePrintTimer->WaitForRemotePrint();
|
||||
Unused << SendProcessPage();
|
||||
if (!mDestroyed) {
|
||||
Unused << SendProcessPage();
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
@ -116,7 +118,10 @@ RemotePrintJobChild::OnStateChange(nsIWebProgress* aProgress,
|
|||
nsIRequest* aRequest, uint32_t aStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
Unused << SendStateChange(aStateFlags, aStatus);
|
||||
if (!mDestroyed) {
|
||||
Unused << SendStateChange(aStateFlags, aStatus);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -128,8 +133,11 @@ RemotePrintJobChild::OnProgressChange(nsIWebProgress * aProgress,
|
|||
int32_t aCurTotalProgress,
|
||||
int32_t aMaxTotalProgress)
|
||||
{
|
||||
Unused << SendProgressChange(aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress);
|
||||
if (!mDestroyed) {
|
||||
Unused << SendProgressChange(aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -146,7 +154,10 @@ RemotePrintJobChild::OnStatusChange(nsIWebProgress* aProgress,
|
|||
nsIRequest* aRequest, nsresult aStatus,
|
||||
const char16_t* aMessage)
|
||||
{
|
||||
Unused << SendStatusChange(aStatus);
|
||||
if (!mDestroyed) {
|
||||
Unused << SendStatusChange(aStatus);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -168,6 +179,8 @@ RemotePrintJobChild::ActorDestroy(ActorDestroyReason aWhy)
|
|||
{
|
||||
mPagePrintTimer = nullptr;
|
||||
mPrintEngine = nullptr;
|
||||
|
||||
mDestroyed = true;
|
||||
}
|
||||
|
||||
} // namespace layout
|
||||
|
|
|
@ -55,6 +55,7 @@ private:
|
|||
void SetNextPageFD(const mozilla::ipc::FileDescriptor& aFd);
|
||||
|
||||
bool mPrintInitialized = false;
|
||||
bool mDestroyed = false;
|
||||
nsresult mInitializationResult = NS_OK;
|
||||
RefPtr<nsPagePrintTimer> mPagePrintTimer;
|
||||
RefPtr<nsPrintEngine> mPrintEngine;
|
||||
|
|
Загрузка…
Ссылка в новой задаче