Bug 1287827 - Part 5. Remove Loop's special permissions for about:loopconversation from MediaManager. r=jib,a=sledru
authorMark Banner <standard8@mozilla.com>
Wed, 27 Jul 2016 11:42:26 +0100
changeset 338157 dcfb698a71b82105f8670f95371ff960a94a564b
parent 338156 c85dda2fd353af506d6c7a97e5d14a60a01ececa
child 338158 77ab901796819a9ab2e820d6bb9350e610786f07
push idunknown
push userunknown
push dateunknown
reviewersjib, sledru
bugs1287827
milestone49.0a2
Bug 1287827 - Part 5. Remove Loop's special permissions for about:loopconversation from MediaManager. r=jib,a=sledru
dom/media/MediaManager.cpp
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -1794,17 +1794,17 @@ MediaManager::GetUserMedia(nsPIDOMWindow
 
   // Determine permissions early (while we still have a stack).
 
   nsIURI* docURI = aWindow->GetDocumentURI();
   if (!docURI) {
     return NS_ERROR_UNEXPECTED;
   }
   bool loop = IsLoop(docURI);
-  bool privileged = loop || IsPrivileged();
+  bool privileged = IsPrivileged();
   bool isHTTPS = false;
   docURI->SchemeIs("https", &isHTTPS);
   nsCString host;
   nsresult rv = docURI->GetHost(host);
   // Test for some other schemes that ServiceWorker recognizes
   bool isFile;
   docURI->SchemeIs("file", &isFile);
   bool isApp;
@@ -1895,17 +1895,17 @@ MediaManager::GetUserMedia(nsPIDOMWindow
               !nsCocoaFeatures::OnLionOrLater()
 #endif
 #if defined (XP_WIN)
               !IsVistaOrLater()
 #endif
               ) ||
 #endif
             (!privileged && !HostIsHttps(*docURI)) ||
-            !(loop || HostHasPermission(*docURI))) {
+            !HostHasPermission(*docURI)) {
           RefPtr<MediaStreamError> error =
               new MediaStreamError(aWindow,
                                    NS_LITERAL_STRING("NotAllowedError"));
           onFailure->OnError(error);
           return NS_OK;
         }
         break;
 
@@ -1940,26 +1940,16 @@ MediaManager::GetUserMedia(nsPIDOMWindow
       if (vc.mAdvanced.WasPassed()) {
         for (MediaTrackConstraintSet& cs : vc.mAdvanced.Value()) {
           if (cs.mBrowserWindow.WasPassed()) {
             cs.mBrowserWindow.Value() = -1;
           }
         }
       }
     }
-
-    // For all but tab sharing, Loop needs to prompt as we are using the
-    // permission menu for selection of the device currently. For tab sharing,
-    // Loop has implicit permissions within Firefox, as it is built-in,
-    // and will manage the active tab and provide appropriate UI.
-    if (loop && (videoType == MediaSourceEnum::Window ||
-                 videoType == MediaSourceEnum::Application ||
-                 videoType == MediaSourceEnum::Screen)) {
-       privileged = false;
-    }
   } else if (IsOn(c.mVideo)) {
     videoType = MediaSourceEnum::Camera;
   }
 
   if (c.mAudio.IsMediaTrackConstraints()) {
     auto& ac = c.mAudio.GetAsMediaTrackConstraints();
     audioType = StringToEnum(dom::MediaSourceEnumValues::strings,
                              ac.mMediaSource,