Bug 558077 - Bookmark folder and its contents lost under certain conditions of syncing same named folder [r=mconnor]

Mark entries as dupe if they're known to be dupes locally so that receiving ends won't bother looking for dupes for these items.

--HG--
extra : rebase_source : 2623f7ed20160ba445b58f538c3397caa0ef78e3
This commit is contained in:
Edward Lee 2010-04-29 14:36:09 -07:00
parent 72f93ad8d0
commit ffe2ddb849
2 changed files with 19 additions and 2 deletions

View File

@ -168,8 +168,13 @@ BookmarksEngine.prototype = {
if (lazyMap[parentName] == null)
lazyMap[parentName] = {};
// If the entry already exists, remember that there are explicit dupes
let entry = new String(guid);
entry.hasDupe = lazyMap[parentName][key] != null;
// Remember this item's guid for its parent-name/key pair
lazyMap[parentName][key] = guid;
lazyMap[parentName][key] = entry;
this._log.trace("Mapped: " + [parentName, key, entry, entry.hasDupe]);
}
// Expose a helper function to get a dupe guid for an item
@ -209,7 +214,19 @@ BookmarksEngine.prototype = {
this._tracker._ensureMobileQuery();
},
_createRecord: function _createRecord(id) {
// Create the record like normal but mark it as having dupes if necessary
let record = SyncEngine.prototype._createRecord.call(this, id);
let entry = this._lazyMap(record);
if (entry != null && entry.hasDupe)
record.hasDupe = true;
return record;
},
_findDupe: function _findDupe(item) {
// Don't bother finding a dupe if the incoming item has duplicates
if (item.hasDupe)
return;
return this._lazyMap(item);
},

View File

@ -85,7 +85,7 @@ PlacesItem.prototype = {
_logName: "Record.PlacesItem",
};
Utils.deferGetSet(PlacesItem, "cleartext", ["parentid", "parentName",
Utils.deferGetSet(PlacesItem, "cleartext", ["hasDupe", "parentid", "parentName",
"predecessorid", "type"]);
function Bookmark(uri, type) {