Closed Bug 193078 Opened 23 years ago Closed 23 years ago

Cookie entries are wiped out by creating a new profile

Categories

(Core :: Networking: Cookies, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.3final

People

(Reporter: kazhik, Assigned: ccarlen)

References

Details

(Keywords: dataloss)

Attachments

(1 file, 1 obsolete file)

Cookie entries are wiped out by creating a new profile. Steps to reproduce: (1) Select [Tools]-[Switch Profile] and create a new profile. (2) Launch with the new profile and quit. (3) Launch with the old profile and open Cookie Manager dialog. Build: 2003021108-trunk/Win98
sounds like we might be missing some profile change notifications in the cookies code :(
This should be easy to fix. Its just to do as IE does it, one cookie map for each profile...
Confirmed by mvl on a recent build. relevant code is: http://lxr.mozilla.org/seamonkey/source/extensions/cookie/nsCookieService.cpp#210 No idea what's going on here, probably some subtle bug...
Using a few printf's, I found out that at http://lxr.mozilla.org/seamonkey/source/extensions/cookie/nsCookieService.cpp#218 when changing back to the old profile, mDir still contains the path of the original profile. So that cookie file is updated. The cookies that were there, are now gone. So that caching of mDir is the problem.
> So that caching of mDir is the problem. You're right. Caching mDir was put in for bug 158216, so it got broken then. If mDir is being cached, it simply needs to be reset after the profile changes.
I'll take it. I have a patch that I'll be able to test when the rest of my build finishes.
Assignee: darin → ccarlen
OS: Windows 98 → All
Hardware: PC → All
Target Milestone: --- → mozilla1.3final
Attached patch patch (obsolete) — Splinter Review
mDir shouldn't be cached anyway. It's used infrequently, once per profile session and, even if it was used frequently, directory service caches internally anyway.
Attachment #114343 - Flags: superreview?(darin)
Attachment #114343 - Flags: review?(mvl)
Comment on attachment 114343 [details] [diff] [review] patch >- COOKIE_Write(mDir); >+ nsCOMPtr<nsIFile> profileDir; >+ rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileDir)); >+ if (NS_SUCCEEDED(rv)) >+ COOKIE_Write(profileDir); > COOKIE_RemoveAll(); Why not use COOKIE_Write(nsnull) and let COOKIE_Write find the profile? It is doing that anyway. And when you do that, you can as well remove the parameter from the prototype of COOKIE_Write, as all the callers use nsnull as parameter.
Attachment #114343 - Attachment is obsolete: true
Attachment #114343 - Flags: superreview?(darin)
Attachment #114343 - Flags: review?(mvl)
Attachment #114350 - Flags: review?(mvl)
Comment on attachment 114350 [details] [diff] [review] removes dir param from COOKIE_Write() Patch looks good to me.
Attachment #114350 - Flags: review?(mvl) → review+
Attachment #114350 - Flags: superreview?(darin)
Comment on attachment 114350 [details] [diff] [review] removes dir param from COOKIE_Write() sr=darin (thanks conrad!)
Attachment #114350 - Flags: superreview?(darin) → superreview+
Comment on attachment 114350 [details] [diff] [review] removes dir param from COOKIE_Write() Requesting approval. This is a dataloss bug when switching profiles. The risk of the patch are pretty small (just removing the caching of an item)
Attachment #114350 - Flags: approval1.3?
Comment on attachment 114350 [details] [diff] [review] removes dir param from COOKIE_Write() a=asa (on behalf of drivers) for checkin to 1.3 final
Attachment #114350 - Flags: approval1.3? → approval1.3+
Fixed. Thanks Michiel - you handed the fix to me on a platter :-)
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 193531 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: