bug remove unnecessary additional SetupDeviceChangeListener() call r?jib draft
authorKarl Tomlinson <karlt+@karlt.net>
Wed, 24 Nov 2021 16:13:05 +1300
changeset 4097844 c794ebafce5817537affecb05d84633af13418a7
parent 4097843 5629261e0dda46a4be100dae986f2216974386ab
child 4097845 581d30bd14cc8e5e214099becd7b21580d83ad9a
child 4097921 69407349b84c2ea7ae3ed7646df799d27d37b559
push id755114
push userktomlinson@mozilla.com
push dateFri, 26 Nov 2021 22:36:51 +0000
treeherdertry@fad75694e0a3 [default view] [failures only]
reviewersjib
milestone96.0a1
bug remove unnecessary additional SetupDeviceChangeListener() call r?jib EventTarget::SetEventHandler() will cause EventListenerAdded() to be called.
dom/media/MediaDevices.cpp
--- a/dom/media/MediaDevices.cpp
+++ b/dom/media/MediaDevices.cpp
@@ -556,17 +556,16 @@ void MediaDevices::SetupDeviceChangeList
   mDeviceChangeListener = MediaManager::Get()->DeviceListChangeEvent().Connect(
       mainThread, this, &MediaDevices::OnDeviceChange);
   mIsDeviceChangeListenerSetUp = true;
 }
 
 void MediaDevices::SetOndevicechange(
     mozilla::dom::EventHandlerNonNull* aCallback) {
   SetEventHandler(nsGkAtoms::ondevicechange, aCallback);
-  SetupDeviceChangeListener();
 }
 
 void MediaDevices::EventListenerAdded(nsAtom* aType) {
   DOMEventTargetHelper::EventListenerAdded(aType);
   SetupDeviceChangeListener();
 }
 
 JSObject* MediaDevices::WrapObject(JSContext* aCx,