Bug 747181 - Profile migration migrates tag folders. r=rnewman a=blocking-fennec-beta

This commit is contained in:
Margaret Leibovic 2012-04-22 09:58:25 -07:00
parent da067e8c2c
commit e7185b6a86

View File

@ -124,6 +124,9 @@ public class ProfileMigrator {
private static final String ROOT_NAME = "root_name";
private static final String ROOT_FOLDER_ID = "folder_id";
// We use this to ignore the tags folder during migration.
private static final String ROOT_TAGS_FOLDER_NAME = "tags";
private static final String BOOKMARK_QUERY_SELECT =
"SELECT places.url AS p_url," +
" bookmark.guid AS b_guid," +
@ -557,6 +560,7 @@ public class ProfileMigrator {
private class PlacesRunnable implements Runnable {
private Map<Long, Long> mRerootMap;
private Long mTagsPlacesFolderId;
private ArrayList<ContentProviderOperation> mOperations;
private int mMaxEntries;
// We support 2 classes of schemas: Firefox Places 12-13
@ -644,6 +648,12 @@ public class ProfileMigrator {
mRerootMap.put(placesFolderId, getFolderId(name));
Log.v(LOGTAG, "Name: " + name + ", pid=" + placesFolderId
+ ", nid=" + mRerootMap.get(placesFolderId));
// Keep track of the tags folder id so we can avoid
// migrating tags later.
if (ROOT_TAGS_FOLDER_NAME.equals(name))
mTagsPlacesFolderId = placesFolderId;
cursor.moveToNext();
}
cursor.close();
@ -1051,9 +1061,10 @@ public class ProfileMigrator {
int type = cursor.getInt(typeCol);
long parent = cursor.getLong(parentCol);
// Places has an explicit root folder, id=1 parent=0.
// Skip that.
if (id == 1 && parent == 0 && type == PLACES_TYPE_FOLDER) {
// Places has an explicit root folder, id=1 parent=0. Skip that.
// Also, skip tags, since we don't use those in native fennec.
if ((id == 1 && parent == 0 && type == PLACES_TYPE_FOLDER) ||
parent == mTagsPlacesFolderId) {
cursor.moveToNext();
continue;
}