зеркало из https://github.com/mozilla/pjs.git
bug 130304, freeze interface for nsICookie and nsICookieManager, r/sr=darin,alecf, a=asa
This commit is contained in:
Родитель
7422a60dda
Коммит
894670491d
|
@ -1,3 +0,0 @@
|
||||||
#
|
|
||||||
# This is a list of local files which get copied to the mozilla:dist directory
|
|
||||||
#
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ----- BEGIN LICENSE BLOCK -----
|
||||||
|
* 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 is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is Netscape Communications Corporation.
|
||||||
|
* Portions created by Netscape Communications Corporation are
|
||||||
|
* Copyright (C) 1998 Netscape Communications Corporation.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either of 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.
|
||||||
|
*
|
||||||
|
* ----- END LICENSE BLOCK ----- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a "service" and not just an ordinary component. A consumer must talk
|
||||||
|
* to the service manager, not the component manager.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NSCCOOKIE_H
|
||||||
|
#define NSCCOOKIE_H
|
||||||
|
|
||||||
|
#include "nsICookie.h"
|
||||||
|
#define NS_COOKIE_CONTRACTID "@mozilla.org/cookie;1"
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,49 @@
|
||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
|
/* ----- BEGIN LICENSE BLOCK -----
|
||||||
|
* 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 is mozilla.org code.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is Netscape Communications Corporation.
|
||||||
|
* Portions created by Netscape Communications Corporation are
|
||||||
|
* Copyright (C) 1998 Netscape Communications Corporation.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either of 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.
|
||||||
|
*
|
||||||
|
* ----- END LICENSE BLOCK ----- */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a "service" and not just an ordinary component. A consumer must talk
|
||||||
|
* to the service manager, not the component manager.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NSCCOOKIEMANAGER_H
|
||||||
|
#define NSCCOOKIEMANAGER_H
|
||||||
|
|
||||||
|
#include "nsICookieManager.h"
|
||||||
|
#define NS_COOKIEMANAGER_CONTRACTID "@mozilla.org/cookiemanager;1"
|
||||||
|
|
||||||
|
#endif
|
|
@ -56,8 +56,8 @@ nsCookie::nsCookie
|
||||||
char * path,
|
char * path,
|
||||||
PRBool isSecure,
|
PRBool isSecure,
|
||||||
PRUint64 expires,
|
PRUint64 expires,
|
||||||
nsCookieStatus_t status,
|
nsCookieStatus status,
|
||||||
nsCookiePolicy_t policy) {
|
nsCookiePolicy policy) {
|
||||||
cookieName = name;
|
cookieName = name;
|
||||||
cookieValue = value;
|
cookieValue = value;
|
||||||
cookieIsDomain = isDomain;
|
cookieIsDomain = isDomain;
|
||||||
|
@ -77,17 +77,17 @@ nsCookie::~nsCookie(void) {
|
||||||
nsCRT::free(cookiePath);
|
nsCRT::free(cookiePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookie::GetName(char * *aName) {
|
NS_IMETHODIMP nsCookie::GetName(nsACString& aName) {
|
||||||
if (cookieName) {
|
if (cookieName) {
|
||||||
*aName = (char *) nsMemory::Clone(cookieName, strlen(cookieName) + 1);
|
aName = cookieName;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookie::GetValue(char * *aValue) {
|
NS_IMETHODIMP nsCookie::GetValue(nsACString& aValue) {
|
||||||
if (cookieValue) {
|
if (cookieValue) {
|
||||||
*aValue = (char *) nsMemory::Clone(cookieValue, strlen(cookieValue) + 1);
|
aValue = cookieValue;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -98,17 +98,21 @@ NS_IMETHODIMP nsCookie::GetIsDomain(PRBool *aIsDomain) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookie::GetHost(char * *aHost) {
|
NS_IMETHODIMP nsCookie::GetHost(nsACString& aHost) {
|
||||||
|
//NS_IMETHODIMP nsCookie::GetHost(nsAUTF8String& aHost) {
|
||||||
|
// using nsACString above instead of nsAUTF8String because the latter doesn't exist yet
|
||||||
if (cookieHost) {
|
if (cookieHost) {
|
||||||
*aHost = (char *) nsMemory::Clone(cookieHost, strlen(cookieHost) + 1);
|
aHost = cookieHost;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookie::GetPath(char * *aPath) {
|
NS_IMETHODIMP nsCookie::GetPath(nsACString& aPath) {
|
||||||
|
//NS_IMETHODIMP nsCookie::GetPath(nsAUTF8String& aPath) {
|
||||||
|
// using nsACString above instead of nsAUTF8String because the latter doesn't exist yet
|
||||||
if (cookiePath) {
|
if (cookiePath) {
|
||||||
*aPath = (char *) nsMemory::Clone(cookiePath, strlen(cookiePath) + 1);
|
aPath = cookiePath;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -124,12 +128,12 @@ NS_IMETHODIMP nsCookie::GetExpires(PRUint64 *aExpires) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookie::GetStatus(nsCookieStatus_t *aStatus) {
|
NS_IMETHODIMP nsCookie::GetStatus(nsCookieStatus *aStatus) {
|
||||||
*aStatus = cookieStatus;
|
*aStatus = cookieStatus;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookie::GetPolicy(nsCookiePolicy_t *aPolicy) {
|
NS_IMETHODIMP nsCookie::GetPolicy(nsCookiePolicy *aPolicy) {
|
||||||
*aPolicy = cookiePolicy;
|
*aPolicy = cookiePolicy;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,8 +63,8 @@ public:
|
||||||
char * path,
|
char * path,
|
||||||
PRBool isSecure,
|
PRBool isSecure,
|
||||||
PRUint64 expires,
|
PRUint64 expires,
|
||||||
nsCookieStatus_t status,
|
nsCookieStatus status,
|
||||||
nsCookiePolicy_t policy
|
nsCookiePolicy policy
|
||||||
);
|
);
|
||||||
nsCookie();
|
nsCookie();
|
||||||
virtual ~nsCookie(void);
|
virtual ~nsCookie(void);
|
||||||
|
@ -77,8 +77,11 @@ protected:
|
||||||
char * cookiePath;
|
char * cookiePath;
|
||||||
PRBool cookieIsSecure;
|
PRBool cookieIsSecure;
|
||||||
PRUint64 cookieExpires;
|
PRUint64 cookieExpires;
|
||||||
nsCookieStatus_t cookieStatus;
|
nsCookieStatus cookieStatus;
|
||||||
nsCookiePolicy_t cookiePolicy;
|
nsCookiePolicy cookiePolicy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// {E9FCB9A4-D376-458f-B720-E65E7DF593BC}
|
||||||
|
#define NS_COOKIE_CID { 0xe9fcb9a4,0xd376,0x458f,{0xb7,0x20,0xe6,0x5e,0x7d,0xf5,0x93,0xbc}}
|
||||||
|
|
||||||
#endif /* nsCookie_h__ */
|
#endif /* nsCookie_h__ */
|
||||||
|
|
|
@ -73,8 +73,8 @@ class nsCookieEnumerator : public nsISimpleEnumerator
|
||||||
char * path;
|
char * path;
|
||||||
PRBool isSecure;
|
PRBool isSecure;
|
||||||
PRUint64 expires;
|
PRUint64 expires;
|
||||||
nsCookieStatus_t status;
|
nsCookieStatus status;
|
||||||
nsCookiePolicy_t policy;
|
nsCookiePolicy policy;
|
||||||
nsresult rv = COOKIE_Enumerate
|
nsresult rv = COOKIE_Enumerate
|
||||||
(mCookieCount++, &name, &value, &isDomain, &host, &path, &isSecure, &expires,
|
(mCookieCount++, &name, &value, &isDomain, &host, &path, &isSecure, &expires,
|
||||||
&status, &policy);
|
&status, &policy);
|
||||||
|
@ -139,7 +139,12 @@ NS_IMETHODIMP nsCookieManager::GetEnumerator(nsISimpleEnumerator * *entries)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsCookieManager::Remove
|
NS_IMETHODIMP nsCookieManager::Remove
|
||||||
(const char* host, const char* name, const char* path, const PRBool permanent) {
|
(const nsACString& host, const nsACString& name, const nsACString& path, PRBool blocked) {
|
||||||
::COOKIE_Remove(host, name, path, permanent);
|
// (const nsAUTF8String& host, const nsACString& name, const nsAUTF8String& path, PRBool blocked) {
|
||||||
|
// using nsACString above instead of nsAUTF8String because the latter doesn't exist yet
|
||||||
|
|
||||||
|
::COOKIE_Remove(PromiseFlatCString(host).get(),
|
||||||
|
PromiseFlatCString(name).get(),
|
||||||
|
PromiseFlatCString(path).get(), blocked);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,4 +58,7 @@ public:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// {AAAB6710-0F2C-11d5-A53B-0010A401EB10}
|
||||||
|
#define NS_COOKIEMANAGER_CID {0xaaab6710,0xf2c,0x11d5,{0xa5,0x3b,0x0,0x10,0xa4,0x1,0xeb,0x10}}
|
||||||
|
|
||||||
#endif /* nsCookieManager_h__ */
|
#endif /* nsCookieManager_h__ */
|
||||||
|
|
|
@ -92,8 +92,8 @@ typedef struct _cookie_CookieStruct {
|
||||||
time_t lastAccessed;
|
time_t lastAccessed;
|
||||||
PRBool isSecure;
|
PRBool isSecure;
|
||||||
PRBool isDomain; /* is it a domain instead of an absolute host? */
|
PRBool isDomain; /* is it a domain instead of an absolute host? */
|
||||||
nsCookieStatus_t status;
|
nsCookieStatus status;
|
||||||
nsCookiePolicy_t policy;
|
nsCookiePolicy policy;
|
||||||
} cookie_CookieStruct;
|
} cookie_CookieStruct;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -826,7 +826,7 @@ cookie_isForeign (char * curURL, char * firstURL, nsIIOService* ioService) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCookieStatus_t
|
nsCookieStatus
|
||||||
cookie_GetStatus(char decision) {
|
cookie_GetStatus(char decision) {
|
||||||
switch (decision) {
|
switch (decision) {
|
||||||
case ' ':
|
case ' ':
|
||||||
|
@ -841,7 +841,7 @@ cookie_GetStatus(char decision) {
|
||||||
return nsICookie::STATUS_UNKNOWN;
|
return nsICookie::STATUS_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCookiePolicy_t
|
nsCookiePolicy
|
||||||
cookie_GetPolicy(int policy) {
|
cookie_GetPolicy(int policy) {
|
||||||
switch (policy) {
|
switch (policy) {
|
||||||
case P3P_NoPolicy:
|
case P3P_NoPolicy:
|
||||||
|
@ -900,7 +900,7 @@ cookie_P3PUserPref(PRInt32 policy, PRBool foreign) {
|
||||||
/*
|
/*
|
||||||
* returns STATUS_ACCEPT, STATUS_DOWNGRADE, STATUS_FLAG, or STATUS_REJECT based on user's preferences
|
* returns STATUS_ACCEPT, STATUS_DOWNGRADE, STATUS_FLAG, or STATUS_REJECT based on user's preferences
|
||||||
*/
|
*/
|
||||||
nsCookieStatus_t
|
nsCookieStatus
|
||||||
cookie_P3PDecision (char * curURL, char * firstURL, nsIIOService* ioService, nsIHttpChannel* aHttpChannel) {
|
cookie_P3PDecision (char * curURL, char * firstURL, nsIIOService* ioService, nsIHttpChannel* aHttpChannel) {
|
||||||
return cookie_GetStatus(
|
return cookie_GetStatus(
|
||||||
cookie_P3PUserPref(
|
cookie_P3PUserPref(
|
||||||
|
@ -987,7 +987,7 @@ cookie_Count(char * host) {
|
||||||
PRIVATE void
|
PRIVATE void
|
||||||
cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCookieHeader,
|
cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCookieHeader,
|
||||||
time_t timeToExpire, nsIIOService* ioService,
|
time_t timeToExpire, nsIIOService* ioService,
|
||||||
nsIHttpChannel* aHttpChannel, nsCookieStatus_t status) {
|
nsIHttpChannel* aHttpChannel, nsCookieStatus status) {
|
||||||
cookie_CookieStruct * prev_cookie;
|
cookie_CookieStruct * prev_cookie;
|
||||||
char *path_from_header=nsnull, *host_from_header=nsnull;
|
char *path_from_header=nsnull, *host_from_header=nsnull;
|
||||||
char *name_from_header=nsnull, *cookie_from_header=nsnull;
|
char *name_from_header=nsnull, *cookie_from_header=nsnull;
|
||||||
|
@ -1094,7 +1094,12 @@ cookie_SetCookieString(char * curURL, nsIPrompt *aPrompter, const char * setCook
|
||||||
int domain_length, cur_host_length;
|
int domain_length, cur_host_length;
|
||||||
|
|
||||||
/* allocate more than we need */
|
/* allocate more than we need */
|
||||||
nsCAutoString domain(ptr+7);
|
nsCAutoString domain;
|
||||||
|
if (*(ptr+7) != '.') { // force domain name to start with a dot
|
||||||
|
domain = '.';
|
||||||
|
}
|
||||||
|
domain.Append(ptr+7);
|
||||||
|
|
||||||
domain.CompressWhitespace();
|
domain.CompressWhitespace();
|
||||||
CKutil_StrAllocCopy(domain_from_header, domain.get());
|
CKutil_StrAllocCopy(domain_from_header, domain.get());
|
||||||
|
|
||||||
|
@ -1416,7 +1421,7 @@ COOKIE_SetCookieStringFromHttp(char * curURL, char * firstURL, nsIPrompt *aPromp
|
||||||
time_t gmtCookieExpires=0, expires=0, sDate;
|
time_t gmtCookieExpires=0, expires=0, sDate;
|
||||||
|
|
||||||
/* check to see if P3P pref is satisfied */
|
/* check to see if P3P pref is satisfied */
|
||||||
nsCookieStatus_t status = nsICookie::STATUS_UNKNOWN;
|
nsCookieStatus status = nsICookie::STATUS_UNKNOWN;
|
||||||
if (cookie_GetBehaviorPref() == PERMISSION_P3P) {
|
if (cookie_GetBehaviorPref() == PERMISSION_P3P) {
|
||||||
status = cookie_P3PDecision(curURL, firstURL, ioService, aHttpChannel);
|
status = cookie_P3PDecision(curURL, firstURL, ioService, aHttpChannel);
|
||||||
if (status == nsICookie::STATUS_REJECTED) {
|
if (status == nsICookie::STATUS_REJECTED) {
|
||||||
|
@ -1772,8 +1777,8 @@ COOKIE_Enumerate
|
||||||
char ** path,
|
char ** path,
|
||||||
PRBool * isSecure,
|
PRBool * isSecure,
|
||||||
PRUint64 * expires,
|
PRUint64 * expires,
|
||||||
nsCookieStatus_t * status,
|
nsCookieStatus * status,
|
||||||
nsCookiePolicy_t * policy) {
|
nsCookiePolicy * policy) {
|
||||||
if (count > COOKIE_Count()) {
|
if (count > COOKIE_Count()) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -1800,7 +1805,7 @@ COOKIE_Enumerate
|
||||||
|
|
||||||
PUBLIC void
|
PUBLIC void
|
||||||
COOKIE_Remove
|
COOKIE_Remove
|
||||||
(const char* host, const char* name, const char* path, const PRBool permanent) {
|
(const char* host, const char* name, const char* path, const PRBool blocked) {
|
||||||
cookie_CookieStruct * cookie;
|
cookie_CookieStruct * cookie;
|
||||||
PRInt32 count = 0;
|
PRInt32 count = 0;
|
||||||
|
|
||||||
|
@ -1814,7 +1819,7 @@ COOKIE_Remove
|
||||||
if ((PL_strcmp(cookie->host, host) == 0) &&
|
if ((PL_strcmp(cookie->host, host) == 0) &&
|
||||||
(PL_strcmp(cookie->name, name) == 0) &&
|
(PL_strcmp(cookie->name, name) == 0) &&
|
||||||
(PL_strcmp(cookie->path, path) == 0)) {
|
(PL_strcmp(cookie->path, path) == 0)) {
|
||||||
if (permanent && cookie->host) {
|
if (blocked && cookie->host) {
|
||||||
char * hostname = nsnull;
|
char * hostname = nsnull;
|
||||||
char * hostnameAfterDot = cookie->host;
|
char * hostnameAfterDot = cookie->host;
|
||||||
while (*hostnameAfterDot == '.') {
|
while (*hostnameAfterDot == '.') {
|
||||||
|
|
|
@ -74,9 +74,9 @@ extern nsresult COOKIE_Enumerate
|
||||||
char ** path,
|
char ** path,
|
||||||
PRBool * isSecure,
|
PRBool * isSecure,
|
||||||
PRUint64 * expires,
|
PRUint64 * expires,
|
||||||
nsCookieStatus_t * status,
|
nsCookieStatus * status,
|
||||||
nsCookiePolicy_t * policy);
|
nsCookiePolicy * policy);
|
||||||
extern void COOKIE_Remove
|
extern void COOKIE_Remove
|
||||||
(const char* host, const char* name, const char* path, const PRBool permanent);
|
(const char* host, const char* name, const char* path, const PRBool blocked);
|
||||||
|
|
||||||
#endif /* COOKIES_H */
|
#endif /* COOKIES_H */
|
||||||
|
|
|
@ -21,61 +21,88 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
typedef long nsCookieStatus_t;
|
/**
|
||||||
typedef long nsCookiePolicy_t;
|
* An optional interface for embedding clients wishing to access an
|
||||||
|
* HTTP or javascript cookie object
|
||||||
|
*
|
||||||
|
* @status FROZEN
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef long nsCookieStatus;
|
||||||
|
typedef long nsCookiePolicy;
|
||||||
|
|
||||||
[scriptable, uuid(E9FCB9A4-D376-458f-B720-E65E7DF593BC)]
|
[scriptable, uuid(E9FCB9A4-D376-458f-B720-E65E7DF593BC)]
|
||||||
|
|
||||||
/**
|
|
||||||
This interface represents a HTTP or Javascript "cookie" object.
|
|
||||||
*/
|
|
||||||
|
|
||||||
interface nsICookie : nsISupports {
|
interface nsICookie : nsISupports {
|
||||||
|
|
||||||
/* the name of the cookie */
|
/**
|
||||||
readonly attribute string name;
|
* the name of the cookie
|
||||||
|
*/
|
||||||
|
readonly attribute ACString name;
|
||||||
|
|
||||||
/* the cookie value */
|
/**
|
||||||
readonly attribute string value;
|
* the cookie value
|
||||||
|
*/
|
||||||
|
readonly attribute ACString value;
|
||||||
|
|
||||||
/* true if the cookie is a domain cookie, false otherwise */
|
/**
|
||||||
|
* true if the cookie is a domain cookie, false otherwise
|
||||||
|
*/
|
||||||
readonly attribute boolean isDomain;
|
readonly attribute boolean isDomain;
|
||||||
|
|
||||||
/* the host (possibly fully qualified) of the cookie */
|
/**
|
||||||
readonly attribute string host;
|
* the host (possibly fully qualified) of the cookie
|
||||||
|
*/
|
||||||
|
readonly attribute AUTF8String host;
|
||||||
|
|
||||||
/* the path pertaining to the cookie */
|
/**
|
||||||
readonly attribute string path;
|
* the path pertaining to the cookie
|
||||||
|
*/
|
||||||
|
readonly attribute AUTF8String path;
|
||||||
|
|
||||||
/* true if the cookie was transmitted over ssl, false otherwise */
|
/**
|
||||||
|
* true if the cookie was transmitted over ssl, false otherwise
|
||||||
|
*/
|
||||||
readonly attribute boolean isSecure;
|
readonly attribute boolean isSecure;
|
||||||
|
|
||||||
/* expiration time (local timezone) expressed as number of seconds since Jan 1, 1970 */
|
/**
|
||||||
|
* expiration time (local timezone) expressed as number of seconds since Jan 1, 1970
|
||||||
|
*/
|
||||||
readonly attribute PRUint64 expires;
|
readonly attribute PRUint64 expires;
|
||||||
|
|
||||||
/* P3P status -- accepted, downgraded, flagged, or rejected */
|
/**
|
||||||
const nsCookieStatus_t STATUS_UNKNOWN=0;
|
* P3P status of cookie. Values are
|
||||||
const nsCookieStatus_t STATUS_ACCEPTED=1;
|
*
|
||||||
const nsCookieStatus_t STATUS_DOWNGRADED=2;
|
* STATUS_UNKNOWN -- cookie collected in a previous session and this info no longer available
|
||||||
const nsCookieStatus_t STATUS_FLAGGED=3;
|
* STATUS_ACCEPTED -- cookie was accepted as it
|
||||||
const nsCookieStatus_t STATUS_REJECTED=4;
|
* STATUS_DOWNGRADED -- cookie was accepted but downgraded to a session cookie
|
||||||
|
* STATUS_FLAGGED -- cookie was accepted with a warning being issued to the user
|
||||||
|
* STATUS_REJECTED -- cookie was not accepted
|
||||||
|
*/
|
||||||
|
const nsCookieStatus STATUS_UNKNOWN=0;
|
||||||
|
const nsCookieStatus STATUS_ACCEPTED=1;
|
||||||
|
const nsCookieStatus STATUS_DOWNGRADED=2;
|
||||||
|
const nsCookieStatus STATUS_FLAGGED=3;
|
||||||
|
const nsCookieStatus STATUS_REJECTED=4;
|
||||||
|
|
||||||
readonly attribute nsCookieStatus_t status;
|
readonly attribute nsCookieStatus status;
|
||||||
|
|
||||||
/* Site's compact policy -- none, noConsent, implicitConsent, explicitConsent, noII */
|
/**
|
||||||
const nsCookiePolicy_t POLICY_UNKNOWN=0;
|
* Site's compact policy. Values are
|
||||||
const nsCookiePolicy_t POLICY_NONE=1;
|
*
|
||||||
const nsCookiePolicy_t POLICY_NO_CONSENT=2;
|
* POLICY_UNKNOWN -- cookie collected in a previous session and this info no longer available
|
||||||
const nsCookiePolicy_t POLICY_IMPLICIT_CONSENT=3;
|
* POLICY_NONE -- site did not send a compact policy along with the cookie
|
||||||
const nsCookiePolicy_t POLICY_EXPLICIT_CONSENT=4;
|
* POLICY_NO_CONSENT -- site collects identfiable information without user involvement
|
||||||
const nsCookiePolicy_t POLICY_NO_II=5;
|
* POLICY_IMPLICIT_CONSENT -- site collects identifiable information unless user opts out
|
||||||
readonly attribute nsCookiePolicy_t policy;
|
* POLICY_EXPLICIT_CONSENT -- site does not collect identifiable information unless user opts in
|
||||||
|
* POLICY_NO_II -- site does not collect identifiable information
|
||||||
|
*/
|
||||||
|
const nsCookiePolicy POLICY_UNKNOWN=0;
|
||||||
|
const nsCookiePolicy POLICY_NONE=1;
|
||||||
|
const nsCookiePolicy POLICY_NO_CONSENT=2;
|
||||||
|
const nsCookiePolicy POLICY_IMPLICIT_CONSENT=3;
|
||||||
|
const nsCookiePolicy POLICY_EXPLICIT_CONSENT=4;
|
||||||
|
const nsCookiePolicy POLICY_NO_II=5;
|
||||||
|
readonly attribute nsCookiePolicy policy;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%{ C++
|
|
||||||
// {E9FCB9A4-D376-458f-B720-E65E7DF593BC}
|
|
||||||
#define NS_COOKIE_CID \
|
|
||||||
{ 0xe9fcb9a4, 0xd376, 0x458f, { 0xb7, 0x20, 0xe6, 0x5e, 0x7d, 0xf5, 0x93, 0xbc } }
|
|
||||||
#define NS_COOKIE_CONTRACTID "@mozilla.org/cookie;1"
|
|
||||||
%}
|
|
||||||
|
|
|
@ -34,28 +34,42 @@
|
||||||
* the provisions above, a recipient may use your version of this file under
|
* the provisions above, a recipient may use your version of this file under
|
||||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
This file contains an interface to the Cookie Manager.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsISimpleEnumerator.idl"
|
#include "nsISimpleEnumerator.idl"
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An optional interface for embedding clients wishing to access or
|
||||||
|
* remove the cookies that are in the cookie list
|
||||||
|
*
|
||||||
|
* @status FROZEN
|
||||||
|
*/
|
||||||
|
|
||||||
[scriptable, uuid(AAAB6710-0F2C-11d5-A53B-0010A401EB10)]
|
[scriptable, uuid(AAAB6710-0F2C-11d5-A53B-0010A401EB10)]
|
||||||
interface nsICookieManager : nsISupports
|
interface nsICookieManager : nsISupports
|
||||||
{
|
{
|
||||||
void removeAll();
|
|
||||||
readonly attribute nsISimpleEnumerator enumerator;
|
|
||||||
void remove(in string domain, in string name, in string path, [const] in boolean permanent);
|
|
||||||
};
|
|
||||||
|
|
||||||
%{ C++
|
/**
|
||||||
// {AAAB6710-0F2C-11d5-A53B-0010A401EB10}
|
* Called to remove all cookies from the cookie list
|
||||||
#define NS_COOKIEMANAGER_CID \
|
*/
|
||||||
{ 0xaaab6710, 0xf2c, 0x11d5, { 0xa5, 0x3b, 0x0, 0x10, 0xa4, 0x1, 0xeb, 0x10 } }
|
void removeAll();
|
||||||
#define NS_COOKIEMANAGER_CONTRACTID "@mozilla.org/cookiemanager;1"
|
|
||||||
%}
|
/**
|
||||||
|
* Called to enumerate through each cookie in the cookie list.
|
||||||
|
* The objects enumerated over are of type nsICookie
|
||||||
|
*/
|
||||||
|
readonly attribute nsISimpleEnumerator enumerator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to remove an individual cookie from the cookie list
|
||||||
|
*
|
||||||
|
* @param aDomain The host or domain for which the cookie was set
|
||||||
|
* @param aName The name specified in the cookie
|
||||||
|
* @param aBlocked Indicates if cookies from this host should be permanently blocked
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void remove(in AUTF8String aDomain, in ACString aName, in AUTF8String aPath, in boolean aBlocked);
|
||||||
|
};
|
||||||
|
|
|
@ -41,8 +41,10 @@
|
||||||
#include "nsIGenericFactory.h"
|
#include "nsIGenericFactory.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsCookie.h"
|
#include "nsCookie.h"
|
||||||
|
#include "nsCCookie.h"
|
||||||
#include "nsPermission.h"
|
#include "nsPermission.h"
|
||||||
#include "nsCookieManager.h"
|
#include "nsCookieManager.h"
|
||||||
|
#include "nsCCookieManager.h"
|
||||||
#include "nsCookieService.h"
|
#include "nsCookieService.h"
|
||||||
#include "nsImgManager.h"
|
#include "nsImgManager.h"
|
||||||
#include "nsPermissionManager.h"
|
#include "nsPermissionManager.h"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче