Bug 755383 - Filter automatic bookmarks that are no longer supported in Native Fennec. r=blassey
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Wed, 16 May 2012 17:49:53 +0200
changeset 95584 d89ad0b19ebbb4a53354da11a7804db179bab432
parent 95583 19cfd6fb3c5718ff40da693888718b5feaf1748e
child 95585 2e7bd3c9bbb5f328859f94f313d20913de4c9e22
push idunknown
push userunknown
push dateunknown
reviewersblassey
bugs755383
milestone15.0a1
Bug 755383 - Filter automatic bookmarks that are no longer supported in Native Fennec. r=blassey
mobile/android/base/ProfileMigrator.java
--- a/mobile/android/base/ProfileMigrator.java
+++ b/mobile/android/base/ProfileMigrator.java
@@ -137,16 +137,24 @@ public class ProfileMigrator {
     // Find the Mobile bookmarks root in places (bug 746860).
     // We cannot rely on the name as that is locale-dependent.
     // If it exists, it will have Id=6, fk=null, type=folder.
     private static final String MOBILE_ROOT_QUERY =
         "SELECT id FROM moz_bookmarks " +
         "WHERE id=6 AND type=2 AND fk IS NULL AND parent=1";
     private static final String MOBILE_ROOT_ID = "id";
 
+    // Do not migrate about URLs that we may not support,
+    // and do not migrate links to the XUL addons page.
+    private static final String FILTER_BLACKLISTED_BOOKMARKS =
+        "AND (places.url IS NULL OR (" +
+        "(places.url NOT LIKE 'about:%') AND " +
+        "(places.url NOT LIKE 'https://addons.mozilla.org/%/mobile%')" +
+        "))";
+
     private static final String BOOKMARK_QUERY_SELECT =
         "SELECT places.url             AS p_url,"         +
         "       bookmark.guid          AS b_guid,"        +
         "       bookmark.id            AS b_id,"          +
         "       bookmark.title         AS b_title,"       +
         "       bookmark.type          AS b_type,"        +
         "       bookmark.parent        AS b_parent,"      +
         "       bookmark.dateAdded     AS b_added,"       +
@@ -160,16 +168,17 @@ public class ProfileMigrator {
         "        ON keyword.id = bookmark.keyword_id) "   +
         "       LEFT OUTER JOIN moz_places AS places "    +
         "       ON places.id = bookmark.fk) "             +
         "      LEFT OUTER JOIN moz_favicons AS favicon "  +
         "      ON places.favicon_id = favicon.id) "       +
         // Bookmark folders don't have a places entry.
         "WHERE (places.hidden IS NULL "                   +
         "       OR places.hidden <> 1) "                  +
+        FILTER_BLACKLISTED_BOOKMARKS                      +
         // This gives us a better chance of adding a folder before
         // adding its contents and hence avoiding extra iterations below.
         "ORDER BY bookmark.id";
 
     private static final String BOOKMARK_QUERY_GUID =
         BOOKMARK_QUERY_SELECT                             +
         "       favicon.data           AS f_data,"        +
         "       favicon.mime_type      AS f_mime_type,"   +