Commit Graph

124 Commits

Author SHA1 Message Date
Cristian Tuns
63f5f0e2d1 Backed out changeset 5c817eb3498b (bug 1891146) for causing xpcshell failures in test_BackupService.js (Bug 1905413) CLOSED TREE 2024-06-28 16:10:51 -04:00
Stephen Thompson
d3f943915d Bug 1891146 - Measure places, favicons, and total profile backup time r=places-reviewers,Standard8,mconley
Differential Revision: https://phabricator.services.mozilla.com/D214983
2024-06-28 17:56:39 +00:00
Mike Conley
b4a1bad483 Bug 1903064 - Prevent recovery from backups created from an application with a newer appVersion. r=backup-reviewers,sthompson,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D215004
2024-06-28 15:50:31 +00:00
Mike Conley
b420e6f986 Bug 1903606 - Prevent recovery from backups created from an application with a different appName. r=backup-reviewers,sthompson,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D215002
2024-06-28 15:50:30 +00:00
Stanca Serban
6dd32359fe Backed out changeset edf305a8036e (bug 1904146) for causing mochitests failures in browser_settings_turn_on_scheduled_backups.js. 2024-06-28 02:20:50 +03:00
Fred Chasen
fe16fc1d18 Bug 1904146 - Add getBackupFileInfo method to BackupService to handle GetBackupFileInfo events. r=mconley
This implements getting the information needed to show the date of a backup in the restore component and showing the password input if that backup is encrypted.

- Adds a `getBackupFileInfo` method to `BackupService` that will call `sampleArchive` for a passed backup file and update the `backupFileInfo` in the state with a subset of that info.
- Update the `GetBackupFileInfo` event handler in `BackupUIParent` to use the new `getBackupFileInfo` method.

Differential Revision: https://phabricator.services.mozilla.com/D214899
2024-06-27 19:04:46 +00:00
Mike Conley
d8f42dafcd Bug 1901526 - Build out backup scheduling mechanism. r=backup-reviewers,kpatenio,sthompson
Differential Revision: https://phabricator.services.mozilla.com/D213468
2024-06-27 17:27:27 +00:00
Stephen Thompson
e789eddb3e Bug 1887765 - BackupService total backup size metric r=backup-reviewers,mconley
Differential Revision: https://phabricator.services.mozilla.com/D214438
2024-06-25 17:35:34 +00:00
Mike Conley
f1aee3dbb7 Bug 1901534 - Compute a new ArchiveEncryptionState for a recovered, encrypted profile. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D214392
2024-06-25 00:35:44 +00:00
Mike Conley
6dedf6b415 Bug 1891854 - Do not backup session cookies if backup encryption is not enabled. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D214318
2024-06-25 00:35:44 +00:00
Mike Conley
85ae68fe2e Bug 1901520 - Part 3: Add tests for the rendered template. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D214027
2024-06-25 00:35:43 +00:00
Mike Conley
f28634d0f8 Bug 1901520 - Part 2: Add styles and scripts to the single file archive. r=backup-reviewers,frontend-codestyle-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D213975
2024-06-25 00:35:43 +00:00
Mike Conley
c6adb68ed0 Bug 1901520 - Part 1: Send localized template down to the archive worker. r=backup-reviewers,fluent-reviewers,kpatenio,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D213974
2024-06-25 00:35:43 +00:00
Sandor Molnar
f5cc48988c Backed out 5 changesets (bug 1901534, bug 1891854, bug 1901520) for causing xpc failures @ test_BackupService_renderTemplate.js CLOSED TREE
Backed out changeset 5e494cb0aff6 (bug 1901534)
Backed out changeset e8773eda97c1 (bug 1891854)
Backed out changeset 4b079909d830 (bug 1901520)
Backed out changeset 5509d1905d2c (bug 1901520)
Backed out changeset 6d98566735ad (bug 1901520)
2024-06-25 01:24:56 +03:00
Mike Conley
43b60062c1 Bug 1901534 - Compute a new ArchiveEncryptionState for a recovered, encrypted profile. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D214392
2024-06-24 20:47:06 +00:00
Mike Conley
ecb25d3a8b Bug 1891854 - Do not backup session cookies if backup encryption is not enabled. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D214318
2024-06-24 20:47:05 +00:00
Mike Conley
397c08d552 Bug 1901520 - Part 3: Add tests for the rendered template. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D214027
2024-06-24 20:47:05 +00:00
Mike Conley
1c0ab38d1f Bug 1901520 - Part 2: Add styles and scripts to the single file archive. r=backup-reviewers,frontend-codestyle-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D213975
2024-06-24 20:47:05 +00:00
Mike Conley
778ea1791c Bug 1901520 - Part 1: Send localized template down to the archive worker. r=backup-reviewers,fluent-reviewers,kpatenio,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D213974
2024-06-24 20:47:04 +00:00
Mike Conley
7fb7aa2030 Bug 1901523 - Stage and store backup snapshots under backups/snapshots. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D213078
2024-06-22 00:52:40 +00:00
Mike Conley
45c44b8ada Bug 1903629 - Run nsIZipReader.test() on the recovery archive before decompressing it. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D214304
2024-06-22 00:52:40 +00:00
Mike Conley
ad5e2c22bd Bug 1901528 - Part 2: Support recovering from single-file archives. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D213228
2024-06-22 00:52:39 +00:00
Mike Conley
c59dde8ed4 Bug 1901528 - Part 1: Rename BackupService.recoverFromBackup to BackupService.recoverFromSnapshotFolder. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D213227
2024-06-22 00:52:39 +00:00
Mike Conley
7b222de590 Bug 1903381 - Make sure to destroy recovery.zip if decryption fails or does not complete. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D214301
2024-06-21 14:07:28 +00:00
Mike Conley
02de0e2758 Bug 1902020 - Fix a math error in calculating binary blob content length when it divides evenly by chunk size. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D213481
2024-06-21 14:07:28 +00:00
Mike Conley
86e875c137 Bug 1901132 - Use the ArchiveEncryptor and ArchiveDecryptor to encrypt and decrypt backup archives. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D213046
2024-06-21 14:07:27 +00:00
Mike Conley
4916692def Bug 1900892 - Part 3: Add ArchiveEncryptor and ArchiveDecryptor. r=djackson,backup-reviewers,kpatenio
These classes allow us to encrypt and decrypt chunks of a backup archive
if encryption is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D212861
2024-06-21 14:07:27 +00:00
Mike Conley
9520e97295 Bug 1900892 - Part 2: Define a ArchiveJSONBlock schema for the JSON block in a backup archive. r=backup-reviewers,fchasen
Since the ArchiveJSONBlock uses a $ref to reference the metadata in the
BackupManifest schema, we have to change the JSON validation mechanism
we're using to one that supports $ref's.

Differential Revision: https://phabricator.services.mozilla.com/D212860
2024-06-21 14:07:26 +00:00
Mike Conley
c43f563dc7 Bug 1900892 - Part 1: Factor out computeBackupKeys to ArchiveUtils. r=djackson,backup-reviewers,kpatenio
Factoring this out, as computing these keys is something that we need to do both
when generating the ArchiveEncryptionState, as well as when performing a
decryption.

This also renames "authKey" and "encKey" in ArchiveEncryptionState to use
"backupAuthKey" and "backupEncKey", as these are more in-line with what the
encryption design document uses (and because there are "authKeys" and "encKeys"
that will be used by the encryption mechanism that are distinct from the
backupAuthKey and backupEncKey).

Differential Revision: https://phabricator.services.mozilla.com/D212858
2024-06-21 14:07:25 +00:00
Fred Chasen
112102e74a Bug 1894020 - Build dialog for restoring from a backup file. r=backup-reviewers,fluent-reviewers,bolsson,mconley
- Adds button in the preferences backup settings to restore from a backup file.
- Adds a dialog component `restore-from-backup` which will open a filepicker to select a HTML backup file to restore from, show the backup's date and prompt to input a password if needed.
- Adds a stub `getBackupInfo` event to eventually return metadata and config JSON from `sampleArchive` in Bug 1901132.

Does not yet implement:
- Expanding the input to fit multiline files names.
- Restoring the selected backup file.

Figma: https://www.figma.com/design/vNbX4c0ws0L1qr0mxpKvsW/Fx-Backup?node-id=147-8701&t=zvoykS3OusX9YVCv-4

Differential Revision: https://phabricator.services.mozilla.com/D211248
2024-06-14 15:39:05 +00:00
kpatenio
56fdf83248 Bug 1895943 - Implement file picker and save location for backups. r=backup-reviewers,fluent-reviewers,flod,firefox-desktop-core-reviewers
Patch by kpatenio <kpatenio@mozilla.com>.

1. Allows for selecting a custom path or the default (Documents) path for saving backups. The selection is passed from the "turn-on-scheduled-backups" dialog to "BackupService".
2. After pressing the "Choose" button in the dialog, a filepicker will appear so that a folder can be selected.
3. Once the dialog is confirmed, the absolute path is saved to a pref called "browser.backup.location" and saved in the service state.

Other changes:
- Added the Documents folder as the default save location
- Added an onUpdate function for "browser.backup.location" that passes the updated BackupService state to registered widgets (backup settings section, dialogs)
- Added Storybook entries and tests for the newly updated input and filepicker

Figma: https://www.figma.com/design/vNbX4c0ws0L1qr0mxpKvsW/Fx-Backup?node-id=147-4568&t=tILUMKfg8c6Ed1Ul-0 (turn on backup dialog)

Differential Revision: https://phabricator.services.mozilla.com/D210850
2024-06-12 17:36:52 +00:00
Mike Conley
660509b6b4 Bug 1897498 - Add a mechanism for exporting backup snapshots to a single file archive. r=Gijs,valentin,backup-reviewers,frontend-codestyle-reviewers,Standard8,kpatenio
There are a number of interesting things going on this patch that I think are worth highlighting
here for my reviewers:

1. The single-file archive format is an HTML file that uses an inlined multipart/mixed MIME
   message within a HTML document comment in order to embed the backup data into the archive.
2. We use the multipart/mixed nsIStreamConverter to extract the JSON and binary data from
   the MIME block.
3. We use a Archive Worker to do the archive creation, allowing us to do the work of construction
   off of the main thread.
4. The Archive Worker is only parsing the header and getting the byte offset of the MIME block.
   Extraction is happening in the parent process. This is mainly for simplicity for now, since
   the Archive Worker cannot invoke an nsIStreamConverter. Down the line, if we determine that
   we'd prefer the Archive Worker do the base64 decoding off of the main thread, we may need
   to use a Message Channel to send the byte sfrom the nsIStreamConverter to it, and add
   stream-writing support to IOUtils so that the Archive Worker can take care of sending the
   decoded bytes to disk.
5. The patch doesn't expose the extraction mechanism in any way except through the debug
   interface right now. That will come down the line. In the meantime, this mechanism
   can be manually tested in the debug interface by creating a backup, which should also
   create an "archive.html" file in the backups folder. Using the "Extract from archive"
   button in the debug tool will let you select that HTML file and extract the ZIP as
   a file in the backups folder called "extraction.zip".
6. The test template contains Unicode characters because certain locales might involve
   us writing Unicode characters in the HTML template when generating the archive. The
   fun part about that is calculating where the byte offset is for the MIME block! See
   the comment in the Archive.worker.mjs script for how that works.

Differential Revision: https://phabricator.services.mozilla.com/D211588
2024-06-11 13:05:58 +00:00
Cristian Tuns
35dd1648b5 Backed out 3 changesets (bug 1895943, bug 1895981, bug 1893299) for causing bc failures in browser_startup_mainthreadio.js CLOSED TREE
Backed out changeset 8103d1ae73d6 (bug 1895981)
Backed out changeset 5dd8df7eb584 (bug 1895943)
Backed out changeset da7b6cd0a729 (bug 1893299)
2024-06-11 02:35:32 -04:00
kpatenio
f5e604a1bf Bug 1895943 - Implement file picker and save location for backups. r=backup-reviewers,mconley,fluent-reviewers,flod,firefox-desktop-core-reviewers
1. Allows for selecting a custom path or the default (Documents) path for saving backups. The selection is passed from the "turn-on-scheduled-backups" dialog to "BackupService".
2. After pressing the "Choose" button in the dialog, a filepicker will appear so that a folder can be selected.
3. Once the dialog is confirmed, the absolute path is saved to a pref called "browser.backup.location" and saved in the service state.

Other changes:
- Added the Documents folder as the default save location
- Added an onUpdate function for "browser.backup.location" that passes the updated BackupService state to registered widgets (backup settings section, dialogs)
- Added Storybook entries and tests for the newly updated input and filepicker

Figma: https://www.figma.com/design/vNbX4c0ws0L1qr0mxpKvsW/Fx-Backup?node-id=147-4568&t=tILUMKfg8c6Ed1Ul-0 (turn on backup dialog)

Differential Revision: https://phabricator.services.mozilla.com/D210850
2024-06-10 21:41:40 +00:00
pstanciu
d754356cd9 Backed out changeset d88e9ba4a866 (bug 1897498) for causing xpcshell failures in test_BackupService_archive.js CLOSED TREE 2024-06-10 19:31:55 +03:00
Mike Conley
17681152e9 Bug 1897498 - Add a mechanism for exporting backup snapshots to a single file archive. r=Gijs,valentin,backup-reviewers,frontend-codestyle-reviewers,Standard8,kpatenio
There are a number of interesting things going on this patch that I think are worth highlighting
here for my reviewers:

1. The single-file archive format is an HTML file that uses an inlined multipart/mixed MIME
   message within a HTML document comment in order to embed the backup data into the archive.
2. We use the multipart/mixed nsIStreamConverter to extract the JSON and binary data from
   the MIME block.
3. We use a Archive Worker to do the archive creation, allowing us to do the work of construction
   off of the main thread.
4. The Archive Worker is only parsing the header and getting the byte offset of the MIME block.
   Extraction is happening in the parent process. This is mainly for simplicity for now, since
   the Archive Worker cannot invoke an nsIStreamConverter. Down the line, if we determine that
   we'd prefer the Archive Worker do the base64 decoding off of the main thread, we may need
   to use a Message Channel to send the byte sfrom the nsIStreamConverter to it, and add
   stream-writing support to IOUtils so that the Archive Worker can take care of sending the
   decoded bytes to disk.
5. The patch doesn't expose the extraction mechanism in any way except through the debug
   interface right now. That will come down the line. In the meantime, this mechanism
   can be manually tested in the debug interface by creating a backup, which should also
   create an "archive.html" file in the backups folder. Using the "Extract from archive"
   button in the debug tool will let you select that HTML file and extract the ZIP as
   a file in the backups folder called "extraction.zip".
6. The test template contains Unicode characters because certain locales might involve
   us writing Unicode characters in the HTML template when generating the archive. The
   fun part about that is calculating where the byte offset is for the MIME block! See
   the comment in the Archive.worker.mjs script for how that works.

Differential Revision: https://phabricator.services.mozilla.com/D211588
2024-06-10 13:20:51 +00:00
Mike Conley
9565d57fb5 Bug 1900877 - Fix busted source docs due to malformed @see tag. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D212788
2024-06-06 20:54:11 +00:00
Mike Conley
85bf4d2a10 Bug 1897278 - Add methods to BackupService to enable / disable encryption. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D211438
2024-06-05 15:24:15 +00:00
Mike Conley
80cc6a5fa8 Bug 1897278 - Make the backups profile folder a constant accessible off of the BackupService class. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D211437
2024-06-05 15:24:14 +00:00
Stanca Serban
502fdc9e7b Backed out 2 changesets (bug 1897278) for causing xpcshell failures in test_BackupService_enable_disable_encryption.js. CLOSED TREE
Backed out changeset b24523dedba4 (bug 1897278)
Backed out changeset d5e43f371c09 (bug 1897278)
2024-06-05 17:38:43 +03:00
Mike Conley
8348a05e60 Bug 1897278 - Add methods to BackupService to enable / disable encryption. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D211438
2024-06-05 13:49:29 +00:00
Mike Conley
361e271c49 Bug 1897278 - Make the backups profile folder a constant accessible off of the BackupService class. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D211437
2024-06-05 13:49:28 +00:00
kpatenio
c4151dfd44 Bug 1893277 - build initial UI for turning on scheduled backups. r=backup-reviewers,firefox-desktop-core-reviewers ,fluent-reviewers,mconley
backup-settings changes:
- adds a new button in the Backup section of about:preferences / about:settings
- shows the turn on dialog after pressing the button

Turn on dialog behaviour (implemented):
- pressing the cancel will close the dialog
- pressing the confirm button will set the pref browser.backup.scheduled.enabled=true and close the dialog
- pressing the passwords checkbox will show more options

Turn on dialog behaviour (not implemented):
- requiring a password for the backup (see Bug 1895981)
- modifying the save location and showing a file picker (see Bug 1895943)

Other changes:
- tests for backup-settings and the turn on dialog
- Storybook template for the turn on dialog

Lo-fi Figma designs: https://www.figma.com/design/vNbX4c0ws0L1qr0mxpKvsW/Fx-Backup?node-id=147-4558&t=PYLY0QMN1n8GR9vW-0

Differential Revision: https://phabricator.services.mozilla.com/D209769
2024-05-17 17:36:33 +00:00
Mike Conley
3b8db9b08a Bug 1892249 - Use nsIZipWriter to compress the staging folder. r=backup-reviewers,fchasen
This is an intermediary stage before the compressed archive gets (optionally)
encrypted and written into the container file. This is why there's not a whole
lot of testing for the compressed file - those tests will get added once it
completes its journey into the container file so that we can test both
extraction and decompression at the same time.

Differential Revision: https://phabricator.services.mozilla.com/D210311
2024-05-15 04:40:59 +00:00
Cristian Tuns
0e662993fc Backed out changeset 6e2699724abd (bug 1892249) for causing marionette failures in PathUtils.cpp CLOSED TREE 2024-05-14 19:15:53 -04:00
Mike Conley
8ce7979a4e Bug 1892249 - Use nsIZipWriter to compress the staging folder. r=backup-reviewers,fchasen
This is an intermediary stage before the compressed archive gets (optionally)
encrypted and written into the container file. This is why there's not a whole
lot of testing for the compressed file - those tests will get added once it
completes its journey into the container file so that we can test both
extraction and decompression at the same time.

Differential Revision: https://phabricator.services.mozilla.com/D210311
2024-05-14 21:25:45 +00:00
Mike Conley
5b979dc884 Bug 1893269 - Build out basic infrastructure for backup management UI. r=backup-reviewers,settings-reviewers,firefox-desktop-core-reviewers ,Gijs,fluent-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209161
2024-05-09 21:34:35 +00:00
Mike Conley
e38e0ec8c6 Bug 1892771 - Clone the legacy client ID from the profile that initiated backup recovery. r=backup-reviewers,kpatenio
Data science wants us to copy the client IDs from whichever profile initiated recovery.
For legacy telemetry, the client ID is stored in a datareporting/state.json file.

This patch ensures that the client ID exists in the state.json file in the profile
that initiated recovery before then copying it over into the destination profile
for recovery.

This patch also updates the Marionette test to use a separate user profile to
initiate recovery from to ensure we get a unique client ID for it, compared to
the profile that the backup was created for.

Differential Revision: https://phabricator.services.mozilla.com/D209555
2024-05-07 13:10:28 +00:00
Mike Conley
4fb8b4713f Bug 1892479 - Add the legacy telemetry client ID to the backup manifest meta object. r=backup-reviewers,fchasen
Differential Revision: https://phabricator.services.mozilla.com/D209461
2024-05-07 13:10:28 +00:00
Mike Conley
6316b6c912 Bug 1894301 - Avoid schema violation before writing backup manifest when not signed into an account. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209040
2024-05-01 19:01:56 +00:00