Bug 710330 - Fix isBookmark logic for duplicated bookmarks. r=margaret
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Tue, 26 Jun 2012 00:32:03 +0200
changeset 102907 aff898bb348b39ab68c8234c0c39009848f00c6d
parent 102906 8c268dafb5a4e9c053cf4031cc594d3392cbecb4
child 102908 493781e75ced48565b48c193a7e10b9e7965b49a
push id191
push userlsblakk@mozilla.com
push dateFri, 05 Oct 2012 17:12:53 +0000
treeherdermozilla-release@ddb22ac6c03b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs710330
milestone16.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 710330 - Fix isBookmark logic for duplicated bookmarks. r=margaret
mobile/android/base/db/AndroidBrowserDB.java
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/db/AndroidBrowserDB.java
+++ b/mobile/android/base/db/AndroidBrowserDB.java
@@ -186,17 +186,17 @@ public class AndroidBrowserDB implements
         if (Build.VERSION.SDK_INT >= 11)
             cursor = isBookmarkQueryPost11(cr, uri);
         else
             cursor = isBookmarkQueryPre11(cr, uri);
 
         int count = cursor.getCount();
         cursor.close();
 
-        return (count == 1);
+        return (count > 0);
     }
 
     public boolean isReadingListItem(ContentResolver cr, String uri) {
         return false;
     }
 
     public String getUrlForKeyword(ContentResolver cr, String keyword) {
         return null;
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -397,30 +397,30 @@ public class LocalBrowserDB implements B
         mReadingListItemsExist = (count > 0);
         return mReadingListItemsExist;
     }
 
     public boolean isBookmark(ContentResolver cr, String uri) {
         // This method is about normal bookmarks, not the Reading List
         int count = 0;
         try {
-            Cursor c = cr.query(mBookmarksUriWithProfile,
+            Cursor c = cr.query(bookmarksUriWithLimit(1),
                                 new String[] { Bookmarks._ID },
                                 Bookmarks.URL + " = ? AND " +
                                 Bookmarks.PARENT + " != ?",
                                 new String[] { uri,
                                                String.valueOf(Bookmarks.FIXED_READING_LIST_ID) },
                                 Bookmarks.URL);
             count = c.getCount();
             c.close();
         } catch (NullPointerException e) {
             Log.e(LOGTAG, "NullPointerException in isBookmark for " + uri);
         }
 
-        return (count == 1);
+        return (count > 0);
     }
 
     public boolean isReadingListItem(ContentResolver cr, String uri) {
         Cursor cursor = cr.query(mBookmarksUriWithProfile,
                                  new String[] { Bookmarks._ID },
                                  Bookmarks.URL + " = ? AND " +
                                  Bookmarks.PARENT + " == ?",
                                  new String[] { uri,