Bug 1529879: Block changing the profile list when another process has changed it. r=froydnj,Gijs,flod draft
authorDave Townsend <dtownsend@oxymoronical.com>
Tue, 05 Mar 2019 12:51:44 -0800
changeset 11397 d3b347b1edeaf270487b25ea571c6819d876bb3b
parent 11396 7de9060c85777d6fc1103847675e6456430d5b1e
child 11398 499f3466dae2552a2bda34d0eb53c7505c467347
child 11409 ac9ab47a3a17d0d1f44dfe655be1488d69e84ff7
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: f7a15eb24f3de849d7b42dca8b827ade5354df0e 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 (flushFailRestartButton): $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