Closed
Bug 98740
Opened 24 years ago
Closed 21 years ago
"expires=" date isn't extracted
Categories
(Core :: Networking: Cookies, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: apm, Assigned: morse)
References
()
Details
(Keywords: verifyme)
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)
BuildID: 2001080110
when setting cookie via document.cookie, passing ";expires=..." gives no effect
Reproducible: Always
Steps to Reproduce:
1. open HTML from below
2. click button
3. open cookie manager and select cookie dontShow...
Actual Results: expiration is set to the end of session
Expected Results: expiration date is 31st Dec 2001
<html>
<head>
<script language="Javascript">
var i = 0;
function fin()
{
alert(document.cookie);
document.cookie = "dontShowConfirm"+ i++ +"=true;expires=Friday, 31-Dec-
2038 23:59:59 GMT";
}
</script>
</head>
<body>
<form><input type=button name=bla value=click_it onclick="fin()"></form>
</body>
</html>
Comment 1•24 years ago
|
||
Browser, not engine --> Cookies
Assignee: rogerl → morse
Component: Javascript Engine → Cookies
QA Contact: pschwartau → tever
Comment 2•24 years ago
|
||
http://lxr.mozilla.org/seamonkey/source/content/html/document/src/nsHTMLDocument.cpp#1989
( nsHTMLDocument::SetCookie() )
is what gets called when the cookie attribute is set. This callss
nsCookieService::SetCookieString() which in turn calls COOKIE_SetCookieString()
(http://lxr.mozilla.org/seamonkey/source/extensions/cookie/nsCookies.cpp#1054).
This does no parsing and passes in a time to expire of "0" to
cookie_SetCookieString() which then should parse the cookie string for the date,
since time to expire is 0.
Artiom, could you attach an HTML/JS testcase that clearly demonstrates the
problem so this can be tested?
| Assignee | ||
Comment 3•24 years ago
|
||
That particular format, namely
31-Dec-2038 23:59:59 GMT
is not being accepted whereas the following format
Sat, 07 Sep 2002 23:26:30 GMT
is accepted.
The date string is decoded by the PR_ParseTimeString routine (see call in
http://lxr.mozilla.org/seamonkey/source/extensions/cookie/nsCookies.cpp#1486).
So the bug is in the NSPR code. Confirming and reassigning.
Zbarsky, why are you asking reporter for a testcase? His html code is clearly
posted in the description of this report.
Status: UNCONFIRMED → NEW
Component: Cookies → NSPR
Ever confirmed: true
Product: Browser → NSPR
| Assignee | ||
Comment 5•24 years ago
|
||
My error, it's not an nspr problem after all. Reassigning back to myself and
then I'll explain.
Assignee: wtc → morse
Component: NSPR → Cookies
Product: NSPR → Browser
QA Contact: wtc → tever
Comment 6•24 years ago
|
||
> Zbarsky, why are you asking reporter for a testcase?
Because I'm an idiot and missed the "alert(document.cookie)"? My apologies.
| Assignee | ||
Comment 7•24 years ago
|
||
Problem has nothing to do with the format but with the date itself. The date in
this exire string exceeds the maximum allowable date for a cookie. That's why
it was getting converted to a session cookie.
Reduce the year by 1 and you'll see that the code works fine.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → INVALID
REOPEN:
This code looks valid to me, and it WFM on mozilla 1.84a.
Status: RESOLVED → REOPENED
QA Contact: tever → benc
Resolution: INVALID → ---
Comment 10•21 years ago
|
||
WFM.
Status: REOPENED → RESOLVED
Closed: 24 years ago → 21 years ago
Keywords: verifyme
Resolution: --- → WORKSFORME
Summary: cookie expiration date isn't extracted → "expires=" date isn't extracted
You need to log in
before you can comment on or make changes to this bug.
Description
•