Bug 43793

Summary: Date("") should be an invalid date time
Product: WebKit Reporter: Leo Yang <leo.yang>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, staikos
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
ggaren: review-
Patch - fix commit message and comments none

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.