Closed Bug 1453982 Opened 7 years ago Closed 7 years ago

Store profile creation date on profile creation

Categories

(Toolkit :: Telemetry, enhancement, P2)

enhancement

Tracking

()

RESOLVED INVALID

People

(Reporter: janerik, Unassigned)

References

Details

Currently `ProfileAge.jsm` reads `times.json` or, if that file is not present, iterates through all files in the profile directory to find the oldest (by creation date/modification date). This date is stored in `times.json` for later use. Bug 1449739 suggests that this might lead to issues for the `new-profile` ping. Instead of relying on dates reported from the filesystem, we should simply store the timestamp upon profile creation into `times.json`. Open questions: * who is relying on ProfileAge? Does above plan change anything for these users?
See Also: → 1449739
Looks like this was already done in bug 808263 5 years ago. I verified it locally that it works for profiles created using the profile manager. The `times.json` is written using the correct date. The file does not get written when starting Firefox with an empty profile directory. The first users (in my tests either UITour or SnippetsFeed) of ProfileAge will trigger the fallback code which scans the profile directory for the oldest file. Above proposed solution is therefore not an easy fix for the future (as it is already there)
interesting... so
^ incomplete comment. So in some cases, the function stores the timestamp upon profile creation. But if you start firefox with an empty profile directory, it'll check the file system age? is the distinction between the two cases, in the first case, there is no profile directory, and a 'new' profile directory is created. in the second case, there is a profile directory (but with no files inside)? - Su
(In reply to Su-Young Hong from comment #3) > ^ incomplete comment. > > So in some cases, the function stores the timestamp upon profile creation. This happens if the profile is created by the profile manager (e.g. Firefox started using `firefox.bin -p`) > But if you start firefox with an empty profile directory, it'll check the > file system age? Yes, the first user of ProfileAge (most likely it will be UITour or SnippetsFeed) will trigger the fallback code, which scans the current profile's directory. > is the distinction between the two cases, in the first case, there is no > profile directory, and a 'new' profile directory is created. in the second > case, there is a profile directory (but with no files inside)? The first case goes through the full profile-creation (I didn't trace the code yet to know the full code path). The second one doesn't trigger the same hooks. The 'new' profile directory does not necessarily needs to be empty (I don't know when a profile is considered complete, i.e. which files need to exist). For a simple test I created a directory and place an old file inside (`touch -d "10 years ago" old-file.txt`). This was then the reference for the "creation date" as read by ProfileAge.
Priority: -- → P2
Closing for now as the profile creation date is written when a full profile is created. We're tracking the larger issue in the original bug.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.