Bug 1512197 - Temporary fix for incorrect sharing of MozPromiseHolder in MediaManager. r=jya

Differential Revision: https://phabricator.services.mozilla.com/D13847

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan-Ivar Bruaroey 2018-12-05 21:46:51 +00:00
Родитель ce87b08ac4
Коммит 0979860740
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -1123,8 +1123,14 @@ class GetUserMediaStreamRunnable : public Runnable {
"TracksCreatedListener::mTrack", aTrack)) {}
~TracksCreatedListener() {
mHolder.RejectIfExists(
MakeRefPtr<MediaMgrError>(MediaMgrError::Name::AbortError), __func__);
RejectIfExists(MakeRefPtr<MediaMgrError>(MediaMgrError::Name::AbortError),
__func__);
}
// TODO: The need for this should be removed by an upcoming refactor.
void RejectIfExists(RefPtr<MediaMgrError>&& aError,
const char* aMethodName) {
mHolder.RejectIfExists(std::move(aError), aMethodName);
}
void NotifyOutput(MediaStreamGraph* aGraph,
@ -1384,7 +1390,7 @@ class GetUserMediaStreamRunnable : public Runnable {
manager->SendPendingGUMRequest();
},
[manager = mManager, windowID = mWindowID,
holder = std::move(mHolder)](RefPtr<MediaMgrError>&& aError) mutable {
tracksCreatedListener](RefPtr<MediaMgrError>&& aError) {
MOZ_ASSERT(NS_IsMainThread());
LOG(
("GetUserMediaStreamRunnable::Run: starting failure callback "
@ -1397,7 +1403,7 @@ class GetUserMediaStreamRunnable : public Runnable {
}
// This is safe since we're on main-thread, and the windowlist can
// only be invalidated from the main-thread (see OnNavigation)
holder.Reject(std::move(aError), __func__);
tracksCreatedListener->RejectIfExists(std::move(aError), __func__);
});
if (!IsPincipalInfoPrivate(mPrincipalInfo)) {