bug 98882, implement p3p cookie management, r=harishd,jag, sr=alecf
git-svn-id: svn://10.0.0.236/trunk@103989 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -6,6 +6,7 @@ comm.jar:
|
||||
content/cookie/pref-cookies.xul (resources/content/pref-cookies.xul)
|
||||
content/cookie/pref-images.xul (resources/content/pref-images.xul)
|
||||
content/cookie/cookieOverlay.js (resources/content/cookieOverlay.js)
|
||||
content/cookie/p3p.xul (resources/content/p3p.xul)
|
||||
|
||||
en-US.jar:
|
||||
locale/en-US/cookie/contents.rdf (resources/locale/en-US/contents.rdf)
|
||||
@@ -14,3 +15,4 @@ en-US.jar:
|
||||
locale/en-US/cookie/cookiePrefsOverlay.dtd (resources/locale/en-US/cookiePrefsOverlay.dtd)
|
||||
locale/en-US/cookie/pref-cookies.dtd (resources/locale/en-US/pref-cookies.dtd)
|
||||
locale/en-US/cookie/pref-images.dtd (resources/locale/en-US/pref-images.dtd)
|
||||
locale/en-US/cookie/p3p.dtd (resources/locale/en-US/p3p.dtd)
|
||||
|
||||
@@ -201,7 +201,7 @@ nsCookieService::SetCookieStringFromHttp(nsIURI *aURL, nsIURI *aFirstURL, nsIPro
|
||||
char *firstSpec = NULL;
|
||||
rv = aFirstURL->GetSpec(&firstSpec);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
COOKIE_SetCookieStringFromHttp(spec, firstSpec, aPrompter, (char *)aCookie, (char *)aExpires);
|
||||
COOKIE_SetCookieStringFromHttp(spec, firstSpec, aPrompter, aCookie, (char *)aExpires);
|
||||
nsCRT::free(firstSpec);
|
||||
}
|
||||
nsCRT::free(spec);
|
||||
|
||||
@@ -61,6 +61,11 @@
|
||||
#define cookie_lifetimePref "network.cookie.lifetimeOption"
|
||||
#define cookie_lifetimeValue "network.cookie.lifetimeLimit"
|
||||
|
||||
#define cookie_lifetimeEnabledPref "network.cookie.lifetime.enabled"
|
||||
#define cookie_lifetimeBehaviorPref "network.cookie.lifetime.behavior"
|
||||
#define cookie_lifetimeDaysPref "network.cookie.lifetime.days"
|
||||
#define cookie_p3pPref "network.cookie.p3p"
|
||||
|
||||
static const char *kCookiesFileName = "cookies.txt";
|
||||
|
||||
MODULE_PRIVATE time_t
|
||||
@@ -89,6 +94,41 @@ PRIVATE PERMISSION_BehaviorEnum cookie_behavior = PERMISSION_Accept;
|
||||
PRIVATE PRBool cookie_warning = PR_FALSE;
|
||||
PRIVATE COOKIE_LifetimeEnum cookie_lifetimeOpt = COOKIE_Normal;
|
||||
PRIVATE time_t cookie_lifetimeLimit = 90*24*60*60;
|
||||
PRIVATE time_t cookie_lifetimeDays;
|
||||
PRIVATE PRBool cookie_lifetimeCurrentSession;
|
||||
|
||||
PRIVATE char* cookie_P3P = nsnull;
|
||||
|
||||
/* cookie_P3P (above) consists of 8 characters having the following interpretation:
|
||||
* [0]: behavior for first-party cookies when site has no privacy policy
|
||||
* [1]: behavior for third-party cookies when site has no privacy policy
|
||||
* [2]: behavior for first-party cookies when site uses PII with no user consent
|
||||
* [3]: behavior for third-party cookies when site uses PII with no user consent
|
||||
* [4]: behavior for first-party cookies when site uses PII with implicit consent only
|
||||
* [5]: behavior for third-party cookies when site uses PII with implicit consent only
|
||||
* [6]: behavior for first-party cookies when site uses PII with explicit consent
|
||||
* [7]: behavior for third-party cookies when site uses PII with explicit consent
|
||||
*
|
||||
* note: PII = personally identifiable information
|
||||
*
|
||||
* each of the eight characters can be one of the following
|
||||
* 'a': accept the cookie
|
||||
* 'd': accept the cookie but downgrade it to a session cookie
|
||||
* 'r': reject the cookie
|
||||
*
|
||||
* The following defines are used to refer to these character positions and values
|
||||
*/
|
||||
|
||||
#define P3P_NoPolicy 0
|
||||
#define P3P_NoConsent 2
|
||||
#define P3P_ImplicitConsent 4
|
||||
#define P3P_ExplicitConsent 6
|
||||
|
||||
#define P3P_Accept 'a'
|
||||
#define P3P_Downgrade 'd'
|
||||
#define P3P_Reject 'r'
|
||||
|
||||
#define cookie_P3P_Default "drdraaaa"
|
||||
|
||||
PRIVATE nsVoidArray * cookie_list=0;
|
||||
|
||||
@@ -135,6 +175,7 @@ COOKIE_RemoveAll()
|
||||
cookie_changed = PR_TRUE;
|
||||
delete cookie_list;
|
||||
cookie_list = nsnull;
|
||||
Recycle(cookie_P3P);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +289,7 @@ PRIVATE cookie_CookieStruct *
|
||||
cookie_CheckForPrevCookie(char * path, char * hostname, char * name) {
|
||||
cookie_CookieStruct * cookie_s;
|
||||
if (cookie_list == nsnull) {
|
||||
return NULL;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PRInt32 count = cookie_list->Count();
|
||||
@@ -261,7 +302,7 @@ cookie_CheckForPrevCookie(char * path, char * hostname, char * name) {
|
||||
return(cookie_s);
|
||||
}
|
||||
}
|
||||
return(NULL);
|
||||
return(nsnull);
|
||||
}
|
||||
|
||||
/* cookie utility functions */
|
||||
@@ -337,7 +378,7 @@ cookie_BehaviorPrefChanged(const char * newpref, void * data) {
|
||||
PRInt32 n;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_FAILED(prefs->GetIntPref(cookie_behaviorPref, &n))) {
|
||||
if (!prefs || NS_FAILED(prefs->GetIntPref(cookie_behaviorPref, &n))) {
|
||||
n = PERMISSION_Accept;
|
||||
}
|
||||
cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n);
|
||||
@@ -349,7 +390,7 @@ cookie_WarningPrefChanged(const char * newpref, void * data) {
|
||||
PRBool x;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_FAILED(prefs->GetBoolPref(cookie_warningPref, &x))) {
|
||||
if (!prefs || NS_FAILED(prefs->GetBoolPref(cookie_warningPref, &x))) {
|
||||
x = PR_FALSE;
|
||||
}
|
||||
cookie_SetWarningPref(x);
|
||||
@@ -361,7 +402,7 @@ cookie_LifetimeOptPrefChanged(const char * newpref, void * data) {
|
||||
PRInt32 n;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_FAILED(prefs->GetIntPref(cookie_lifetimePref, &n))) {
|
||||
if (!prefs || NS_FAILED(prefs->GetIntPref(cookie_lifetimePref, &n))) {
|
||||
n = COOKIE_Normal;
|
||||
}
|
||||
cookie_SetLifetimePref((COOKIE_LifetimeEnum)n);
|
||||
@@ -373,12 +414,61 @@ cookie_LifetimeLimitPrefChanged(const char * newpref, void * data) {
|
||||
PRInt32 n;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeValue, &n))) {
|
||||
if (!NS_FAILED(rv) && !NS_FAILED(prefs->GetIntPref(cookie_lifetimeValue, &n))) {
|
||||
cookie_SetLifetimeLimit(n);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_PRIVATE int PR_CALLBACK
|
||||
cookie_LifetimeEnabledPrefChanged(const char * newpref, void * data) {
|
||||
PRInt32 n;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (!prefs || NS_FAILED(prefs->GetBoolPref(cookie_lifetimeEnabledPref, &n))) {
|
||||
n = PR_FALSE;
|
||||
}
|
||||
cookie_SetLifetimePref(n ? COOKIE_Trim : COOKIE_Normal);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_PRIVATE int PR_CALLBACK
|
||||
cookie_LifetimeBehaviorPrefChanged(const char * newpref, void * data) {
|
||||
PRInt32 n;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (!prefs || NS_FAILED(prefs->GetIntPref(cookie_lifetimeBehaviorPref, &n))) {
|
||||
n = 0;
|
||||
}
|
||||
cookie_SetLifetimeLimit((n==0) ? 0 : cookie_lifetimeDays);
|
||||
cookie_lifetimeCurrentSession = (n==0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_PRIVATE int PR_CALLBACK
|
||||
cookie_LifetimeDaysPrefChanged(const char * newpref, void * data) {
|
||||
PRInt32 n;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (!prefs || !NS_FAILED(prefs->GetIntPref(cookie_lifetimeDaysPref, &n))) {
|
||||
cookie_lifetimeDays = n;
|
||||
if (!cookie_lifetimeCurrentSession) {
|
||||
cookie_SetLifetimeLimit(n);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
MODULE_PRIVATE int PR_CALLBACK
|
||||
cookie_P3PPrefChanged(const char * newpref, void * data) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (!prefs || NS_FAILED(prefs->CopyCharPref(cookie_p3pPref, &cookie_P3P))) {
|
||||
cookie_P3P = PL_strdup(cookie_P3P_Default);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRIVATE int
|
||||
cookie_SameDomain(char * currentHost, char * firstHost);
|
||||
|
||||
@@ -388,33 +478,59 @@ COOKIE_RegisterPrefCallbacks(void) {
|
||||
PRBool x;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (!prefs) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize for cookie_behaviorPref
|
||||
if (NS_FAILED(prefs->GetIntPref(cookie_behaviorPref, &n))) {
|
||||
n = PERMISSION_Accept;
|
||||
}
|
||||
cookie_SetBehaviorPref((PERMISSION_BehaviorEnum)n);
|
||||
prefs->RegisterCallback(cookie_behaviorPref, cookie_BehaviorPrefChanged, NULL);
|
||||
prefs->RegisterCallback(cookie_behaviorPref, cookie_BehaviorPrefChanged, nsnull);
|
||||
|
||||
// Initialize for cookie_warningPref
|
||||
if (NS_FAILED(prefs->GetBoolPref(cookie_warningPref, &x))) {
|
||||
x = PR_FALSE;
|
||||
}
|
||||
cookie_SetWarningPref(x);
|
||||
prefs->RegisterCallback(cookie_warningPref, cookie_WarningPrefChanged, NULL);
|
||||
prefs->RegisterCallback(cookie_warningPref, cookie_WarningPrefChanged, nsnull);
|
||||
|
||||
// Initialize for cookie_lifetimePref
|
||||
if (NS_FAILED(prefs->GetIntPref(cookie_lifetimePref, &n))) {
|
||||
n = COOKIE_Normal;
|
||||
// Initialize for cookie_lifetime
|
||||
cookie_SetLifetimePref(COOKIE_Normal);
|
||||
cookie_lifetimeDays = 90;
|
||||
cookie_lifetimeCurrentSession = PR_FALSE;
|
||||
|
||||
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeDaysPref, &n))) {
|
||||
cookie_lifetimeDays = n;
|
||||
}
|
||||
cookie_SetLifetimePref((COOKIE_LifetimeEnum)n);
|
||||
prefs->RegisterCallback(cookie_lifetimePref, cookie_LifetimeOptPrefChanged, NULL);
|
||||
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeBehaviorPref, &n))) {
|
||||
cookie_lifetimeCurrentSession = (n==0);
|
||||
cookie_SetLifetimeLimit((n==0) ? 0 : cookie_lifetimeDays);
|
||||
}
|
||||
if (!NS_FAILED(prefs->GetBoolPref(cookie_lifetimeEnabledPref, &n))) {
|
||||
cookie_SetLifetimePref(n ? COOKIE_Trim : COOKIE_Normal);
|
||||
}
|
||||
prefs->RegisterCallback(cookie_lifetimeEnabledPref, cookie_LifetimeEnabledPrefChanged, nsnull);
|
||||
prefs->RegisterCallback(cookie_lifetimeBehaviorPref, cookie_LifetimeBehaviorPrefChanged, nsnull);
|
||||
prefs->RegisterCallback(cookie_lifetimeDaysPref, cookie_LifetimeDaysPrefChanged, nsnull);
|
||||
|
||||
// Override cookie_lifetime initialization if the older prefs (with no UI) are used
|
||||
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimePref, &n))) {
|
||||
cookie_SetLifetimePref((COOKIE_LifetimeEnum)n);
|
||||
}
|
||||
prefs->RegisterCallback(cookie_lifetimePref, cookie_LifetimeOptPrefChanged, nsnull);
|
||||
|
||||
// Initialize for cookie_lifetimeValue
|
||||
if (!NS_FAILED(prefs->GetIntPref(cookie_lifetimeValue, &n))) {
|
||||
cookie_SetLifetimeLimit(n);
|
||||
}
|
||||
prefs->RegisterCallback(cookie_lifetimeValue, cookie_LifetimeLimitPrefChanged, NULL);
|
||||
prefs->RegisterCallback(cookie_lifetimeValue, cookie_LifetimeLimitPrefChanged, nsnull);
|
||||
|
||||
// Initialize for P3P prefs
|
||||
if (NS_FAILED(prefs->CopyCharPref(cookie_p3pPref, &cookie_P3P))) {
|
||||
cookie_P3P = PL_strdup(cookie_P3P_Default);
|
||||
}
|
||||
prefs->RegisterCallback(cookie_p3pPref, cookie_P3PPrefChanged, nsnull);
|
||||
}
|
||||
|
||||
PRBool
|
||||
@@ -479,7 +595,7 @@ COOKIE_GetCookie(char * address) {
|
||||
|
||||
/* disable cookies if the user's prefs say so */
|
||||
if(cookie_GetBehaviorPref() == PERMISSION_DontUse) {
|
||||
return NULL;
|
||||
return nsnull;
|
||||
}
|
||||
if (!PL_strncasecmp(address, "https", 5)) {
|
||||
isSecure = PR_TRUE;
|
||||
@@ -487,7 +603,7 @@ COOKIE_GetCookie(char * address) {
|
||||
|
||||
/* search for all cookies */
|
||||
if (cookie_list == nsnull) {
|
||||
return NULL;
|
||||
return nsnull;
|
||||
}
|
||||
char *host = CKutil_ParseURL(address, GET_HOST_PART);
|
||||
char *path = CKutil_ParseURL(address, GET_PATH_PART);
|
||||
@@ -561,7 +677,7 @@ COOKIE_GetCookie(char * address) {
|
||||
PR_FREEIF(path);
|
||||
PR_FREEIF(host);
|
||||
|
||||
/* may be NULL */
|
||||
/* may be nsnull */
|
||||
return(rv);
|
||||
}
|
||||
|
||||
@@ -610,6 +726,9 @@ cookie_SameDomain(char * currentHost, char * firstHost) {
|
||||
|
||||
PRBool
|
||||
cookie_isForeign (char * curURL, char * firstURL) {
|
||||
if (!firstURL) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
char * curHost = CKutil_ParseURL(curURL, GET_HOST_PART);
|
||||
char * firstHost = CKutil_ParseURL(firstURL, GET_HOST_PART);
|
||||
char * curHostColon = 0;
|
||||
@@ -640,6 +759,41 @@ cookie_isForeign (char * curURL, char * firstURL) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns P3P_NoPolicy, P3P_NoConsent, P3P_ImplicitConsent, or P3P_ExplicitConsent
|
||||
* based on site
|
||||
*/
|
||||
int
|
||||
P3P_SitePolicy(char * curURL) {
|
||||
// to be replaced with harishd's routine when available
|
||||
return P3P_ImplicitConsent;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns P3P_Accept, P3P_Downgrade, or P3P_Reject based on user's preferences
|
||||
*/
|
||||
int
|
||||
cookie_P3PUserPref(PRInt32 policy, PRBool foreign) {
|
||||
NS_ASSERTION(policy == P3P_NoPolicy ||
|
||||
policy == P3P_NoConsent ||
|
||||
policy == P3P_ImplicitConsent ||
|
||||
policy == P3P_ExplicitConsent,
|
||||
"invalid value for p3p policy");
|
||||
if (cookie_P3P && PL_strlen(cookie_P3P) == 8) {
|
||||
return (foreign ? cookie_P3P[policy+1] : cookie_P3P[policy]);
|
||||
} else {
|
||||
return P3P_Accept;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* returns P3P_Accept, P3P_Downgrade, or P3P_Reject based on user's preferences
|
||||
*/
|
||||
int
|
||||
cookie_P3PDecision (char * curURL, char * firstURL) {
|
||||
return cookie_P3PUserPref(P3P_SitePolicy(curURL), cookie_isForeign(curURL, firstURL));
|
||||
}
|
||||
|
||||
/* returns PR_TRUE if authorization is required
|
||||
**
|
||||
**
|
||||
@@ -649,6 +803,11 @@ cookie_isForeign (char * curURL, char * firstURL) {
|
||||
PUBLIC char *
|
||||
COOKIE_GetCookieFromHttp(char * address, char * firstAddress) {
|
||||
|
||||
if ((cookie_GetBehaviorPref() == PERMISSION_P3P) &&
|
||||
(cookie_P3PDecision(address, firstAddress) == P3P_Reject)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if ((cookie_GetBehaviorPref() == PERMISSION_DontAcceptForeign) &&
|
||||
(!firstAddress || cookie_isForeign(address, firstAddress))) {
|
||||
|
||||
@@ -661,7 +820,7 @@ COOKIE_GetCookieFromHttp(char * address, char * firstAddress) {
|
||||
* have to resort to two prefs
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
return nsnull;
|
||||
}
|
||||
return COOKIE_GetCookie(address);
|
||||
}
|
||||
@@ -713,8 +872,8 @@ cookie_Count(char * host) {
|
||||
PRIVATE void
|
||||
cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCookieHeader, time_t timeToExpire) {
|
||||
cookie_CookieStruct * prev_cookie;
|
||||
char *path_from_header=NULL, *host_from_header=NULL;
|
||||
char *name_from_header=NULL, *cookie_from_header=NULL;
|
||||
char *path_from_header=nsnull, *host_from_header=nsnull;
|
||||
char *name_from_header=nsnull, *cookie_from_header=nsnull;
|
||||
char *cur_path = CKutil_ParseURL(curURL, GET_PATH_PART);
|
||||
char *cur_host = CKutil_ParseURL(curURL, GET_HOST_PART);
|
||||
char *semi_colon, *ptr, *equal;
|
||||
@@ -797,7 +956,7 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||
/* look for a domain */
|
||||
ptr = PL_strcasestr(semi_colon, "domain=");
|
||||
if(ptr) {
|
||||
char *domain_from_header=NULL;
|
||||
char *domain_from_header=nsnull;
|
||||
char *dot, *colon;
|
||||
int domain_length, cur_host_length;
|
||||
|
||||
@@ -872,7 +1031,7 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||
*/
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));
|
||||
if (NS_FAILED(prefs->GetBoolPref(cookie_strictDomainsPref, &pref_scd))) {
|
||||
if (!prefs || NS_FAILED(prefs->GetBoolPref(cookie_strictDomainsPref, &pref_scd))) {
|
||||
pref_scd = PR_FALSE;
|
||||
}
|
||||
if ( pref_scd == PR_TRUE ) {
|
||||
@@ -896,26 +1055,6 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||
// TRACEMSG(("Accepted domain: %s", host_from_header));
|
||||
PR_Free(domain_from_header);
|
||||
}
|
||||
|
||||
/* now search for the expires header
|
||||
* NOTE: that this part of the parsing
|
||||
* destroys the original part of the string
|
||||
*/
|
||||
ptr = PL_strcasestr(semi_colon, "expires=");
|
||||
if(ptr) {
|
||||
char *date = ptr+8;
|
||||
/* terminate the string at the next semi-colon */
|
||||
for(ptr=date; *ptr != '\0'; ptr++) {
|
||||
if(*ptr == ';') {
|
||||
*ptr = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(timeToExpire == 0) {
|
||||
timeToExpire = cookie_ParseDate(date);
|
||||
}
|
||||
// TRACEMSG(("Have expires date: %ld", timeToExpire));
|
||||
}
|
||||
}
|
||||
if(!path_from_header) {
|
||||
/* strip down everything after the last slash to get the path. */
|
||||
@@ -1082,7 +1221,7 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||
|
||||
PUBLIC void
|
||||
COOKIE_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCookieHeader) {
|
||||
cookie_SetCookieString(curURL, aPrompter, setCookieHeader, 0);
|
||||
COOKIE_SetCookieStringFromHttp(curURL, nsnull, aPrompter, setCookieHeader, 0);
|
||||
}
|
||||
|
||||
/* This function wrapper wraps COOKIE_SetCookieString for the purposes of
|
||||
@@ -1094,7 +1233,7 @@ COOKIE_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||
*/
|
||||
|
||||
PUBLIC void
|
||||
COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPrompter, char * setCookieHeader, char * server_date) {
|
||||
COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPrompter, const char * setCookieHeader, char * server_date) {
|
||||
|
||||
/* allow for multiple cookies separated by newlines */
|
||||
char *newline = PL_strchr(setCookieHeader, '\n');
|
||||
@@ -1112,9 +1251,22 @@ COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPromp
|
||||
* to based on his preference to deal with foreign cookies. If it's not inline, just set
|
||||
* the cookie.
|
||||
*/
|
||||
char *ptr=NULL;
|
||||
char *ptr=nsnull;
|
||||
time_t gmtCookieExpires=0, expires=0, sDate;
|
||||
|
||||
PRBool downgrade = PR_FALSE;
|
||||
|
||||
/* check to see if P3P pref is satisfied */
|
||||
if (cookie_GetBehaviorPref() == PERMISSION_P3P) {
|
||||
PRInt32 decision = cookie_P3PDecision(curURL, firstURL);
|
||||
if (decision == P3P_Reject) {
|
||||
return;
|
||||
}
|
||||
if (decision == P3P_Downgrade) {
|
||||
downgrade = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for foreign cookie if pref says to reject such */
|
||||
if ((cookie_GetBehaviorPref() == PERMISSION_DontAcceptForeign) &&
|
||||
cookie_isForeign(curURL, firstURL)) {
|
||||
@@ -1130,7 +1282,7 @@ COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPromp
|
||||
|
||||
/* Get the time the cookie is supposed to expire according to the attribute*/
|
||||
ptr = PL_strcasestr(setCookieHeader, "expires=");
|
||||
if(ptr) {
|
||||
if(ptr && !downgrade) {
|
||||
char *date = ptr+8;
|
||||
char origLast = '\0';
|
||||
for(ptr=date; *ptr != '\0'; ptr++) {
|
||||
@@ -1462,11 +1614,11 @@ COOKIE_Enumerate
|
||||
if (cookie->expires) {
|
||||
/*
|
||||
* Cookie expiration times on mac will not be decoded correctly because
|
||||
* they were based on get_current_time() instead of time(NULL) -- see comments in
|
||||
* they were based on get_current_time() instead of time(nsnull) -- see comments in
|
||||
* get_current_time. So we need to adjust for that now in order for the
|
||||
* display of the expiration time to be correct
|
||||
*/
|
||||
expiresTime = cookie->expires + (time(NULL) - get_current_time());
|
||||
expiresTime = cookie->expires + (time(nsnull) - get_current_time());
|
||||
}
|
||||
// *expires = expiresTime; -- no good no mac, using next line instead
|
||||
LL_UI2L(*expires, expiresTime);
|
||||
|
||||
@@ -55,7 +55,7 @@ extern nsresult COOKIE_Write();
|
||||
extern char * COOKIE_GetCookie(char * address);
|
||||
extern char * COOKIE_GetCookieFromHttp(char * address, char * firstAddress);
|
||||
extern void COOKIE_SetCookieString(char * cur_url, nsIPrompt *aPrompter, const char * set_cookie_header);
|
||||
extern void COOKIE_SetCookieStringFromHttp(char * cur_url, char * first_url, nsIPrompt *aPRompter, char * set_cookie_header, char * server_date);
|
||||
extern void COOKIE_SetCookieStringFromHttp(char * cur_url, char * first_url, nsIPrompt *aPRompter, const char * set_cookie_header, char * server_date);
|
||||
extern void COOKIE_RegisterPrefCallbacks(void);
|
||||
|
||||
extern void COOKIE_RemoveAll(void);
|
||||
|
||||
@@ -48,7 +48,8 @@
|
||||
typedef enum {
|
||||
PERMISSION_Accept,
|
||||
PERMISSION_DontAcceptForeign,
|
||||
PERMISSION_DontUse
|
||||
PERMISSION_DontUse,
|
||||
PERMISSION_P3P
|
||||
} PERMISSION_BehaviorEnum;
|
||||
|
||||
class nsIPrompt;
|
||||
|
||||
@@ -31,3 +31,8 @@ function viewTutorial() {
|
||||
window.openDialog
|
||||
("chrome://communicator/content/wallet/privacy.xul","tutorial","modal=no,chrome,resizable=yes,height=400,width=600", 0);
|
||||
}
|
||||
|
||||
function viewP3P() {
|
||||
window.openDialog
|
||||
("chrome://cookie/content/p3p.xul","_blank","modal=yes,chrome,resizable=yes,height=480,width=600", 0);
|
||||
}
|
||||
|
||||
255
mozilla/extensions/cookie/resources/content/p3p.xul
Normal file
255
mozilla/extensions/cookie/resources/content/p3p.xul
Normal file
@@ -0,0 +1,255 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corp.
|
||||
- Portions created by Netscape Communications Corp are Copyright (C) 2001
|
||||
- Netscape Communications Corp. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
-->
|
||||
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<!DOCTYPE window SYSTEM "chrome://cookie/locale/p3p.dtd">
|
||||
|
||||
<window id="privacySettings"
|
||||
class="dialog"
|
||||
title="&windowtitle.label;"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical"
|
||||
onload="init();">
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
|
||||
var pref;
|
||||
|
||||
var low = 0;
|
||||
var medium = 1;
|
||||
var high = 2;
|
||||
var custom = 3;
|
||||
|
||||
var p3pLength = 8;
|
||||
|
||||
function init()
|
||||
{
|
||||
// init ok event handler
|
||||
doSetOKCancel(onOK, null);
|
||||
|
||||
// get pref service
|
||||
pref = Components.classes['@mozilla.org/preferences;1'];
|
||||
pref = pref.getService();
|
||||
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
var p3pLevel = medium;
|
||||
try {
|
||||
// set prefLevel radio button
|
||||
p3pLevel = pref.getIntPref("network.cookie.p3plevel");
|
||||
document.getElementById("p3pLevel").childNodes[p3pLevel].checked = true;
|
||||
|
||||
// set custom settings
|
||||
if (p3pLevel == custom) {
|
||||
for (var i=0; i<p3pLength; i++) {
|
||||
document.getElementById("menulist_"+i).value =
|
||||
pref.getCharPref("network.cookie.p3p").charAt(i);
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
// initialize the settings display
|
||||
settings(p3pLevel);
|
||||
}
|
||||
|
||||
function onOK(){
|
||||
|
||||
var p3pLevel = document.getElementById("p3pLevel").selectedItem.value;
|
||||
pref.setIntPref("network.cookie.p3plevel",p3pLevel);
|
||||
|
||||
var value = "";
|
||||
for (var i=0; i<p3pLength; i++) {
|
||||
value += document.getElementById("menulist_"+i).value;
|
||||
}
|
||||
pref.setCharPref("network.cookie.p3p", value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function settings(level) {
|
||||
var settings = [];
|
||||
|
||||
switch (level) {
|
||||
case low:
|
||||
settings = "adadaaaa";
|
||||
break;
|
||||
case medium:
|
||||
settings = "drdraaaa";
|
||||
break;
|
||||
case high:
|
||||
settings = "rrrrrraa";
|
||||
break;
|
||||
case custom:
|
||||
break;
|
||||
}
|
||||
|
||||
var hide = (level != custom);
|
||||
var menulist;
|
||||
|
||||
for (var j=0; j<p3pLength; j++) {
|
||||
menulist = document.getElementById("menulist_" + j);
|
||||
menulist.disabled = hide;
|
||||
if (hide) {
|
||||
menulist.value = settings[j];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
<groupbox orient="vertical">
|
||||
<caption label="&privacyLevel.label;"/>
|
||||
|
||||
<html>&p3pDetails;</html>
|
||||
<spacer/>
|
||||
<html>&choose;</html>
|
||||
|
||||
<radiogroup id="p3pLevel" orient="horizontal" align="center">
|
||||
<radio group="p3pLevel" value="0" label="&low.label;"
|
||||
accesskey="&low.accesskey;" oncommand="settings(low);"/>
|
||||
<radio group="p3pLevel" value="1" label="&medium.label;"
|
||||
accesskey="&medium.accesskey;" oncommand="settings(medium);"/>
|
||||
<radio group="p3pLevel" value="2" label="&high.label;"
|
||||
accesskey="&high.accesskey;" oncommand="settings(high);"/>
|
||||
<radio group="p3pLevel" value="3" label="&custom.label;"
|
||||
accesskey="&custom.accesskey;" oncommand="settings(custom);"/>
|
||||
</radiogroup>
|
||||
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="customSettingBox" orient="vertical">
|
||||
<caption label="&customSettings.label;"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex="1"/>
|
||||
<column width="120"/>
|
||||
<column width="120"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<spacer/>
|
||||
<html>&firstParty.label;</html>
|
||||
<html>&thirdParty.label;</html>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&noPolicy.label;</html>
|
||||
<menulist flex="1" id="menulist_0">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_1">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&noConsent.label;</html>
|
||||
<menulist flex="1" id="menulist_2">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_3">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&implicitConsent.label;</html>
|
||||
<menulist flex="1" id="menulist_4">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_5">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&explicitConsent.label;</html>
|
||||
<menulist flex="1" id="menulist_6">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_7">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</groupbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
|
||||
|
||||
</window>
|
||||
@@ -38,22 +38,53 @@
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
|
||||
var _elementIDs = ["networkCookieBehaviour", "networkWarnAboutCookies"];
|
||||
var _elementIDs = ["networkCookieBehaviour", "networkWarnAboutCookies",
|
||||
"lifetimeEnabled", "lifetimeBehavior", "lifetimeDays"];
|
||||
|
||||
function init()
|
||||
{
|
||||
parent.initPanel('chrome://cookie/content/pref-cookies.xul');
|
||||
|
||||
var enabled = document.getElementById("networkCookieBehaviour").value != "2";
|
||||
setWarnAboutCookiesEnabled(enabled);
|
||||
setDisables();
|
||||
}
|
||||
|
||||
function setWarnAboutCookiesEnabled(aEnabled)
|
||||
const cookies_disabled = "2";
|
||||
const cookies_no_third_party = "1";
|
||||
const cookies_p3p = "3";
|
||||
const cookies_enabled = "0";
|
||||
|
||||
function setDisables()
|
||||
{
|
||||
var cookieBehavior = document.getElementById("networkCookieBehaviour");
|
||||
|
||||
var p3pButton = document.getElementById("p3pDialog");
|
||||
p3pButton.disabled = (cookieBehavior.value != cookies_p3p);
|
||||
if (parent.hPrefWindow.getPrefIsLocked(p3pButton.getAttribute("prefstring")) )
|
||||
p3pButton.disabled = true;
|
||||
|
||||
var warnCheckbox = document.getElementById("networkWarnAboutCookies");
|
||||
warnCheckbox.disabled = !aEnabled;
|
||||
warnCheckbox.disabled = (cookieBehavior.value == cookies_disabled);
|
||||
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")) )
|
||||
lifetimeDays.disabled = true;
|
||||
}
|
||||
|
||||
]]>
|
||||
@@ -70,20 +101,47 @@
|
||||
pref="true" preftype="int" prefstring="network.cookie.cookieBehavior"
|
||||
prefattribute="value">
|
||||
<radio group="networkCookieBehaviour" value="2" label="&disableCookies.label;"
|
||||
accesskey="&disableCookies.accesskey;" oncommand="setWarnAboutCookiesEnabled(false);"/>
|
||||
accesskey="&disableCookies.accesskey;" oncommand="setDisables();"/>
|
||||
<radio group="networkCookieBehaviour" value="1" label="&accOrgCookiesRadio.label;"
|
||||
accesskey="&accOrgCookiesRadio.accesskey;" oncommand="setWarnAboutCookiesEnabled(true);"/>
|
||||
accesskey="&accOrgCookiesRadio.accesskey;" oncommand="setDisables();"/>
|
||||
<hbox>
|
||||
<radio group="networkCookieBehaviour" value="3" label="&accP3PCookiesRadio.label;"
|
||||
accesskey="&accP3PCookiesRadio.accesskey;" oncommand="setDisables();"/>
|
||||
<button class="dialog" label="&viewP3P.label;" accesskey="&viewP3P.accesskey;" oncommand="viewP3P();"
|
||||
id="p3pDialog" pref="true" preftype="bool"
|
||||
prefstring="pref.advanced.cookies.disable_button.more_info" prefattribute="disabled"/>
|
||||
</hbox>
|
||||
<radio group="networkCookieBehaviour" value="0" label="&accAllCookiesRadio.label;"
|
||||
accesskey="&accAllCookiesRadio.accesskey;" oncommand="setWarnAboutCookiesEnabled(true);"/>
|
||||
accesskey="&accAllCookiesRadio.accesskey;" oncommand="setDisables();"/>
|
||||
</radiogroup>
|
||||
|
||||
<separator/>
|
||||
|
||||
<hbox autostretch="never">
|
||||
<vbox autostretch="never">
|
||||
<checkbox id="networkWarnAboutCookies" label="&warnAboutCookies.label;" accesskey="&warnAboutCookies.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="network.cookie.warnAboutCookies"
|
||||
prefattribute="checked"/>
|
||||
</hbox>
|
||||
<checkbox id="lifetimeEnabled" label="&limitLifetime.label;" accesskey="&limitLifetime.accesskey;"
|
||||
pref="true" preftype="bool" prefstring="network.cookie.lifetime.enabled"
|
||||
prefattribute="checked" oncommand="setDisables();"/>
|
||||
<hbox class="indent">
|
||||
<radiogroup id="lifetimeBehavior" orient="vertical" autostretch="never"
|
||||
pref="true" preftype="int" prefstring="network.cookie.lifetime.behavior"
|
||||
prefattribute="value">
|
||||
<radio group="lifetimeBehavior" value="0" label="¤t.label;"
|
||||
accesskey="¤t.accesskey;"
|
||||
oncommand="setDisables();"/>
|
||||
<hbox>
|
||||
<radio group="lifetimeBehavior" value="1" accesskey="&days.accesskey;"
|
||||
oncommand="setDisables();"/>
|
||||
<textbox id="lifetimeDays" pref="true" size="4" prefattribute="value"
|
||||
preftype="int" prefstring="network.cookie.lifetime.days"/>
|
||||
<html>&days.label;</html>
|
||||
</hbox>
|
||||
</radiogroup>
|
||||
</hbox>
|
||||
|
||||
</vbox>
|
||||
|
||||
<separator/>
|
||||
|
||||
|
||||
61
mozilla/extensions/cookie/resources/locale/en-US/p3p.dtd
Normal file
61
mozilla/extensions/cookie/resources/locale/en-US/p3p.dtd
Normal file
@@ -0,0 +1,61 @@
|
||||
<!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corp.
|
||||
- Portions created by Netscape Communications Corp are Copyright (C) 2001
|
||||
- Netscape Communications Corp. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
-->
|
||||
|
||||
<!ENTITY windowtitle.label "Privacy Levels">
|
||||
<!ENTITY privacyLevel.label "Level of Privacy">
|
||||
<!ENTITY p3pDetails "Some sites publish privacy policies stating what they will do with your personal information. This dialog allows you to make cookie decisions based on the level of privacy that you are willing to accept.">
|
||||
<!ENTITY choose "Choose a predefined level of privacy, or define your own custom setting:">
|
||||
<!ENTITY low.label "low">
|
||||
<!ENTITY medium.label "medium">
|
||||
<!ENTITY high.label "high">
|
||||
<!ENTITY custom.label "custom">
|
||||
<!ENTITY low.accesskey "l">
|
||||
<!ENTITY medium.accesskey "m">
|
||||
<!ENTITY high.accesskey "h">
|
||||
<!ENTITY custom.accesskey "c">
|
||||
|
||||
<!ENTITY customSettings.label "Cookie Acceptance Policy (a function of Level of Privacy)">
|
||||
<!ENTITY firstParty.label "First Party Cookies">
|
||||
<!ENTITY thirdParty.label "Third Party Cookies">
|
||||
<!ENTITY noPolicy.label "Site has no privacy policy">
|
||||
<!ENTITY noConsent.label "Site collects personally identifiable information without your consent">
|
||||
<!ENTITY implicitConsent.label "Site collects personally identifiable information with only your implicit consent">
|
||||
<!ENTITY explicitConsent.label "Site does not collect personally identifiable information without your explicity consent">
|
||||
|
||||
<!ENTITY accept.label "Accept">
|
||||
<!ENTITY downgrade.label "Downgrade">
|
||||
<!ENTITY reject.label "Reject">
|
||||
@@ -10,6 +10,9 @@
|
||||
<!ENTITY accOrgCookiesRadio.label "Enable cookies for the originating web site only">
|
||||
<!ENTITY accOrgCookiesRadio.accesskey "o">
|
||||
|
||||
<!ENTITY accP3PCookiesRadio.label "Enable cookies based on privacy levels">
|
||||
<!ENTITY accP3PCookiesRadio.accesskey "p">
|
||||
|
||||
<!ENTITY disableCookies.label "Disable cookies">
|
||||
<!ENTITY disableCookies.accesskey "r">
|
||||
|
||||
@@ -19,9 +22,15 @@
|
||||
<!ENTITY cookieDetails "Cookies are small pieces of information that some web sites ask to store on your computer. If you enable cookies, your browser will accept a web site's cookies automatically when you visit the site. Such cookies are sent back to the web site on future visits.">
|
||||
|
||||
<!ENTITY viewCookies.label "View Stored Cookies">
|
||||
<!ENTITY viewCookies.accesskey "v">
|
||||
|
||||
<!ENTITY viewCookies.accesskey "S">
|
||||
<!ENTITY viewP3P.label "View Privacy Levels">
|
||||
<!ENTITY viewP3P.accesskey "V">
|
||||
<!ENTITY viewTutorial.label "More Information">
|
||||
<!ENTITY viewTutorial.accesskey "m">
|
||||
|
||||
<!ENTITY viewTutorial.accesskey "M">
|
||||
|
||||
<!ENTITY limitLifetime.label "Limit maximum lifetime of cookies to">
|
||||
<!ENTITY limitLifetime.accesskey "l">
|
||||
<!ENTITY current.label "current session">
|
||||
<!ENTITY current.accesskey "c">
|
||||
<!ENTITY days.label "days">
|
||||
<!ENTITY days.accesskey "d">
|
||||
|
||||
@@ -381,6 +381,11 @@ pref("network.accept_cookies", 0); // 0 = Always, 1 = warn, 2 =
|
||||
pref("network.foreign_cookies", 0); // 0 = Accept, 1 = Don't accept
|
||||
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontUse
|
||||
pref("network.cookie.warnAboutCookies", false);
|
||||
pref("network.cookie.lifetime.enabled", false);
|
||||
pref("network.cookie.lifetime.behavior", 0);
|
||||
pref("network.cookie.lifetime.days", 90);
|
||||
pref("network.cookie.p3p", "drdraaaa");
|
||||
pref("network.cookie.p3plevel", 1);
|
||||
pref("signon.rememberSignons", true);
|
||||
pref("network.enablePad", false); // Allow client to do proxy autodiscovery
|
||||
pref("converter.html2txt.structs", true); // Output structured phrases (strong, em, code, sub, sup, b, i, u)
|
||||
|
||||
255
mozilla/xpfe/components/permissions/content/cookieP3P.xul
Normal file
255
mozilla/xpfe/components/permissions/content/cookieP3P.xul
Normal file
@@ -0,0 +1,255 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corp.
|
||||
- Portions created by Netscape Communications Corp are Copyright (C) 2001
|
||||
- Netscape Communications Corp. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
-->
|
||||
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
|
||||
<!-- CHANGE THIS WHEN MOVING FILES -->
|
||||
<!DOCTYPE window SYSTEM "chrome://cookie/locale/p3p.dtd">
|
||||
|
||||
<window id="privacySettings"
|
||||
class="dialog"
|
||||
title="&windowtitle.label;"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
orient="vertical"
|
||||
onload="init();">
|
||||
|
||||
<script type="application/x-javascript">
|
||||
<![CDATA[
|
||||
|
||||
var pref;
|
||||
|
||||
var low = 0;
|
||||
var medium = 1;
|
||||
var high = 2;
|
||||
var custom = 3;
|
||||
|
||||
var p3pLength = 8;
|
||||
|
||||
function init()
|
||||
{
|
||||
// init ok event handler
|
||||
doSetOKCancel(onOK, null);
|
||||
|
||||
// get pref service
|
||||
pref = Components.classes['@mozilla.org/preferences;1'];
|
||||
pref = pref.getService();
|
||||
pref = pref.QueryInterface(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
var p3pLevel = medium;
|
||||
try {
|
||||
// set prefLevel radio button
|
||||
p3pLevel = pref.getIntPref("network.cookie.p3plevel");
|
||||
document.getElementById("p3pLevel").childNodes[p3pLevel].checked = true;
|
||||
|
||||
// set custom settings
|
||||
if (p3pLevel == custom) {
|
||||
for (var i=0; i<p3pLength; i++) {
|
||||
document.getElementById("menulist_"+i).value =
|
||||
pref.getCharPref("network.cookie.p3p").charAt(i);
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
// initialize the settings display
|
||||
settings(p3pLevel);
|
||||
}
|
||||
|
||||
function onOK(){
|
||||
|
||||
var p3pLevel = document.getElementById("p3pLevel").selectedItem.value;
|
||||
pref.setIntPref("network.cookie.p3plevel",p3pLevel);
|
||||
|
||||
var value = "";
|
||||
for (var i=0; i<p3pLength; i++) {
|
||||
value += document.getElementById("menulist_"+i).value;
|
||||
}
|
||||
pref.setCharPref("network.cookie.p3p", value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function settings(level) {
|
||||
var settings = [];
|
||||
|
||||
switch (level) {
|
||||
case low:
|
||||
settings = "adadaaaa";
|
||||
break;
|
||||
case medium:
|
||||
settings = "drdraaaa";
|
||||
break;
|
||||
case high:
|
||||
settings = "rrrrrraa";
|
||||
break;
|
||||
case custom:
|
||||
break;
|
||||
}
|
||||
|
||||
var hide = (level != custom);
|
||||
var menulist;
|
||||
|
||||
for (var j=0; j<p3pLength; j++) {
|
||||
menulist = document.getElementById("menulist_" + j);
|
||||
menulist.disabled = hide;
|
||||
if (hide) {
|
||||
menulist.value = settings[j];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<keyset id="dialogKeys"/>
|
||||
|
||||
<groupbox orient="vertical">
|
||||
<caption label="&privacyLevel.label;"/>
|
||||
|
||||
<html>&p3pDetails;</html>
|
||||
<spacer/>
|
||||
<html>&choose;</html>
|
||||
|
||||
<radiogroup id="p3pLevel" orient="horizontal" align="center">
|
||||
<radio group="p3pLevel" value="0" label="&low.label;"
|
||||
accesskey="&low.accesskey;" oncommand="settings(low);"/>
|
||||
<radio group="p3pLevel" value="1" label="&medium.label;"
|
||||
accesskey="&medium.accesskey;" oncommand="settings(medium);"/>
|
||||
<radio group="p3pLevel" value="2" label="&high.label;"
|
||||
accesskey="&high.accesskey;" oncommand="settings(high);"/>
|
||||
<radio group="p3pLevel" value="3" label="&custom.label;"
|
||||
accesskey="&custom.accesskey;" oncommand="settings(custom);"/>
|
||||
</radiogroup>
|
||||
|
||||
</groupbox>
|
||||
|
||||
<groupbox id="customSettingBox" orient="vertical">
|
||||
<caption label="&customSettings.label;"/>
|
||||
<grid>
|
||||
<columns>
|
||||
<column flex="1"/>
|
||||
<column width="120"/>
|
||||
<column width="120"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row align="center">
|
||||
<spacer/>
|
||||
<html>&firstParty.label;</html>
|
||||
<html>&thirdParty.label;</html>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&noPolicy.label;</html>
|
||||
<menulist flex="1" id="menulist_0">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_1">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&noConsent.label;</html>
|
||||
<menulist flex="1" id="menulist_2">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_3">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&implicitConsent.label;</html>
|
||||
<menulist flex="1" id="menulist_4">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_5">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
<row align="center">
|
||||
<html>&explicitConsent.label;</html>
|
||||
<menulist flex="1" id="menulist_6">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<menulist flex="1" id="menulist_7">
|
||||
<menupopup>
|
||||
<menuitem value="a" label="&accept.label;"/>
|
||||
<menuitem value="d" label="&downgrade.label;"/>
|
||||
<menuitem value="r" label="&reject.label;"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</groupbox>
|
||||
|
||||
<separator class="thin"/>
|
||||
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
|
||||
|
||||
</window>
|
||||
@@ -31,3 +31,8 @@ function viewTutorial() {
|
||||
window.openDialog
|
||||
("chrome://communicator/content/wallet/privacy.xul","tutorial","modal=no,chrome,resizable=yes,height=400,width=600", 0);
|
||||
}
|
||||
|
||||
function viewP3P() {
|
||||
window.openDialog
|
||||
("chrome://cookie/content/p3p.xul","_blank","modal=yes,chrome,resizable=yes,height=480,width=600", 0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
|
||||
<!--
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is Mozilla.org code.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- Netscape Communications Corp.
|
||||
- Portions created by Netscape Communications Corp are Copyright (C) 2001
|
||||
- Netscape Communications Corp. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
-->
|
||||
|
||||
<!ENTITY windowtitle.label "Privacy Levels">
|
||||
<!ENTITY privacyLevel.label "Level of Privacy">
|
||||
<!ENTITY p3pDetails "Some sites publish privacy policies stating what they will do with your personal information. This dialog allows you to make cookie decisions based on the level of privacy that you are willing to accept.">
|
||||
<!ENTITY choose "Choose a predefined level of privacy, or define your own custom setting:">
|
||||
<!ENTITY low.label "low">
|
||||
<!ENTITY medium.label "medium">
|
||||
<!ENTITY high.label "high">
|
||||
<!ENTITY custom.label "custom">
|
||||
<!ENTITY low.accesskey "l">
|
||||
<!ENTITY medium.accesskey "m">
|
||||
<!ENTITY high.accesskey "h">
|
||||
<!ENTITY custom.accesskey "c">
|
||||
|
||||
<!ENTITY customSettings.label "Cookie Acceptance Policy (a function of Level of Privacy)">
|
||||
<!ENTITY firstParty.label "First Party Cookies">
|
||||
<!ENTITY thirdParty.label "Third Party Cookies">
|
||||
<!ENTITY noPolicy.label "Site has no privacy policy">
|
||||
<!ENTITY noConsent.label "Site collects personally identifiable information without your consent">
|
||||
<!ENTITY implicitConsent.label "Site collects personally identifiable information with only your implicit consent">
|
||||
<!ENTITY explicitConsent.label "Site does not collect personally identifiable information without your explicity consent">
|
||||
|
||||
<!ENTITY accept.label "Accept">
|
||||
<!ENTITY downgrade.label "Downgrade">
|
||||
<!ENTITY reject.label "Reject">
|
||||
Reference in New Issue
Block a user