зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1056468 - Clear metadata when history entries are removed. r=lucasr
This commit is contained in:
Родитель
e47ba45aed
Коммит
2282b2d613
|
@ -1400,7 +1400,8 @@ public class BrowserProvider extends SharedBrowserDatabaseProvider {
|
|||
+ " AND " + Bookmarks.URL + " IS NOT NULL)";
|
||||
|
||||
return deleteFavicons(uri, faviconSelection, null) +
|
||||
deleteThumbnails(uri, thumbnailSelection, null);
|
||||
deleteThumbnails(uri, thumbnailSelection, null) +
|
||||
URLMetadata.deleteUnused(getContext().getContentResolver());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
*/
|
||||
package org.mozilla.gecko.db;
|
||||
|
||||
import org.mozilla.gecko.db.BrowserContract.Bookmarks;
|
||||
import org.mozilla.gecko.db.BrowserContract.History;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
|
||||
|
@ -187,4 +189,18 @@ public class URLMetadata {
|
|||
Log.e(LOGTAG, "error saving", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static int deleteUnused(final ContentResolver cr) {
|
||||
final String selection = URLMetadataTable.URL_COLUMN + " NOT IN "
|
||||
+ "(SELECT " + History.URL
|
||||
+ " FROM " + History.TABLE_NAME
|
||||
+ " WHERE " + History.IS_DELETED + " = 0"
|
||||
+ " UNION "
|
||||
+ " SELECT " + Bookmarks.URL
|
||||
+ " FROM " + Bookmarks.TABLE_NAME
|
||||
+ " WHERE " + Bookmarks.IS_DELETED + " = 0 "
|
||||
+ " AND " + Bookmarks.URL + " IS NOT NULL)";
|
||||
|
||||
return cr.delete(URLMetadataTable.CONTENT_URI, selection, null);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче