Bug 716729 - Consider deleted entries when looking whether to insert or update. r=lucasr
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Mon, 26 Mar 2012 19:06:51 +0200
changeset 90305 263150bd32bbd4e3696f246c717023b3ef52d675
parent 90304 f01aac7289844cf5f24a43c858e5cd027825dfeb
child 90306 3e5eee67741ff61d1a18d922bdd5bc2fa26b7aa4
push id7584
push usergpascutto@mozilla.com
push dateMon, 26 Mar 2012 17:07:25 +0000
treeherdermozilla-inbound@263150bd32bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr
bugs716729
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 716729 - Consider deleted entries when looking whether to insert or update. r=lucasr
mobile/android/base/ProfileMigrator.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -187,25 +187,32 @@ public class ProfileMigrator {
         new PlacesRunnable().run();
     }
 
     private class PlacesRunnable implements Runnable {
         private Map<Long, Long> mRerootMap;
         private ArrayList<ContentProviderOperation> mOperations;
 
         protected Uri getBookmarksUri() {
-            return Bookmarks.CONTENT_URI;
+            Uri.Builder uriBuilder = Bookmarks.CONTENT_URI.buildUpon()
+                .appendQueryParameter(BrowserContract.PARAM_SHOW_DELETED, "1");
+            return uriBuilder.build();
         }
 
         protected Uri getHistoryUri() {
-            return History.CONTENT_URI;
+            Uri.Builder uriBuilder = History.CONTENT_URI.buildUpon()
+                .appendQueryParameter(BrowserContract.PARAM_SHOW_DELETED, "1");
+            return uriBuilder.build();
+
         }
 
         protected Uri getImagesUri() {
-            return Images.CONTENT_URI;
+            Uri.Builder uriBuilder = Images.CONTENT_URI.buildUpon()
+                .appendQueryParameter(BrowserContract.PARAM_SHOW_DELETED, "1");
+            return uriBuilder.build();
         }
 
         private long getFolderId(String guid) {
             Cursor c = null;
 
             try {
                 c = mCr.query(getBookmarksUri(),
                               new String[] { Bookmarks._ID },
@@ -311,16 +318,18 @@ public class ProfileMigrator {
                                    projection,
                                    History.URL + " = ?",
                                    new String[] { url },
                                    null);
 
                 ContentValues values = new ContentValues();
                 ContentProviderOperation.Builder builder = null;
                 values.put(History.DATE_LAST_VISITED, date);
+                // Restore deleted record if possible
+                values.put(History.IS_DELETED, 0);
 
                 if (cursor.moveToFirst()) {
                     int visitsCol = cursor.getColumnIndexOrThrow(History.VISITS);
                     int oldVisits = cursor.getInt(visitsCol);
 
                     values.put(History.VISITS, oldVisits + visits);
                     if (title != null) {
                         values.put(History.TITLE, title);