зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1694791 check placeholderListener instead of window listener for enumerateDevices() abort r=jib DONTBUILD
An enumerateDevices() call before a navigation possibly should sometimes resolve its promise even after the navigation, but that shouldn't depend on whether another enumerateDevices() call is made with the same Window after the navigation but before the first would resolve. The current behavior is that listeners are removed on Document navigation, but listeners can be added after navigation. Testing the window listener is checking for any listener but testing the placeholderListener checks the listener associated with this particular operation. Differential Revision: https://phabricator.services.mozilla.com/D114317
This commit is contained in:
Родитель
98934eac2e
Коммит
354ec81af7
|
@ -3046,15 +3046,14 @@ RefPtr<MediaManager::MgrPromise> MediaManager::EnumerateDevicesImpl(
|
||||||
aAudioInputEnumType, aOutDevices](bool) {
|
aAudioInputEnumType, aOutDevices](bool) {
|
||||||
// Only run if window is still on our active list.
|
// Only run if window is still on our active list.
|
||||||
MediaManager* mgr = MediaManager::GetIfExists();
|
MediaManager* mgr = MediaManager::GetIfExists();
|
||||||
if (!mgr || !mgr->IsWindowStillActive(windowId)) {
|
if (!mgr || placeholderListener->Stopped()) {
|
||||||
// The listener has already been removed if the window is no
|
// The listener has already been removed if the window is no
|
||||||
// longer active.
|
// longer active.
|
||||||
MOZ_ASSERT(placeholderListener->Stopped());
|
|
||||||
return MgrPromise::CreateAndReject(
|
return MgrPromise::CreateAndReject(
|
||||||
MakeRefPtr<MediaMgrError>(MediaMgrError::Name::AbortError),
|
MakeRefPtr<MediaMgrError>(MediaMgrError::Name::AbortError),
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(!placeholderListener->Stopped());
|
MOZ_ASSERT(mgr->IsWindowStillActive(windowId));
|
||||||
placeholderListener->Stop();
|
placeholderListener->Stop();
|
||||||
|
|
||||||
for (auto& device : *aOutDevices) {
|
for (auto& device : *aOutDevices) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче