Bug 1320375 - Remove webrtcUI.showSharingDoorhanger's obsolete aType parameter, r=johannh.
☠☠ backed out by f905fe26e901 ☠ ☠
authorFlorian Quèze <florian@queze.net>
Mon, 28 Nov 2016 12:29:31 +0100
changeset 371677 77b01f2bda7f4737ad3573103c05ccea895d1a39
parent 371676 ca8ca07756ab80d29778329aa22ebc453f17fc69
child 371678 ebab26f0002c4d6757d4c22158c3ac420c02a774
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1320375
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 1320375 - Remove webrtcUI.showSharingDoorhanger's obsolete aType parameter, r=johannh.
browser/base/content/test/webrtc/browser_devices_get_user_media.js
browser/base/content/webrtcIndicator.js
browser/modules/webrtcUI.jsm
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media.js
@@ -450,17 +450,17 @@ var gTests = [
     is((yield getMediaCaptureState()), "Camera", "expected camera to be shared");
 
     yield indicator;
     yield checkSharingUI({video: true});
 
     ok(gIdentityHandler._identityPopup.hidden, "control center should be hidden");
     if ("nsISystemStatusBar" in Ci) {
       let activeStreams = webrtcUI.getActiveStreams(true, false, false);
-      webrtcUI.showSharingDoorhanger(activeStreams[0], "Devices");
+      webrtcUI.showSharingDoorhanger(activeStreams[0]);
     }
     else {
       let win =
         Services.wm.getMostRecentWindow("Browser:WebRTCGlobalIndicator");
       let elt = win.document.getElementById("audioVideoButton");
       EventUtils.synthesizeMouseAtCenter(elt, {}, win);
       yield promiseWaitForCondition(() => !gIdentityHandler._identityPopup.hidden);
     }
--- a/browser/base/content/webrtcIndicator.js
+++ b/browser/base/content/webrtcIndicator.js
@@ -83,26 +83,25 @@ function updateWindowAttr(attr, value) {
   if (value)
     docEl.setAttribute(attr, "true");
   else
     docEl.removeAttribute(attr);
 }
 
 function onPopupMenuShowing(event) {
   let popup = event.target;
-  let type = popup.getAttribute("type");
 
   let activeStreams;
-  if (type == "Devices")
+  if (popup.getAttribute("type") == "Devices")
     activeStreams = webrtcUI.getActiveStreams(true, true, false);
   else
     activeStreams = webrtcUI.getActiveStreams(false, false, true);
 
   if (activeStreams.length == 1) {
-    webrtcUI.showSharingDoorhanger(activeStreams[0], type);
+    webrtcUI.showSharingDoorhanger(activeStreams[0]);
     event.preventDefault();
     return;
   }
 
   for (let stream of activeStreams) {
     let item = document.createElement("menuitem");
     item.setAttribute("label", stream.browser.contentTitle || stream.uri);
     item.setAttribute("tooltiptext", stream.uri);
@@ -113,19 +112,17 @@ function onPopupMenuShowing(event) {
 
 function onPopupMenuHiding(event) {
   let popup = event.target;
   while (popup.firstChild)
     popup.firstChild.remove();
 }
 
 function onPopupMenuCommand(event) {
-  let item = event.target;
-  webrtcUI.showSharingDoorhanger(item.stream,
-                                 item.parentNode.getAttribute("type"));
+  webrtcUI.showSharingDoorhanger(event.target.stream);
 }
 
 function onFirefoxButtonClick(event) {
   event.target.blur();
   let activeStreams = webrtcUI.getActiveStreams(true, true, true);
   activeStreams[0].browser.ownerGlobal.focus();
 }
 
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -131,17 +131,17 @@ this.webrtcUI = {
         stream.browser = aNewBrowser;
     }
   },
 
   forgetStreamsFromBrowser: function(aBrowser) {
     this._streams = this._streams.filter(stream => stream.browser != aBrowser);
   },
 
-  showSharingDoorhanger: function(aActiveStream, aType) {
+  showSharingDoorhanger: function(aActiveStream) {
     let browserWindow = aActiveStream.browser.ownerGlobal;
     if (aActiveStream.tab) {
       browserWindow.gBrowser.selectedTab = aActiveStream.tab;
     } else {
       aActiveStream.browser.focus();
     }
     browserWindow.focus();
     let identityBox = browserWindow.document.getElementById("identity-box");
@@ -692,22 +692,17 @@ function getGlobalIndicator() {
 
     _hiddenDoc: Cc["@mozilla.org/appshell/appShellService;1"]
                   .getService(Ci.nsIAppShellService)
                   .hiddenDOMWindow.document,
     _statusBar: Cc["@mozilla.org/widget/macsystemstatusbar;1"]
                   .getService(Ci.nsISystemStatusBar),
 
     _command: function(aEvent) {
-      let type = this.getAttribute("type");
-      if (type == "Camera" || type == "Microphone")
-        type = "Devices";
-      else if (type == "Window" || type == "Application" || type == "Browser")
-        type = "Screen";
-      webrtcUI.showSharingDoorhanger(aEvent.target.stream, type);
+      webrtcUI.showSharingDoorhanger(aEvent.target.stream);
     },
 
     _popupShowing: function(aEvent) {
       let type = this.getAttribute("type");
       let activeStreams;
       if (type == "Camera") {
         activeStreams = webrtcUI.getActiveStreams(true, false, false);
       }
@@ -730,17 +725,16 @@ function getGlobalIndicator() {
         let label = stream.browser.contentTitle || stream.uri;
         menuitem.setAttribute("label", bundle.formatStringFromName(labelId, [label], 1));
         menuitem.setAttribute("disabled", "true");
         this.appendChild(menuitem);
 
         menuitem = this.ownerDocument.createElement("menuitem");
         menuitem.setAttribute("label",
                               bundle.GetStringFromName("webrtcIndicator.controlSharing.menuitem"));
-        menuitem.setAttribute("type", type);
         menuitem.stream = stream;
         menuitem.addEventListener("command", indicator._command);
 
         this.appendChild(menuitem);
         return true;
       }
 
       // We show a different menu when there are several active streams.
@@ -752,17 +746,16 @@ function getGlobalIndicator() {
       menuitem.setAttribute("disabled", "true");
       this.appendChild(menuitem);
 
       for (let stream of activeStreams) {
         let item = this.ownerDocument.createElement("menuitem");
         labelId = "webrtcIndicator.controlSharingOn.menuitem";
         label = stream.browser.contentTitle || stream.uri;
         item.setAttribute("label", bundle.formatStringFromName(labelId, [label], 1));
-        item.setAttribute("type", type);
         item.stream = stream;
         item.addEventListener("command", indicator._command);
         this.appendChild(item);
       }
 
       return true;
     },
 
@@ -827,40 +820,28 @@ function onTabSharingMenuPopupShowing(e)
 
     let doc = e.target.ownerDocument;
     let bundle = doc.defaultView.gNavigatorBundle;
 
     let origin = getHost(null, streamInfo.uri);
     let menuitem = doc.createElement("menuitem");
     menuitem.setAttribute("label", bundle.getFormattedString(stringName, [origin]));
     menuitem.stream = streamInfo;
-
-    // We can only open 1 doorhanger at a time. Guessing that users would be
-    // most eager to control screen/window/app sharing, and only then
-    // camera/microphone sharing, in that (decreasing) order of priority.
-    let doorhangerType;
-    if ((/Screen|Window|Application/).test(stringName)) {
-      doorhangerType = "Screen";
-    } else {
-      doorhangerType = "Devices";
-    }
-    menuitem.setAttribute("doorhangertype", doorhangerType);
     menuitem.addEventListener("command", onTabSharingMenuPopupCommand);
     e.target.appendChild(menuitem);
   }
 }
 
 function onTabSharingMenuPopupHiding(e) {
   while (this.lastChild)
     this.lastChild.remove();
 }
 
 function onTabSharingMenuPopupCommand(e) {
-  let type = e.target.getAttribute("doorhangertype");
-  webrtcUI.showSharingDoorhanger(e.target.stream, type);
+  webrtcUI.showSharingDoorhanger(e.target.stream);
 }
 
 function showOrCreateMenuForWindow(aWindow) {
   let document = aWindow.document;
   let menu = document.getElementById("tabSharingMenu");
   if (!menu) {
     let stringBundle = aWindow.gNavigatorBundle;
     menu = document.createElement("menu");