{ "id": "125573", "key": "TIMOB-16351", "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": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2018-01-03T02:39:51.000+0000", "created": "2014-01-29T11:47:38.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "andoid" ], "versions": [ { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "issuelinks": [ { "id": "34706", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "93290", "key": "TIMOB-9560", "fields": { "summary": "iOS: addEventListener via call()/apply() fails with exception", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "mchen", "key": "mchen", "displayName": "Maggie Chen", "active": true, "timeZone": "Asia/Singapore" }, "updated": "2018-01-03T02:39:51.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": "I'm using this widget https://github.com/hoyo/net.hoyohoyo.iconiclabel where they are getting reference of (https://github.com/hoyo/net.hoyohoyo.iconiclabel/blob/master/app/widgets/net.hoyohoyo.iconiclabel/controllers/widget.js) some list of functions / properties and export them. When I use addEventListener it crashes on Android but works fine on iOS.\r\n\r\nThis is similar to TIMOB-9560 but on Android.", "attachment": [], "flagged": false, "summary": "Android: addEventListener via call()/apply() fails with exception", "creator": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "subtasks": [], "reporter": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "environment": "Mac OSX 10.8.5\r\nTiSDK 3.2.0 GA\r\nAndroid Galaxy S3", "comment": { "comments": [ { "id": "290305", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~mano_mykingdom] I used the addEventListener method on Android Galaxy S3 and its not crashing. I am using the following test scenario's.\n\n{code}\nvar win = Ti.UI.createWindow({\n backgroundColor: '#fff'\n});\nvar al = win.addEventListener;\n \n// test 1\n//al.call(win, 'click', function(e) { alert('clicked window'); });\n \n// test 2\n//al.apply(win, ['click', function(e) { alert('clicked window'); }]);\n \n// test 3\n//Ti.UI.createWindow().addEventListener.call(win, 'click', function(e) { alert('clicked window'); });\n \n// test 4\n//Ti.UI.createWindow().addEventListener.apply(win, ['click', function(e) { alert('clicked window'); }]);\n \nwin.open();\n{code}\n\nIf you are doing something different, please attach a simple and runnable test case so that we can reproduce the issue.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-29T20:55:29.000+0000", "updated": "2014-01-29T20:55:29.000+0000" }, { "id": "290409", "author": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I'm using like this. It crashes on Android but fine with iOS.\n\n{code}\nvar win = Ti.UI.createWindow({\n backgroundColor: '#fff'\n});\nvar al = win.addEventListener;\nal('click', function(e) { alert('clicked window'); });\nwin.open();\n{code}", "updateAuthor": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-01-30T09:22:13.000+0000", "updated": "2014-01-30T09:22:13.000+0000" }, { "id": "290567", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving this ticket to engineering as I can reproduce the issue with the provided code. Note that this is a valid scenario as per ticket TIMOB-9560 and it works fine for iOS platform.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-31T03:58:30.000+0000", "updated": "2014-01-31T03:58:30.000+0000" }, { "id": "290586", "author": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Not only addEventListener but all the methods it seems. I tried the below one it works on iOS and fails on Android.\r\n\r\n{code}\r\nvar lbl = Ti.UI.createLabel({\r\n text: \"Appcelerator\",\r\n visible : false\r\n});\r\nvar visible = lbl.setVisible;\r\nvisible(true);\r\n{code}", "updateAuthor": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-01-31T05:37:03.000+0000", "updated": "2014-01-31T05:37:03.000+0000" }, { "id": "290587", "author": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "body": "There is a reason for this kind of use case, for example when I have a label / button in a widget and want to access the methods of that object from a controller where it is included. Have a look here https://github.com/hoyo/net.hoyohoyo.iconiclabel/blob/master/app/widgets/net.hoyohoyo.iconiclabel/controllers/widget.js at line no. 320", "updateAuthor": { "name": "mano_mykingdom", "key": "mano_mykingdom", "displayName": "Manojkumar Murugesan", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-01-31T05:42:54.000+0000", "updated": "2014-01-31T05:44:08.000+0000" }, { "id": "298776", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "I don't think this is a bug. Assigning lbl.setVisible to a variable will detach the method from the lbl and needs to be bound again before calling it. Something like\n var visible = lbl.setVisible;\n\tvar boundVisible = visible.bind(lbl);\n\tboundVisible(true);", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-03-26T14:02:17.000+0000", "updated": "2014-03-26T14:02:17.000+0000" }, { "id": "318751", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-14T21:31:58.000+0000", "updated": "2014-08-14T21:31:58.000+0000" }, { "id": "321840", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue reproduces\r\n\r\nTitanium SDK version 3.4.0 master, 3.2.0.GA\r\nTitanium Studio, build: 3.3.0.201407100905\r\nTitanium Command-Line Interface\r\nCLI version 3.3.0, \r\nAndroid device : Motorola Moto G, Android version : 4.4.4\r\n\r\niOS simulator : iPhone Retina (3.5-inch), iOS 7.0.3", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-04T16:45:54.000+0000", "updated": "2014-09-04T16:45:54.000+0000" }, { "id": "432618", "author": { "name": "mchen", "key": "mchen", "displayName": "Maggie Chen", "active": true, "timeZone": "Asia/Singapore" }, "body": "Unable to reproduce with the code as follows. The exception can be avoided through the following code:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\nvar al = win.addEventListener('click', function(e) { alert('clicked window'); });\r\nwin.open();\r\n{code}\r\n\r\nor\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\nvar al = win.addEventListener;\r\n\r\n// test 1\r\n//al.call(win, 'click', function(e) { alert('clicked window'); });\r\n\r\n// test 2\r\nal.apply(win, ['click', function(e) { alert('clicked window'); }]);\r\n\r\nwin.open();\r\n{code}\r\n", "updateAuthor": { "name": "mchen", "key": "mchen", "displayName": "Maggie Chen", "active": true, "timeZone": "Asia/Singapore" }, "created": "2018-01-02T07:50:20.000+0000", "updated": "2018-01-02T07:50:20.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }