Bug 803452 - Remember my choice for geolocation doesn't work. r=vingtetun
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 22 Oct 2012 22:22:27 -0400
changeset 111242 ab22c6590cfdc2099d98f7355e5cc20d62b44d84
parent 111241 9e1b8da160a290d32432560eb7c551aaf5c5ec5a
child 111243 c6fe2305d29c60ad266614974f3448469f81fa99
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersvingtetun
bugs803452
milestone19.0a1
Bug 803452 - Remember my choice for geolocation doesn't work. r=vingtetun
b2g/components/ContentPermissionPrompt.js
--- a/b2g/components/ContentPermissionPrompt.js
+++ b/b2g/components/ContentPermissionPrompt.js
@@ -42,20 +42,31 @@ ContentPermissionPrompt.prototype = {
 
     let requestId = this._id++;
     content.addEventListener("mozContentEvent", function contentEvent(evt) {
       if (evt.detail.id != requestId)
         return;
       evt.target.removeEventListener(evt.type, contentEvent);
 
       if (evt.detail.type == "permission-allow") {
+
+        if (evt.detail.remember) {
+          Services.perms.addFromPrincipal(request.principal, request.type,
+                                          Ci.nsIPermissionManager.ALLOW_ACTION);
+        }
+
         request.allow();
         return;
       }
 
+      if (evt.detail.remember) {
+        Services.perms.addFromPrincipal(request.principal, request.type,
+                                        Ci.nsIPermissionManager.DENY_ACTION);
+      }
+
       request.cancel();
     });
 
     let principal = request.principal;
     let isApp = principal.appStatus != Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED;
 
     let details = {
       type: "permission-prompt",