Skip to content

Commit

Permalink
Merge branch 'omp-jb50930' into 'master'
Browse files Browse the repository at this point in the history
[embedlite-components] Expire temporary permission after session ends. Contributes to JB#50930

See merge request mer-core/embedlite-components!93
  • Loading branch information
rainemak committed Oct 30, 2020
2 parents 3788865 + 85d2fab commit 77f7e45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jscomps/ContentPermissionPrompt.js
Expand Up @@ -70,9 +70,7 @@ ContentPermissionPrompt.prototype = {
// If the user checked "Don't ask again", make a permanent exception
if (ret.checkedDontAsk) {
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION);
} else if (entityName == "desktopNotification") {
// For notifications, it doesn't make sense to grant permission once. So when the user clicks allow,
// we let the requestor create notifications for the session.
} else {
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.ALLOW_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION);
}
Expand All @@ -81,6 +79,9 @@ ContentPermissionPrompt.prototype = {
// If the user checked "Don't ask again", make a permanent exception
if (ret.checkedDontAsk) {
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.DENY_ACTION);
} else {
Services.perms.addFromPrincipal(request.principal, perm.type, Ci.nsIPermissionManager.DENY_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION);
}
cachedreqs.forEach(function(r) { r.cancel(); });
}
Expand Down

0 comments on commit 77f7e45

Please sign in to comment.