diff --git a/mozilla/allmakefiles.sh b/mozilla/allmakefiles.sh index c0a5de74686..82c1a2cafaa 100755 --- a/mozilla/allmakefiles.sh +++ b/mozilla/allmakefiles.sh @@ -388,6 +388,9 @@ netwerk/build2/Makefile netwerk/cache/Makefile netwerk/cache/public/Makefile netwerk/cache/src/Makefile +netwerk/cookie/Makefile +netwerk/cookie/public/Makefile +netwerk/cookie/src/Makefile netwerk/dns/Makefile netwerk/dns/public/Makefile netwerk/dns/src/Makefile diff --git a/mozilla/extensions/cookie/Makefile.in b/mozilla/extensions/cookie/Makefile.in index 8247a5ca0d4..c90847f1aec 100644 --- a/mozilla/extensions/cookie/Makefile.in +++ b/mozilla/extensions/cookie/Makefile.in @@ -52,9 +52,7 @@ endif CPPSRCS = \ nsModuleFactory.cpp \ - nsCookie.cpp \ nsPermission.cpp \ - nsCookieService.cpp \ nsImgManager.cpp \ nsPermissionManager.cpp \ nsPopupWindowManager.cpp \ @@ -62,25 +60,12 @@ CPPSRCS = \ nsCookiePermission.cpp \ $(NULL) -SDK_XPIDLSRCS = \ - nsICookie.idl \ - nsICookieManager.idl \ - $(NULL) - XPIDLSRCS = \ - nsICookie2.idl \ - nsICookieConsent.idl \ nsIImgManager.idl \ nsIPermissionManager.idl \ nsIPermission.idl \ nsICookieAcceptDialog.idl \ nsICookiePromptService.idl \ - nsICookieManager2.idl \ - nsICookiePermission.idl \ - $(NULL) - -EXPORTS = \ - nsCCookieManager.h \ $(NULL) EXTRA_DSO_LDOPTS = \ diff --git a/mozilla/extensions/cookie/nsModuleFactory.cpp b/mozilla/extensions/cookie/nsModuleFactory.cpp index d0967fd18a1..a7084c2fa77 100644 --- a/mozilla/extensions/cookie/nsModuleFactory.cpp +++ b/mozilla/extensions/cookie/nsModuleFactory.cpp @@ -40,8 +40,6 @@ #include "nsIModule.h" #include "nsIGenericFactory.h" #include "nsIServiceManager.h" -#include "nsCCookieManager.h" -#include "nsCookieService.h" #include "nsImgManager.h" #include "nsPermissionManager.h" #include "nsPopupWindowManager.h" @@ -51,7 +49,6 @@ #include "nsXPIDLString.h" // Define the constructor function for the objects -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsCookieService, nsCookieService::GetSingleton) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsImgManager, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPermissionManager, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPopupWindowManager, Init) @@ -92,16 +89,6 @@ UnregisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath, // The list of components we register static const nsModuleComponentInfo components[] = { - { "CookieManager", - NS_COOKIEMANAGER_CID, - NS_COOKIEMANAGER_CONTRACTID, - nsCookieServiceConstructor - }, - { "CookieService", - NS_COOKIESERVICE_CID, - NS_COOKIESERVICE_CONTRACTID, - nsCookieServiceConstructor - }, { "ImgManager", NS_IMGMANAGER_CID, NS_IMGMANAGER_CONTRACTID, diff --git a/mozilla/netwerk/build/Makefile.in b/mozilla/netwerk/build/Makefile.in index ef9b53b5876..681b28a1f22 100644 --- a/mozilla/netwerk/build/Makefile.in +++ b/mozilla/netwerk/build/Makefile.in @@ -58,6 +58,7 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)neckobase_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)neckodns_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)neckosocket_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)neckocookie_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)nkconv_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)nkcnvts_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \ @@ -71,6 +72,7 @@ LOCAL_INCLUDES = \ -I$(srcdir)/../base/src \ -I$(srcdir)/../dns/src \ -I$(srcdir)/../socket/base \ + -I$(srcdir)/../cookie/src \ -I$(srcdir)/../streamconv/src \ -I$(srcdir)/../streamconv/converters \ -I$(srcdir)/../mime/src \ diff --git a/mozilla/netwerk/build/nsNetModule.cpp b/mozilla/netwerk/build/nsNetModule.cpp index 9e00e902271..cbddd389061 100644 --- a/mozilla/netwerk/build/nsNetModule.cpp +++ b/mozilla/netwerk/build/nsNetModule.cpp @@ -138,6 +138,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirIndex) #include "nsStreamListenerTee.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee) +/////////////////////////////////////////////////////////////////////////////// + +#include "nsCookieService.h" +#include "nsCCookieManager.h" +NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsCookieService, nsCookieService::GetSingleton) + /////////////////////////////////////////////////////////////////////////////// // protocols /////////////////////////////////////////////////////////////////////////////// @@ -999,6 +1005,18 @@ static const nsModuleComponentInfo gNetModuleInfo[] = { nsCacheService::Create }, + { "CookieManager", + NS_COOKIEMANAGER_CID, + NS_COOKIEMANAGER_CONTRACTID, + nsCookieServiceConstructor + }, + + { "CookieService", + NS_COOKIESERVICE_CID, + NS_COOKIESERVICE_CONTRACTID, + nsCookieServiceConstructor + }, + }; NS_IMPL_NSGETMODULE_WITH_DTOR(necko_core_and_primary_protocols, gNetModuleInfo, diff --git a/mozilla/netwerk/cookie/Makefile.in b/mozilla/netwerk/cookie/Makefile.in index de2d385d8bf..41dab9f7184 100644 --- a/mozilla/netwerk/cookie/Makefile.in +++ b/mozilla/netwerk/cookie/Makefile.in @@ -26,6 +26,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public +DIRS = public src include $(topsrcdir)/config/rules.mk diff --git a/mozilla/netwerk/cookie/public/Makefile.in b/mozilla/netwerk/cookie/public/Makefile.in index 5941bb977ae..8ef51b78eda 100644 --- a/mozilla/netwerk/cookie/public/Makefile.in +++ b/mozilla/netwerk/cookie/public/Makefile.in @@ -30,8 +30,21 @@ MODULE = necko XPIDL_MODULE = necko_cookie GRE_MODULE = 1 +SDK_XPIDLSRCS = \ + nsICookieManager.idl \ + nsICookie.idl \ + $(NULL) + XPIDLSRCS = \ nsICookieService.idl \ + nsICookie2.idl \ + nsICookieConsent.idl \ + nsICookieManager2.idl \ + nsICookiePermission.idl \ + $(NULL) + +EXPORTS = \ + nsCCookieManager.h \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/netwerk/cookie/public/nsCCookieManager.h b/mozilla/netwerk/cookie/public/nsCCookieManager.h new file mode 100644 index 00000000000..d69227330cb --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsCCookieManager.h @@ -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) 2002 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 diff --git a/mozilla/netwerk/cookie/public/nsICookie.idl b/mozilla/netwerk/cookie/public/nsICookie.idl new file mode 100644 index 00000000000..febc3e7128a --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsICookie.idl @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * 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, Inc. Portions created by Netscape are + * Copyright (C) 2001, Mozilla. All Rights Reserved. + + * Contributor(s): + */ + +#include "nsISupports.idl" + +/** + * An optional interface for accessing the HTTP or + * javascript cookie object + * + * @status FROZEN + */ + +typedef long nsCookieStatus; +typedef long nsCookiePolicy; + +[scriptable, uuid(E9FCB9A4-D376-458f-B720-E65E7DF593BC)] + +interface nsICookie : nsISupports { + + /** + * the name of the cookie + */ + readonly attribute ACString name; + + /** + * the cookie value + */ + readonly attribute ACString value; + + /** + * true if the cookie is a domain cookie, false otherwise + */ + readonly attribute boolean isDomain; + + /** + * the host (possibly fully qualified) of the cookie + */ + readonly attribute AUTF8String host; + + /** + * the path pertaining to the cookie + */ + readonly attribute AUTF8String path; + + /** + * true if the cookie was transmitted over ssl, false otherwise + */ + readonly attribute boolean isSecure; + + /** + * expiration time (local timezone) expressed as number of seconds since Jan 1, 1970 + */ + readonly attribute PRUint64 expires; + + /** + * P3P status of cookie. Values are + * + * STATUS_UNKNOWN -- cookie collected in a previous session and this info no longer available + * STATUS_ACCEPTED -- cookie was accepted as it + * 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 status; + + /** + * Site's compact policy. Values are + * + * POLICY_UNKNOWN -- cookie collected in a previous session and this info no longer available + * POLICY_NONE -- site did not send a compact policy along with the cookie + * POLICY_NO_CONSENT -- site collects identfiable information without user involvement + * POLICY_IMPLICIT_CONSENT -- site collects identifiable information unless user opts out + * 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; + +}; diff --git a/mozilla/netwerk/cookie/public/nsICookie2.idl b/mozilla/netwerk/cookie/public/nsICookie2.idl new file mode 100644 index 00000000000..d05e47443b6 --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsICookie2.idl @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; 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 mozilla.org code. + * + * The Initial Developer of the Original Code is + * Daniel Witte. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Daniel Witte (dwitte@stanford.edu) + * + * 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 GPL or the LGPL. 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 ***** */ + +#include "nsICookie.idl" + +/** + * Main cookie object interface for use by consumers: + * extends nsICookie, a frozen interface for external + * access of cookie objects + */ + +[scriptable, uuid(d3493503-7854-46ed-8284-8af54a847efb)] + +interface nsICookie2 : nsICookie +{ + + /** + * true if the cookie is a session cookie + * (note: if true, the expiry time is undefined). + */ + readonly attribute boolean isSession; + + /** + * the actual expiry time of the cookie + * (where 0 does not represent a session cookie). + * + * not to be confused with |expires|, an + * attribute on nsICookie. + */ + readonly attribute PRInt64 expiry; + +}; diff --git a/mozilla/netwerk/cookie/public/nsICookieConsent.idl b/mozilla/netwerk/cookie/public/nsICookieConsent.idl new file mode 100644 index 00000000000..af56b2c0b93 --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsICookieConsent.idl @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. 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 NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. 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 NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" + +interface nsIHttpChannel; + +[scriptable,uuid(F5A34F50-1F39-11d6-A627-0010A401EB10)] +interface nsICookieConsent : nsISupports { + long getConsent(in string aURI, + in nsIHttpChannel aHttpChannel); +}; + +%{C++ +#define NS_COOKIECONSENT_CONTRACTID "@mozilla.org/cookie-consent;1" +%} diff --git a/mozilla/netwerk/cookie/public/nsICookieManager.idl b/mozilla/netwerk/cookie/public/nsICookieManager.idl new file mode 100644 index 00000000000..8f5dc7b0a0d --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsICookieManager.idl @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape 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/NPL/ + * + * 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 Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. 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 NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. 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 NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** + */ + +#include "nsISupports.idl" +#include "nsISimpleEnumerator.idl" + + +/** + * An optional interface for accessing or removing the cookies + * that are in the cookie list + * + * @status FROZEN + */ + +[scriptable, uuid(AAAB6710-0F2C-11d5-A53B-0010A401EB10)] +interface nsICookieManager : nsISupports +{ + + /** + * Called to remove all cookies from the cookie list + */ + void removeAll(); + + /** + * 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); +}; diff --git a/mozilla/netwerk/cookie/public/nsICookieManager2.idl b/mozilla/netwerk/cookie/public/nsICookieManager2.idl new file mode 100644 index 00000000000..47ed6fda6fb --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsICookieManager2.idl @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 2; 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 mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. 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 GPL or the LGPL. 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 ***** */ + +#include "nsICookieManager.idl" + +/** + * Additions to the frozen nsICookieManager + */ + +[scriptable, uuid(3E73FF5F-154E-494f-B640-3C654BA2CC2B)] +interface nsICookieManager2 : nsICookieManager +{ + /** + * Add a cookie. nsICookieService is the normal way to do this. This + * method is something of a backdoor. + * + * @param aDomain the host or domain for which the cookie is set + * @param aPath path within the domain for which the cookie is valid + * @param aName cookie name + * @param aValue cookie data + * @param aSecure true if the cookie should be secure + * @param aExpires expiration date. 0 means none; a session cookie. + */ + [noscript] + void add(in AUTF8String aDomain, in AUTF8String aPath, + in ACString aName, in ACString aValue, + in boolean aSecure, in PRInt32 aExpires); +}; diff --git a/mozilla/netwerk/cookie/public/nsICookiePermission.idl b/mozilla/netwerk/cookie/public/nsICookiePermission.idl new file mode 100644 index 00000000000..e1a88edd733 --- /dev/null +++ b/mozilla/netwerk/cookie/public/nsICookiePermission.idl @@ -0,0 +1,126 @@ +/* ***** 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 cookie manager code. + * + * The Initial Developer of the Original Code is + * Michiel van Leeuwen (mvl@exedo.nl). + * Portions created by the Initial Developer are Copyright (C) 2003 + * the Initial Developer. 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 GPL or the LGPL. 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 ***** */ + +#include "nsISupports.idl" + +interface nsICookie; +interface nsIURI; +interface nsIChannel; + +typedef long nsCookieAccess; + +/** + * An interface to test for cookie permissions + */ +[scriptable, uuid(91f1c3ec-73a0-4bf0-bdc5-348a1f181b0e)] +interface nsICookiePermission : nsISupports +{ + /** + * nsCookieAccess values + */ + const nsCookieAccess ACCESS_DEFAULT = 0; + const nsCookieAccess ACCESS_ALLOW = 1; + const nsCookieAccess ACCESS_DENY = 2; + + /** + * setAccess + * + * this method is called to block cookie access for the given URI. this + * may result in other URIs being blocked as well (e.g., URIs which share + * the same host name). + * + * @param aURI + * the URI to block + * @param aAccess + * the new cookie access for the URI + */ + void setAccess(in nsIURI aURI, + in nsCookieAccess aAccess); + + /** + * canAccess + * + * this method is called to test whether or not the given URI/channel may + * access the cookie database, either to set or get cookies. + * + * @param aURI + * the URI trying to access cookies + * @param aFirstURI + * the URI initiated by the user that resulted in aURI being loaded + * @param aChannel + * the channel corresponding to aURI + * + * @return nsCookieAccess value + */ + nsCookieAccess canAccess(in nsIURI aURI, + in nsIURI aFirstURI, + in nsIChannel aChannel); + + /** + * canSetCookie + * + * this method is called to test whether or not the given URI/channel may + * set a specific cookie. this method is always preceded by a call to + * canAccessCookies. + * + * @param aURI + * the URI trying to set the cookie + * @param aChannel + * the corresponding to aURI + * @param aCookie + * the cookie being added to the cookie database + * @param aNumCookiesFromHost + * the number of cookies this host already has set + * @param aChangingCookie + * PR_TRUE if the cookie is being modified; otherwise, the cookie + * is new + * + * @return true if the cookie can be set. + */ + boolean canSetCookie(in nsIURI aURI, + in nsIChannel aChannel, + in nsICookie aCookie, + in long aNumCookiesFromHost, + in boolean aChangingCookie); +}; + +%{ C++ +/** + * The nsICookiePermission implementation is an XPCOM service registered + * under the ContractID: + */ +#define NS_COOKIEPERMISSION_CONTRACTID "@mozilla.org/cookie/permission;1" +%}