Closed
Bug 826302
Opened 12 years ago
Closed 12 years ago
.valueAsDate should throw TypeError if passed something else than a Date
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: mounir, Assigned: mounir)
References
Details
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Updated•12 years ago
|
Comment 1•12 years ago
|
||
Is this fixed now that bug 742206 landed?
Assignee | ||
Comment 2•12 years ago
|
||
Yes. Though I would like a test in content/html/content/test/forms/test_valueasdate_attribute.html before fixing the bug.
Assignee | ||
Comment 3•12 years ago
|
||
The basic idea was already tested, we only need to test the error name ;)
Comment 4•12 years ago
|
||
Comment on attachment 745233 [details] [diff] [review]
Test
r=me
Do we need a followup bug on these bits:
354 // TODO: check the Date object value (UTCFullYear, UTCMonth and UTCDate)
355 // when .valueAsDate will stop returning null.
Attachment #745233 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 5•12 years ago
|
||
Let's do that here so we don't waste time with administrative overhead.
Attachment #745233 -
Attachment is obsolete: true
Attachment #747403 -
Flags: review?(bzbarsky)
Comment 6•12 years ago
|
||
Comment on attachment 747403 [details] [diff] [review]
Test
>+ is(element.valueAsDate.getUTCFullYear.toString(),
>+ Date.prototype.getUTCFullYear.toString(), "prototype is the same");
Why the toString bits for the methods?
>+ is(element.valueAsDate.toString(), witnessDate.toString(), "correct Date");
And here?
Updated•12 years ago
|
Flags: needinfo?(mounir)
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #6)
> Comment on attachment 747403 [details] [diff] [review]
> Test
>
> >+ is(element.valueAsDate.getUTCFullYear.toString(),
> >+ Date.prototype.getUTCFullYear.toString(), "prototype is the same");
>
> Why the toString bits for the methods?
This is indeed not needed.
> >+ is(element.valueAsDate.toString(), witnessDate.toString(), "correct Date");
>
> And here?
.valueAsDate and witnessDate do not return the same object. .toString() is a simple way to check that those objects have the same value. I do not know if the objects are supposed to be seen equals when they have the same value even if they are not the same but it is possible that Mochitests have special path in is() for objects to check that they are the same instance.
Flags: needinfo?(mounir)
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #747403 -
Attachment is obsolete: true
Attachment #747403 -
Flags: review?(bzbarsky)
Attachment #747962 -
Flags: review?(bzbarsky)
Comment 9•12 years ago
|
||
Comment on attachment 747962 [details] [diff] [review]
Test
Oh, I see. I'd prefer we use valueOf() there, not toString(), then.
r=me with that.
Attachment #747962 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 10•12 years ago
|
||
Flags: in-testsuite+
Target Milestone: --- → mozilla24
Comment 11•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•