{ "id": "82879", "key": "TIMOB-6231", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-02-10T00:26:40.000+0000", "created": "2011-11-17T23:39:02.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "parity" ], "versions": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "12570", "name": "Release 1.7.5", "archived": true, "released": true, "releaseDate": "2011-11-02" }, { "id": "12571", "description": "CI for 1_7_X", "name": "Release 1.7.6", "archived": true, "released": false }, { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" } ], "issuelinks": [], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-02-10T00:26:40.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": "This is related to the customer issue reported in TIMOB-1662. In trying to describe the behavior of Ti.include to resolve the related doc bug, TIMOB-4108, I came across the following parity issue: Ti.include works correctly when called from an event handler on iOS, but not on Android. Consider the following code:\r\n\r\n{{app.js}}:\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({\r\n title:'Window 1',\r\n backgroundColor:'blue',\r\n fullscreen:false\r\n});\r\n\r\nwin1.open();\r\n\r\n\r\n\r\nvar testVar1 = \"I can see the global context.\";\r\n\r\nvar testMe = function(){\r\n Ti.API.info(\"In the function\");\r\n Ti.include('include_test2.js');\r\n\r\n Ti.API.info(\"testVar2 defined in include_test2.js and output in app.js: \" + testVar2);\r\n};\r\n\r\ntestMe();\r\nwin1.addEventListener('click', function()\r\n{\r\n\tTi.API.info(\"In the event handler\");\r\n\ttestMe();\r\n});\r\nwin1.fireEvent('click', {});\r\n{code}\r\n\r\nAnd the include file, {{include_test2.js}}:\r\n\r\n{code}\r\nvar testVar2 = \"Variable defined in the include file.\";\r\nTi.API.info(\"In the include file.\")\r\nTi.API.info(\"testVar1: \" + testVar1);\r\n{code}\r\n\r\nOn iOS, whether the testMe function is called directly or from inside the event handler, the include file can access the global context. On Android, though, it succeeds when the function is called directly, and fails with a reference error when called from the event handler.\r\n\r\nh3.Attached new test case (whole small runnable project).\r\n\r\nh3.Reproducible Steps\r\n1. Press \"Click button\"", "attachment": [ { "id": "24540", "filename": "namespace2.zip", "author": { "name": "kpomaski", "key": "kpomaski", "displayName": "Karol Pomaski", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-12-09T12:07:28.000+0000", "size": 2321943, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: Ti.include doesn't work correctly in event handler", "creator": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "178777", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can not reproduce with the latest master.", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-10T15:27:30.000+0000", "updated": "2012-01-10T15:27:30.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }