polish the nsICookieManager2::Add interface a tad.

b=222343, r=danm, sr=darin.
This commit is contained in:
dwitte%stanford.edu 2003-10-30 02:50:11 +00:00
Родитель c7754ba02e
Коммит b6f814cb06
3 изменённых файлов: 22 добавлений и 10 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -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<nsCookie> 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) {