зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1436341 - Fix assertion for when a device operation fails. r=jib
The previous assertion was from an earlier developer stage which changed during development of bug 1299515. It assumed that mDeviceEnabled was updated only after passing the assert. In the final version of bug 1299515 that is no longer true, and both the failed and the successful device operation asserts can now be unified to one. MozReview-Commit-ID: KMdnIs0UgPr --HG-- extra : rebase_source : 936900db168623f913aaa76a9148d4ee80157493
This commit is contained in:
Родитель
b9cd3068b0
Коммит
ae9597da39
|
@ -4101,6 +4101,8 @@ SourceListener::SetEnabledFor(TrackID aTrackID, bool aEnable)
|
|||
return DeviceOperationPromise::CreateAndResolve(NS_ERROR_ABORT, __func__);
|
||||
})->Then(GetMainThreadSerialEventTarget(), __func__,
|
||||
[self, this, &state, aTrackID, aEnable](nsresult aResult) mutable {
|
||||
MOZ_ASSERT_IF(aResult != NS_ERROR_ABORT,
|
||||
state.mDeviceEnabled == aEnable);
|
||||
MOZ_ASSERT(state.mOperationInProgress);
|
||||
state.mOperationInProgress = false;
|
||||
|
||||
|
@ -4120,9 +4122,6 @@ SourceListener::SetEnabledFor(TrackID aTrackID, bool aEnable)
|
|||
// This path handles errors from starting or stopping the device.
|
||||
// NS_ERROR_ABORT are for cases where *we* aborted. They need graceful
|
||||
// handling.
|
||||
MOZ_ASSERT(state.mDeviceEnabled != aEnable,
|
||||
"If operating the device failed, the device's `enabled` "
|
||||
"state must remain at its old value");
|
||||
if (aEnable) {
|
||||
// Starting the device failed. Stopping the track here will make the
|
||||
// MediaStreamTrack end after a pass through the MediaStreamGraph.
|
||||
|
@ -4142,7 +4141,6 @@ SourceListener::SetEnabledFor(TrackID aTrackID, bool aEnable)
|
|||
// NS_ERROR_ABORT (*we* canceled the operation).
|
||||
// At this point we have to follow up on the intended state, i.e., update
|
||||
// the device state if the track state changed in the meantime.
|
||||
MOZ_ASSERT_IF(NS_SUCCEEDED(aResult), state.mDeviceEnabled == aEnable);
|
||||
|
||||
if (state.mTrackEnabled == state.mDeviceEnabled) {
|
||||
// Intended state is same as device's current state.
|
||||
|
|
Загрузка…
Ссылка в новой задаче