зеркало из https://github.com/mozilla/pjs.git
bug 233339 - rewrite CanSetCookie to reflect what dialogs now do, r=dwitte, sr=darin
This commit is contained in:
Родитель
28dd4b96fe
Коммит
3e528ab467
|
@ -67,16 +67,30 @@
|
||||||
// have been chosen to extend nsCookieAccess for convenience.
|
// have been chosen to extend nsCookieAccess for convenience.
|
||||||
static const nsCookieAccess ACCESS_SESSION = 8;
|
static const nsCookieAccess ACCESS_SESSION = 8;
|
||||||
|
|
||||||
|
// values for mCookiesLifetimePolicy
|
||||||
|
// 0 == accept normally
|
||||||
|
// 1 == ask before accepting
|
||||||
|
// 2 == downgrade to session
|
||||||
|
// 3 == limit lifetime to N days
|
||||||
|
static const PRUint32 ACCEPT_NORMALLY = 0;
|
||||||
|
static const PRUint32 ASK_BEFORE_ACCEPT = 1;
|
||||||
|
static const PRUint32 ACCEPT_SESSION = 2;
|
||||||
|
static const PRUint32 ACCEPT_FOR_N_DAYS = 3;
|
||||||
|
|
||||||
static const PRBool kDefaultPolicy = PR_TRUE;
|
static const PRBool kDefaultPolicy = PR_TRUE;
|
||||||
static const char kCookiesAskPermission[] = "network.cookie.warnAboutCookies";
|
static const char kCookiesLifetimePolicy[] = "network.cookie.lifetimePolicy";
|
||||||
#ifdef MOZ_PHOENIX
|
|
||||||
static const char kCookiesLifetimeEnabled[] = "network.cookie.enableForCurrentSessionOnly";
|
|
||||||
#else
|
|
||||||
static const char kCookiesLifetimeEnabled[] = "network.cookie.lifetime.enabled";
|
|
||||||
static const char kCookiesLifetimeCurrentSession[] = "network.cookie.lifetime.behavior";
|
|
||||||
static const char kCookiesLifetimeDays[] = "network.cookie.lifetime.days";
|
static const char kCookiesLifetimeDays[] = "network.cookie.lifetime.days";
|
||||||
|
static const char kCookiesAlwaysAcceptSession[] = "network.cookie.alwaysAcceptSessionCookies";
|
||||||
|
#ifdef MOZ_MAIL_NEWS
|
||||||
static const char kCookiesDisabledForMailNews[] = "network.cookie.disableCookieForMailNews";
|
static const char kCookiesDisabledForMailNews[] = "network.cookie.disableCookieForMailNews";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const char kCookiesPrefsMigrated[] = "network.cookie.prefsMigrated";
|
||||||
|
// obsolete pref names for migration
|
||||||
|
static const char kCookiesLifetimeEnabled[] = "network.cookie.lifetime.enabled";
|
||||||
|
static const char kCookiesLifetimeBehavior[] = "network.cookie.lifetime.behavior";
|
||||||
|
static const char kCookiesAskPermission[] = "network.cookie.warnAboutCookies";
|
||||||
|
|
||||||
static const char kPermissionType[] = "cookie";
|
static const char kPermissionType[] = "cookie";
|
||||||
|
|
||||||
// XXX these casts and constructs are horrible, but our nsInt64/nsTime
|
// XXX these casts and constructs are horrible, but our nsInt64/nsTime
|
||||||
|
@ -84,7 +98,7 @@ static const char kPermissionType[] = "cookie";
|
||||||
#define USEC_PER_SEC (nsInt64(1000000))
|
#define USEC_PER_SEC (nsInt64(1000000))
|
||||||
#define NOW_IN_SECONDS (nsInt64(PR_Now()) / USEC_PER_SEC)
|
#define NOW_IN_SECONDS (nsInt64(PR_Now()) / USEC_PER_SEC)
|
||||||
|
|
||||||
#ifndef MOZ_PHOENIX
|
#ifdef MOZ_MAIL_NEWS
|
||||||
// returns PR_TRUE if URI appears to be the URI of a mailnews protocol
|
// returns PR_TRUE if URI appears to be the URI of a mailnews protocol
|
||||||
static PRBool
|
static PRBool
|
||||||
IsFromMailNews(nsIURI *aURI)
|
IsFromMailNews(nsIURI *aURI)
|
||||||
|
@ -140,14 +154,40 @@ nsCookiePermission::Init()
|
||||||
nsCOMPtr<nsIPrefBranchInternal> prefBranch =
|
nsCOMPtr<nsIPrefBranchInternal> prefBranch =
|
||||||
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
if (prefBranch) {
|
if (prefBranch) {
|
||||||
prefBranch->AddObserver(kCookiesAskPermission, this, PR_FALSE);
|
prefBranch->AddObserver(kCookiesLifetimePolicy, this, PR_FALSE);
|
||||||
prefBranch->AddObserver(kCookiesLifetimeEnabled, this, PR_FALSE);
|
|
||||||
#ifndef MOZ_PHOENIX
|
|
||||||
prefBranch->AddObserver(kCookiesLifetimeCurrentSession, this, PR_FALSE);
|
|
||||||
prefBranch->AddObserver(kCookiesLifetimeDays, this, PR_FALSE);
|
prefBranch->AddObserver(kCookiesLifetimeDays, this, PR_FALSE);
|
||||||
|
prefBranch->AddObserver(kCookiesAlwaysAcceptSession, this, PR_FALSE);
|
||||||
|
#ifdef MOZ_MAIL_NEWS
|
||||||
prefBranch->AddObserver(kCookiesDisabledForMailNews, this, PR_FALSE);
|
prefBranch->AddObserver(kCookiesDisabledForMailNews, this, PR_FALSE);
|
||||||
#endif
|
#endif
|
||||||
PrefChanged(prefBranch, nsnull);
|
PrefChanged(prefBranch, nsnull);
|
||||||
|
|
||||||
|
// migration code for original cookie prefs
|
||||||
|
PRBool migrated;
|
||||||
|
rv = prefBranch->GetBoolPref(kCookiesPrefsMigrated, &migrated);
|
||||||
|
if (NS_FAILED(rv) || !migrated) {
|
||||||
|
PRBool warnAboutCookies = PR_FALSE;
|
||||||
|
prefBranch->GetBoolPref(kCookiesAskPermission, &warnAboutCookies);
|
||||||
|
|
||||||
|
// if the user is using ask before accepting, we'll use that
|
||||||
|
if (warnAboutCookies)
|
||||||
|
prefBranch->SetIntPref(kCookiesLifetimePolicy, ASK_BEFORE_ACCEPT);
|
||||||
|
|
||||||
|
PRBool lifetimeEnabled = PR_FALSE;
|
||||||
|
prefBranch->GetBoolPref(kCookiesLifetimeEnabled, &lifetimeEnabled);
|
||||||
|
|
||||||
|
// if they're limiting lifetime and not using the prompts, use the
|
||||||
|
// appropriate limited lifetime pref
|
||||||
|
if (lifetimeEnabled && !warnAboutCookies) {
|
||||||
|
PRInt32 lifetimeBehavior;
|
||||||
|
prefBranch->GetIntPref(kCookiesLifetimeBehavior, &lifetimeBehavior);
|
||||||
|
if (lifetimeBehavior)
|
||||||
|
prefBranch->SetIntPref(kCookiesLifetimePolicy, ACCEPT_FOR_N_DAYS);
|
||||||
|
else
|
||||||
|
prefBranch->SetIntPref(kCookiesLifetimePolicy, ACCEPT_SESSION);
|
||||||
|
}
|
||||||
|
prefBranch->SetBoolPref(kCookiesPrefsMigrated, PR_TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -161,24 +201,20 @@ nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch,
|
||||||
|
|
||||||
#define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P))
|
#define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P))
|
||||||
|
|
||||||
if (PREF_CHANGED(kCookiesAskPermission) &&
|
if (PREF_CHANGED(kCookiesLifetimePolicy) &&
|
||||||
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAskPermission, &val)))
|
NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimePolicy, &val)))
|
||||||
mCookiesAskPermission = val;
|
mCookiesLifetimePolicy = val;
|
||||||
|
|
||||||
if (PREF_CHANGED(kCookiesLifetimeEnabled) &&
|
|
||||||
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesLifetimeEnabled, &val)))
|
|
||||||
mCookiesLifetimeEnabled = val;
|
|
||||||
|
|
||||||
#ifndef MOZ_PHOENIX
|
|
||||||
if (PREF_CHANGED(kCookiesLifetimeCurrentSession) &&
|
|
||||||
NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeCurrentSession, &val)))
|
|
||||||
mCookiesLifetimeCurrentSession = (val == 0);
|
|
||||||
|
|
||||||
if (PREF_CHANGED(kCookiesLifetimeDays) &&
|
if (PREF_CHANGED(kCookiesLifetimeDays) &&
|
||||||
NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeDays, &val)))
|
NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeDays, &val)))
|
||||||
// save cookie lifetime in seconds instead of days
|
// save cookie lifetime in seconds instead of days
|
||||||
mCookiesLifetimeSec = val * 24 * 60 * 60;
|
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) &&
|
if (PREF_CHANGED(kCookiesDisabledForMailNews) &&
|
||||||
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesDisabledForMailNews, &val)))
|
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesDisabledForMailNews, &val)))
|
||||||
mCookiesDisabledForMailNews = val;
|
mCookiesDisabledForMailNews = val;
|
||||||
|
@ -203,7 +239,7 @@ nsCookiePermission::CanAccess(nsIURI *aURI,
|
||||||
nsIChannel *aChannel,
|
nsIChannel *aChannel,
|
||||||
nsCookieAccess *aResult)
|
nsCookieAccess *aResult)
|
||||||
{
|
{
|
||||||
#ifndef MOZ_PHOENIX
|
#ifdef MOZ_MAIL_NEWS
|
||||||
// disable cookies in mailnews if user's prefs say so
|
// disable cookies in mailnews if user's prefs say so
|
||||||
if (mCookiesDisabledForMailNews) {
|
if (mCookiesDisabledForMailNews) {
|
||||||
//
|
//
|
||||||
|
@ -242,7 +278,7 @@ nsCookiePermission::CanAccess(nsIURI *aURI,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // MOZ_PHOENIX
|
#endif // MOZ_MAIL_NEWS
|
||||||
|
|
||||||
// finally, check with permission manager...
|
// finally, check with permission manager...
|
||||||
nsresult rv = mPermMgr->TestPermission(aURI, kPermissionType, (PRUint32 *) aResult);
|
nsresult rv = mPermMgr->TestPermission(aURI, kPermissionType, (PRUint32 *) aResult);
|
||||||
|
@ -282,7 +318,6 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI,
|
||||||
|
|
||||||
*aResult = kDefaultPolicy;
|
*aResult = kDefaultPolicy;
|
||||||
|
|
||||||
nsresult rv;
|
|
||||||
PRUint32 perm;
|
PRUint32 perm;
|
||||||
mPermMgr->TestPermission(aURI, kPermissionType, &perm);
|
mPermMgr->TestPermission(aURI, kPermissionType, &perm);
|
||||||
switch (perm) {
|
switch (perm) {
|
||||||
|
@ -302,32 +337,26 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI,
|
||||||
// so, we apply the default prefs to it.
|
// so, we apply the default prefs to it.
|
||||||
NS_ASSERTION(perm == nsIPermissionManager::UNKNOWN_ACTION, "unknown permission");
|
NS_ASSERTION(perm == nsIPermissionManager::UNKNOWN_ACTION, "unknown permission");
|
||||||
|
|
||||||
// check cookie lifetime pref, and limit lifetime if required.
|
// now we need to figure out what type of accept policy we're dealing with
|
||||||
// we only want to do this if the cookie isn't going to be expired anyway.
|
// if we accept cookies normally, just bail and return
|
||||||
nsInt64 delta;
|
if (mCookiesLifetimePolicy == ACCEPT_NORMALLY) {
|
||||||
if (!*aIsSession) {
|
*aResult = PR_TRUE;
|
||||||
nsInt64 currentTime = NOW_IN_SECONDS;
|
return NS_OK;
|
||||||
delta = nsInt64(*aExpiry) - currentTime;
|
}
|
||||||
|
|
||||||
if (mCookiesLifetimeEnabled && delta > nsInt64(0)) {
|
// declare this here since it'll be used in all of the remaining cases
|
||||||
#ifdef MOZ_PHOENIX
|
nsInt64 currentTime = NOW_IN_SECONDS;
|
||||||
// limit lifetime to session
|
nsInt64 delta = nsInt64(*aExpiry) - currentTime;
|
||||||
*aIsSession = PR_TRUE;
|
|
||||||
#else
|
|
||||||
if (mCookiesLifetimeCurrentSession) {
|
|
||||||
// limit lifetime to session
|
|
||||||
*aIsSession = PR_TRUE;
|
|
||||||
} else if (delta > mCookiesLifetimeSec) {
|
|
||||||
// limit lifetime to specified time
|
|
||||||
delta = mCookiesLifetimeSec;
|
|
||||||
*aExpiry = currentTime + mCookiesLifetimeSec;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check whether the user wants to be prompted
|
// check whether the user wants to be prompted
|
||||||
if (mCookiesAskPermission) {
|
if (mCookiesLifetimePolicy == ASK_BEFORE_ACCEPT) {
|
||||||
|
// if it's a session cookie and the user wants to accept these
|
||||||
|
// without asking, just accept the cookie and return
|
||||||
|
if (*aIsSession && mCookiesAlwaysAcceptSession) {
|
||||||
|
*aResult = PR_TRUE;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// default to rejecting, in case the prompting process fails
|
// default to rejecting, in case the prompting process fails
|
||||||
*aResult = PR_FALSE;
|
*aResult = PR_FALSE;
|
||||||
|
|
||||||
|
@ -352,6 +381,7 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI,
|
||||||
|
|
||||||
// we don't cache the cookiePromptService - it's not used often, so not
|
// we don't cache the cookiePromptService - it's not used often, so not
|
||||||
// worth the memory.
|
// worth the memory.
|
||||||
|
nsresult rv;
|
||||||
nsCOMPtr<nsICookiePromptService> cookiePromptService =
|
nsCOMPtr<nsICookiePromptService> cookiePromptService =
|
||||||
do_GetService(NS_COOKIEPROMPTSERVICE_CONTRACTID, &rv);
|
do_GetService(NS_COOKIEPROMPTSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
@ -405,6 +435,18 @@ nsCookiePermission::CanSetCookie(nsIURI *aURI,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// we're not prompting, so we must be limiting the lifetime somehow
|
||||||
|
// if it's a session cookie, we do nothing
|
||||||
|
if (!*aIsSession && delta > nsInt64(0)) {
|
||||||
|
if (mCookiesLifetimePolicy == ACCEPT_SESSION) {
|
||||||
|
// limit lifetime to session
|
||||||
|
*aIsSession = PR_TRUE;
|
||||||
|
} else if (delta > mCookiesLifetimeSec) {
|
||||||
|
// limit lifetime to specified time
|
||||||
|
*aExpiry = currentTime + mCookiesLifetimeSec;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,11 @@ public:
|
||||||
NS_DECL_NSIOBSERVER
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
nsCookiePermission()
|
nsCookiePermission()
|
||||||
: mCookiesAskPermission(PR_FALSE)
|
: mCookiesLifetimeSec(LL_MAXINT)
|
||||||
, mCookiesLifetimeEnabled(PR_FALSE)
|
, mCookiesLifetimePolicy(LL_MAXINT)
|
||||||
#ifndef MOZ_PHOENIX
|
, mCookiesAlwaysAcceptSession(PR_FALSE)
|
||||||
|
#ifdef MOZ_MAIL_NEWS
|
||||||
, mCookiesDisabledForMailNews(PR_TRUE)
|
, mCookiesDisabledForMailNews(PR_TRUE)
|
||||||
, mCookiesLifetimeCurrentSession(PR_FALSE)
|
|
||||||
, mCookiesLifetimeSec(LL_MAXINT)
|
|
||||||
#endif
|
#endif
|
||||||
{}
|
{}
|
||||||
virtual ~nsCookiePermission() {}
|
virtual ~nsCookiePermission() {}
|
||||||
|
@ -72,13 +71,11 @@ public:
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsIPermissionManager> mPermMgr;
|
nsCOMPtr<nsIPermissionManager> mPermMgr;
|
||||||
|
|
||||||
PRPackedBool mCookiesAskPermission;
|
|
||||||
PRPackedBool mCookiesLifetimeEnabled; // cookie lifetime limit enabled
|
|
||||||
// (for phoenix, this implies limited to session)
|
|
||||||
#ifndef MOZ_PHOENIX
|
|
||||||
PRPackedBool mCookiesDisabledForMailNews;
|
|
||||||
PRPackedBool mCookiesLifetimeCurrentSession; // limit cookie lifetime to current session
|
|
||||||
nsInt64 mCookiesLifetimeSec; // lifetime limit specified in seconds
|
nsInt64 mCookiesLifetimeSec; // lifetime limit specified in seconds
|
||||||
|
PRUint8 mCookiesLifetimePolicy; // pref for how long cookies are stored
|
||||||
|
PRPackedBool mCookiesAlwaysAcceptSession; // don't prompt for session cookies
|
||||||
|
#ifdef MOZ_MAIL_NEWS
|
||||||
|
PRPackedBool mCookiesDisabledForMailNews;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
<script type="application/x-javascript">
|
<script type="application/x-javascript">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var panel = "chrome://cookie/content/pref-cookies.xul";
|
var panel = "chrome://cookie/content/pref-cookies.xul";
|
||||||
var _elementIDs = ["networkCookieBehaviour", "networkWarnAboutCookies",
|
var _elementIDs = ["networkCookieBehavior", "networkCookieLifetime",
|
||||||
"lifetimeEnabled", "lifetimeBehavior", "lifetimeDays"];
|
"alwaysAcceptSession", "lifetimeDays"];
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,6 @@
|
||||||
var p3pRadioButton = document.getElementById("p3pRadioButton");
|
var p3pRadioButton = document.getElementById("p3pRadioButton");
|
||||||
p3pRadioButton.removeAttribute("hidden");
|
p3pRadioButton.removeAttribute("hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const cookies_disabled = "2";
|
const cookies_disabled = "2";
|
||||||
|
@ -56,44 +55,37 @@
|
||||||
const cookies_p3p = "3";
|
const cookies_p3p = "3";
|
||||||
const cookies_enabled = "0";
|
const cookies_enabled = "0";
|
||||||
|
|
||||||
|
const accept_normally = "0";
|
||||||
|
const accept_session = "2";
|
||||||
|
const accept_for_n_days = "3";
|
||||||
|
const ask_before_accepting = "1";
|
||||||
|
|
||||||
function setDisables(setFocus)
|
function setDisables(setFocus)
|
||||||
{
|
{
|
||||||
var cookieBehavior = document.getElementById("networkCookieBehaviour");
|
var cookieBehavior = document.getElementById("networkCookieBehavior");
|
||||||
|
|
||||||
var p3pButton = document.getElementById("p3pDialog");
|
var p3pButton = document.getElementById("p3pDialog");
|
||||||
p3pButton.disabled = (cookieBehavior.value != cookies_p3p);
|
p3pButton.disabled = (cookieBehavior.value != cookies_p3p);
|
||||||
if (parent.hPrefWindow.getPrefIsLocked(p3pButton.getAttribute("prefstring")) )
|
if (parent.hPrefWindow.getPrefIsLocked(p3pButton.getAttribute("prefstring")) )
|
||||||
p3pButton.disabled = true;
|
p3pButton.disabled = true;
|
||||||
|
|
||||||
// if mailnews is installed then we will have networkCookieBehaviorForMailNews checkbox
|
var cookieLifetime = document.getElementById("networkCookieLifetime");
|
||||||
if (document.getElementById('networkDisableCookieForMailNews'))
|
var lifetimeDays = document.getElementById("lifetimeDays");
|
||||||
{
|
var alwaysAcceptSession = document.getElementById("alwaysAcceptSession");
|
||||||
var networkDisableCookieForMailNews = document.getElementById("networkDisableCookieForMailNews");
|
if (cookieLifetime.value == ask_before_accepting) {
|
||||||
networkDisableCookieForMailNews.disabled = cookieBehavior.value == cookies_disabled;
|
lifetimeDays.disabled = true;
|
||||||
|
alwaysAcceptSession.disabled = false;
|
||||||
|
} else if (cookieLifetime.value == accept_for_n_days) {
|
||||||
|
lifetimeDays.disabled = false;
|
||||||
|
alwaysAcceptSession.disabled = true;
|
||||||
|
} else {
|
||||||
|
lifetimeDays.disabled = true;
|
||||||
|
alwaysAcceptSession.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var warnCheckbox = document.getElementById("networkWarnAboutCookies");
|
if (parent.hPrefWindow.getPrefIsLocked(alwaysAcceptSession.getAttribute("prefstring")) )
|
||||||
warnCheckbox.disabled = (cookieBehavior.value == cookies_disabled);
|
alwaysAcceptSession.disabled = true;
|
||||||
if (parent.hPrefWindow.getPrefIsLocked(warnCheckbox.getAttribute("prefstring")) )
|
|
||||||
warnCheckbox.disabled = true;
|
|
||||||
|
|
||||||
var lifetimeCheckbox = document.getElementById("lifetimeEnabled");
|
|
||||||
lifetimeCheckbox.disabled = (cookieBehavior.value == cookies_disabled);
|
|
||||||
if (parent.hPrefWindow.getPrefIsLocked(lifetimeCheckbox.getAttribute("prefstring")) )
|
|
||||||
lifetimeCheckbox.disabled = true;
|
|
||||||
|
|
||||||
var lifetimeEnabled = document.getElementById("lifetimeEnabled");
|
|
||||||
var lifetimeBehavior = document.getElementById("lifetimeBehavior");
|
|
||||||
var lifetimeDays = document.getElementById("lifetimeDays");
|
|
||||||
|
|
||||||
lifetimeBehavior.disabled = (cookieBehavior.value == cookies_disabled) ||
|
|
||||||
!lifetimeEnabled.checked;
|
|
||||||
if (parent.hPrefWindow.getPrefIsLocked(lifetimeBehavior.getAttribute("prefstring")) )
|
|
||||||
lifetimeBehavior.disabled = true;
|
|
||||||
|
|
||||||
lifetimeDays.disabled = (cookieBehavior.value == cookies_disabled) ||
|
|
||||||
!lifetimeEnabled.checked ||
|
|
||||||
(lifetimeBehavior.value != 1);
|
|
||||||
if (parent.hPrefWindow.getPrefIsLocked(lifetimeDays.getAttribute("prefstring")) )
|
if (parent.hPrefWindow.getPrefIsLocked(lifetimeDays.getAttribute("prefstring")) )
|
||||||
lifetimeDays.disabled = true;
|
lifetimeDays.disabled = true;
|
||||||
|
|
||||||
|
@ -103,8 +95,9 @@
|
||||||
]]>
|
]]>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<description>&cookieDetails;</description>
|
<groupbox id="networkCookieAcceptPolicy">
|
||||||
<radiogroup id="networkCookieBehaviour"
|
<caption label="&cookiePolicy.label;"/>
|
||||||
|
<radiogroup id="networkCookieBehavior"
|
||||||
prefstring="network.cookie.cookieBehavior">
|
prefstring="network.cookie.cookieBehavior">
|
||||||
<radio value="2" label="&disableCookies.label;"
|
<radio value="2" label="&disableCookies.label;"
|
||||||
accesskey="&disableCookies.accesskey;" oncommand="setDisables(false);"/>
|
accesskey="&disableCookies.accesskey;" oncommand="setDisables(false);"/>
|
||||||
|
@ -120,32 +113,36 @@
|
||||||
<radio value="0" label="&accAllCookiesRadio.label;"
|
<radio value="0" label="&accAllCookiesRadio.label;"
|
||||||
accesskey="&accAllCookiesRadio.accesskey;" oncommand="setDisables(false);"/>
|
accesskey="&accAllCookiesRadio.accesskey;" oncommand="setDisables(false);"/>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
<separator id="networkCookieBehaviorSeparator"/>
|
</groupbox>
|
||||||
<vbox align="start">
|
<groupbox id="networkCookieLifetimePolicy">
|
||||||
<checkbox id="networkWarnAboutCookies" label="&warnAboutCookies.label;" accesskey="&warnAboutCookies.accesskey;"
|
<caption label="&cookieLifetimePolicy.label;"/>
|
||||||
prefstring="network.cookie.warnAboutCookies"/>
|
<radiogroup id="networkCookieLifetime"
|
||||||
<checkbox id="lifetimeEnabled" label="&limitLifetime.label;" accesskey="&limitLifetime.accesskey;"
|
prefstring="network.cookie.lifetimePolicy">
|
||||||
prefstring="network.cookie.lifetime.enabled"
|
<radio value="0" label="&acceptNormally.label;" accesskey="&acceptNormally.accesskey;" oncommand="setDisables(false);"/>
|
||||||
oncommand="setDisables(false);"/>
|
<radio value="2" label="&acceptForSession.label;" accesskey="&acceptForSession.accesskey;" oncommand="setDisables(false);"/>
|
||||||
<hbox class="indent">
|
<hbox align="center">
|
||||||
<radiogroup id="lifetimeBehavior" prefstring="network.cookie.lifetime.behavior">
|
<radio value="3" accesskey="&acceptforNDays.accesskey;" label="&acceptforNDays.label;"
|
||||||
<radio value="0" label="¤t.label;"
|
|
||||||
accesskey="¤t.accesskey;"
|
|
||||||
oncommand="setDisables(false);"/>
|
|
||||||
<hbox>
|
|
||||||
<radio value="1" accesskey="&days.accesskey;"
|
|
||||||
oncommand="setDisables(true);"/>
|
oncommand="setDisables(true);"/>
|
||||||
<textbox id="lifetimeDays" pref="true" size="4"
|
<textbox id="lifetimeDays" pref="true" size="4"
|
||||||
preftype="int" prefstring="network.cookie.lifetime.days"/>
|
preftype="int" prefstring="network.cookie.lifetime.days"/>
|
||||||
<description>&days.label;</description>
|
<label value="&days.label;" for="lifetimeDays"/>
|
||||||
|
</hbox>
|
||||||
|
<hbox>
|
||||||
|
<radio value="1" label="&warnAboutCookies.label;"
|
||||||
|
accesskey="&warnAboutCookies.accesskey;" oncommand="setDisables(false);"/>
|
||||||
|
<checkbox id="alwaysAcceptSession" label="&forCurrentSession.label;"
|
||||||
|
accesskey="&forCurrentSession.accesskey;"
|
||||||
|
prefstring="network.cookie.alwaysAcceptSessionCookies"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
</radiogroup>
|
</radiogroup>
|
||||||
</hbox>
|
</groupbox>
|
||||||
</vbox>
|
<groupbox id="manageCookiesAndSites">
|
||||||
<separator/>
|
<caption label="&manageCookies.label;"/>
|
||||||
|
<description>&manageCookiesDescription.label;</description>
|
||||||
<hbox pack="end">
|
<hbox pack="end">
|
||||||
<button label="&viewCookies.label;" accesskey="&viewCookies.accesskey;" oncommand="viewCookies();"
|
<button label="&viewCookies.label;" accesskey="&viewCookies.accesskey;" oncommand="viewCookies();"
|
||||||
id="viewCookieButton"
|
id="viewCookieButton"
|
||||||
prefstring="pref.advanced.cookies.disable_button.view_cookies"/>
|
prefstring="pref.advanced.cookies.disable_button.view_cookies"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
</groupbox>
|
||||||
</page>
|
</page>
|
||||||
|
|
|
@ -4,31 +4,40 @@
|
||||||
|
|
||||||
<!ENTITY cookiePolicy.label "Cookie Acceptance Policy">
|
<!ENTITY cookiePolicy.label "Cookie Acceptance Policy">
|
||||||
|
|
||||||
<!ENTITY accAllCookiesRadio.label "Enable all cookies">
|
<!ENTITY accAllCookiesRadio.label "Allow all cookies">
|
||||||
<!ENTITY accAllCookiesRadio.accesskey "c">
|
<!ENTITY accAllCookiesRadio.accesskey "c">
|
||||||
|
|
||||||
<!ENTITY accOrgCookiesRadio.label "Enable cookies for the originating web site only">
|
<!ENTITY accOrgCookiesRadio.label "Allow cookies for the originating web site only">
|
||||||
<!ENTITY accOrgCookiesRadio.accesskey "o">
|
<!ENTITY accOrgCookiesRadio.accesskey "o">
|
||||||
|
|
||||||
<!ENTITY accP3PCookiesRadio.label "Enable cookies based on privacy settings">
|
<!ENTITY accP3PCookiesRadio.label "Allow cookies based on privacy settings">
|
||||||
<!ENTITY accP3PCookiesRadio.accesskey "p">
|
<!ENTITY accP3PCookiesRadio.accesskey "p">
|
||||||
|
|
||||||
<!ENTITY disableCookies.label "Disable cookies">
|
<!ENTITY disableCookies.label "Block cookies">
|
||||||
<!ENTITY disableCookies.accesskey "D">
|
<!ENTITY disableCookies.accesskey "B">
|
||||||
|
|
||||||
<!ENTITY warnAboutCookies.label "Ask me before storing a cookie">
|
<!ENTITY cookieLifetimePolicy.label "Cookie Lifetime Policy">
|
||||||
|
|
||||||
|
<!ENTITY acceptNormally.label "Accept cookies normally">
|
||||||
|
<!ENTITY acceptNormally.accesskey "n">
|
||||||
|
|
||||||
|
<!ENTITY acceptForSession.label "Accept for current session only">
|
||||||
|
<!ENTITY acceptForSession.accesskey "s">
|
||||||
|
|
||||||
|
<!ENTITY acceptforNDays.label "Accept cookies for">
|
||||||
|
<!ENTITY acceptforNDays.accesskey "f">
|
||||||
|
<!ENTITY days.label "days">
|
||||||
|
|
||||||
|
<!ENTITY warnAboutCookies.label "Ask for each cookie">
|
||||||
<!ENTITY warnAboutCookies.accesskey "A">
|
<!ENTITY warnAboutCookies.accesskey "A">
|
||||||
|
<!ENTITY forCurrentSession.label "except for session cookies">
|
||||||
|
<!ENTITY forCurrentSession.accesskey "e">
|
||||||
|
|
||||||
<!ENTITY cookieDetails "Cookies are small pieces of information that some web sites ask to store on (and later retrieve from) your computer.">
|
<!ENTITY manageCookies.label "Manage Cookies and Sites">
|
||||||
|
<!ENTITY manageCookiesDescription.label "Allows you to view and manage stored cookies and per-site settings for accepting and rejecting cookies. Per-site settings will override the settings above.">
|
||||||
|
|
||||||
<!ENTITY viewCookies.label "Manage Stored Cookies">
|
<!ENTITY viewCookies.label "Cookie Manager">
|
||||||
<!ENTITY viewCookies.accesskey "M">
|
<!ENTITY viewCookies.accesskey "M">
|
||||||
<!ENTITY viewP3P.label "View">
|
<!ENTITY viewP3P.label "View">
|
||||||
<!ENTITY viewP3P.accesskey "V">
|
<!ENTITY viewP3P.accesskey "V">
|
||||||
|
|
||||||
<!ENTITY limitLifetime.label "Limit maximum lifetime of cookies to:">
|
|
||||||
<!ENTITY limitLifetime.accesskey "L">
|
|
||||||
<!ENTITY current.label "current session">
|
|
||||||
<!ENTITY current.accesskey "r">
|
|
||||||
<!ENTITY days.label "days">
|
|
||||||
<!ENTITY days.accesskey "y">
|
|
||||||
|
|
|
@ -21,9 +21,6 @@
|
||||||
case "chrome://communicator/content/pref/pref-appearance.xul":
|
case "chrome://communicator/content/pref/pref-appearance.xul":
|
||||||
_elementIDs.push("generalStartupMail");
|
_elementIDs.push("generalStartupMail");
|
||||||
break;
|
break;
|
||||||
case "chrome://cookie/content/pref-cookies.xul":
|
|
||||||
_elementIDs.push("networkDisableCookieForMailNews");
|
|
||||||
break;
|
|
||||||
case "chrome://cookie/content/pref-images.xul":
|
case "chrome://cookie/content/pref-images.xul":
|
||||||
_elementIDs.push("networkImageDisableImagesInMailNews");
|
_elementIDs.push("networkImageDisableImagesInMailNews");
|
||||||
break;
|
break;
|
||||||
|
@ -54,13 +51,6 @@
|
||||||
pref="true" preftype="bool" prefstring="general.startup.mail"
|
pref="true" preftype="bool" prefstring="general.startup.mail"
|
||||||
prefattribute="checked"/>
|
prefattribute="checked"/>
|
||||||
</groupbox>
|
</groupbox>
|
||||||
<!--- cookie toggle for mail/news -->
|
|
||||||
<page id="cookiesPanel">
|
|
||||||
<checkbox id="networkDisableCookieForMailNews"
|
|
||||||
label="&disableCookieForMailNews.label;" accesskey="&disableCookieForMailNews.accesskey;"
|
|
||||||
preftype="bool" prefstring="network.cookie.disableCookieForMailNews"
|
|
||||||
insertafter="networkCookieBehaviorSeparator"/>
|
|
||||||
</page>
|
|
||||||
<!--- image toggle for mail/news -->
|
<!--- image toggle for mail/news -->
|
||||||
<groupbox id="imagesArea">
|
<groupbox id="imagesArea">
|
||||||
<checkbox id="networkImageDisableImagesInMailNews"
|
<checkbox id="networkImageDisableImagesInMailNews"
|
||||||
|
|
|
@ -4,9 +4,6 @@
|
||||||
<!ENTITY enbPluginCheckMailNews.label "Mail & Newsgroups">
|
<!ENTITY enbPluginCheckMailNews.label "Mail & Newsgroups">
|
||||||
<!ENTITY enbPluginCheckMailNews.accesskey "p">
|
<!ENTITY enbPluginCheckMailNews.accesskey "p">
|
||||||
|
|
||||||
<!ENTITY disableCookieForMailNews.label "Disable cookies in Mail & Newsgroups">
|
|
||||||
<!ENTITY disableCookieForMailNews.accesskey "m">
|
|
||||||
|
|
||||||
<!ENTITY disableImageInMailNews.label "Do not load remote images in Mail & Newsgroup messages">
|
<!ENTITY disableImageInMailNews.label "Do not load remote images in Mail & Newsgroup messages">
|
||||||
<!ENTITY disableImageInMailNews.accesskey "i">
|
<!ENTITY disableImageInMailNews.accesskey "i">
|
||||||
|
|
||||||
|
|
|
@ -591,9 +591,9 @@ pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
|
||||||
pref("network.online", true); //online/offline
|
pref("network.online", true); //online/offline
|
||||||
pref("network.cookie.cookieBehavior", 3); // 0-Accept, 1-dontAcceptForeign, 2-dontUse, 3-p3p
|
pref("network.cookie.cookieBehavior", 3); // 0-Accept, 1-dontAcceptForeign, 2-dontUse, 3-p3p
|
||||||
pref("network.cookie.disableCookieForMailNews", true); // disable all cookies for mail
|
pref("network.cookie.disableCookieForMailNews", true); // disable all cookies for mail
|
||||||
pref("network.cookie.warnAboutCookies", false);
|
pref("network.cookie.lifetimePolicy", 0); // accept normally, 1-askBeforeAccepting, 2-acceptForSession,3-acceptForNDays
|
||||||
pref("network.cookie.lifetime.enabled", false);
|
pref("network.cookie.alwaysAcceptSessionCookies", false);
|
||||||
pref("network.cookie.lifetime.behavior", 0);
|
pref("network.cookie.prefsMigrated", false);
|
||||||
pref("network.cookie.lifetime.days", 90);
|
pref("network.cookie.lifetime.days", 90);
|
||||||
|
|
||||||
// The following default value is for p3p medium mode.
|
// The following default value is for p3p medium mode.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче