void nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch, const char *aPref) { PRBool val; #define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P)) if (PREF_CHANGED(kCookiesLifetimePolicy) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimePolicy, &val))) mCookiesLifetimePolicy = val; if (PREF_CHANGED(kCookiesLifetimeDays) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeDays, &val))) // save cookie lifetime in seconds instead of days mCookiesLifetimeSec = val * 24 * 60 * 60; if (PREF_CHANGED(kCookiesAlwaysAcceptSession) && NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &val))) mCookiesAlwaysAcceptSession = val; #ifdef MOZ_MAIL_NEWS if (PREF_CHANGED(kCookiesDisabledForMailNews) && NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesDisabledForMailNews, &val))) mCookiesDisabledForMailNews = val; #endif }
void nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch, const char *aPref) { int32_t val; #define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P)) if (PREF_CHANGED(kCookiesLifetimePolicy) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimePolicy, &val))) { if (val != static_cast<int32_t>(ACCEPT_SESSION) && val != static_cast<int32_t>(ACCEPT_FOR_N_DAYS)) { val = ACCEPT_NORMALLY; } mCookiesLifetimePolicy = val; } if (PREF_CHANGED(kCookiesLifetimeDays) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeDays, &val))) // save cookie lifetime in seconds instead of days mCookiesLifetimeSec = val * 24 * 60 * 60; }
void nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch, const char *aPref) { PRInt32 val; #define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P)) if (PREF_CHANGED(kCookiesLifetimePolicy) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimePolicy, &val))) mCookiesLifetimePolicy = val; if (PREF_CHANGED(kCookiesLifetimeDays) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeDays, &val))) // save cookie lifetime in seconds instead of days mCookiesLifetimeSec = val * 24 * 60 * 60; bool bval; if (PREF_CHANGED(kCookiesAlwaysAcceptSession) && NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &bval))) mCookiesAlwaysAcceptSession = bval; }
void nsContentBlocker::PrefChanged(nsIPrefBranch *aPrefBranch, const char *aPref) { int32_t val; #define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P)) for(uint32_t i = 0; i < NUMBER_OF_TYPES; ++i) { if (PREF_CHANGED(kTypeString[i]) && NS_SUCCEEDED(aPrefBranch->GetIntPref(kTypeString[i], &val))) mBehaviorPref[i] = LIMIT(val, 1, 3, 1); } }