Closed Bug 346363 Opened 20 years ago Closed 20 years ago

setFullYear() (with no arguments) seems to clobber a Date object

Categories

(Core :: JavaScript Engine, defect)

x86
All
defect
Not set
minor

Tracking

()

VERIFIED FIXED

People

(Reporter: ispiked, Assigned: feng.qian.moz)

Details

(Keywords: testcase, verified1.8.1)

Attachments

(2 files, 1 obsolete file)

On 1.5, 1.8, and trunk. Steps to reproduce: 1. ./run-mozilla.sh ./xpcshell 2. js> var d = new Date() js> var foo = new Date() js> foo.setFullYear() NaN js> foo.setFullYear(2006) NaN js> foo.getFullYear() NaN Results: Calling setFullYear() without any arguments on a Date object seems to clobber it, not allowing it to be modified anymore. Expected results: setFullYear(2006) should be able to set the full year of the Date object.
Attached file regression testcase (obsolete) —
Figured I'd have a go at making a regression testcase for this.
Attachment #231169 - Attachment is obsolete: true
(In reply to comment #2) > Created an attachment (id=231171) [edit] > regression testcase (corrected) Looks good on a quick glance. Lets see what the masters of javascript say before we go further.
Attached patch patch Splinter Review
It seems someone typed wrong varaible name. The comment says that if it should be setting Year if maxargs is 3. I verified with the first test case, it should work correctly.
Attachment #231184 - Flags: review?(mrbkap)
Status: NEW → ASSIGNED
Assignee: general → feng.qian.moz
Status: ASSIGNED → NEW
Keywords: testcase
Attachment #231184 - Flags: review?(mrbkap) → review+
Fix checked into trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Checking in regress-346363.js; /cvsroot/mozilla/js/tests/js1_5/Date/regress-346363.js,v <-- regress-346363.js initial revision: 1.1
Flags: in-testsuite+
verified fixed 1.9 _but not 1.8_ window/mac(ppc|tel)/linux 20060803.
Status: RESOLVED → VERIFIED
OS: Linux → All
Version: 1.8 Branch → Trunk
Attachment #231184 - Flags: approval1.8.1?
Comment on attachment 231184 [details] [diff] [review] patch a=schrep
Attachment #231184 - Flags: approval1.8.1? → approval1.8.1+
This is _not_ fixed on 1.8 and is at risk of missing Firefox 2. Please check this in to MOZILLA_1_8_BRANCH and add the fixed1.8.1 keyword when you have done so.
Whiteboard: [at risk]
Fixed on the 1.8 branch.
Keywords: fixed1.8.1
verified fixed 1.8.1 20060811 windows/mac(ppc|tel)/linux
Whiteboard: [at risk]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: