mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1540189 - LSNG: Result of SendReady call is not checked; r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D25423
This commit is contained in:
parent
16b6c300a5
commit
78e96d22bc
@ -2170,8 +2170,12 @@ class LSRequestBase : public DatastoreOperationBase,
|
|||||||
private:
|
private:
|
||||||
void SendReadyMessage();
|
void SendReadyMessage();
|
||||||
|
|
||||||
|
nsresult SendReadyMessageInternal();
|
||||||
|
|
||||||
void Finish();
|
void Finish();
|
||||||
|
|
||||||
|
void FinishInternal();
|
||||||
|
|
||||||
void SendResults();
|
void SendResults();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -5703,27 +5707,49 @@ void LSRequestBase::SendReadyMessage() {
|
|||||||
MaybeSetFailureCode(NS_ERROR_FAILURE);
|
MaybeSetFailureCode(NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MayProceed()) {
|
nsresult rv = SendReadyMessageInternal();
|
||||||
Unused << SendReady();
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
|
MaybeSetFailureCode(rv);
|
||||||
|
|
||||||
mState = State::WaitingForFinish;
|
FinishInternal();
|
||||||
|
|
||||||
mWaitingForFinish = true;
|
|
||||||
} else {
|
|
||||||
Cleanup();
|
|
||||||
|
|
||||||
mState = State::Completed;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult LSRequestBase::SendReadyMessageInternal() {
|
||||||
|
AssertIsOnOwningThread();
|
||||||
|
MOZ_ASSERT(mState == State::SendingReadyMessage);
|
||||||
|
|
||||||
|
if (!MayProceed()) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NS_WARN_IF(!SendReady())) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
mState = State::WaitingForFinish;
|
||||||
|
|
||||||
|
mWaitingForFinish = true;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void LSRequestBase::Finish() {
|
void LSRequestBase::Finish() {
|
||||||
AssertIsOnOwningThread();
|
AssertIsOnOwningThread();
|
||||||
MOZ_ASSERT(mState == State::WaitingForFinish);
|
MOZ_ASSERT(mState == State::WaitingForFinish);
|
||||||
|
|
||||||
mState = State::SendingResults;
|
|
||||||
|
|
||||||
mWaitingForFinish = false;
|
mWaitingForFinish = false;
|
||||||
|
|
||||||
|
FinishInternal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LSRequestBase::FinishInternal() {
|
||||||
|
AssertIsOnOwningThread();
|
||||||
|
MOZ_ASSERT(mState == State::SendingReadyMessage ||
|
||||||
|
mState == State::WaitingForFinish);
|
||||||
|
|
||||||
|
mState = State::SendingResults;
|
||||||
|
|
||||||
// This LSRequestBase can only be held alive by the IPDL. Run() can end up
|
// This LSRequestBase can only be held alive by the IPDL. Run() can end up
|
||||||
// with clearing that last reference. So we need to add a self reference here.
|
// with clearing that last reference. So we need to add a self reference here.
|
||||||
RefPtr<LSRequestBase> kungFuDeathGrip = this;
|
RefPtr<LSRequestBase> kungFuDeathGrip = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user