remove p3p hooks from cookies. b=383994, r=timeless, sr=biesi
authordwitte@stanford.edu
Wed, 20 Jun 2007 22:17:08 -0700
changeset 2626 717ea39864f66d52ed4df6669a850e2923d3bfe1
parent 2625 56043378ee7390777ddcfc34ff5f890c248aad50
child 2627 14579731818945986a79b7b1bd5dd53ad8d09625
push idunknown
push userunknown
push dateunknown
reviewerstimeless, biesi
bugs383994
milestone1.9a6pre
remove p3p hooks from cookies. b=383994, r=timeless, sr=biesi
netwerk/cookie/public/Makefile.in
netwerk/cookie/public/nsICookie.idl
netwerk/cookie/public/nsICookieConsent.idl
netwerk/cookie/public/nsICookieService.idl
netwerk/cookie/src/nsCookie.cpp
netwerk/cookie/src/nsCookie.h
netwerk/cookie/src/nsCookieService.cpp
netwerk/cookie/src/nsCookieService.h
--- a/netwerk/cookie/public/Makefile.in
+++ b/netwerk/cookie/public/Makefile.in
@@ -50,16 +50,15 @@ SDK_XPIDLSRCS   = \
 		nsICookieManager.idl \
 		nsICookie.idl \
 		$(NULL)
 
 XPIDLSRCS	= \
 		nsICookieService.idl \
 		nsICookieServiceInternal.idl \
 		nsICookie2.idl \
-		nsICookieConsent.idl \
 		nsICookieManager2.idl \
 		nsICookiePermission.idl \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DIMPL_NS_NET
--- a/netwerk/cookie/public/nsICookie.idl
+++ b/netwerk/cookie/public/nsICookie.idl
@@ -78,50 +78,36 @@ interface nsICookie : nsISupports {
     readonly attribute AUTF8String path;
 
     /**
      * true if the cookie was transmitted over ssl, false otherwise
      */
     readonly attribute boolean isSecure;
 
     /**
-     * @DEPRECATED - use nsICookie2.expiry and nsICookie2.isSession instead.
+     * @DEPRECATED use nsICookie2.expiry and nsICookie2.isSession instead.
      *
      * expiration time in seconds since midnight (00:00:00), January 1, 1970 UTC.
      * expires = 0 represents a session cookie.
      * expires = 1 represents an expiration time earlier than 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
+     * @DEPRECATED status implementation will return STATUS_UNKNOWN in all cases.
      */
     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
+     * @DEPRECATED policy implementation will return POLICY_UNKNOWN in all cases.
      */
     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;
deleted file mode 100644
--- a/netwerk/cookie/public/nsICookieConsent.idl
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- 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) 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 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"
-#include "nsICookie.idl"
-
-interface nsIURI;
-interface nsIHttpChannel;
-
-[scriptable,uuid(F5A34F50-1F39-11d6-A627-0010A401EB10)]
-interface nsICookieConsent : nsISupports
-{
-  /**
-   * getConsent
-   *
-   * gives a decision on what should be done with a cookie, based on a site's
-   * p3p policy and the user's preferences. the policy for the given URI and
-   * channel is also returned.
-   *
-   * @param uri
-   *        the URI to find the policy for
-   * @param httpChannel
-   *        the channel to extract the p3p headers from
-   * @param isForeign
-   *        true if the cookie originates from a third-party site. this is used
-   *        to decide the cookie status based on user preferences.
-   * @param policy
-   *        the policy for the given URI, or nsICookie::POLICY_UNKNOWN if one
-   *        cannot be found. valid values are defined in nsICookie.idl.
-   *
-   * @return nsCookieStatus value. valid values are defined in nsICookie.idl.
-   */
-  nsCookieStatus getConsent(in  nsIURI         uri,
-                            in  nsIHttpChannel httpChannel,
-                            in  boolean        isForeign,
-                            out nsCookiePolicy policy);
-};  
-
-%{C++
-#define NS_COOKIECONSENT_CONTRACTID "@mozilla.org/cookie-consent;1"
-%}
--- a/netwerk/cookie/public/nsICookieService.idl
+++ b/netwerk/cookie/public/nsICookieService.idl
@@ -69,17 +69,17 @@ interface nsIChannel;
  *
  * topic  : "cookie-rejected"
  *          broadcast whenever a cookie was rejected from being set as a
  *          result of user prefs.
  * subject: an nsIURI interface pointer representing the URI that attempted
  *          to set the cookie.
  * data   : none.
  */
-[scriptable, uuid(011C3190-1434-11d6-A618-0010A401EB10)]
+[scriptable, uuid(2aaa897a-293c-4d2b-a657-8c9b7136996d)]
 interface nsICookieService : nsISupports
 {
   /*
    * Get the complete cookie string associated with the URI.
    *
    * @param aURI
    *        the URI of the document for which cookies are being queried.
    * @param aChannel
@@ -149,16 +149,9 @@ interface nsICookieService : nsISupports
    *        the expiry information of the cookie (the Date header from the HTTP
    *        response).
    * @param aChannel
    *        the channel used to load the document.  this parameter may be null,
    *        but it is strongly recommended that a non-null value be provided to
    *        ensure that the cookie privacy preferences are honored.
    */
   void setCookieStringFromHttp(in nsIURI aURI, in nsIURI aFirstURI, in nsIPrompt aPrompt, in string aCookie, in string aServerTime, in nsIChannel aChannel);
-
-  /**
-   * This attribute really doesn't belong on this interface.  CVS blame will
-   * tell you why it is here.  It remains until we can find a better home for
-   * it.  Read the source if you want to know what it does :-(
-   */
-  readonly attribute boolean cookieIconIsVisible;
 };
--- a/netwerk/cookie/src/nsCookie.cpp
+++ b/netwerk/cookie/src/nsCookie.cpp
@@ -87,19 +87,17 @@ nsCookie *
 nsCookie::Create(const nsACString &aName,
                  const nsACString &aValue,
                  const nsACString &aHost,
                  const nsACString &aPath,
                  PRInt64           aExpiry,
                  PRInt64           aCreationID,
                  PRBool            aIsSession,
                  PRBool            aIsSecure,
-                 PRBool            aIsHttpOnly,
-                 nsCookieStatus    aStatus,
-                 nsCookiePolicy    aPolicy)
+                 PRBool            aIsHttpOnly)
 {
   // find the required string buffer size, adding 4 for the terminating nulls
   const PRUint32 stringLength = aName.Length() + aValue.Length() +
                                 aHost.Length() + aPath.Length() + 4;
 
   // allocate contiguous space for the nsCookie and its strings -
   // we store the strings in-line with the nsCookie to save allocations
   void *place = ::operator new(sizeof(nsCookie) + stringLength);
@@ -117,18 +115,17 @@ nsCookie::Create(const nsACString &aName
   if (aCreationID > gLastCreationID)
     gLastCreationID = aCreationID;
   else
     aCreationID = ++gLastCreationID;
 
   // construct the cookie. placement new, oh yeah!
   return new (place) nsCookie(name, value, host, path, end,
                               aExpiry, aCreationID,
-                              aIsSession, aIsSecure, aIsHttpOnly,
-                              aStatus, aPolicy);
+                              aIsSession, aIsSecure, aIsHttpOnly);
 }
 
 /******************************************************************************
  * nsCookie:
  * xpcom impl
  ******************************************************************************/
 
 // xpcom getters
@@ -136,19 +133,19 @@ NS_IMETHODIMP nsCookie::GetName(nsACStri
 NS_IMETHODIMP nsCookie::GetValue(nsACString &aValue)       { aValue = Value();          return NS_OK; }
 NS_IMETHODIMP nsCookie::GetHost(nsACString &aHost)         { aHost = Host();            return NS_OK; }
 NS_IMETHODIMP nsCookie::GetRawHost(nsACString &aHost)      { aHost = RawHost();         return NS_OK; }
 NS_IMETHODIMP nsCookie::GetPath(nsACString &aPath)         { aPath = Path();            return NS_OK; }
 NS_IMETHODIMP nsCookie::GetExpiry(PRInt64 *aExpiry)        { *aExpiry = Expiry();       return NS_OK; }
 NS_IMETHODIMP nsCookie::GetIsSession(PRBool *aIsSession)   { *aIsSession = IsSession(); return NS_OK; }
 NS_IMETHODIMP nsCookie::GetIsDomain(PRBool *aIsDomain)     { *aIsDomain = IsDomain();   return NS_OK; }
 NS_IMETHODIMP nsCookie::GetIsSecure(PRBool *aIsSecure)     { *aIsSecure = IsSecure();   return NS_OK; }
-NS_IMETHODIMP nsCookie::GetStatus(nsCookieStatus *aStatus) { *aStatus = Status();       return NS_OK; }
-NS_IMETHODIMP nsCookie::GetPolicy(nsCookiePolicy *aPolicy) { *aPolicy = Policy();       return NS_OK; }
 NS_IMETHODIMP nsCookie::GetIsHttpOnly(PRBool *aHttpOnly)   { *aHttpOnly = IsHttpOnly(); return NS_OK; }
+NS_IMETHODIMP nsCookie::GetStatus(nsCookieStatus *aStatus) { *aStatus = 0;              return NS_OK; }
+NS_IMETHODIMP nsCookie::GetPolicy(nsCookiePolicy *aPolicy) { *aPolicy = 0;              return NS_OK; }
 
 // compatibility method, for use with the legacy nsICookie interface.
 // here, expires == 0 denotes a session cookie.
 NS_IMETHODIMP
 nsCookie::GetExpires(PRUint64 *aExpires)
 {
   if (IsSession()) {
     *aExpires = 0;
--- a/netwerk/cookie/src/nsCookie.h
+++ b/netwerk/cookie/src/nsCookie.h
@@ -73,50 +73,44 @@ class nsCookie : public nsICookie2
              const char     *aValue,
              const char     *aHost,
              const char     *aPath,
              const char     *aEnd,
              PRInt64         aExpiry,
              PRInt64         aCreationID,
              PRBool          aIsSession,
              PRBool          aIsSecure,
-             PRBool          aIsHttpOnly,
-             nsCookieStatus  aStatus,
-             nsCookiePolicy  aPolicy)
+             PRBool          aIsHttpOnly)
      : mNext(nsnull)
      , mName(aName)
      , mValue(aValue)
      , mHost(aHost)
      , mPath(aPath)
      , mEnd(aEnd)
      , mExpiry(aExpiry)
      , mCreationID(aCreationID)
      , mRefCnt(0)
      , mIsSession(aIsSession != PR_FALSE)
      , mIsSecure(aIsSecure != PR_FALSE)
      , mIsHttpOnly(aIsHttpOnly != PR_FALSE)
-     , mStatus(aStatus)
-     , mPolicy(aPolicy)
     {
     }
 
   public:
     // public helper to create an nsCookie object. use |operator delete|
     // to destroy an object created by this method.
     static nsCookie * Create(const nsACString &aName,
                              const nsACString &aValue,
                              const nsACString &aHost,
                              const nsACString &aPath,
                              PRInt64           aExpiry,
                              PRInt64           aCreationID,
                              PRBool            aIsSession,
                              PRBool            aIsSecure,
-                             PRBool            aIsHttpOnly,
-                             nsCookieStatus    aStatus,
-                             nsCookiePolicy    aPolicy);
+                             PRBool            aIsHttpOnly);
 
     virtual ~nsCookie() {}
 
     // fast (inline, non-xpcom) getters
     inline const nsDependentCString Name()  const { return nsDependentCString(mName, mValue - 1); }
     inline const nsDependentCString Value() const { return nsDependentCString(mValue, mHost - 1); }
     inline const nsDependentCString Host()  const { return nsDependentCString(mHost, mPath - 1); }
     inline const nsDependentCString RawHost() const { return nsDependentCString(IsDomain() ? mHost + 1 : mHost, mPath - 1); }
@@ -124,18 +118,16 @@ class nsCookie : public nsICookie2
     inline PRInt64 Expiry()                 const { return mExpiry; }
     inline PRInt64 CreationID()             const { return mCreationID; }
     // cookie creation time, in seconds
     inline PRInt64 CreationTime()           const { return mCreationID / PR_USEC_PER_SEC; }
     inline PRBool IsSession()               const { return mIsSession; }
     inline PRBool IsDomain()                const { return *mHost == '.'; }
     inline PRBool IsSecure()                const { return mIsSecure; }
     inline PRBool IsHttpOnly()              const { return mIsHttpOnly; }
-    inline nsCookieStatus Status()          const { return mStatus; }
-    inline nsCookiePolicy Policy()          const { return mPolicy; }
 
     // setters
     inline void SetExpiry(PRInt64 aExpiry)        { mExpiry = aExpiry; }
     inline void SetIsSession(PRBool aIsSession)   { mIsSession = aIsSession; }
     // set the creation id manually, overriding the monotonicity checks in Create().
     // use with caution!
     inline void SetCreationID(PRInt64 aID)        { mCreationID = aID; }
 
@@ -158,13 +150,11 @@ class nsCookie : public nsICookie2
     PRInt64     mExpiry;
     // creation id is unique for each cookie and approximately represents the cookie
     // creation time, in microseconds.
     PRInt64     mCreationID;
     PRUint32    mRefCnt    : 16;
     PRUint32    mIsSession : 1;
     PRUint32    mIsSecure  : 1;
     PRUint32    mIsHttpOnly: 1;
-    PRUint32    mStatus    : 3;
-    PRUint32    mPolicy    : 3;
 };
 
 #endif // nsCookie_h__
--- a/netwerk/cookie/src/nsCookieService.cpp
+++ b/netwerk/cookie/src/nsCookieService.cpp
@@ -40,17 +40,16 @@
 
 #include "nsCookieService.h"
 #include "nsIServiceManager.h"
 
 #include "nsIIOService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefBranch2.h"
 #include "nsIPrefService.h"
-#include "nsICookieConsent.h"
 #include "nsICookiePermission.h"
 #include "nsIURI.h"
 #include "nsIURL.h"
 #include "nsIChannel.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h" // evil hack!
 #include "nsIPrompt.h"
 #include "nsIFile.h"
@@ -93,28 +92,29 @@ static const char kOldCookieFileName[] =
 
 // default limits for the cookie list. these can be tuned by the
 // network.cookie.maxNumber and network.cookie.maxPerHost prefs respectively.
 static const PRUint32 kMaxNumberOfCookies = 1000;
 static const PRUint32 kMaxCookiesPerHost  = 50;
 static const PRUint32 kMaxBytesPerCookie  = 4096;
 static const PRUint32 kMaxBytesPerPath    = 1024;
 
-// this constant augments those defined on nsICookie, and indicates
-// the cookie should be rejected because of an error (rather than
-// something the user can control). this is used for notifying about
-// rejected cookies, since we only want to notify of rejections where
+// these constants represent a decision about a cookie based on user prefs.
+static const PRUint32 STATUS_ACCEPTED            = 0;
+static const PRUint32 STATUS_REJECTED            = 1;
+// STATUS_REJECTED_WITH_ERROR indicates the cookie should be rejected because
+// of an error (rather than something the user can control). this is used for
+// notification purposes, since we only want to notify of rejections where
 // the user can do something about it (e.g. whitelist the site).
-static const nsCookieStatus STATUS_REJECTED_WITH_ERROR = 5;
+static const PRUint32 STATUS_REJECTED_WITH_ERROR = 2;
 
 // behavior pref constants 
 static const PRUint32 BEHAVIOR_ACCEPT        = 0;
 static const PRUint32 BEHAVIOR_REJECTFOREIGN = 1;
 static const PRUint32 BEHAVIOR_REJECT        = 2;
-static const PRUint32 BEHAVIOR_P3P           = 3;
 
 // pref string constants
 static const char kPrefCookiesPermissions[] = "network.cookie.cookieBehavior";
 static const char kPrefMaxNumberOfCookies[] = "network.cookie.maxNumber";
 static const char kPrefMaxCookiesPerHost[]  = "network.cookie.maxPerHost";
 
 // struct for temporarily storing cookie attributes during header parsing
 struct nsCookieAttributes
@@ -373,17 +373,16 @@ NS_IMPL_ISUPPORTS6(nsCookieService,
                    nsICookieServiceInternal,
                    nsICookieManager,
                    nsICookieManager2,
                    nsIObserver,
                    nsISupportsWeakReference)
 
 nsCookieService::nsCookieService()
  : mCookieCount(0)
- , mCookieIconVisible(PR_FALSE)
  , mCookiesPermissions(BEHAVIOR_ACCEPT)
  , mMaxNumberOfCookies(kMaxNumberOfCookies)
  , mMaxCookiesPerHost(kMaxCookiesPerHost)
 {
 }
 
 nsresult
 nsCookieService::Init()
@@ -404,17 +403,16 @@ nsCookieService::Init()
   // ignore failure here, since it's non-fatal (we can run fine without
   // persistent storage - e.g. if there's no profile)
   InitDB();
 
   mObserverService = do_GetService("@mozilla.org/observer-service;1");
   if (mObserverService) {
     mObserverService->AddObserver(this, "profile-before-change", PR_TRUE);
     mObserverService->AddObserver(this, "profile-do-change", PR_TRUE);
-    mObserverService->AddObserver(this, "cookieIcon", PR_TRUE);
   }
 
   mPermissionService = do_GetService(NS_COOKIEPERMISSION_CONTRACTID);
 
   return NS_OK;
 }
 
 nsresult
@@ -580,21 +578,16 @@ nsCookieService::Observe(nsISupports    
         if (NS_FAILED(rv))
           NS_WARNING("db delete failed");
       }
 
   } else if (!strcmp(aTopic, "profile-do-change")) {
     // the profile has already changed; init the db from the new location
     InitDB();
 
-  } else if (!strcmp(aTopic, "cookieIcon")) {
-    // this is an evil trick to avoid the blatant inefficiency of
-    // (!nsCRT::strcmp(aData, NS_LITERAL_STRING("on").get()))
-    mCookieIconVisible = (aData[0] == 'o' && aData[1] == 'n' && aData[2] == '\0');
-
   } else if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
     nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(aSubject);
     if (prefBranch)
       PrefChanged(prefBranch);
   }
 
   return NS_OK;
 }
@@ -611,21 +604,20 @@ nsCookieService::GetCookieList(nsIURI   
                                nsAutoVoidArray  &aResult)
 {
   if (!aHostURI) {
     COOKIE_LOGFAILURE(GET_COOKIE, nsnull, nsnull, "host URI is null");
     return;
   }
 
   // check default prefs
-  nsCookiePolicy cookiePolicy; // we don't use this here... just a placeholder
-  nsCookieStatus cookieStatus = CheckPrefs(aHostURI, aFirstURI, aChannel, nsnull, cookiePolicy);
+  PRUint32 cookieStatus = CheckPrefs(aHostURI, aFirstURI, aChannel, nsnull);
   // for GetCookie(), we don't fire rejection notifications.
   switch (cookieStatus) {
-  case nsICookie::STATUS_REJECTED:
+  case STATUS_REJECTED:
   case STATUS_REJECTED_WITH_ERROR:
     return;
   }
 
   // get host and path from the nsIURI
   // note: there was a "check if host has embedded whitespace" here.
   // it was removed since this check was added into the nsIURI impl (bug 146094).
   nsCAutoString hostFromURI, pathFromURI;
@@ -718,19 +710,19 @@ nsCookieService::GetCookieList(nsIURI   
   // return cookies in order of path length; longest to shortest.
   // this is required per RFC2109.  if cookies match in length,
   // then sort by creation time (see bug 236772).
   aResult.Sort(compareCookiesForSending, nsnull);
 }
 
 NS_IMETHODIMP
 nsCookieService::GetCookieValue(nsIURI *aHostURI,
-				nsIChannel *aChannel,
+                                nsIChannel *aChannel,
                                 const nsACString& aName,
-				nsACString& aResult)
+                                nsACString& aResult)
 {
   aResult.Truncate();
 
   // try to determine first party URI
   nsCOMPtr<nsIURI> firstURI;
   if (aChannel) {
     nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(aChannel);
     if (httpInternal)
@@ -837,21 +829,20 @@ nsCookieService::SetCookieValue(nsIURI *
 
   if (aChannel) {
     nsCOMPtr<nsIHttpChannelInternal> httpInternal = do_QueryInterface(aChannel);
     if (httpInternal)
       httpInternal->GetDocumentURI(getter_AddRefs(firstURI));
   }
 
   // check default prefs
-  nsCookiePolicy cookiePolicy = nsICookie::POLICY_UNKNOWN;
-  nsCookieStatus cookieStatus = CheckPrefs(aHostURI, firstURI, aChannel, "", cookiePolicy);
+  PRUint32 cookieStatus = CheckPrefs(aHostURI, firstURI, aChannel, "");
   // fire a notification if cookie was rejected (but not if there was an error)
   switch (cookieStatus) {
-  case nsICookie::STATUS_REJECTED:
+  case STATUS_REJECTED:
     NotifyRejected(aHostURI);
   case STATUS_REJECTED_WITH_ERROR:
     return NS_OK;
   }
 
   nsCookieAttributes attributes;
   attributes.name = aName;
   attributes.value = aValue;
@@ -859,18 +850,17 @@ nsCookieService::SetCookieValue(nsIURI *
   attributes.path = aPath;
   attributes.expiryTime = aExpiry;
   attributes.creationID = PR_Now();
   attributes.isSession = aIsSession;
 
   attributes.isSecure = PR_FALSE;
   aHostURI->SchemeIs("https", &attributes.isSecure);
 
-  CheckAndAdd(aHostURI, aChannel, attributes,
-              cookieStatus, cookiePolicy, EmptyCString());
+  CheckAndAdd(aHostURI, aChannel, attributes, EmptyCString());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCookieService::SetCookieString(nsIURI     *aHostURI,
                                  nsIPrompt  *aPrompt,
                                  const char *aCookieHeader,
                                  nsIChannel *aChannel)
@@ -896,21 +886,20 @@ nsCookieService::SetCookieStringFromHttp
                                          nsIChannel *aChannel) 
 {
   if (!aHostURI) {
     COOKIE_LOGFAILURE(SET_COOKIE, nsnull, aCookieHeader, "host URI is null");
     return NS_OK;
   }
 
   // check default prefs
-  nsCookiePolicy cookiePolicy = nsICookie::POLICY_UNKNOWN;
-  nsCookieStatus cookieStatus = CheckPrefs(aHostURI, aFirstURI, aChannel, aCookieHeader, cookiePolicy);
+  PRUint32 cookieStatus = CheckPrefs(aHostURI, aFirstURI, aChannel, aCookieHeader);
   // fire a notification if cookie was rejected (but not if there was an error)
   switch (cookieStatus) {
-  case nsICookie::STATUS_REJECTED:
+  case STATUS_REJECTED:
     NotifyRejected(aHostURI);
   case STATUS_REJECTED_WITH_ERROR:
     return NS_OK;
   }
 
   // parse server local time. this is not just done here for efficiency
   // reasons - if there's an error parsing it, and we need to default it
   // to the current time, we must do it here since the current time in
@@ -925,19 +914,17 @@ nsCookieService::SetCookieStringFromHttp
   }
 
   // start a transaction on the storage db, to optimize insertions.
   // transaction will automically commit on completion
   mozStorageTransaction transaction(mDBConn, PR_TRUE);
  
   // switch to a nice string type now, and process each cookie in the header
   nsDependentCString cookieHeader(aCookieHeader);
-  while (SetCookieInternal(aHostURI, aChannel,
-                           cookieHeader, serverTime,
-                           cookieStatus, cookiePolicy));
+  while (SetCookieInternal(aHostURI, aChannel, cookieHeader, serverTime));
 
   return NS_OK;
 }
 
 // notify observers that a cookie was rejected due to the users' prefs.
 void
 nsCookieService::NotifyRejected(nsIURI *aHostURI)
 {
@@ -952,54 +939,29 @@ nsCookieService::NotifyRejected(nsIURI *
 // "changed" means a cookie was altered. aCookie is the new cookie.
 // "cleared" means the entire cookie list was cleared. aCookie is null.
 void
 nsCookieService::NotifyChanged(nsICookie2      *aCookie,
                                const PRUnichar *aData)
 {
   if (mObserverService)
     mObserverService->NotifyObservers(aCookie, "cookie-changed", aData);
-
-  // fire a cookieIcon notification if the cookie was downgraded or flagged
-  // by p3p. the cookieIcon notification is now deprecated, but we still need
-  // this until consumers can be fixed. to see if cookies have been
-  // downgraded or flagged, listen to cookie-changed directly.
-  if (mCookiesPermissions == BEHAVIOR_P3P &&
-      (!nsCRT::strcmp(aData, NS_LITERAL_STRING("added").get()) ||
-       !nsCRT::strcmp(aData, NS_LITERAL_STRING("changed").get()))) {
-    nsCookieStatus status;
-    aCookie->GetStatus(&status);
-    if (status == nsICookie::STATUS_DOWNGRADED ||
-        status == nsICookie::STATUS_FLAGGED) {
-      mCookieIconVisible = PR_TRUE;
-      if (mObserverService)
-        mObserverService->NotifyObservers(nsnull, "cookieIcon", NS_LITERAL_STRING("on").get());
-    }
-  }
-}
-
-// this method is deprecated. listen to the cookie-changed notification instead.
-NS_IMETHODIMP
-nsCookieService::GetCookieIconIsVisible(PRBool *aIsVisible)
-{
-  *aIsVisible = mCookieIconVisible;
-  return NS_OK;
 }
 
 /******************************************************************************
  * nsCookieService:
  * pref observer impl
  ******************************************************************************/
 
 void
 nsCookieService::PrefChanged(nsIPrefBranch *aPrefBranch)
 {
   PRInt32 val;
   if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefCookiesPermissions, &val)))
-    mCookiesPermissions = LIMIT(val, 0, 3, 0);
+    mCookiesPermissions = LIMIT(val, 0, 2, 0);
 
   if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefMaxNumberOfCookies, &val)))
     mMaxNumberOfCookies = LIMIT(val, 0, 0xFFFF, 0xFFFF);
 
   if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefMaxCookiesPerHost, &val)))
     mMaxCookiesPerHost = LIMIT(val, 0, 0xFFFF, 0xFFFF);
 }
 
@@ -1058,19 +1020,17 @@ nsCookieService::Add(const nsACString &a
   PRInt64 currentTimeInUsec = PR_Now();
 
   nsRefPtr<nsCookie> cookie =
     nsCookie::Create(aName, aValue, aDomain, aPath,
                      aExpiry,
                      currentTimeInUsec,
                      aIsSession,
                      aIsSecure,
-                     aIsHttpOnly,
-                     nsICookie::STATUS_UNKNOWN,
-                     nsICookie::POLICY_UNKNOWN);
+                     aIsHttpOnly);
   if (!cookie) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   AddInternal(cookie, currentTimeInUsec / PR_USEC_PER_SEC, nsnull, nsnull);
   return NS_OK;
 }
 
@@ -1151,19 +1111,17 @@ nsCookieService::Read()
 
     // create a new nsCookie and assign the data.
     nsCookie* newCookie =
       nsCookie::Create(name, value, host, path,
                        expiry,
                        creationID,
                        PR_FALSE,
                        isSecure,
-                       isHttpOnly,
-                       nsICookie::STATUS_UNKNOWN,
-                       nsICookie::POLICY_UNKNOWN);
+                       isHttpOnly);
     if (!newCookie)
       return NS_ERROR_OUT_OF_MEMORY;
 
     if (!AddCookieToList(newCookie, PR_FALSE))
       // It is purpose that created us; purpose that connects us;
       // purpose that pulls us; that guides us; that drives us.
       // It is purpose that defines us; purpose that binds us.
       // When a cookie no longer has purpose, it has a choice:
@@ -1282,19 +1240,17 @@ nsCookieService::ImportCookies()
       nsCookie::Create(Substring(buffer, nameIndex, cookieIndex - nameIndex - 1),
                        Substring(buffer, cookieIndex, buffer.Length() - cookieIndex),
                        host,
                        Substring(buffer, pathIndex, secureIndex - pathIndex - 1),
                        expires,
                        creationIDCounter,
                        PR_FALSE,
                        Substring(buffer, secureIndex, expiresIndex - secureIndex - 1).EqualsLiteral(kTrue),
-                       isHttpOnly,
-                       nsICookie::STATUS_UNKNOWN,
-                       nsICookie::POLICY_UNKNOWN);
+                       isHttpOnly);
     if (!newCookie) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
     
     // manually set the creation id. this is okay, since nsCookie::Create() will keep
     // track of the largest id we've used, and we're setting it to a smaller
     // known unique one here.
     newCookie->SetCreationID(--creationIDCounter);
@@ -1323,19 +1279,17 @@ nsCookieService::ImportCookies()
  ******************************************************************************/
 
 // processes a single cookie, and returns PR_TRUE if there are more cookies
 // to be processed
 PRBool
 nsCookieService::SetCookieInternal(nsIURI             *aHostURI,
                                    nsIChannel         *aChannel,
                                    nsDependentCString &aCookieHeader,
-                                   PRInt64             aServerTime,
-                                   nsCookieStatus      aStatus,
-                                   nsCookiePolicy      aPolicy)
+                                   PRInt64             aServerTime)
 {
   // create a stack-based nsCookieAttributes, to store all the
   // attributes parsed from the cookie
   nsCookieAttributes cookieAttributes;
 
   // init expiryTime such that session cookies won't prematurely expire
   cookieAttributes.expiryTime = LL_MAXINT;
 
@@ -1346,33 +1300,29 @@ nsCookieService::SetCookieInternal(nsIUR
   // newCookie says whether there are multiple cookies in the header;
   // so we can handle them separately.
   PRBool newCookie = ParseAttributes(aCookieHeader, cookieAttributes);
 
   // generate a creation id for the cookie
   PRInt64 currentTimeInUsec = PR_Now();
   cookieAttributes.creationID = currentTimeInUsec;
 
-  // calculate expiry time of cookie. we need to pass in cookieStatus, since
-  // the cookie may have been downgraded to a session cookie by p3p.
+  // calculate expiry time of cookie.
   cookieAttributes.isSession = GetExpiry(cookieAttributes, aServerTime,
-                                         currentTimeInUsec / PR_USEC_PER_SEC, aStatus);
+                                         currentTimeInUsec / PR_USEC_PER_SEC);
 
-  CheckAndAdd(aHostURI, aChannel, cookieAttributes,
-              aStatus, aPolicy, savedCookieHeader);
+  CheckAndAdd(aHostURI, aChannel, cookieAttributes, savedCookieHeader);
 
   return newCookie;
 }
 
 void
 nsCookieService::CheckAndAdd(nsIURI               *aHostURI,
                              nsIChannel           *aChannel,
                              nsCookieAttributes   &aAttributes,
-                             nsCookieStatus        aStatus,
-                             const nsCookiePolicy  aPolicy,
                              const nsAFlatCString &aCookieHeader)
 {
   // reject cookie if it's over the size limit, per RFC2109
   if ((aAttributes.name.Length() + aAttributes.value.Length()) > kMaxBytesPerCookie) {
     COOKIE_LOGFAILURE(SET_COOKIE, aHostURI, aCookieHeader, "cookie too big (> 4kb)");
     return;
   }
 
@@ -1396,19 +1346,17 @@ nsCookieService::CheckAndAdd(nsIURI     
     nsCookie::Create(aAttributes.name,
                      aAttributes.value,
                      aAttributes.host,
                      aAttributes.path,
                      aAttributes.expiryTime,
                      aAttributes.creationID,
                      aAttributes.isSession,
                      aAttributes.isSecure,
-                     aAttributes.isHttpOnly,
-                     aStatus,
-                     aPolicy);
+                     aAttributes.isHttpOnly);
   if (!cookie) {
     return;
   }
 
   // check permissions from site permission list, or ask the user,
   // to determine if we can set the cookie
   if (mPermissionService) {
     PRBool permission;
@@ -1872,37 +1820,31 @@ nsCookieService::IsForeign(nsIURI *aHost
     return !IsInDomain(Substring(firstHost, dot1, firstHost.Length() - dot1), currentHost);
   }
 
   // don't have enough dots to chop firstHost, or the subdomain levels differ;
   // so we just do the plain old check, IsInDomain(firstHost, currentHost).
   return !IsInDomain(NS_LITERAL_CSTRING(".") + firstHost, currentHost);
 }
 
-nsCookieStatus
+PRUint32
 nsCookieService::CheckPrefs(nsIURI         *aHostURI,
                             nsIURI         *aFirstURI,
                             nsIChannel     *aChannel,
-                            const char     *aCookieHeader,
-                            nsCookiePolicy &aPolicy)
+                            const char     *aCookieHeader)
 {
   // pref tree:
   // 0) get the scheme strings from the two URI's
   // 1) disallow ftp
   // 2) disallow mailnews, if pref set
   // 3) perform a permissionlist lookup to see if an entry exists for this host
   //    (a match here will override defaults in 4)
   // 4) go through enumerated permissions to see which one we have:
   // -> cookies disabled: return
   // -> dontacceptforeign: check if cookie is foreign
-  // -> p3p: check p3p cookie data
-
-  // we've extended the "nsCookieStatus" type to be used for all cases now
-  // (used to be only for p3p), so beware that its interpretation is not p3p-
-  // specific anymore.
 
   // first, get the URI scheme for further use
   // if GetScheme fails on aHostURI, reject; aFirstURI is optional, so failing is ok
   nsCAutoString currentURIScheme, firstURIScheme;
   nsresult rv, rv2 = NS_OK;
   rv = aHostURI->GetScheme(currentURIScheme);
   if (aFirstURI) {
     rv2 = aFirstURI->GetScheme(firstURIScheme);
@@ -1924,67 +1866,44 @@ nsCookieService::CheckPrefs(nsIURI      
     nsCookieAccess access;
     rv = mPermissionService->CanAccess(aHostURI, aFirstURI, aChannel, &access);
 
     // if we found an entry, use it
     if (NS_SUCCEEDED(rv)) {
       switch (access) {
       case nsICookiePermission::ACCESS_DENY:
         COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "cookies are blocked for this site");
-        return nsICookie::STATUS_REJECTED;
+        return STATUS_REJECTED;
 
       case nsICookiePermission::ACCESS_ALLOW:
-        return nsICookie::STATUS_ACCEPTED;
+        return STATUS_ACCEPTED;
       }
     }
   }
 
   // check default prefs - go thru enumerated permissions
   if (mCookiesPermissions == BEHAVIOR_REJECT) {
     COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "cookies are disabled");
-    return nsICookie::STATUS_REJECTED;
+    return STATUS_REJECTED;
 
   } else if (mCookiesPermissions == BEHAVIOR_REJECTFOREIGN) {
     // check if cookie is foreign.
     // if aFirstURI is null, allow by default
 
     // note: this can be circumvented if we have http redirects within html,
     // since the documentURI attribute isn't always correctly
     // passed to the redirected channels. (or isn't correctly set in the first place)
     if (IsForeign(aHostURI, aFirstURI)) {
       COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "originating server test failed");
-      return nsICookie::STATUS_REJECTED;
+      return STATUS_REJECTED;
     }
-
-  } else if (mCookiesPermissions == BEHAVIOR_P3P) {
-    // check to see if P3P conditions are satisfied. see nsICookie.idl for
-    // P3P-related constants.
-
-    nsCookieStatus p3pStatus = nsICookie::STATUS_UNKNOWN;
-
-    nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
-
-    // lazily init the P3P service
-    if (!mP3PService)
-      mP3PService = do_GetService(NS_COOKIECONSENT_CONTRACTID);
-
-    if (mP3PService) {
-      // get the site policy and a status decision for the cookie
-      PRBool isForeign = IsForeign(aHostURI, aFirstURI);
-      mP3PService->GetConsent(aHostURI, httpChannel, isForeign, &aPolicy, &p3pStatus);
-    }
-
-    if (p3pStatus == nsICookie::STATUS_REJECTED) {
-      COOKIE_LOGFAILURE(aCookieHeader ? SET_COOKIE : GET_COOKIE, aHostURI, aCookieHeader, "P3P test failed");
-    }
-    return p3pStatus;
   }
 
   // if nothing has complained, accept cookie
-  return nsICookie::STATUS_ACCEPTED;
+  return STATUS_ACCEPTED;
 }
 
 // processes domain attribute, and returns PR_TRUE if host has permission to set for this domain.
 PRBool
 nsCookieService::CheckDomain(nsCookieAttributes &aCookieAttributes,
                              nsIURI             *aHostURI)
 {
   // get host from aHostURI
@@ -2095,18 +2014,17 @@ nsCookieService::CheckPath(nsCookieAttri
     return PR_FALSE;
 
   return PR_TRUE;
 }
 
 PRBool
 nsCookieService::GetExpiry(nsCookieAttributes &aCookieAttributes,
                            PRInt64             aServerTime,
-                           PRInt64             aCurrentTime,
-                           nsCookieStatus      aStatus)
+                           PRInt64             aCurrentTime)
 {
   /* Determine when the cookie should expire. This is done by taking the difference between 
    * the server time and the time the server wants the cookie to expire, and adding that 
    * difference to the client time. This localizes the client time regardless of whether or
    * not the TZ environment variable was set on the client.
    *
    * Note: We need to consider accounting for network lag here, per RFC.
    */
@@ -2143,21 +2061,17 @@ nsCookieService::GetExpiry(nsCookieAttri
   } else {
     return PR_TRUE;
   }
 
   // if this addition overflows, expiryTime will be less than currentTime
   // and the cookie will be expired - that's okay.
   aCookieAttributes.expiryTime = aCurrentTime + delta;
 
-  // we need to return whether the cookie is a session cookie or not:
-  // the cookie may have been previously downgraded by p3p prefs,
-  // so we take that into account here. only applies to non-expired cookies.
-  return aStatus == nsICookie::STATUS_DOWNGRADED &&
-         aCookieAttributes.expiryTime > aCurrentTime;
+  return PR_FALSE;
 }
 
 /******************************************************************************
  * nsCookieService impl:
  * private cookielist management functions
  ******************************************************************************/
 
 void
--- a/netwerk/cookie/src/nsCookieService.h
+++ b/netwerk/cookie/src/nsCookieService.h
@@ -52,17 +52,16 @@
 
 struct nsCookieAttributes;
 struct nsListIter;
 struct nsEnumerationData;
 
 class nsAutoVoidArray;
 
 class nsIPrefBranch;
-class nsICookieConsent;
 class nsICookiePermission;
 class nsIPrefBranch;
 class nsIObserverService;
 class nsIURI;
 class nsIChannel;
 class mozIStorageConnection;
 class mozIStorageStatement;
 
@@ -167,54 +166,52 @@ class nsCookieService : public nsICookie
   protected:
     void                          PrefChanged(nsIPrefBranch *aPrefBranch);
     nsresult                      InitDB();
     nsresult                      CreateTable();
     nsresult                      ImportCookies();
     nsresult                      Read();
     void                          GetCookieList(nsIURI *aHostURI, nsIURI *aFirstURI, nsIChannel *aChannel, const nsACString *aName, PRBool isHttpBound, nsAutoVoidArray &aResult);
     char*                         CookieStringFromArray(const nsAutoVoidArray& aCookieList, nsIURI *aHostURI);
-    PRBool                        SetCookieInternal(nsIURI *aHostURI, nsIChannel *aChannel, nsDependentCString &aCookieHeader, PRInt64 aServerTime, nsCookieStatus aStatus, nsCookiePolicy aPolicy);
-    void                          CheckAndAdd(nsIURI *aHostURI, nsIChannel *aChannel, nsCookieAttributes &aAttributes, nsCookieStatus aStatus, nsCookiePolicy aPolicy, const nsAFlatCString &aCookieHeader);
+    PRBool                        SetCookieInternal(nsIURI *aHostURI, nsIChannel *aChannel, nsDependentCString &aCookieHeader, PRInt64 aServerTime);
+    void                          CheckAndAdd(nsIURI *aHostURI, nsIChannel *aChannel, nsCookieAttributes &aAttributes, const nsAFlatCString &aCookieHeader);
     void                          AddInternal(nsCookie *aCookie, PRInt64 aCurrentTime, nsIURI *aHostURI, const char *aCookieHeader);
     void                          RemoveCookieFromList(nsListIter &aIter);
     PRBool                        AddCookieToList(nsCookie *aCookie, PRBool aWriteToDB = PR_TRUE);
     static PRBool                 GetTokenValue(nsASingleFragmentCString::const_char_iterator &aIter, nsASingleFragmentCString::const_char_iterator &aEndIter, nsDependentCSubstring &aTokenString, nsDependentCSubstring &aTokenValue, PRBool &aEqualsFound);
     static PRBool                 ParseAttributes(nsDependentCString &aCookieHeader, nsCookieAttributes &aCookie);
     static PRBool                 IsIPAddress(const nsAFlatCString &aHost);
     static PRBool                 IsInDomain(const nsACString &aDomain, const nsACString &aHost, PRBool aIsDomain = PR_TRUE);
     static PRBool                 IsForeign(nsIURI *aHostURI, nsIURI *aFirstURI);
-    nsCookieStatus                CheckPrefs(nsIURI *aHostURI, nsIURI *aFirstURI, nsIChannel *aChannel, const char *aCookieHeader, nsCookiePolicy &aPolicy);
+    PRUint32                      CheckPrefs(nsIURI *aHostURI, nsIURI *aFirstURI, nsIChannel *aChannel, const char *aCookieHeader);
     static PRBool                 CheckDomain(nsCookieAttributes &aCookie, nsIURI *aHostURI);
     static PRBool                 CheckPath(nsCookieAttributes &aCookie, nsIURI *aHostURI);
-    static PRBool                 GetExpiry(nsCookieAttributes &aCookie, PRInt64 aServerTime, PRInt64 aCurrentTime, nsCookieStatus aStatus);
+    static PRBool                 GetExpiry(nsCookieAttributes &aCookie, PRInt64 aServerTime, PRInt64 aCurrentTime);
     void                          RemoveAllFromMemory();
     void                          RemoveExpiredCookies(PRInt64 aCurrentTime);
     PRBool                        FindCookie(const nsAFlatCString &aHost, const nsAFlatCString &aName, const nsAFlatCString &aPath, nsListIter &aIter);
     void                          FindOldestCookie(nsEnumerationData &aData);
     PRUint32                      CountCookiesFromHostInternal(const nsACString &aHost, nsEnumerationData &aData);
     void                          NotifyRejected(nsIURI *aHostURI);
     void                          NotifyChanged(nsICookie2 *aCookie, const PRUnichar *aData);
 
   protected:
     // cached members
     nsCOMPtr<mozIStorageConnection> mDBConn;
     nsCOMPtr<mozIStorageStatement> mStmtInsert;
     nsCOMPtr<mozIStorageStatement> mStmtDelete;
     nsCOMPtr<nsIObserverService>  mObserverService;
-    nsCOMPtr<nsICookieConsent>    mP3PService;
     nsCOMPtr<nsICookiePermission> mPermissionService;
 
     // impl members
     nsTHashtable<nsCookieEntry>   mHostTable;
     PRUint32                      mCookieCount;
-    PRPackedBool                  mCookieIconVisible;
 
     // cached prefs
-    PRUint8                       mCookiesPermissions;   // BEHAVIOR_{ACCEPT, REJECTFOREIGN, REJECT, P3P}
+    PRUint8                       mCookiesPermissions;   // BEHAVIOR_{ACCEPT, REJECTFOREIGN, REJECT}
     PRUint16                      mMaxNumberOfCookies;
     PRUint16                      mMaxCookiesPerHost;
 
     // private static member, used to cache a ptr to nsCookieService,
     // so we can make nsCookieService a singleton xpcom object.
     static nsCookieService        *gCookieService;
 
     // this callback needs access to member functions