{ "id": "86138", "key": "TIMOB-7559", "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": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-09T19:48:22.000+0000", "created": "2012-02-06T16:36:11.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "parity" ], "versions": [ { "id": "12580", "description": "Dual Runtime 1.8.0", "name": "Release 1.8.0.1", "archived": true, "released": true, "releaseDate": "2011-12-22" }, { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-09T19:48:22.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": "Undeclared variables referenced from a module fail to generate an error. Android does generate the error. Screenshot attached.\r\n\r\nThe undeclared variable can then be used in further logic, such as adding it to a window. Screenshot attached.\r\n\r\nIf an undeclared variable is used in the module itself, there is an error.\r\nIf an undeclared variable is returned from an exports function-call, there is an error.\r\nIf an undeclared variable is defined as a return value in an exports function, but the function is never called, there is no error.\r\nIf an undeclared variable is returned from an exports function-call and assigned to a new variable outside the module, there is no error, and the variable can continue to be used.\r\n\r\nSteps to Reproduce:\r\n\r\n1. Run Code (also attached):\r\n\r\n{code:title=app.js}\r\nvar undeclaredVar = require('Module').getUndeclaredVar();\r\n\r\nTi.UI.createWindow().add(undeclaredVar);\r\n{code}\r\n\r\n{code:title=Module.js}\r\nexports.getUndeclaredVar = function()\r\n{\r\n\treturn undeclaredVar;\r\n};\r\n{code}\r\n\r\nExpected Result:\r\n\r\nRuntime error indicating undeclared variable.\r\n\r\nActual Result:\r\n\r\nNo runtime error.", "attachment": [ { "id": "25632", "filename": "android.png", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-06T16:36:11.000+0000", "size": 75640, "mimeType": "image/png" }, { "id": "25633", "filename": "ios - undeclared var added to window.png", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-06T16:36:11.000+0000", "size": 96191, "mimeType": "image/png" }, { "id": "25631", "filename": "RequireTest.zip", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-06T16:36:11.000+0000", "size": 2322325, "mimeType": "application/zip" } ], "flagged": false, "summary": "iOS: CommonJS require: undeclared variable referenced from module fails to generate error", "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": "SDK: 1.8.0.1 githash=fbdc96f, 1.8.1 githash=a24502a, 1.9.0.v20120203163134\r\nStudio: 1.0.8.201201262211\r\nOS: Lion\r\nDevices Tested: iPhone 5.0.1, iPhone/iPad Simulator 5.0", "comment": { "comments": [ { "id": "182189", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Hi.\r\n\r\n\r\nThis should be duplicate (I think).\r\n\r\n\r\nThe problem is that global variables are still allowed in CommonJS implementation on iOS (so, the problem is not undeclared variable as test case suggests).\r\n\r\n\r\n\"undeclaredVar\" is actually in global scope (in \"app.js\"). Since there is a bug on iOS that allows referening global scope variables from module scope, when \"getUndeclaredVar\" is called from module scope, it references \"undeclaredVar\" global variable and therefore does not produce JS reference error.\r\n\r\n\r\nChange \"undeclaredVar\" to \"undeclaredGlobalVar\" and error should be thrown.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-02-07T02:10:18.000+0000", "updated": "2012-02-07T02:10:18.000+0000" }, { "id": "182336", "author": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue can be taken up during JSCore upgrade.", "updateAuthor": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-02-07T18:28:20.000+0000", "updated": "2012-02-07T18:28:20.000+0000" }, { "id": "182349", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2012-02-08T01:01:36.000+0000", "updated": "2012-02-08T01:01:36.000+0000" }, { "id": "248328", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue reproduces \n\nTested with\n\nTitanium Studio, build: 3.0.1.201212181159\nTitanium SDK version: 3.1.0 \nTitanium SDK version: 3.0.2 \niOS iPhone Simulator: iOS SDK version: 6.0\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-19T09:19:07.000+0000", "updated": "2013-04-19T09:19:07.000+0000" }, { "id": "453589", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. \r\n\r\nIf community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-09T19:48:22.000+0000", "updated": "2020-01-09T19:48:22.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }