{ "id": "164825", "key": "TIMOB-24196", "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": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-12-05T19:05:52.000+0000", "created": "2016-12-05T18:34:16.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "debugger", "ios", "jscore", "safari" ], "versions": [ { "id": "16980", "description": "New V8", "name": "Release 6.0.0", "archived": false, "released": true, "releaseDate": "2016-11-15" } ], "issuelinks": [], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2016-12-05T23:02:43.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "In TIMOB-23871, we introduced the ability to debug apps with Safari - this is great! While testing around it, I found out that adding event listeners throws an error in the Inspector (no visible error on the app). \r\n\r\nThe errors are caused by [this|https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/KrollObject.m#L1343] and [this|https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/KrollObject.m#L1359] line. They can be resolved by checking the value of {{jsEventHash}} beforehand (thanks [~cwilliams]!). ", "attachment": [ { "id": "60828", "filename": "debugger-safari.m4v", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-05T19:05:09.000+0000", "size": 6108271, "mimeType": "video/mp4" } ], "flagged": false, "summary": "iOS: Debugging app with Safari throws error when adding event-listeners", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "402571", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/8659", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2016-12-05T18:35:52.000+0000", "updated": "2016-12-05T18:35:52.000+0000" }, { "id": "402575", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "*To test this ticket*:\r\n\r\n1. Create a new app with {{appc new -p ios}} \r\n1a. Ensure you have the {{true}} property in your {{}} section of the tiapp.xml\r\n2. Paste the following code in your app:\r\n{code:javascript}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar btn1 = Ti.UI.createButton({\r\n title: 'Toggle event-listener #1',\r\n top: 40\r\n});\r\n\r\nbtn1.addEventListener('click', function() {\r\n alert('#1 works!');\r\n});\r\n\r\nvar btn2 = Ti.UI.createButton({\r\n title: 'Toggle event-listener #2',\r\n top: 120\r\n});\r\n\r\nbtn2.addEventListener('click', myHandler);\r\n\r\nwin.add(btn1);\r\nwin.add(btn2);\r\nwin.open();\r\n\r\nfunction myHandler() {\r\n alert('#2 works!');\r\n}\r\n{code}\r\n3. Run the app in the iOS Simulator\r\n4. Open Safari and select the app by navigating to {{Develop > Simulator > JSContext}}. If the menu is not there, enable it in {{Settings > Advanced > \"Enable Develop menu in menu bar\"}}.\r\n5. Set a breakpoint to both event listeners\r\n6. Click both event listeners\r\n\r\n*Expected behavior*: The breakpoints are hit, the app doesn't crash and the Safari console does not throw any error.\r\n\r\nPlease also see the attached video {{debugger-safari.m4v}} to see how I tested the PR. ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-12-05T19:03:41.000+0000", "updated": "2016-12-05T19:05:39.000+0000" }, { "id": "402586", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, the Debugger on Safari no longer shows an error on event listeners and breakpoints are able to be hit (tested with the code provided above).\r\n\r\n*Environement*\r\n{code:java}\r\nAppcelerator Command-Line Interface, version 6.0.0\r\nIOS 10.1\r\nIOS Simulator: iphone 7 plus \r\nSafari version: 10.0.1 (11602.2.14.0.7)\r\nOperating System Name: Mac OS X El Capitan\r\nOperating System Version: 10.11.6\r\nNode.js Version: 4.6.0\r\nnpm: 4.2.8\r\nTitanium CLI Version: 5.0.10\r\nTitanium SDK Version: 6.1.0.v20161204170304\r\nXcode: 8.0\r\nAppcelerator Studio: 4.8.0.201611121409\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-05T22:39:39.000+0000", "updated": "2016-12-05T22:39:39.000+0000" }, { "id": "402589", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Just realized didn't update the SDK Version build in the environement. ^\r\n{code:java}\r\nTitanium SDK Version: 6.1.0.v20161205110006\r\n{code}\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-12-05T23:02:43.000+0000", "updated": "2016-12-05T23:02:43.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }