mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 18:55:30 +00:00
Remove getter that fixes the 'two-store' problem
This commit is contained in:
parent
0932057beb
commit
fd1d0e8eef
@ -112,10 +112,11 @@ Engine.prototype = {
|
||||
get enabled() Utils.prefs.getBoolPref("engine." + this.name),
|
||||
get score() this._tracker.score,
|
||||
|
||||
__store: null,
|
||||
get _store() {
|
||||
let store = new this._storeObj();
|
||||
this.__defineGetter__("_store", function() store);
|
||||
return store;
|
||||
if (!this.__store)
|
||||
this.__store = new this._storeObj();
|
||||
return this.__store;
|
||||
},
|
||||
|
||||
get _tracker() {
|
||||
|
@ -64,16 +64,7 @@ PasswordEngine.prototype = {
|
||||
_trackerObj: PasswordTracker,
|
||||
_recordObj: LoginRec,
|
||||
|
||||
/* We override syncStartup & syncFinish to populate/reset our local cache
|
||||
of loginInfo items. We can remove this when the interface to query
|
||||
LoginInfo items by GUID is ready
|
||||
*/
|
||||
_syncStartup: function PasswordEngine__syncStartup() {
|
||||
let self = yield;
|
||||
this._store._cacheLogins();
|
||||
yield SyncEngine.prototype._syncStartup.async(this, self.cb);
|
||||
},
|
||||
|
||||
/* Wipe cache when sync finishes */
|
||||
_syncFinish: function PasswordEngine__syncFinish() {
|
||||
let self = yield;
|
||||
this._store._clearLoginCache();
|
||||
@ -94,16 +85,18 @@ PasswordStore.prototype = {
|
||||
return loginManager;
|
||||
},
|
||||
|
||||
__loginItems: null,
|
||||
get _loginItems() {
|
||||
let loginItems = {};
|
||||
let logins = this._loginManager.getAllLogins({});
|
||||
for (let i = 0; i < logins.length; i++) {
|
||||
let metaInfo = logins[i].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
loginItems[metaInfo.guid] = logins[i];
|
||||
if (!this.__loginItems) {
|
||||
this.__loginItems = {};
|
||||
let logins = this._loginManager.getAllLogins({});
|
||||
for (let i = 0; i < logins.length; i++) {
|
||||
let metaInfo = logins[i].QueryInterface(Ci.nsILoginMetaInfo);
|
||||
this.__loginItems[metaInfo.guid] = logins[i];
|
||||
}
|
||||
}
|
||||
|
||||
this.__defineGetter__("_loginItems", function() loginItems);
|
||||
return loginItems;
|
||||
return this.__loginItems;
|
||||
},
|
||||
|
||||
_nsLoginInfo: null,
|
||||
@ -116,13 +109,6 @@ PasswordStore.prototype = {
|
||||
);
|
||||
},
|
||||
|
||||
_cacheLogins: function PasswordStore__cacheLogins() {
|
||||
/* Force the getter to populate the property
|
||||
Also, this way, we don't fail if the store is created twice?
|
||||
*/
|
||||
return this._loginItems;
|
||||
},
|
||||
|
||||
_clearLoginCache: function PasswordStore__clearLoginCache() {
|
||||
this.__loginItems = null;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user