Closed
Bug 116598
Opened 23 years ago
Closed 22 years ago
document.lastModified doesn't show the "date" header if no "last-modified" header is sent
Categories
(Core :: DOM: Core & HTML, defect, P5)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla1.4beta
People
(Reporter: primorec, Unassigned)
References
()
Details
(Whiteboard: [HAVE FIX])
Attachments
(1 file, 1 obsolete file)
9.45 KB,
patch
|
caillon
:
review+
bzbarsky
:
superreview+
asa
:
approval1.4b+
|
Details | Diff | Splinter Review |
From Bugzilla Helper:
User-Agent: Mozilla/4.72 [en] (X11; U; Linux 2.2.14-5.0 i686)
BuildID: Mozilla 0.9.7
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7) Gecko/20011221
The following java script code is not interpreted correctly.
Mozilla 0.9.7 shows:
The document was last modified: January 1, 1970 GMT.
instead
The document was last modified: December 22, 2001 GMT.
MSIE shows:
The document was last modified: 12/22/01 10:03:33.
offending java script code:
<script language="javascript">
var lm = document.lastModified;
document.write("<BR>The document was last modified: <B>" +lm+ "</B>.")
</script>
Reproducible: Always
Steps to Reproduce:
1. click with mozilla 0.9.7 on this link
http://www.furlan.org/misc/tips_and_tricks/Sony_Vaio_PCG-FXA32/step_by_step_instructions.html
Actual Results: Date is not shown correctly
Expected Results: I should see the correct date
NS4.X on Linux has the same problem
Comment 1•23 years ago
|
||
document.lastModified is a DOM feature -- sending off to our DOM friends, please
triage as needed.
Assignee: rogerl → jst
Status: UNCONFIRMED → NEW
Component: Javascript Engine → DOM HTML
Ever confirmed: true
QA Contact: pschwartau → stummala
Summary: "document.lastModified" not correctly shown → "document.lastModified" not correctly shown
Comment 2•23 years ago
|
||
The reason document.lastModified is incorrect in this case is that the server
doesn't send the information (the "last-modified" HTTP header), so there's no
way for mozilla to know when the file was last modified. IE seems to use the
"date" header if the "last-modified" header isn't sent, mozilla could do that
too, but that's WRONG! That's not what document.lastModified should say. The
"date" header just contains the current date (AFAIK), which has nothing to do
with the last modified time.
What do other people think? I'm Futuring this for now, but if someone has a good
reason to make document.lastModified contain the value of the "date" header if
there's no "last-modified" header let me know and I'll "fix" this. I already
have a patch (will attach).
Severity: major → minor
OS: Linux → All
Hardware: PC → All
Summary: "document.lastModified" not correctly shown → document.lastModified doesn't show the "date" header if no "last-modified" header is sent
Target Milestone: --- → Future
Comment 3•23 years ago
|
||
Note that IE gives document.lastModified in this case in the local
timezone/locale, whereas this patch makes mozilla simply return the value of
the header which in this case contains the date in GMT.
Updated•23 years ago
|
Priority: -- → P5
Comment 4•23 years ago
|
||
The following URI says that the 'Date' header field is for the creation date of
the object OR the last modified date. Obviously it would be better to keep
these two things discrete, but if 'Last-Modified' is missing, I think it should be
assumed that 'Date' is the last modified date.
http://www.w3.org/Protocols/HTTP/Object_Headers.html#date
Updated•23 years ago
|
Attachment #62647 -
Attachment description: Make document.lastModified contain the "data" header if no "last-modified" header is sent. → Make document.lastModified contain the "date" header if no "last-modified" header is sent.
Reporter | ||
Comment 5•23 years ago
|
||
yes... that is the right way to go
Comment 6•23 years ago
|
||
With some difinition of "right", yeah :-)
Comment 7•22 years ago
|
||
Comment on attachment 62647 [details] [diff] [review]
Make document.lastModified contain the "date" header if no "last-modified" header is sent.
r=caillon
Attachment #62647 -
Flags: review+
Updated•22 years ago
|
Status: NEW → ASSIGNED
Whiteboard: [HAVE FIX]
Target Milestone: Future → mozilla1.2beta
Comment 8•22 years ago
|
||
Tghat URL actually says:
Creation date of object. (or last modified, and separately have a Created: field?)
Note the ? - this was obviously for a draft/white paper/etc
rfc2616 makes it clear that these are not the same - date-Age (if present) may
give you something closer, but if the last modified header isn't present, then
theres not much you can do about it.
Comment 9•22 years ago
|
||
OTOH, if IE does it....
I still think its wrong - we should just return null, or something.
Does IE do this for http/1.1 responses? Does it take the Age header into account?
http://www.xs4all.nl/~ppk/js/lastmod.html suggests that IE uses today's date,
while ns/opera use January 1 1970. IS this true (ie if the date string was from
yesterday) Is this just a different fallback string? (In which case I prefer our
one...)
Updated•22 years ago
|
Target Milestone: mozilla1.2beta → mozilla1.3alpha
Updated•22 years ago
|
Target Milestone: mozilla1.3alpha → mozilla1.3final
Comment 10•22 years ago
|
||
*** Bug 198205 has been marked as a duplicate of this bug. ***
Comment 12•22 years ago
|
||
What if the Date header value is used only when there is no Last-Modified header
AND there is no Content-Length header? It seem that just about every http
server sends a Content-Length except for CGI/dynamic content, and in the case of
CGI, using the Date header as the Last-Modified header seems appropriate.
But just about anything is better than "January 1, 1970 GMT". If the using the
Date header is wrong, how about using null, undefined, "unknown", or an empty
string?
Comment 13•22 years ago
|
||
Anyone have a problem with just reporting the date if no last-modified header is
returned? "January 1, 1970 GMT" just looks bad. This is for IE compatibility if
nothing else. I ran into this when someone wondered why we handled
http://webmaster.info.aol.com/ differently.
Comment 14•22 years ago
|
||
Bob, that sounds reasonable to me. Does IE use the date header, or does it just
return the current time, if so, in what timezone?
Comment 15•22 years ago
|
||
IE appears to return the current time. I set my calendar to 4/1/2003 and did a
wget on devedge.netscape.com (which doesn't have modified times)
HTTP/1.1 200 OK
Server: Netscape-Enterprise/6.0 AOL
Date: Fri, 25 Apr 2003 13:50:19 GMT
Vary: Accept-language
Content-type: text/html
Connection: close
javascript:document.lastModified gave in IE6
04/01/2003 09:51:19
Which is the date setting on my PC in my local timezone (Eastern)
Comment 16•22 years ago
|
||
This should make us compatible with IE.
Attachment #62647 -
Attachment is obsolete: true
Updated•22 years ago
|
Attachment #121740 -
Flags: superreview?(bzbarsky)
Attachment #121740 -
Flags: review?(caillon)
Updated•22 years ago
|
Attachment #121740 -
Flags: superreview?(bzbarsky) → superreview+
Updated•22 years ago
|
Attachment #121740 -
Flags: review?(caillon) → review+
Updated•22 years ago
|
Status: NEW → ASSIGNED
Target Milestone: mozilla1.3final → mozilla1.4beta
Comment 17•22 years ago
|
||
Comment on attachment 121740 [details] [diff] [review]
Make document.lastModified = now when no last-modified header is sent.
Requesting 1.4b approval, this matters for compatibility with IE, not a huge
issue, but should IMO be fixed.
Attachment #121740 -
Flags: approval1.4b?
Comment 18•22 years ago
|
||
Comment on attachment 121740 [details] [diff] [review]
Make document.lastModified = now when no last-modified header is sent.
a=asa (on behalf of drivers) for checkin to 1.4b
Attachment #121740 -
Flags: approval1.4b? → approval1.4b+
Comment 19•22 years ago
|
||
Fix checked in. FIXED.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in
before you can comment on or make changes to this bug.
Description
•