Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#15173 closed defect (wontfix)

dojo/cookie and NaN

Reported by: mm Owned by:
Priority: undecided Milestone: tbd
Component: General Version: 1.7.2
Keywords: Cc: Adam Peller
Blocked By: Blocking:

Description

dojo.cookie = function(/*String*/name, /*String?*/value, /*dojo.cookieProps?*/props)

what happens if you send NaN in props.expires ? RESULT: =-1; expires=Invalid Date

or other type than number ? =-1; expires=dog

what will happen in each browser when you try to set cookie with nonsence explire ?

Please try a bit safer code. Thank you.

Change History (2)

comment:1 Changed 8 years ago by bill

Cc: Adam Peller added
Resolution: wontfix
Status: newclosed

Dojo's policy is usually to not bloat our code with argument type checking, but rather to "fail early" so that apps can notice their mistake and fix it. Explicit argument type checking penalizes apps that use the API correctly (penalizes them by slowing down load time).

I'm cc'ing Adam since it seems like he did the most recent changes to dojo/cookie, but I'm going to close this for now as wontfix. He can reopen if he disagrees.

comment:2 Changed 8 years ago by mm

I understand the general strategy, however dojo is quite inconsistent in this as well. Specially dealing with isNumber checks. In this case maybe we are talking about one isNaN check.

But ok.

Note: See TracTickets for help on using tickets.