{ "id": "63848", "key": "TIMOB-3216", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11257", "description": "", "name": "Sprint-2011-09", "archived": true, "released": true, "releaseDate": "2011-03-07" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T02:01:12.000+0000", "created": "2011-04-15T03:39:41.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "feature", "release-1.7.0", "reported-1.6.0", "rplist" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T02:01:12.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

Problem

\n

Object.keys and for X in Y should work for proxy objects. Right\nnow you can't do for (var n in Ti.UI.createWindow({ left: 0, right:\n0 }) {}, for example.

\n

Example App

\n
\nvar win = Ti.UI.createWindow({ backgroundColor: '#fff', title: 'Test' });\nwin.color = '#444';\nvar label = Ti.UI.createLabel({ left: 20, right: 20 });\nwin.add(label);\nwin.open();\n\nlabel.text = '';\nfor (var n in win) {\n    label.text += n + ': ' + win[n] + ',\\n';\n}\nif (label.text.length == 0) {\n    label.text = 'FAIL: We were not able to iterate over the properties of the proxy object using for-in!';\n}\n
\n

The label.text will contain a line for each property.

\n

Tested On

\n

Titanium SDK version: 1.7.0 (02/18/11 18:13 316c2c7)
\nBROKEN in iPhone Simulator 4.2
\nBROKEN on Android EPIC 4g Device 2.1

\n

Associated Helpdesk Ticket

\n

http://developer.appcelerator.com/helpdesk/view/75581

{html}", "attachment": [], "flagged": false, "summary": "Android: Expose Properties Dictionary", "creator": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "environment": null, "comment": { "comments": [ { "id": "130313", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [5d8c78a437289743b62125b34634862775fcff05])\ninitial support of for (x in proxy) and Object.keys(proxy).forEach\nin Android [#3216 state:fixed-in-qa\nmilestone:Sprint-2011-09]
\n\nhttps://github.com/appcelerator/titanium_mobile/commit/5d8c78a43728...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:42.000+0000", "updated": "2011-04-15T03:39:42.000+0000" }, { "id": "130314", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Updated to test both Object.keys and\nObject.getOwnPropertyNames:

\n
\n\nvar win = Ti.UI.createWindow({ backgroundColor: '#fff', title: 'Test' });\nvar label = Ti.UI.createLabel({ top: 20, left: 20, right: 20, text: '' });\nwin.add(label);\n\n\nfor (var n in win) {\n    label.text += n + ': ' + win[n] + ',\\n';\n}\nif (label.text.length == 0) {\n    label.text = 'FAIL: We were not able to iterate over the properties of the proxy object using for-in!';\n}\n\nvar label2 = Ti.UI.createLabel({ top: 20, left: 20, right: 20, text: ''});\nwin.add(label2);\n\nObject.keys(win).forEach(function(key) {\n    label2.text += key + ': ' + win[key]+ ',\\n';\n});\n\nif (label2.text.length == 0) {\n    label2.text = 'FAIL: We were not able to iterate over the properties of the proxy object using Object.keys(proxy).forEach!';\n}\n\nvar label3 = Ti.UI.createLabel({ top: 20, left: 20, right: 20, text: ''});\nwin.add(label3);\n\nObject.getOwnPropertyNames(win).forEach(function(key) {\n    label3.text += key + ', '\n});\n\nif (label3.text.length == 0) {\n    label3.text = 'FAIL: We were not able to iterate over the properties of the proxy object using Object.getOwnPropertyNames(proxy).forEach!';\n}\n\nwin.open();\n
{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:43.000+0000", "updated": "2011-04-15T03:39:43.000+0000" }, { "id": "130315", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Tested with Titanium SDK version: 1.7.0 (03/03/11 11:06 87a2113)\non
\nEmulator 2.1
\nGalaxy Tab 2.2

\n

Still broken on iPhone 4 OS 4.2.1 and Emulator

{html}", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:44.000+0000", "updated": "2011-04-15T03:39:44.000+0000" }, { "id": "130316", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Created #3299 to track the iOS side of this problem.\nMarking this one as resolved per Natalie's comment. Adding the\nrelease 1.7.0 tag back it got removed.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:44.000+0000", "updated": "2011-04-15T03:39:44.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }