mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 501925 Change cookie policy to relax the mailnews-specific APP_TYPE_MAIL requirement. r=Neil,r=dwitte,sr=dmose
This commit is contained in:
parent
81e5c46fcb
commit
8376e9e637
@ -52,8 +52,6 @@
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
@ -83,9 +81,6 @@ static const PRBool kDefaultPolicy = PR_TRUE;
|
||||
static const char kCookiesLifetimePolicy[] = "network.cookie.lifetimePolicy";
|
||||
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";
|
||||
#endif
|
||||
|
||||
static const char kCookiesPrefsMigrated[] = "network.cookie.prefsMigrated";
|
||||
// obsolete pref names for migration
|
||||
@ -130,9 +125,6 @@ nsCookiePermission::Init()
|
||||
prefBranch->AddObserver(kCookiesLifetimePolicy, 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);
|
||||
#endif
|
||||
PrefChanged(prefBranch, nsnull);
|
||||
|
||||
// migration code for original cookie prefs
|
||||
@ -186,12 +178,6 @@ nsCookiePermission::PrefChanged(nsIPrefBranch *aPrefBranch,
|
||||
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
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -212,27 +198,11 @@ nsCookiePermission::CanAccess(nsIURI *aURI,
|
||||
nsCookieAccess *aResult)
|
||||
{
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
// disable cookies in mailnews if user's prefs say so
|
||||
if (mCookiesDisabledForMailNews) {
|
||||
//
|
||||
// try to examine the "app type" of the window owning this request. if it
|
||||
// or some ancestor is of type APP_TYPE_MAIL, then assume this URI is being
|
||||
// loaded from within mailnews.
|
||||
PRBool isMail = PR_FALSE;
|
||||
if (aChannel) {
|
||||
nsCOMPtr<nsILoadContext> ctx;
|
||||
NS_QueryNotificationCallbacks(aChannel, ctx);
|
||||
if (ctx) {
|
||||
PRBool temp;
|
||||
isMail =
|
||||
NS_FAILED(ctx->IsAppOfType(nsIDocShell::APP_TYPE_MAIL, &temp)) ||
|
||||
temp;
|
||||
}
|
||||
}
|
||||
if (isMail || IsFromMailNews(aURI)) {
|
||||
*aResult = ACCESS_DENY;
|
||||
return NS_OK;
|
||||
}
|
||||
// If this URI is a mailnews one (e.g. imap etc), don't allow cookies for
|
||||
// it.
|
||||
if (IsFromMailNews(aURI)) {
|
||||
*aResult = ACCESS_DENY;
|
||||
return NS_OK;
|
||||
}
|
||||
#endif // MOZ_MAIL_NEWS
|
||||
|
||||
|
@ -59,9 +59,6 @@ public:
|
||||
: mCookiesLifetimeSec(LL_MAXINT)
|
||||
, mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY
|
||||
, mCookiesAlwaysAcceptSession(PR_FALSE)
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
, mCookiesDisabledForMailNews(PR_TRUE)
|
||||
#endif
|
||||
{}
|
||||
virtual ~nsCookiePermission() {}
|
||||
|
||||
@ -77,10 +74,6 @@ private:
|
||||
PRInt64 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
|
||||
|
||||
};
|
||||
|
||||
// {EF565D0A-AB9A-4A13-9160-0644CDFD859A}
|
||||
|
@ -865,7 +865,6 @@ pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
|
||||
pref("network.proxy.failover_timeout", 1800); // 30 minutes
|
||||
pref("network.online", true); //online/offline
|
||||
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontUse
|
||||
pref("network.cookie.disableCookieForMailNews", true); // disable all cookies for mail
|
||||
pref("network.cookie.lifetimePolicy", 0); // accept normally, 1-askBeforeAccepting, 2-acceptForSession,3-acceptForNDays
|
||||
pref("network.cookie.alwaysAcceptSessionCookies", false);
|
||||
pref("network.cookie.prefsMigrated", false);
|
||||
|
@ -56,7 +56,6 @@ static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
|
||||
|
||||
// various pref strings
|
||||
static const char kCookiesPermissions[] = "network.cookie.cookieBehavior";
|
||||
static const char kCookiesDisabledForMailNews[] = "network.cookie.disableCookieForMailNews";
|
||||
static const char kCookiesLifetimeEnabled[] = "network.cookie.lifetime.enabled";
|
||||
static const char kCookiesLifetimeDays[] = "network.cookie.lifetime.days";
|
||||
static const char kCookiesLifetimeCurrentSession[] = "network.cookie.lifetime.behavior";
|
||||
@ -206,7 +205,6 @@ InitPrefs(nsIPrefBranch *aPrefBranch)
|
||||
// we use the most restrictive set of prefs we can;
|
||||
// however, we don't test third party blocking here.
|
||||
aPrefBranch->SetIntPref(kCookiesPermissions, 0); // accept all
|
||||
aPrefBranch->SetBoolPref(kCookiesDisabledForMailNews, PR_TRUE);
|
||||
aPrefBranch->SetBoolPref(kCookiesLifetimeEnabled, PR_TRUE);
|
||||
aPrefBranch->SetIntPref(kCookiesLifetimeCurrentSession, 0);
|
||||
aPrefBranch->SetIntPref(kCookiesLifetimeDays, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user