Skip to content
  • Stefan Brüns's avatar
    [Bookmarks Runner] Remove duplicate results for bookmarks · e02f3fcb
    Stefan Brüns authored
    Summary:
    An entry from the moz_places db may have several referring entries
    in the moz_bookmarks db, i.e. where moz_places.id = moz_bookmarks.fk.
    One of these entries is the "main" entry, while the other ones are used
    for tags. Only the main entry has a title, while the others have not.
    The tag entries have the same type as the main entry, even the parents
    have the same type (folder).
    
    Another source for duplicate URLs are manually created bookmarks, e.g.
    in different folders. These may have the same or different titles.
    
    To remove these duplicates, merge all entries with the same URL. If a
    URL has multiple entries, keep all with distinct titles, otherwise keep
    at least one - a bookmark may have an empty title.
    
    See also T9626
    
    Test Plan:
    - Create a bookmark
    - Add one or more tags
    - Open FFs bookmarks sidebar
    - Copy and paste the new entry
    - Copy and paste the new entry again, change its title
    
    Search for the new bookmark. It should appear exactly twice, once
    with the original title, once with the modified one.
    Without patch, it appears 3 times, plus once more for each tag.
    
    Caveat: The bookmarks db has to be checkpointed to make the new
    entries visible in the main DB file.  To force checkpointing, execute:
    $> sqlite3 -column -header  ~/.mozilla/firefox/*.default/places.sqlite "PRAGMA wal_checkpoint"
    
    Reviewers: #plasma, broulik
    
    Reviewed By: #plasma, broulik
    
    Subscribers: broulik, davidedmundson, zzag, ngraham, plasma-devel
    
    Tags: #plasma
    
    Maniphest Tasks: T9626
    
    Differential Revision: https://phabricator.kde.org/D15357
    e02f3fcb