Commit 694234b4 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Bookmark sync: Handle incoming updates with known server ID

Bug: 1004205
Change-Id: Ib5759c9c112cff7915eef128a21b12b89de30d31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871593Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707802}
parent 133c6d7d
...@@ -228,6 +228,27 @@ void BookmarkRemoteUpdatesHandler::Process( ...@@ -228,6 +228,27 @@ void BookmarkRemoteUpdatesHandler::Process(
bookmark_tracker_->model_type_state().cache_guid() && bookmark_tracker_->model_type_state().cache_guid() &&
bookmark_tracker_->GetEntityForSyncId( bookmark_tracker_->GetEntityForSyncId(
update_entity.originator_client_item_id) != nullptr) { update_entity.originator_client_item_id) != nullptr) {
if (tracked_entity) {
// We generally shouldn't have an entry for both the old ID and the new
// ID, but it could happen due to some past bug (see crbug.com/1004205).
// In that case, the two entries should be duplicates in the sense that
// they have the same URL.
// TODO(crbug.com/516866): Clean up the workaround once this has been
// resolved.
const SyncedBookmarkTracker::Entity* old_entity =
bookmark_tracker_->GetEntityForSyncId(
update_entity.originator_client_item_id);
const bookmarks::BookmarkNode* old_node = old_entity->bookmark_node();
const bookmarks::BookmarkNode* new_node =
tracked_entity->bookmark_node();
CHECK(old_node->type() == bookmarks::BookmarkNode::URL);
CHECK(new_node->type() == bookmarks::BookmarkNode::URL);
CHECK(old_node->url() == new_node->url());
bookmark_tracker_->Remove(update_entity.originator_client_item_id);
bookmark_model_->Remove(old_node);
continue;
}
bookmark_tracker_->UpdateSyncForLocalCreationIfNeeded( bookmark_tracker_->UpdateSyncForLocalCreationIfNeeded(
/*old_id=*/update_entity.originator_client_item_id, /*old_id=*/update_entity.originator_client_item_id,
/*new_id=*/update_entity.id); /*new_id=*/update_entity.id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment