Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10213] TiAPI: Ti.Locale.getString() and L() accept arbitrary functions

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2017-07-26T02:58:42.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsTiAPI
Labelsapi
ReporterTim Poulsen
AssigneeEric Merriman
Created2012-07-27T11:57:48.000+0000
Updated2017-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

  1. Tim Poulsen 2012-07-27

    A bit more explicit test case:
       var lbl = Ti.UI.createLabel({
         text: Ti.Locale.getString(console.log('foo'))
       });
       win.add(lbl);
       
  2. Lee Morris 2017-07-26

    Closing due to inactivity. If this issue still exists, please raise a new ticket.

JSON Source