Summary: | REGRESSION: JavaScript Date constructor won't accept another Date object | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | andrew | ||||||
Component: | JavaScriptCore | Assignee: | Darin Adler <darin> | ||||||
Status: | VERIFIED FIXED | ||||||||
Severity: | Normal | Keywords: | HasReduction, Regression | ||||||
Priority: | P1 | ||||||||
Version: | 420+ | ||||||||
Hardware: | Mac | ||||||||
OS: | OS X 10.4 | ||||||||
URL: | http://www.qantas.com.au/regions/dyn/home/qualifier-region-au | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 6908 | ||||||||
Attachments: |
|
Description
andrew
2006-01-27 02:29:47 PST
Confirmed, this one needs reduction. This is a regression. Works for me in Safari 2.0.3 (417.8) on 10.4.4. If it's a regression, it should be P1 :) This is broken in WebKit-CVS-2005-10-01 03-27-01 GMT.dmg, the very first nightly build available. It broke between the time WebKit was open-sourced and the date on the above nightly. Created attachment 6035 [details]
Test case v1
The Date object in JavaScript won't accept another Date object in a single-argument constructor: var d = new Date(new Date()); // Results in "Invalid Date" Works correctly in Firefox 1.5 and Safari 2.0.3 (417.8) on 10.4.4. I've got a fix. The Date constructor was not following the algorithm from the JavaScript specification properly. It was supposed to convert to a primitive, then check to see if the result is a string. Instead it was checking to see if the result was a string first. Created attachment 6060 [details]
patch to fix bug, including a test
Verified fix. Removing Regression keyword from bugs already fixed. Added back removed keywords. |