зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1152921 - Don't send an uninitialized PrintData over IPC when cancelling print dialog (or failing ShowPrintDialog for other reasons). r=mconley
This fixes a crash in debug builds (due to uninitialized booleans) when canceling a print dialog.
This commit is contained in:
Родитель
37a366fbce
Коммит
aa31a08c28
|
@ -9,12 +9,19 @@ include protocol PPrinting;
|
|||
namespace mozilla {
|
||||
namespace embedding {
|
||||
|
||||
// A PrintData for success, a failure nsresult for failure.
|
||||
union PrintDataOrNSResult
|
||||
{
|
||||
PrintData;
|
||||
nsresult;
|
||||
};
|
||||
|
||||
protocol PPrintSettingsDialog
|
||||
{
|
||||
manager PPrinting;
|
||||
|
||||
child:
|
||||
__delete__(nsresult rv, PrintData data);
|
||||
__delete__(PrintDataOrNSResult result);
|
||||
};
|
||||
|
||||
} // namespace embedding
|
||||
|
|
|
@ -21,11 +21,15 @@ PrintSettingsDialogChild::~PrintSettingsDialogChild()
|
|||
}
|
||||
|
||||
bool
|
||||
PrintSettingsDialogChild::Recv__delete__(const nsresult& aResult,
|
||||
const PrintData& aData)
|
||||
PrintSettingsDialogChild::Recv__delete__(const PrintDataOrNSResult& aData)
|
||||
{
|
||||
mResult = aResult;
|
||||
mData = aData;
|
||||
if (aData.type() == PrintDataOrNSResult::Tnsresult) {
|
||||
mResult = aData.get_nsresult();
|
||||
MOZ_ASSERT(NS_FAILED(mResult), "expected a failure result");
|
||||
} else {
|
||||
mResult = NS_OK;
|
||||
mData = aData.get_PrintData();
|
||||
}
|
||||
mReturned = true;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,7 @@ class PrintSettingsDialogChild final : public PPrintSettingsDialogChild
|
|||
public:
|
||||
MOZ_IMPLICIT PrintSettingsDialogChild();
|
||||
|
||||
virtual bool Recv__delete__(const nsresult& aResult,
|
||||
const PrintData& aData) override;
|
||||
virtual bool Recv__delete__(const PrintDataOrNSResult& aData) override;
|
||||
|
||||
bool returned() { return mReturned; };
|
||||
nsresult result() { return mResult; };
|
||||
|
|
|
@ -117,7 +117,11 @@ PrintingParent::RecvShowPrintDialog(PPrintSettingsDialogParent* aDialog,
|
|||
// to hear about the print settings. We return the results
|
||||
// with an async message which frees the child process from
|
||||
// its nested event loop.
|
||||
mozilla::unused << aDialog->Send__delete__(aDialog, rv, resultData);
|
||||
if (NS_FAILED(rv)) {
|
||||
mozilla::unused << aDialog->Send__delete__(aDialog, rv);
|
||||
} else {
|
||||
mozilla::unused << aDialog->Send__delete__(aDialog, resultData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче