Bug 1037438 - implement persistent deny permissions for screen sharing, r=jesup,past.
authorFlorian Quèze <florian@queze.net>
Mon, 28 Nov 2016 12:29:31 +0100
changeset 324649 6992281f395d344cf6921297ecf83fe8df071188
parent 324648 7c7b942f915b4ba43119f17d735c75c6b7376e32
child 324650 4d13fd025112b2e9da6433815bc2fc2abe0f883c
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersjesup, past
bugs1037438
milestone53.0a1
Bug 1037438 - implement persistent deny permissions for screen sharing, r=jesup,past.
browser/modules/webrtcUI.jsm
dom/media/MediaManager.cpp
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -307,17 +307,17 @@ function prompt(aBrowser, aRequest) {
       accessKey: stringBundle.getString("getUserMedia.dontAllow.accesskey"),
       callback: function(aState) {
         denyRequest(notification.browser, aRequest);
         if (aState && aState.checkboxChecked) {
           let perms = Services.perms;
           if (audioDevices.length)
             perms.add(uri, "microphone", perms.DENY_ACTION);
           if (videoDevices.length)
-            perms.add(uri, "camera", perms.DENY_ACTION);
+            perms.add(uri, sharingScreen ? "screen" : "camera", perms.DENY_ACTION);
         }
       }
     }
   ];
 
   let productName = gBrandBundle.GetStringFromName("brandShortName");
 
   // Disable the permanent 'Allow' action if the connection isn't secure, or for
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -2260,17 +2260,18 @@ if (privileged) {
       rv = permManager->TestExactPermissionFromPrincipal(
         principal, "microphone", &audioPerm);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     uint32_t videoPerm = nsIPermissionManager::UNKNOWN_ACTION;
     if (IsOn(c.mVideo)) {
       rv = permManager->TestExactPermissionFromPrincipal(
-        principal, "camera", &videoPerm);
+        principal, videoType == MediaSourceEnum::Camera ? "camera" : "screen",
+        &videoPerm);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
     if ((!IsOn(c.mAudio) && !IsOn(c.mVideo)) ||
         (IsOn(c.mAudio) && audioPerm == nsIPermissionManager::DENY_ACTION) ||
         (IsOn(c.mVideo) && videoPerm == nsIPermissionManager::DENY_ACTION)) {
       RefPtr<MediaStreamError> error =
           new MediaStreamError(aWindow, NS_LITERAL_STRING("NotAllowedError"));