зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1550131 - Remove about:logins master password login notifications when the user logs in. r=jaws
Depends on D31699 Differential Revision: https://phabricator.services.mozilla.com/D31700 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
80e0594431
Коммит
2cee12df26
|
@ -75,6 +75,7 @@ var AboutLoginsParent = {
|
|||
}
|
||||
case "AboutLogins:Subscribe": {
|
||||
if (!ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers).length) {
|
||||
Services.obs.addObserver(this, "passwordmgr-crypto-login");
|
||||
Services.obs.addObserver(this, "passwordmgr-crypto-loginCanceled");
|
||||
Services.obs.addObserver(this, "passwordmgr-storage-changed");
|
||||
}
|
||||
|
@ -108,11 +109,18 @@ var AboutLoginsParent = {
|
|||
|
||||
observe(subject, topic, type) {
|
||||
if (!ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers).length) {
|
||||
Services.obs.removeObserver(this, "passwordmgr-crypto-login");
|
||||
Services.obs.removeObserver(this, "passwordmgr-crypto-loginCanceled");
|
||||
Services.obs.removeObserver(this, "passwordmgr-storage-changed");
|
||||
return;
|
||||
}
|
||||
|
||||
if (topic == "passwordmgr-crypto-login") {
|
||||
this.removeMasterPasswordLoginNotifications();
|
||||
this.messageSubscribers("AboutLogins:AllLogins", this.getAllLogins());
|
||||
return;
|
||||
}
|
||||
|
||||
if (topic == "passwordmgr-crypto-loginCanceled") {
|
||||
this.showMasterPasswordLoginNotifications();
|
||||
return;
|
||||
|
@ -179,6 +187,19 @@ var AboutLoginsParent = {
|
|||
}
|
||||
},
|
||||
|
||||
removeMasterPasswordLoginNotifications() {
|
||||
for (let subscriber of this._subscriberIterator()) {
|
||||
let {gBrowser} = subscriber.ownerGlobal;
|
||||
let browser = subscriber;
|
||||
let notificationBox = gBrowser.getNotificationBox(browser);
|
||||
let notification = notificationBox.getNotificationWithValue(MASTER_PASSWORD_NOTIFICATION_ID);
|
||||
if (!notification) {
|
||||
continue;
|
||||
}
|
||||
notificationBox.removeNotification(notification);
|
||||
}
|
||||
},
|
||||
|
||||
* _subscriberIterator() {
|
||||
let subscribers = ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers);
|
||||
for (let subscriber of subscribers) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче