{ "id": "99061", "key": "TIMOB-10412", "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": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-06-26T22:15:22.000+0000", "created": "2012-08-12T17:38:09.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "mobileweb", "qe-sdk3.0.2" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13572", "description": "Release 2.1.1", "name": "Release 2.1.1", "archived": true, "released": true, "releaseDate": "2012-07-31" }, { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" } ], "issuelinks": [ { "id": "24643", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "108055", "key": "TIMOB-12324", "fields": { "summary": "iOS: improve RTE for addEventListener with one arg", "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" } }, "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": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-08-24T20:52: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": "11500", "name": "MobileWeb", "description": "Mobile Web (HTML) Platform" } ], "description": "If addEventListener is called on a Titanium object with a null, undefined, or any non-function callback argument, a runtime error should be generated (as in Android and iOS). See runtime errors below.\r\n\r\nThis not a regression.\r\n\r\nSee API Docs below.\r\n\r\nAPI Docs 2.1:\r\n\r\n{code}\r\nMethods\r\nTitanium.Proxy\r\n\r\naddEventListener( String name, Callback callback )\r\nAdds the specified callback as an event listener for the named event.\r\n\r\nParameters\r\n\r\nname : String\r\nName of the event.\r\n\r\ncallback : Callback\r\nCallback function to invoke when the event is fired.\r\n\r\nReturns\r\nvoid\r\n{code}\r\n\r\niOS Runtime Error:\r\n\r\n{code}\r\n[ERROR] Invalid type passed to function. expected: KrollCallback, was: NSNull in -[TiProxy addEventListener:] (TiProxy.m:764)\r\n[ERROR] Script Error = Invalid type passed to function. expected: KrollCallback, was: NSNull in -[TiProxy addEventListener:] (TiProxy.m:764) at app.js (line 1).\r\n{code}\r\n\r\nAndroid Runtime Error:\r\n\r\n{code}\r\n[ERROR][TiJSError( 487)] (main) [345,1716] ----- Titanium Javascript Runtime Error -----\r\n[ERROR][TiJSError( 487)] (main) [0,1716] - In ti:/events.js:141,10\r\n[ERROR][TiJSError( 487)] (main) [0,1716] - Message: Uncaught Error: addListener only takes instances of Function. The listener for event \"\" is \"object\"\r\n[ERROR][TiJSError( 487)] (main) [1,1717] - Source: \t\t\tthrow new Error('addListener only takes instances of Function. The listener\r\n[ERROR][V8Exception( 487)] Exception occurred at ti:/events.js:141: Uncaught Error: addListener only takes instances of Function. The listener for event \"\" is \"object\"\r\n{code}\r\n\r\nMobileWeb Runtime Error:\r\n\r\n\r\n\r\nSteps to Reproduce:\r\n\r\n1. Run sample code:\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor:'green'\r\n});\r\n\r\nwin.addEventListener('click', undefined);\r\n\r\nwin.open();\r\n{code}\r\n\r\nActual Result:\r\n\r\nNo runtime error. Program executes without interference.\r\n\r\nExpected Result:\r\n\r\nRuntime error.\r\n\r\n2. If no runtime error is generated, click on green background.\r\n\r\nExpected Result:\r\n\r\nClick events should fire, runtime errors should generate.", "attachment": [], "flagged": false, "summary": "MobileWeb: inject RTE for addEventListener call with null or undefined callback argument", "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": "Titanium Studio: 2.1.2\r\nTitanium SDK: 2.1.0, 2.1.1, 2.1.2.v20120809183109\r\nOS: Mountain Lion\r\nDevices Tested: iPhone Simulator 5.1, Android Emulator 2.2, MobileWeb Preview Chrome & Firefox\r\nDevices Affected: iPhone Simulator 5.1, Android Emulator 2.2\r\nAndroid Runtimes: V8\r\nAPI Docs: 2.1\r\nTitanium Objects Tested: Ti, Ti.UI.Tab instance", "comment": { "comments": [ { "id": "213976", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "I'm strongly against expected result. :)\r\nSilent fail (and passing wrong parameter is developer's error) is the worst possible scenario for developers (because, we cannot know something went wrong if it failed silently). It's better to throw an exception than to do nothing. Making that exception catchable is proper way to handle this kind of fail in production environment.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-08-13T04:25:34.000+0000", "updated": "2012-08-13T04:25:34.000+0000" }, { "id": "234811", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Also add RTE if only one arg passed to addEventListener:\n\n{code}\nwin.addEventListener(function(){});\n{code}", "updateAuthor": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-17T15:33:58.000+0000", "updated": "2013-01-17T15:33:58.000+0000" }, { "id": "427208", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Mobile Web has been deprecated and will be removed in fixVersion 7.0.0.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-08-24T20:52:40.000+0000", "updated": "2017-08-24T20:52:40.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }