[TIMOB-10213] TiAPI: Ti.Locale.getString() and L() accept arbitrary functions
| GitHub Issue | n/a |
| Type | Bug |
| Priority | Low |
| Status | Closed |
| Resolution | Won't Fix |
| Resolution Date | 2017-07-26T02:58:42.000+0000 |
| Affected Version/s | Release 2.1.0 |
| Fix Version/s | n/a |
| Components | TiAPI |
| Labels | api |
| Reporter | Tim Poulsen |
| Assignee | Eric Merriman |
| Created | 2012-07-27T11:57:48.000+0000 |
| Updated | 2017-07-26T02:58:42.000+0000 |
Description
Expected result
Ti.Locale.getString() and it's alias L() shouldn't accept a function as an argument. Both should throw an error is one is supplied.
Actual result
You can pass arbitrary functions, for example:
Ti.Locale.getString(alert('foo')) <- shows the alert box
Ti.Locale.getString(console.log('foo')) <- logs to the console
Comments
JSON Source
A bit more explicit test case:
var lbl = Ti.UI.createLabel({ text: Ti.Locale.getString(console.log('foo')) }); win.add(lbl);Closing due to inactivity. If this issue still exists, please raise a new ticket.