mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Fix for 22065, cookies are read twice. a=sspitzer, r=leaf
This commit is contained in:
parent
46a1cd6fb2
commit
bf67c7d948
@ -2023,9 +2023,16 @@ cookie_LoadCookies() {
|
||||
|
||||
|
||||
PUBLIC int
|
||||
COOKIE_ReadCookies() {
|
||||
COOKIE_ReadCookies()
|
||||
{
|
||||
static PRBool sReadCookies = PR_FALSE;
|
||||
|
||||
if (sReadCookies)
|
||||
NS_WARNING("We are reading the cookies more than once. Probably bad");
|
||||
|
||||
cookie_LoadCookies();
|
||||
cookie_LoadPermissions();
|
||||
sReadCookies = PR_TRUE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,8 @@ public:
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
|
||||
PRBool mInitted;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIHTTPNotify> mCookieHTTPNotify;
|
||||
};
|
||||
@ -67,15 +68,26 @@ private:
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsCookieService, nsICookieService);
|
||||
|
||||
nsCookieService::nsCookieService() {
|
||||
nsCookieService::nsCookieService()
|
||||
: mInitted(PR_FALSE)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
Init();
|
||||
}
|
||||
|
||||
nsCookieService::~nsCookieService(void) {
|
||||
nsCookieService::~nsCookieService(void)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsCookieService::Init() {
|
||||
nsresult nsCookieService::Init()
|
||||
{
|
||||
// make sure we're not initted twice, because this has the serious
|
||||
// consequence of reading the cookies file twice
|
||||
if (mInitted)
|
||||
{
|
||||
NS_ASSERTION(0, "Baking the cookies twice. Doesn't that make them biscuits?");
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
@ -87,7 +99,8 @@ nsresult nsCookieService::Init() {
|
||||
}
|
||||
|
||||
COOKIE_RegisterCookiePrefCallbacks();
|
||||
COOKIE_ReadCookies();
|
||||
COOKIE_ReadCookies();
|
||||
mInitted = PR_TRUE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user