Closed Bug 826305 Opened 12 years ago Closed 12 years ago

.valueAsDate shouldn't set the value to the empty string if the passed value isn't a Date

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21
Tracking Status
firefox20 --- fixed
firefox21 --- fixed

People

(Reporter: mounir, Assigned: mounir)

References

Details

(Keywords: doc-bug-filed)

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) (deleted) — Splinter Review
It should set the value to the empty string if the passed value is null or a Date with NaN value. Otherwise, it should throw a TypeError, per WebIDL spec.
Attachment #697484 - Flags: review?(bzbarsky)
Depends on: 826302
Blocks: 769370
Attached patch Patch (deleted) — Splinter Review
(I forgot to refresh the patch...)
Assignee: nobody → mounir
Attachment #697484 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #697484 - Flags: review?(bzbarsky)
Attachment #697485 - Flags: review?(bzbarsky)
Keywords: dev-doc-needed
Comment on attachment 697485 [details] [diff] [review] Patch >+ if (aDate.isNull()) { isNullOrUndefined(), please. >+ ok(caught, "Setting " + value + " to .valueAsDate should throw"); Either s/Setting/Assigning/ or "setting .valueAsDate to " + value + " should throw". r=me with those nits.
Attachment #697485 - Flags: review?(bzbarsky) → review+
(In reply to Boris Zbarsky (:bz) from comment #2) > Comment on attachment 697485 [details] [diff] [review] > Patch > > >+ if (aDate.isNull()) { > > isNullOrUndefined(), please. The HTML specs say: "if the new value is null or a Date object representing the NaN time value, then set the value of the element to the empty string". As far as I understand it, that means "undefined" should be considered as a TypeError. Or did I missed something? I've added a test for this to make it clearer that undefined should throw.
> "if the new value is null That's the IDL value, not the JS value. Nullable IDL values turn both JS null and JS undefined into null IDL values. If you were actually using our WebIDL bindings, this would happen automatically before you ever got into this code. Specifically, see http://dev.w3.org/2006/webapi/WebIDL/#es-nullable-type step 3 under "An ECMAScript value V is converted to an IDL nullable type T? value (where T is the inner type) as follows".
Fixed. Thanks for the explanations :)
Flags: in-testsuite+
Target Milestone: --- → mozilla20
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: mozilla20 → mozilla21
Comment on attachment 697485 [details] [diff] [review] Patch [Approval Request Comment] Bug caused by (feature/regressing bug #): bug 769370 User impact if declined: adding a new feature with a known bug Testing completed (on m-c, etc.): m-c Risk to taking this patch (and alternatives if risky): low, we could introduce another bug in the feature by fixing that one but we have a pretty good test coverage String or UUID changes made by this patch: none
Attachment #697485 - Flags: approval-mozilla-aurora?
Comment on attachment 697485 [details] [diff] [review] Patch Low risk uplift for a new feature in Fx20.Approving on aurora.
Attachment #697485 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
See bug 866440 for documentation.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: