зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359106 - Make sure AltDataOutputStreamParent::SendError is not called after ActorDestroy r=bagder
MozReview-Commit-ID: I2m4K7MhQoA --HG-- extra : rebase_source : 6a9d1457ae53e2438e01691064458d1c6a138924
This commit is contained in:
Родитель
476ddf32bb
Коммит
3b8965a9dd
|
@ -16,6 +16,7 @@ NS_IMPL_ISUPPORTS0(AltDataOutputStreamParent)
|
|||
AltDataOutputStreamParent::AltDataOutputStreamParent(nsIOutputStream* aStream)
|
||||
: mOutputStream(aStream)
|
||||
, mStatus(NS_OK)
|
||||
, mIPCOpen(true)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Main thread only");
|
||||
}
|
||||
|
@ -29,7 +30,9 @@ mozilla::ipc::IPCResult
|
|||
AltDataOutputStreamParent::RecvWriteData(const nsCString& data)
|
||||
{
|
||||
if (NS_FAILED(mStatus)) {
|
||||
if (mIPCOpen) {
|
||||
Unused << SendError(mStatus);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
nsresult rv;
|
||||
|
@ -37,7 +40,7 @@ AltDataOutputStreamParent::RecvWriteData(const nsCString& data)
|
|||
if (mOutputStream) {
|
||||
rv = mOutputStream->Write(data.BeginReading(), data.Length(), &n);
|
||||
MOZ_ASSERT(n == data.Length());
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv) && mIPCOpen) {
|
||||
Unused << SendError(rv);
|
||||
}
|
||||
}
|
||||
|
@ -48,13 +51,15 @@ mozilla::ipc::IPCResult
|
|||
AltDataOutputStreamParent::RecvClose()
|
||||
{
|
||||
if (NS_FAILED(mStatus)) {
|
||||
if (mIPCOpen) {
|
||||
Unused << SendError(mStatus);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
nsresult rv;
|
||||
if (mOutputStream) {
|
||||
rv = mOutputStream->Close();
|
||||
if (NS_FAILED(rv)) {
|
||||
if (NS_FAILED(rv) && mIPCOpen) {
|
||||
Unused << SendError(rv);
|
||||
}
|
||||
mOutputStream = nullptr;
|
||||
|
@ -65,6 +70,7 @@ AltDataOutputStreamParent::RecvClose()
|
|||
void
|
||||
AltDataOutputStreamParent::ActorDestroy(ActorDestroyReason aWhy)
|
||||
{
|
||||
mIPCOpen = false;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
// In case any error occurs mStatus will be != NS_OK, and this status code will
|
||||
// be sent to the content process asynchronously.
|
||||
nsresult mStatus;
|
||||
bool mIPCOpen;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
Загрузка…
Ссылка в новой задаче