Closed Bug 1885609 Opened 7 months ago Closed 6 months ago

Implement `backup` method for PlacesBackupResource

Categories

(Firefox :: Profile Backup, task, P3)

task

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: mconley, Assigned: kpatenio)

References

Details

(Whiteboard: [fidefe-device-migration] )

Attachments

(1 file)

This bug is for implementing the backup method on the PlacesBackupResource. Along with copying the places.sqlite and favicons.sqlite databases.

As part of this step, the bookmarks from the Places database should be extracted to some importable format, like JSON or HTML, and placed into the staging folder.

Critically, if the user is configured to:

  1. Not remember history, or
  2. Clear history on exit
  3. Use permanent private browsing mode

Then neither places.sqlite or favicons.sqlite should be written to the staging folder.

Whiteboard: [fidefe-device-migration]
Whiteboard: [fidefe-device-migration] → [fidefe-device-migration]
Blocks: 1885614
No longer blocks: 1885614

For the two places.sqlite and favicons.sqlite databases here, we're going to want to use the backup method exposed on Sqlite.sys.mjs to do the copying: https://searchfox.org/mozilla-central/rev/529f04f4cd2ae68a0f729ba91cf8985edb23e9d3/toolkit/modules/Sqlite.sys.mjs#1998-2009

Critically, if the user is configured to:
Not remember history, or
Clear history on exit
Use permanent private browsing mode

Then neither places.sqlite or favicons.sqlite should be written to the staging folder.

The other detail, however, is that bookmarks exist in the Places folder, and are still valuable to back up. What I think we should do is to generate a "bookmarks backup" representation (see PlacesBackup) within the backup method, and include that in the staging folder. After this, check to see if the user fits any of the above conditions - and if so, return early. Otherwise, clone places.sqlite and favicons.sqlite into the staging folder.

During recovery, if we find a places.sqlite and favicons.sqlite in the recovery folder, we know that we can skip reading in the bookmarks backup file. Otherwise, we'll attempt to import the bookmarks backup file into a newly created places.sqlite after the recovered profile is launched.

Assignee: nobody → kpatenio
Status: NEW → ASSIGNED
Attachment #9394833 - Attachment description: WIP: Bug 1885609 - implement backup method for PlacesBackupResource. r=#backup-reviewers! → Bug 1885609 - implement backup method for PlacesBackupResource. r=#backup-reviewers!

To expand a bit on comment 2, I think it's perfectly reasonable to use BookmarkJSONUtils.exportToFile(aFilePath); to create the bookmarks backup in the event that the Places database as a whole isn't being backed up.

(We'll definitely want an automated test for that case)

Blocks: 1888446
Blocks: 1890427
Blocks: 1890591
Pushed by kpatenio@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f5e6fa4ea052 implement backup method for PlacesBackupResource. r=backup-reviewers,places-reviewers,mak,mconley
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: