Bug 699793 - Clear favicon urls database when history is cleared (r=blassey)
authorLucas Rocha <lucasr@mozilla.com>
Fri, 13 Jan 2012 16:21:20 +0000
changeset 84429 23099bd5d462e0fde1a316a2d9a512333eac912d
parent 84428 8a0d9d68c5b0c8962db2780c6dc1cac54a22bdf4
child 84430 03fbbdd792f02a54de1d3c40138fd6689035a0cf
child 84437 2b2ca37b0305d1f41c42e26bd66b59bf0239e1b6
push id21848
push usermak77@bonardo.net
push dateSat, 14 Jan 2012 09:02:20 +0000
treeherdermozilla-central@27a7f197c6fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs699793
milestone12.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 699793 - Clear favicon urls database when history is cleared (r=blassey)
mobile/android/base/ConfirmPreference.java
mobile/android/base/Favicons.java
--- a/mobile/android/base/ConfirmPreference.java
+++ b/mobile/android/base/ConfirmPreference.java
@@ -61,16 +61,17 @@ class ConfirmPreference extends DialogPr
     }
     protected void onDialogClosed(boolean positiveResult) {
         if (!positiveResult)
             return;
         if ("clear_history".equalsIgnoreCase(mAction)) {
             GeckoAppShell.getHandler().post(new Runnable(){
                 public void run() {
                     BrowserDB.clearHistory(mContext.getContentResolver());
+                    GeckoApp.mAppContext.mFavicons.clearFavicons();
                 }
             });
         } else if ("clear_private_data".equalsIgnoreCase(mAction)) {
             GeckoAppShell.getHandler().post(new Runnable(){
                 public void run() {
                     GeckoAppShell.sendEventToGecko(new GeckoEvent("Sanitize:ClearAll", null));
                 }
             });
--- a/mobile/android/base/Favicons.java
+++ b/mobile/android/base/Favicons.java
@@ -147,16 +147,22 @@ public class Favicons {
             SQLiteDatabase db = mDbHelper.getWritableDatabase();
 
             ContentValues values = new ContentValues();
             values.put(COLUMN_FAVICON_URL, faviconUrl);
             values.put(COLUMN_PAGE_URL, pageUrl);
 
             db.replace(TABLE_NAME, null, values);
         }
+
+
+        public void clearFavicons() {
+            SQLiteDatabase db = mDbHelper.getWritableDatabase();
+            db.delete(TABLE_NAME, null, null);
+        }
     }
 
     public Favicons(Context context) {
         Log.d(LOGTAG, "Creating Favicons instance");
 
         mContext = context;
         mDbHelper = new DatabaseHelper(context);
 
@@ -194,16 +200,20 @@ public class Favicons {
             return false;
 
         Log.d(LOGTAG, "Cancelling favicon load (" + taskId + ")");
 
         LoadFaviconTask task = mLoadTasks.get(taskId);
         return task.cancel(false);
     }
 
+    public void clearFavicons() {
+        mDbHelper.clearFavicons();
+    }
+
     public void close() {
         Log.d(LOGTAG, "Closing Favicons database");
         mDbHelper.close();
 
         // Cancel any pending tasks
         Set<Long> taskIds = mLoadTasks.keySet();
         Iterator iter = taskIds.iterator();
         while (iter.hasNext()) {