Bug 917544 - Don't remember audio-capturing permission in a session. r=fabrice, a=koi+
authorShih-Chiang Chien <schien@mozilla.com>
Fri, 27 Sep 2013 07:59:31 -0400
changeset 160498 f45c9cf22f329ef6d800b6b7588a94f46febd2cf
parent 160497 3d333503a19acdd3cb1a28abf1d19d779bda300b
child 160499 4c72e82e825faae3062e9b4c861cb8828dc60c9a
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice, koi
bugs917544
milestone26.0a2
Bug 917544 - Don't remember audio-capturing permission in a session. r=fabrice, a=koi+
b2g/components/ContentPermissionPrompt.js
--- a/b2g/components/ContentPermissionPrompt.js
+++ b/b2g/components/ContentPermissionPrompt.js
@@ -8,17 +8,21 @@ function debug(str) {
   //dump("-*- ContentPermissionPrompt: " + s + "\n");
 }
 
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 const Cc = Components.classes;
 
-const PROMPT_FOR_UNKNOWN = ["geolocation", "desktop-notification", "audio-capture"];
+const PROMPT_FOR_UNKNOWN    = ["geolocation", "desktop-notification",
+                               "audio-capture"];
+// Due to privary issue, permission requests like GetUserMedia should prompt
+// every time instead of providing session persistence.
+const PERMISSION_NO_SESSION = ["audio-capture"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Webapps.jsm");
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import("resource://gre/modules/PermissionsInstaller.jsm");
 Cu.import("resource://gre/modules/PermissionsTable.jsm");
 
@@ -38,17 +42,17 @@ function rememberPermission(aPermission,
       permissionManager.testExactPermissionFromPrincipal(aPrincipal, aPerm);
     if (type == Ci.nsIPermissionManager.PROMPT_ACTION ||
         (type == Ci.nsIPermissionManager.UNKNOWN_ACTION &&
         PROMPT_FOR_UNKNOWN.indexOf(aPermission) >= 0)) {
       if (!aSession) {
         permissionManager.addFromPrincipal(aPrincipal,
                                            aPerm,
                                            Ci.nsIPermissionManager.ALLOW_ACTION);
-      } else {
+      } else if (PERMISSION_NO_SESSION.indexOf(aPermission) < 0) {
         permissionManager.addFromPrincipal(aPrincipal,
                                            aPerm,
                                            Ci.nsIPermissionManager.ALLOW_ACTION,
                                            Ci.nsIPermissionManager.EXPIRE_SESSION, 0);
       }
     }
   }