{ "id": "108055", "key": "TIMOB-12324", "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": [], "resolution": null, "resolutiondate": null, "created": "2013-01-17T15:47:50.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "ios", "qe-sdk3.0.2" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" }, { "id": "14164", "description": "Release 3.0.2", "name": "Release 3.0.2", "archived": true, "released": true, "releaseDate": "2013-02-19" } ], "issuelinks": [ { "id": "24643", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "99061", "key": "TIMOB-10412", "fields": { "summary": "MobileWeb: inject RTE for addEventListener call with null or undefined callback argument", "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": "Low", "id": "4" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": null, "updated": "2018-02-28T20:03:44.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "iOS: improve RTE for addEventListener with one arg.\r\n\r\nIf only one arg is passed to addEventListener, the iOS RTE does not indicate the nature of the problem:\r\n\r\n{code}\r\n[ERROR] : \b\b \bScript Error = *** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0] at app.js (line 100).\r\n{code}\r\n\r\nTest Code:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\n\r\nwin.addEventListener(function(){\r\n\tTi.API.error('SESSION ID: ' + Ti.App.sessionId);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nThe Android Error message is informative:\r\n\r\n{code}\r\n[ERROR][TiExceptionHandler( 310)] (main) [682,2923] ----- Titanium Javascript Runtime Error -----\r\n[ERROR][TiExceptionHandler( 310)] (main) [0,2923] - In ti:/events.js:138,10\r\n[ERROR][TiExceptionHandler( 310)] (main) [0,2923] - Message: Uncaught Error: addListener only takes instances of Function. The listener for event \"function (){}\" is \"undefined\"\r\n[ERROR][TiExceptionHandler( 310)] (main) [1,2924] - Source: \t\t\tthrow new Error('addListener only takes instances of Function. The listener\r\n[ERROR][V8Exception( 310)] Exception occurred at ti:/events.js:138: Uncaught Error: addListener only takes instances of Function. The listener for event \"function (){}\" is \"undefined\"\r\n{code}\r\n\r\nThe iOS Error message for an undefined callback is informative:\r\n\r\n{code}\r\n[ERROR] : \b\b \bInvalid type passed to function. expected: KrollCallback, was: (null) in -[TiProxy addEventListener:] (TiProxy.m:798)\r\n[ERROR] : \b\b \bScript Error = Invalid type passed to function. expected: KrollCallback, was: (null) in -[TiProxy addEventListener:] (TiProxy.m:798) at app.js (line 115).\r\n{code}\r\n\r\nUndefined callback test code:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\n\r\nwin.addEventListener();\r\n\r\nwin.open();\r\n{code}\r\n\r\nMobileWeb has no RTE: TIMOB-10412\r\n\r\nSteps to Reproduce:\r\n\r\n1. Run code:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow();\r\n\r\nwin.addEventListener(function(){\r\n\tTi.API.error('SESSION ID: ' + Ti.App.sessionId);\r\n});\r\n\r\nwin.open();\r\n{code}\r\n\r\nActual Result:\r\n\r\nIndex out of bounds runtime error.\r\n\r\nExpected Result:\r\n\r\nRTE indicating wrong number of args, or unexpected arg type.", "attachment": [], "flagged": false, "summary": "iOS: improve RTE for addEventListener with one arg", "creator": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "OS: Mountain Lion 10.8.2\r\nXcode: 4.5.2\r\niTunes: 11.0.1\r\n\r\nTitanium SDK: 3.0.0.GA, 3.0.2.v20130117100201\r\nTitanium CLI: 3.0.22\r\nTitanium Studio: 3.0.2.201301162143\r\n\r\nDevices: iPhone Simulator 6.0", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }