Bug 1508961 - Don't prematurely check for permissions in pushManager.subscribe() permission requests. r=lina

This permission checking should be handled by PermissionUI.jsm, to be able to apply custom heuristics
for denying the permission and also to be able to "post-prompt" after denying automatically.

Differential Revision: https://phabricator.services.mozilla.com/D25416

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2019-04-05 10:22:21 +00:00
Родитель 9fb44dc7a9
Коммит 7d9bd82b23
1 изменённых файлов: 3 добавлений и 13 удалений

Просмотреть файл

@ -70,21 +70,11 @@ Push.prototype = {
));
};
let permission = Ci.nsIPermissionManager.UNKNOWN_ACTION;
try {
permission = this._testPermission();
} catch (e) {
permissionDenied();
return;
if (Services.prefs.getBoolPref("dom.push.testing.ignorePermission", false)) {
resolve();
}
if (permission == Ci.nsIPermissionManager.ALLOW_ACTION) {
resolve();
} else if (permission == Ci.nsIPermissionManager.DENY_ACTION) {
permissionDenied();
} else {
this._requestPermission(isHandlingUserInput, resolve, permissionDenied);
}
this._requestPermission(isHandlingUserInput, resolve, permissionDenied);
});
},