Bug 1529879: Block changing the profile list when another process has changed it. r=froydnj,Gijs,flod draft
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 17 Apr 2019 20:06:20 +0000
changeset 11389 21436979ee109501cdf6ff04a8197c400de2318d
parent 11388 a7d9c86e5f6126cf840f1b507e384b1ee4836e11
child 11390 8c000bedf50f377c1708ad2f4e947cc47979fe76
push id202
push userflodolo@mozilla.com
push dateFri, 19 Apr 2019 11:15:43 +0000
reviewersfroydnj, Gijs, flod
bugs1529879, 1522584, 1539868
Bug 1529879: Block changing the profile list when another process has changed it. r=froydnj,Gijs,flod On startup we record the size and modified time of the profile lists. If changed we refuse to flush any new changes to disk. Also adds a getter to check if they've changed so the UI can do something sensible. All attempts to flush are now checked for success. In some cases in early startup the failure mode isn't great, we just quit startup. The assumption though is that it's extremely unlikely that the files will have changed on disk in the time between when they are read and when profile selection occurs, likely less than a second later. The profile reset flow is changed to only delete the old profile and flush once all the migration has completed, so if something fails the user gets back to their old profile. In testing I ended up having to fix bug 1522584 so background file deletions on a background thread are safer. I haven't implemented any UI tests right now since making modifications to the profiles means modifying the actual user's profiles which I'm not keen to do. See bug 1539868. Differential Revision: https://phabricator.services.mozilla.com/D25278 X-Channel-Repo: mozilla-central X-Channel-Converted-Revision: 77dbf6f2d6d4f9825e9041946f4cb78c75f5a8dd X-Channel-Repo: releases/mozilla-beta X-Channel-Revision: 7b5b8c302a1ab509c7e995254f0e7a809db07327 X-Channel-Repo: releases/mozilla-release X-Channel-Revision: 15f10287a218572a7fd47acabb40208645b4462d
toolkit/chrome/mozapps/profile/profileSelection.properties
toolkit/toolkit/about/aboutProfiles.ftl
--- a/toolkit/chrome/mozapps/profile/profileSelection.properties
+++ b/toolkit/chrome/mozapps/profile/profileSelection.properties
@@ -46,8 +46,16 @@ profileFinishTextMac=Click Done to creat
 profileMissing=Your %S profile cannot be loaded. It may be missing or inaccessible.
 profileMissingTitle=Profile Missing
 profileDeletionFailed=Profile couldn’t be deleted as it may be in use.
 profileDeletionFailedTitle=Deletion Failed
 
 # Profile reset
 # LOCALIZATION NOTE (resetBackupDirectory): Directory name for the profile directory backup created during reset. This directory is placed in a location users will see it (ie. their desktop). %S is the application name.
 resetBackupDirectory=Old %S Data
+
+flushFailTitle=Changes not saved
+# LOCALIZATION NOTE (conflictMessage): %1$S is brandProductName, %2$S is brandShortName.
+conflictMessage=Another copy of %1$S has made changes to profiles. You must restart %2$S before making more changes.
+flushFailMessage=An unexpected error has prevented your changes from being saved.
+# LOCALIZATION NOTE (flushFailButton): $S is brandShortName.
+flushFailRestartButton=Restart %S
+flushFailExitButton=Exit
--- a/toolkit/toolkit/about/aboutProfiles.ftl
+++ b/toolkit/toolkit/about/aboutProfiles.ftl
@@ -5,16 +5,22 @@
 
 profiles-title = About Profiles
 profiles-subtitle = This page helps you to manage your profiles. Each profile is a separate world which contains separate history, bookmarks, settings and add-ons.
 profiles-create = Create a New Profile
 profiles-restart-title = Restart
 profiles-restart-in-safe-mode = Restart with Add-ons Disabled…
 profiles-restart-normal = Restart normally…
 
+profiles-conflict = Another copy of { -brand-product-name } has made changes to profiles. You must restart { -brand-short-name } before making more changes.
+profiles-flush-fail-title = Changes not saved
+profiles-flush-conflict = { profiles-conflict }
+profiles-flush-failed = An unexpected error has prevented your changes from being saved.
+profiles-flush-restart-button = Restart { -brand-short-name }
+
 # Variables:
 #   $name (String) - Name of the profile
 profiles-name = Profile: { $name }
 profiles-is-default = Default Profile
 profiles-rootdir = Root Directory
 
 # localDir is used to show the directory corresponding to
 # the main profile directory that exists for the purpose of storing data on the