Bug 549633 - Standardize record creation so all SyncEngines encrypt data [r=mconnor]

Always add the id and encryption value so client and delete records can be encrypted.
This commit is contained in:
Edward Lee 2010-03-05 14:46:48 -08:00
Родитель 28164da619
Коммит 650316bd73
8 изменённых файлов: 13 добавлений и 24 удалений

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

@ -333,9 +333,12 @@ SyncEngine.prototype = {
this._toFetch = o));
},
// Create a new record by querying the store, and add the engine metadata
// Create a new record using the store and add in crypto fields
_createRecord: function SyncEngine__createRecord(id) {
return this._store.createRecord(id, this.cryptoMetaURL);
let record = this._store.createRecord(id);
record.id = id;
record.encryption = this.cryptoMetaURL;
return record;
},
// Any setup that needs to happen at the beginning of each sync.

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

@ -704,11 +704,10 @@ BookmarksStore.prototype = {
},
// Create a record starting from the weave id (places guid)
createRecord: function BStore_createRecord(guid, cryptoMetaURL) {
createRecord: function createRecord(guid) {
let placeId = idForGUID(guid);
if (placeId <= 0) { // deleted item
record = new PlacesItem();
record.id = guid;
record.deleted = true;
return record;
}
@ -787,10 +786,8 @@ BookmarksStore.prototype = {
this._bms.getItemType(placeId));
}
record.id = guid;
record.parentid = this._getParentGUIDForId(placeId);
record.predecessorid = this._getPredecessorGUIDForId(placeId);
record.encryption = cryptoMetaURL;
record.sortindex = this._calculateIndex(record);
return record;

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

@ -211,10 +211,9 @@ ClientStore.prototype = {
this.update(record);
},
createRecord: function ClientStore_createRecord(id) {
createRecord: function createRecord(guid) {
let record = new ClientRecord();
record.id = id;
record.payload = this.clients[id];
record.payload = this.clients[guid];
return record;
},

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

@ -155,13 +155,11 @@ FormStore.prototype = {
return (id in this._formItems);
},
createRecord: function FormStore_createRecord(guid, cryptoMetaURL) {
createRecord: function createRecord(guid) {
let record = new FormRec();
record.id = guid;
if (guid in this._formItems) {
let item = this._formItems[guid];
record.encryption = cryptoMetaURL;
record.name = item.name;
record.value = item.value;
} else {

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

@ -249,16 +249,14 @@ HistoryStore.prototype = {
return url ? this._hsvc.isVisited(url) : false;
},
createRecord: function HistStore_createRecord(guid, cryptoMetaURL) {
createRecord: function createRecord(guid) {
let foo = this._findURLByGUID(guid);
let record = new HistoryRec();
record.id = guid;
if (foo) {
record.histUri = foo.url;
record.title = foo.title;
record.sortindex = foo.frecency;
record.visits = this._getVisits(record.histUri);
record.encryption = cryptoMetaURL;
}
else
record.deleted = true;

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

@ -170,13 +170,11 @@ PasswordStore.prototype = {
return false;
},
createRecord: function PasswordStore__createRecord(guid, cryptoMetaURL) {
createRecord: function createRecord(guid) {
let record = new LoginRec();
let login = this._getLoginFromGUID(guid);
record.id = guid;
if (login) {
record.encryption = cryptoMetaURL;
record.hostname = login.hostname;
record.formSubmitURL = login.formSubmitURL;
record.httpRealm = login.httpRealm;

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

@ -182,12 +182,10 @@ PrefStore.prototype = {
return (id === WEAVE_PREFS_GUID);
},
createRecord: function FormStore_createRecord(guid, cryptoMetaURL) {
createRecord: function createRecord(guid) {
let record = new PrefRec();
record.id = guid;
if (guid == WEAVE_PREFS_GUID) {
record.encryption = cryptoMetaURL;
record.value = this._getAllPrefs();
} else {
record.deleted = true;

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

@ -149,7 +149,7 @@ TabStore.prototype = {
return allTabs;
},
createRecord: function TabStore_createRecord(id, cryptoMetaURL) {
createRecord: function createRecord(guid) {
let record = new TabSetRecord();
record.clientName = Clients.clientName;
@ -161,8 +161,6 @@ TabStore.prototype = {
this._log.trace("Wrapping tab: " + JSON.stringify(tab));
}, this);
record.id = id;
record.encryption = cryptoMetaURL;
return record;
},