Bug 752052 - updateBookmark updates all bookmarks with the same URL, not a specific bookmark. r=rnewman
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 07 May 2012 15:33:07 -0700
changeset 93403 764c37699d2af6b56bbdb8db6fd4f1a0a99eaa30
parent 93402 afe5651a18dcd11c0aea1c3df1ba3c6a0a4c88d5
child 93404 c77b4c6085c1411135e42b6ba6bd0d40490a75a9
push id9127
push usermleibovic@mozilla.com
push dateMon, 07 May 2012 22:34:48 +0000
treeherdermozilla-inbound@764c37699d2a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs752052
milestone15.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 752052 - updateBookmark updates all bookmarks with the same URL, not a specific bookmark. r=rnewman
mobile/android/base/AwesomeBar.java
mobile/android/base/db/AndroidBrowserDB.java
mobile/android/base/db/BrowserDB.java
mobile/android/base/db/LocalBrowserDB.java
--- a/mobile/android/base/AwesomeBar.java
+++ b/mobile/android/base/AwesomeBar.java
@@ -564,17 +564,17 @@ public class AwesomeBar extends GeckoAct
                 keywordText.setText(keyword);
 
                 editPrompt.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
                     public void onClick(DialogInterface dialog, int whichButton) {
                         (new GeckoAsyncTask<Void, Void, Void>() {
                             @Override
                             public Void doInBackground(Void... params) {
                                 String newUrl = locationText.getText().toString().trim();
-                                BrowserDB.updateBookmark(mResolver, url, newUrl, nameText.getText().toString(),
+                                BrowserDB.updateBookmark(mResolver, id, newUrl, nameText.getText().toString(),
                                                          keywordText.getText().toString());
                                 return null;
                             }
 
                             @Override
                             public void onPostExecute(Void result) {
                                 Toast.makeText(AwesomeBar.this, R.string.bookmark_updated, Toast.LENGTH_SHORT).show();
                             }
--- a/mobile/android/base/db/AndroidBrowserDB.java
+++ b/mobile/android/base/db/AndroidBrowserDB.java
@@ -258,43 +258,18 @@ public class AndroidBrowserDB implements
 
     public void addBookmark(ContentResolver cr, String title, String uri) {
         if (Build.VERSION.SDK_INT >= 11)
             addBookmarkPost11(cr, title, uri);
         else
             addBookmarkPre11(cr, title, uri);
     }
 
-    public void updateBookmarkPre11(ContentResolver cr, String oldUri, String uri, String title) {
-        ContentValues values = new ContentValues();
-        values.put(Browser.BookmarkColumns.TITLE, title);
-        values.put(Browser.BookmarkColumns.URL, uri);
-
-        cr.update(Browser.BOOKMARKS_URI,
-                  values,
-                  Browser.BookmarkColumns.URL + " = ?",
-                  new String[] { oldUri });
-    }
-
-    public void updateBookmarkPost11(ContentResolver cr, String oldUri, String uri, String title) {
-        ContentValues values = new ContentValues();
-        values.put(Browser.BookmarkColumns.TITLE, title);
-        values.put(Browser.BookmarkColumns.URL, uri);
-
-        cr.update(BOOKMARKS_CONTENT_URI_POST_11,
-                  values,
-                  Browser.BookmarkColumns.URL + " = ?",
-                  new String[] { oldUri });
-    }
-
-    public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
-        if (Build.VERSION.SDK_INT >= 11)
-            updateBookmarkPost11(cr, oldUri, uri, title);
-        else
-            updateBookmarkPre11(cr, oldUri, uri, title);
+    public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
+        // Not implemented
     }
 
     public void removeBookmarkPre11(ContentResolver cr, String uri) {
         ContentValues values = new ContentValues();
         values.put(Browser.BookmarkColumns.BOOKMARK, "0");
 
         cr.update(Browser.BOOKMARKS_URI,
                   values,
--- a/mobile/android/base/db/BrowserDB.java
+++ b/mobile/android/base/db/BrowserDB.java
@@ -84,17 +84,17 @@ public class BrowserDB {
         public String getUrlForKeyword(ContentResolver cr, String keyword);
 
         public void addBookmark(ContentResolver cr, String title, String uri);
 
         public void removeBookmark(ContentResolver cr, int id);
 
         public void removeBookmarksWithURL(ContentResolver cr, String uri);
 
-        public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword);
+        public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword);
 
         public BitmapDrawable getFaviconForUrl(ContentResolver cr, String uri);
 
         public void updateFaviconForUrl(ContentResolver cr, String uri, BitmapDrawable favicon);
 
         public void updateThumbnailForUrl(ContentResolver cr, String uri, BitmapDrawable thumbnail);
 
         public byte[] getThumbnailForUrl(ContentResolver cr, String uri);
@@ -163,18 +163,18 @@ public class BrowserDB {
     public static void removeBookmark(ContentResolver cr, int id) {
         sDb.removeBookmark(cr, id);
     }
 
     public static void removeBookmarksWithURL(ContentResolver cr, String uri) {
         sDb.removeBookmarksWithURL(cr, uri);
     }
 
-    public static void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
-        sDb.updateBookmark(cr, oldUri, uri, title, keyword);
+    public static void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
+        sDb.updateBookmark(cr, id, uri, title, keyword);
     }
 
     public static BitmapDrawable getFaviconForUrl(ContentResolver cr, String uri) {
         return sDb.getFaviconForUrl(cr, uri);
     }
 
     public static void updateFaviconForUrl(ContentResolver cr, String uri, BitmapDrawable favicon) {
         sDb.updateFaviconForUrl(cr, uri, favicon);
--- a/mobile/android/base/db/LocalBrowserDB.java
+++ b/mobile/android/base/db/LocalBrowserDB.java
@@ -496,26 +496,26 @@ public class LocalBrowserDB implements B
         cr.delete(contentUri, urlEquals, urlArgs);
     }
 
     public void registerBookmarkObserver(ContentResolver cr, ContentObserver observer) {
         Uri uri = mBookmarksUriWithProfile;
         cr.registerContentObserver(uri, false, observer);
     }
 
-    public void updateBookmark(ContentResolver cr, String oldUri, String uri, String title, String keyword) {
+    public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
         ContentValues values = new ContentValues();
         values.put(Browser.BookmarkColumns.TITLE, title);
         values.put(Bookmarks.URL, uri);
         values.put(Bookmarks.KEYWORD, keyword);
 
         cr.update(mBookmarksUriWithProfile,
                   values,
-                  Bookmarks.URL + " = ?",
-                  new String[] { oldUri });
+                  Bookmarks._ID + " = ?",
+                  new String[] { String.valueOf(id) });
     }
 
     public BitmapDrawable getFaviconForUrl(ContentResolver cr, String uri) {
         Cursor c = cr.query(mImagesUriWithProfile,
                             new String[] { Images.FAVICON },
                             Images.URL + " = ?",
                             new String[] { uri },
                             null);