Bug 1329976 - make the microphone prompt select the same device by default all the time by clearing the leftover value from previous prompts, r=johannh.
authorFlorian Quèze <florian@queze.net>
Fri, 20 Jan 2017 12:50:14 +0100
changeset 375339 bc99b50404754b0e0d1637defcf2d3bebe0fe912
parent 375338 ab4dc22fcd04354db1dc728754b497a83ca01e34
child 375340 8b510027eae07a61a61e80177bc327653cfe6b0b
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1329976
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1329976 - make the microphone prompt select the same device by default all the time by clearing the leftover value from previous prompts, r=johannh.
browser/modules/webrtcUI.jsm
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -549,16 +549,21 @@ function prompt(aBrowser, aRequest) {
           this.remove();
           return true;
         }
       }
 
       function listDevices(menupopup, devices) {
         while (menupopup.lastChild)
           menupopup.removeChild(menupopup.lastChild);
+        // Removing the child nodes of the menupopup doesn't clear the value
+        // attribute of the menulist. This can have unfortunate side effects
+        // when the list is rebuilt with a different content, so we remove
+        // the value attribute explicitly.
+        menupopup.parentNode.removeAttribute("value");
 
         for (let device of devices)
           addDeviceToList(menupopup, device.name, device.deviceIndex);
       }
 
       function listScreenShareDevices(menupopup, devices) {
         while (menupopup.lastChild)
           menupopup.removeChild(menupopup.lastChild);