Bug 43793 - Date("") should be an invalid date time
Summary: Date("") should be an invalid date time
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-10 08:09 PDT by Leo Yang
Modified: 2010-08-11 17:31 PDT (History)
2 users (show)

See Also:


Attachments
Patch (3.56 KB, patch)
2010-08-10 08:21 PDT, Leo Yang
ggaren: review-
Details | Formatted Diff | Diff
Patch - fix commit message and comments (3.83 KB, patch)
2010-08-11 07:28 PDT, Leo Yang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Yang 2010-08-10 08:09:45 PDT
Date("") should be an invalid date time. isNaN(new Date("")) should return true.
Comment 1 Leo Yang 2010-08-10 08:21:13 PDT
Created attachment 64013 [details]
Patch
Comment 2 Geoffrey Garen 2010-08-10 10:48:36 PDT
Comment on attachment 64013 [details]
Patch

Why should new Date("") be NaN? Can you point to a part of a spec, or the behavior of another browser? As a general rule, it's better for your ChangeLog to explain the why, rather than the what.

>      cachedDateString = UString();
> +    cachedDateStringValue = NaN;

Can you explain why you needed to make this change?

UString() should not be == to UString(""). If it is, I think we have another bug to solve.
Comment 3 Leo Yang 2010-08-10 11:09:35 PDT
(In reply to comment #2)
> (From update of attachment 64013 [details])
> Why should new Date("") be NaN? Can you point to a part of a spec, or the behavior of another browser? As a general rule, it's better for your ChangeLog to explain the why, rather than the what.
For IE and FireFox, new Date("") is NaN.

> 
> >      cachedDateString = UString();
> > +    cachedDateStringValue = NaN;
> 
> Can you explain why you needed to make this change?
There isn't initial value for cachedDateStringValue. Do we depend on the first assignment when Date cache is hit? After we call restDateCache(), we leave cachedDateStringValue and reset cachedDateString, it's not consistent.

> 
> UString() should not be == to UString(""). If it is, I think we have another bug to solve.
Yes, I don't know why UString() == UString(""). This also need to be fixed.
Comment 4 Leo Yang 2010-08-11 07:28:37 PDT
Created attachment 64112 [details]
Patch - fix commit message and comments
Comment 5 Geoffrey Garen 2010-08-11 12:16:45 PDT
Comment on attachment 64112 [details]
Patch - fix commit message and comments

r=me
Comment 6 WebKit Commit Bot 2010-08-11 17:31:35 PDT
Comment on attachment 64112 [details]
Patch - fix commit message and comments

Clearing flags on attachment: 64112

Committed r65201: <http://trac.webkit.org/changeset/65201>
Comment 7 WebKit Commit Bot 2010-08-11 17:31:39 PDT
All reviewed patches have been landed.  Closing bug.