Bug 1363261 - Remove a callId from mCallIds when the corresponding GetUserMediaTask is removed from mActiveCallbacks. r=jib

MozReview-Commit-ID: DcSQ8O9MoCb
This commit is contained in:
Munro Mengjue Chiang 2017-04-24 15:11:51 +08:00
Родитель ad4120d507
Коммит c8de52fd2d
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -1620,6 +1620,12 @@ public:
return NS_OK;
}
uint64_t
GetWindowID()
{
return mWindowID;
}
private:
MediaStreamConstraints mConstraints;
@ -3010,6 +3016,12 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
nsTArray<nsString>* array;
if (!mCallIds.Get(task->GetWindowID(), &array)) {
return NS_OK;
}
array->RemoveElement(key);
if (aSubject) {
// A particular device or devices were chosen by the user.
// NOTE: does not allow setting a device to null; assumes nullptr
@ -3074,6 +3086,11 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
mActiveCallbacks.Remove(key, getter_AddRefs(task));
if (task) {
task->Denied(errorMessage);
nsTArray<nsString>* array;
if (!mCallIds.Get(task->GetWindowID(), &array)) {
return NS_OK;
}
array->RemoveElement(key);
}
return NS_OK;