Commit Graph

108 Commits

Author SHA1 Message Date
kpatenio
d52799a404 Bug 1893301 - Build confirmation dialog element for removing encryption password from backup. r=backup-reviewers,firefox-desktop-core-reviewers ,fluent-reviewers,mconley
This patch adds a new dialog for disabling a backup's password protection.

Steps to test this feature:
1. First ensure that the following prefs are enabled: browser.backup.enabled and browser.backup.preferences.ui.enabled
2. Then ensure that the existing backup for the current profile has encryption enabled (should have enc-state.json)
3. Else, access the debug page (chrome://browser/content/backup/debug.html) to enable encryption
4. Once encryption is enabled, the sensitive data checkbox should be checked in about:settings / about:preferences
5. Clicking the checked checkbox should now show the new dialog for removing password protection
6. If the dialog is confirmed, the checkbox should be unchecked in both the settings/preferences page and the debug page

Other notes:
- If the checkbox is *not* checked, nothing will happen. This is because the dialog for enabling password protection is not yet implemented
- Added tests and Storybook entries as well

Figma: https://www.figma.com/design/vNbX4c0ws0L1qr0mxpKvsW/Fx-Backup?node-id=147-4568&t=9NNUojWMeOLwe3rD-0

Differential Revision: https://phabricator.services.mozilla.com/D213171
2024-06-19 17:36:01 +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
7e650b7436 Bug 1895981 - Allow password setting from turn-on-scheduled-backups dialog. r=backup-reviewers,fchasen
Patch by kpatenio <kpatenio@mozilla.com>.

Makes several updates to turn-on-scheduled-backups dialog:

- Selecting the encryption option will disable the Confirm button until matching passwords are entered
- Confirming turn-on options with encryption enabled will call BackupService.enableEncryption
- Does not turn on scheduled backups if there is any issue with enabling encryption.

Differential Revision: https://phabricator.services.mozilla.com/D211945
2024-06-12 17:36:53 +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
kpatenio
256fc8f6ff Bug 1893299 - build confirmation dialog for turning off scheduled backups. r=backup-reviewers,fluent-reviewers,desktop-theme-reviewers,firefox-desktop-core-reviewers ,bolsson,dao
Patch by kpatenio <kpatenio@mozilla.com>.

Differential Revision: https://phabricator.services.mozilla.com/D210753
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
a71dda6ab1 Bug 1895981 - allow password setting from turn-on-scheduled-backups dialog r=backup-reviewers,mconley
Makes several updates to turn-on-scheduled-backups dialog:

- Selecting the encryption option will disable the Confirm button until matching passwords are entered
- Confirming turn-on options with encryption enabled will call BackupService.enableEncryption
- Does not turn on scheduled backups if there is any issue with enabling encryption.

Differential Revision: https://phabricator.services.mozilla.com/D211945
2024-06-10 21:41:40 +00: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
kpatenio
027089b9b5 Bug 1893299 - build confirmation dialog for turning off scheduled backups. r=backup-reviewers,fluent-reviewers,desktop-theme-reviewers,firefox-desktop-core-reviewers ,bolsson,mconley,dao
Differential Revision: https://phabricator.services.mozilla.com/D210753
2024-06-10 21:41:39 +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
Mike Conley
a37c6fe7cd Bug 1900618 - Disable test_ArchiveEncryptionState.js if running Apple silicon in automation. r=jmaher,backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D212603
2024-06-05 13:04:12 +00:00
Mike Conley
59dca4e409 Bug 1896715 - Create an ArchiveEncryptionState class for encrypting backups. r=djackson,backup-reviewers,kpatenio
This class will be used to generate the keys and ephemera necessary to
encrypt backups. The actual encryption will occur in a later patch.

The state can be serialized and deserialized to disk.

Differential Revision: https://phabricator.services.mozilla.com/D210718
2024-06-03 18:14:33 +00:00
Tamas Szentpeteri
b5da774bc4 Backed out changeset 5a69f64cfafc (bug 1896715) for causing mochitest failures on browser_all_files_referenced.js. CLOSED TREE 2024-06-03 20:22:36 +03:00
Mike Conley
b81a694637 Bug 1896715 - Create an ArchiveEncryptionState class for encrypting backups. r=djackson,backup-reviewers,kpatenio
This class will be used to generate the keys and ephemera necessary to
encrypt backups. The actual encryption will occur in a later patch.

The state can be serialized and deserialized to disk.

Differential Revision: https://phabricator.services.mozilla.com/D210718
2024-06-03 16:04:33 +00:00
Nikki Sharpley
f2f0a26b06 Bug 1892033 - Move sidebar style persistence from XULstore to SessionStore r=sidebar-reviewers,sessionstore-reviewers,backup-reviewers,dao,Gijs,sclements,kpatenio
Move style persistence from XULstore to SessionStore.

Follow up bug to fix persistence of sidebar when only a new tab is open and window is closed, and its
accompanying test `browser_sidebar_persist.js`: Bug 1898613

Depends on D207048

Differential Revision: https://phabricator.services.mozilla.com/D207787
2024-05-24 20:16:31 +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
Gijs Kruitbosch
d4ea70da14 Bug 1895692 - turn off import/no-unassigned-import for storybook files, r=reusable-components-reviewers,frontend-codestyle-reviewers,hjones
Differential Revision: https://phabricator.services.mozilla.com/D210475
2024-05-15 16:08:57 +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
f680db2687 Bug 1892959 - Stub out initial section for backup management within about:preferences. r=backup-reviewers,fluent-reviewers,settings-reviewers,desktop-theme-reviewers,flod,Gijs,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209055
2024-05-08 20:37:04 +00:00
Sandor Molnar
da02f8de36 Backed out changeset 5d2a72296044 (bug 1892959) for causing bc failures @ browser/components/preferences/tests/browser_bug731866.js CLOSED TREE 2024-05-08 19:44:06 +03:00
Mike Conley
773e48c40f Bug 1892959 - Stub out initial section for backup management within about:preferences. r=backup-reviewers,fluent-reviewers,settings-reviewers,desktop-theme-reviewers,flod,Gijs,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209055
2024-05-08 15:21:37 +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
0adb271bf9 Bug 1892312 - Copy times.json from profile that initiated recovery and record recovery time. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209028
2024-05-06 16:47:00 +00:00
Mike Conley
afeeb05292 Bug 1892312 - Stop backing up times.json in MiscDataBackupResource. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209026
2024-05-06 16:46:59 +00:00
Stanca Serban
77cc188b7a Backed out 4 changesets (bug 1892312) for causing linting opt failures.
Backed out changeset a471d91079ae (bug 1892312)
Backed out changeset 3c4d8db39a35 (bug 1892312)
Backed out changeset 197faa33654c (bug 1892312)
Backed out changeset 8510a0207087 (bug 1892312)
2024-05-06 19:17:04 +03:00
Mike Conley
4792f8ea5d Bug 1892312 - Copy times.json from profile that initiated recovery and record recovery time. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209028
2024-05-06 15:18:40 +00:00
Mike Conley
f0682248ea Bug 1892312 - Stop backing up times.json in MiscDataBackupResource. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D209026
2024-05-06 15:18:39 +00:00
Nikki Sharpley
b43107b445 Bug 1885894 - Remove sidebar persistence from XULStore r=sessionstore-reviewers,backup-reviewers,sidebar-reviewers,Gijs,mconley,sfoster,sclements
Since we are moving away from XUL for the revamped sidebar, remove persistence off of XULstore.
For now, this involves moving persistence of "sidebar-command" and "positionend" to SessionStore.

A follow up bug 1892033 for moving the style attribute to SessionStore has been filed. This is slightly more involved,
hence the separate patch.

Differential Revision: https://phabricator.services.mozilla.com/D207048
2024-05-06 15:11:20 +00:00
kpatenio
1ed5674500 Bug 1888448 - Implement recover for SessionStoreBackupResource. r=backup-reviewers,mconley
Differential Revision: https://phabricator.services.mozilla.com/D209319
2024-05-03 21:05:55 +00:00
Fred Chasen
de6192b5bb Bug 1890297 - Implement recover for AddonsBackupResource. r=backup-reviewers,mconley
Differential Revision: https://phabricator.services.mozilla.com/D209174
2024-05-03 16:43:53 +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
Mike Conley
182eeceb22 Bug 1892105 - Flesh out test_backup.py with some data to backup and recover. r=backup-reviewers,kpatenio
This patch updates test_backup.py to write some testing data into various data stores
that BackupService is backing up, create a backup, recover from that backup, and check
to see if the written data exists in the recovered profile.

This isn't exactly exhaustive - there are a number of data stores that aren't accounted
for here yet. Chiefly AddonsBackupResource and SessionStoreBackupResource (bug 1894004),
but also:

1. FxA sign-in status
2. Logins backups
3. Site Security Service State
4. ProfileAge data
5. WebRTC device ID mappings
6. Favicons
7. XUL Store data
8. Content preferences
9. Containers preferences
10. File handler preferences
11. Search preferences
12. user.js and chrome/ customizations

Still, this is a start, and certainly better than nothing. Bug 1894089 has been filed
to add more data to test the listed 12 items.

Differential Revision: https://phabricator.services.mozilla.com/D208939
2024-05-01 14:54:35 +00:00
Mike Conley
0616eead57 Bug 1892105 - Add a postRecoveryComplete Promise getter to BackupService. r=backup-reviewers,kpatenio
This Promise is mainly for use by Marionette tests to know when to check
data stores that might have been updated by postRecovery steps.

Differential Revision: https://phabricator.services.mozilla.com/D208938
2024-05-01 14:54:35 +00:00
Mike Conley
47cb2e4b60 Bug 1888440 - Implement recover for CookiesBackupResource. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D208894
2024-04-29 18:56:28 +00:00
kpatenio
1ddd494dbd Bug 1888446 - implement recover for PlacesBackupResource. r=backup-reviewers,places-reviewers,mconley,Standard8
Differential Revision: https://phabricator.services.mozilla.com/D208565
2024-04-29 17:17:02 +00:00
kpatenio
b3f402d410 Bug 1888442 - import recover for CredentialsAndSecurityBackupResource. r=backup-reviewers,mconley
Differential Revision: https://phabricator.services.mozilla.com/D208806
2024-04-29 17:12:54 +00:00
Mike Conley
d4cc583b01 Bug 1893362 - Workaround sphinx-js being unhappy with static async private methods. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D208625
2024-04-25 17:15:29 +00:00
Mike Conley
8f084a79be Bug 1888444 - Implement recover for FormHistoryBackupResource. r=backup-reviewers,kpatenio
Differential Revision: https://phabricator.services.mozilla.com/D208554
2024-04-25 16:59:09 +00:00