From b6f814cb06d5576b29d08491144e6f3fb34d2172 Mon Sep 17 00:00:00 2001 From: "dwitte%stanford.edu" Date: Thu, 30 Oct 2003 02:50:11 +0000 Subject: [PATCH] polish the nsICookieManager2::Add interface a tad. b=222343, r=danm, sr=darin. --- .../src/nsTridentPreferencesWin.cpp | 5 ++++- netwerk/cookie/public/nsICookieManager2.idl | 16 +++++++++++----- netwerk/cookie/src/nsCookieService.cpp | 11 +++++++---- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/extensions/tridentprofile/src/nsTridentPreferencesWin.cpp b/extensions/tridentprofile/src/nsTridentPreferencesWin.cpp index e0010ce8da33..57c209ef8453 100644 --- a/extensions/tridentprofile/src/nsTridentPreferencesWin.cpp +++ b/extensions/tridentprofile/src/nsTridentPreferencesWin.cpp @@ -49,6 +49,7 @@ #include "plstr.h" #include "prio.h" #include "prmem.h" +#include "prlong.h" #include "nsICookieManager2.h" #include "nsICookieService.h" #include "nsIFile.h" @@ -600,7 +601,9 @@ nsTridentPreferencesWin::CopyCookiesFromBuffer( nsDependentCString(path), nsDependentCString(name), nsDependentCString(value), - flagsValue & 0x1, expirationDate); + flagsValue & 0x1, + PR_FALSE, + PRInt64(expirationDate)); if (NS_FAILED(onerv)) { rv = onerv; break; diff --git a/netwerk/cookie/public/nsICookieManager2.idl b/netwerk/cookie/public/nsICookieManager2.idl index 8cade7b0151a..d3732bca9f70 100644 --- a/netwerk/cookie/public/nsICookieManager2.idl +++ b/netwerk/cookie/public/nsICookieManager2.idl @@ -51,7 +51,9 @@ interface nsICookieManager2 : nsICookieManager * method is something of a backdoor. * * @param aDomain - * the host or domain for which the cookie is set + * the host or domain for which the cookie is set. presence of a + * leading dot indicates a domain cookie; otherwise, the cookie + * is treated as a non-domain cookie. see RFC2109. * @param aPath * path within the domain for which the cookie is valid * @param aName @@ -59,9 +61,12 @@ interface nsICookieManager2 : nsICookieManager * @param aValue * cookie data * @param aSecure - * true if the cookie should be secure - * @param aExpires - * expiration date. 0 means none; a session cookie. + * true if the cookie should only be sent over a secure connection. + * @param aIsSession + * true if the cookie should exist for the current session only. + * @param aExpiry + * expiration date, in seconds since the epoch. only relevant if + * aIsSession is false. */ [noscript] void add(in AUTF8String aDomain, @@ -69,7 +74,8 @@ interface nsICookieManager2 : nsICookieManager in ACString aName, in ACString aValue, in boolean aSecure, - in PRInt32 aExpires); + in boolean aIsSession, + in PRInt64 aExpiry); /** * Find whether a matching cookie already exists, and how many cookies diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/src/nsCookieService.cpp index 42de40e7642c..392892b82dd5 100644 --- a/netwerk/cookie/src/nsCookieService.cpp +++ b/netwerk/cookie/src/nsCookieService.cpp @@ -922,15 +922,18 @@ nsCookieService::Add(const nsACString &aDomain, const nsACString &aPath, const nsACString &aName, const nsACString &aValue, - PRBool aIsSecure, - PRInt32 aExpires) + PRBool aIsSecure, + PRBool aIsSession, + PRInt64 aExpiry) { nsInt64 currentTime = NOW_IN_SECONDS; nsRefPtr cookie = new nsCookie(aName, aValue, aDomain, aPath, - nsInt64(aExpires), currentTime, - nsInt64(aExpires) == nsInt64(0), aIsSecure, + nsInt64(aExpiry), + currentTime, + aIsSession, + aIsSecure, nsICookie::STATUS_UNKNOWN, nsICookie::POLICY_UNKNOWN); if (!cookie) {