mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1288558 - Part 4: Replace kObserverService and passwordmanager variables with inline Services. r=MattN
MozReview-Commit-ID: GKcSSCgEkDe --HG-- extra : rebase_source : 344389b39ad60f49dd58e19dc684a6506d8514ba
This commit is contained in:
parent
6283e8bf1c
commit
e5e14894b9
@ -15,10 +15,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
|
||||
"resource://gre/modules/PlacesUtils.jsm");
|
||||
|
||||
let kSignonBundle;
|
||||
let kObserverService;
|
||||
|
||||
// interface variables
|
||||
let passwordmanager = null;
|
||||
|
||||
let showingPasswords = false;
|
||||
|
||||
@ -46,7 +42,7 @@ let signonReloadDisplay = {
|
||||
}
|
||||
break;
|
||||
}
|
||||
kObserverService.notifyObservers(null, "passwordmgr-dialog-updated", null);
|
||||
Services.obs.notifyObservers(null, "passwordmgr-dialog-updated", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,14 +55,8 @@ let dateAndTimeFormatter = new Intl.DateTimeFormat(undefined,
|
||||
hour: "numeric", minute: "numeric" });
|
||||
|
||||
function Startup() {
|
||||
// xpconnect to password manager interfaces
|
||||
passwordmanager = Cc["@mozilla.org/login-manager;1"]
|
||||
.getService(Ci.nsILoginManager);
|
||||
|
||||
// be prepared to reload the display if anything changes
|
||||
kObserverService = Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(Ci.nsIObserverService);
|
||||
kObserverService.addObserver(signonReloadDisplay, "passwordmgr-storage-changed", false);
|
||||
Services.obs.addObserver(signonReloadDisplay, "passwordmgr-storage-changed", false);
|
||||
|
||||
signonsTree = document.getElementById("signonsTree");
|
||||
}
|
||||
@ -112,7 +102,7 @@ function SignonsStartup() {
|
||||
}
|
||||
|
||||
function Shutdown() {
|
||||
kObserverService.removeObserver(signonReloadDisplay, "passwordmgr-storage-changed");
|
||||
Services.obs.removeObserver(signonReloadDisplay, "passwordmgr-storage-changed");
|
||||
}
|
||||
|
||||
function setFilter(aFilterString) {
|
||||
@ -215,7 +205,7 @@ let signonsTreeView = {
|
||||
let existingLogin = table[row].clone();
|
||||
table[row][field] = value;
|
||||
table[row].timePasswordChanged = Date.now();
|
||||
passwordmanager.modifyLogin(existingLogin, table[row]);
|
||||
Services.logins.modifyLogin(existingLogin, table[row]);
|
||||
signonsTree.treeBoxObject.invalidateRow(row);
|
||||
}
|
||||
|
||||
@ -302,7 +292,7 @@ function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending,
|
||||
function LoadSignons() {
|
||||
// loads signons into table
|
||||
try {
|
||||
signons = passwordmanager.getAllLogins();
|
||||
signons = Services.logins.getAllLogins();
|
||||
} catch (e) {
|
||||
signons = [];
|
||||
}
|
||||
@ -464,7 +454,7 @@ function TogglePasswordVisible() {
|
||||
|
||||
// Notify observers that the password visibility toggling is
|
||||
// completed. (Mostly useful for tests)
|
||||
kObserverService.notifyObservers(null, "passwordmgr-password-toggle-complete", null);
|
||||
Services.obs.notifyObservers(null, "passwordmgr-password-toggle-complete", null);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_VISIBILITY_TOGGLED").add(showingPasswords);
|
||||
}
|
||||
|
||||
@ -481,14 +471,14 @@ function AskUserShowPasswords() {
|
||||
|
||||
function FinalizeSignonDeletions(syncNeeded) {
|
||||
for (let s = 0; s < deletedSignons.length; s++) {
|
||||
passwordmanager.removeLogin(deletedSignons[s]);
|
||||
Services.logins.removeLogin(deletedSignons[s]);
|
||||
Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED").add(1);
|
||||
}
|
||||
// If the deletion has been performed in a filtered view, reflect the deletion in the unfiltered table.
|
||||
// See bug 405389.
|
||||
if (syncNeeded) {
|
||||
try {
|
||||
signons = passwordmanager.getAllLogins();
|
||||
signons = Services.logins.getAllLogins();
|
||||
} catch (e) {
|
||||
signons = [];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user