зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1349703 - (part 1) Fix issue where sync would fail misreconcile special folders in fresh syncs r=kitcambridge
MozReview-Commit-ID: Izy9JgMYpom --HG-- extra : rebase_source : b740e81aafbabae2947fd26888c677065742db96
This commit is contained in:
Родитель
b640dd363b
Коммит
908a695b92
|
@ -1360,6 +1360,13 @@ SyncEngine.prototype = {
|
|||
// By default, assume there's no dupe items for the engine
|
||||
},
|
||||
|
||||
/**
|
||||
* Called before a remote record is discarded due to failed reconciliation.
|
||||
* Used by bookmark sync to note the child ordering of special folders.
|
||||
*/
|
||||
beforeRecordDiscard(record) {
|
||||
},
|
||||
|
||||
// Called when the server has a record marked as deleted, but locally we've
|
||||
// changed it more recently than the deletion. If we return false, the
|
||||
// record will be deleted locally. If we return true, we'll reupload the
|
||||
|
@ -1569,6 +1576,9 @@ SyncEngine.prototype = {
|
|||
// opportunity to merge the records. Bug 720592 tracks this feature.
|
||||
this._log.warn("DATA LOSS: Both local and remote changes to record: " +
|
||||
item.id);
|
||||
if (!remoteIsNewer) {
|
||||
this.beforeRecordDiscard(item);
|
||||
}
|
||||
return remoteIsNewer;
|
||||
},
|
||||
|
||||
|
|
|
@ -630,6 +630,17 @@ BookmarksEngine.prototype = {
|
|||
FORBIDDEN_INCOMING_PARENT_IDS.includes(incomingItem.parentid);
|
||||
},
|
||||
|
||||
beforeRecordDiscard(record) {
|
||||
let isSpecial = PlacesSyncUtils.bookmarks.ROOTS.includes(record.id);
|
||||
if (isSpecial && record.children && !this._store._childrenToOrder[record.id]) {
|
||||
if (this._modified.getStatus(record.id) != PlacesUtils.bookmarks.SYNC_STATUS.NEW) {
|
||||
return;
|
||||
}
|
||||
this._log.debug("Recording children of " + record.id + " as " + JSON.stringify(record.children));
|
||||
this._store._childrenToOrder[record.id] = record.children;
|
||||
}
|
||||
},
|
||||
|
||||
getValidator() {
|
||||
return new BookmarkValidator();
|
||||
}
|
||||
|
@ -1122,6 +1133,14 @@ class BookmarksChangeset extends Changeset {
|
|||
this.weakChanges = {};
|
||||
}
|
||||
|
||||
getStatus(id) {
|
||||
let change = this.changes[id];
|
||||
if (!change) {
|
||||
return PlacesUtils.bookmarks.SYNC_STATUS.UNKNOWN;
|
||||
}
|
||||
return change.status;
|
||||
}
|
||||
|
||||
getModifiedTimestamp(id) {
|
||||
let change = this.changes[id];
|
||||
if (change) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче