{ "id": "169713", "key": "TIMOB-25455", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2017-11-07T08:58:50.000+0000", "created": "2017-09-07T04:01:26.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [ { "id": "56127", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "169857", "key": "TIMOB-25328", "fields": { "summary": "CLI: Option \"Enable Javascript Minification\" break code from SDK >= 6.1.1.G.A", "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": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-08-06T17:41:10.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": "JavaScript eval() function is not working inside the CommonJS module and the iOS device. It can not detect the variable value when we write down inside the CommonJS module. But it works if we write eval() function to the app.js file.\r\n\r\nSteps to Reproduce:\r\n\r\n1. Create a new App\r\n2. Disable LiveView \r\n3. Run the following test code on the iOS device\r\n\r\nNote: It works if liveveiw is enabled. Also, working in a simulator.\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'red',\r\n\tlayout : \"vertical\"\r\n});\r\n\r\n// Create a Button.\r\nvar request = Ti.UI.createButton({\r\n\ttitle : 'Got it',\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n\ttop : 50\r\n});\r\n\r\n\r\nrequest.addEventListener('click', function(e) {\r\n\r\n\tvar EvalTestClass = require('lib/evalTest');\r\n\r\n\tvar evalTest = new EvalTestClass();\r\n\r\n\tevalTest.open();\r\n});\r\n\r\nwin.add(request);\r\n\r\nwin.open();\r\n\r\n\r\n\r\n{code}\r\n\r\n{code:title=evalTest}\r\nfunction view() {\r\n\r\n\tvar win = Ti.UI.createWindow({\r\n\t\ttitle : \"Test\",\r\n\t\tbackgroundColor : '#fff'\r\n\t});\r\n\r\n\tvar X = 10;\r\n\tvar Y = 20;\r\n\r\n\tfunction iWantToKillMyslef() {\r\n\t\talert(\"This works in the Simulator and in Live View\");\r\n\t}\r\n\r\n\tvar a = eval(\"X*Y\");\r\n\r\n\tvar label = Ti.UI.createLabel({\r\n\t\ttext : a,\r\n\t\tcolor : \"#333\",\r\n\t\tfont : {\r\n\t\t\tfontSize : 20\r\n\t\t}\r\n\t});\r\n\twin.add(label);\r\n\r\n\ttry {\r\n\t\teval(\"iWantToKillMyslef()\");\r\n\t} catch (e) {\r\n\t\talert(e);\r\n\t}\r\n\r\n\treturn win;\r\n};\r\n\r\nmodule.exports = view;\r\n\r\n\r\n{code}\r\n\r\nError Code\r\n{code}\r\n[ERROR] : Script Error {\r\n[ERROR] : column = 2;\r\n[ERROR] : line = 1;\r\n[ERROR] : message = \"Can't find variable: X\";\r\n[ERROR] : stack = \"eval code\\neval@[native code]\\nview@file:///var/containers/Bundle/Application/A4AEE4ED-3CBA-4F93-9E91-A3E4ACE80496/EvalTest.app/lib/evalTest.js:1:287\\nfile:///var/containers/Bundle/Application/A4AEE4ED-3CBA-4F93-9E91-A3E4ACE80496/EvalTest.app/app.js:1:276\";\r\n[ERROR] : }\r\n\r\n{code}\r\n\r\nThanks\r\n\r\n", "attachment": [], "flagged": false, "summary": "Syntax eval is not working inside the CommonJS module.", "creator": { "name": "lau.yikonn", "key": "lau.yikonn", "displayName": "lau.yikonn", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "lau.yikonn", "key": "lau.yikonn", "displayName": "lau.yikonn", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Ti SDK version: 6.2.2\r\nNode: 6.11.4\r\niOS device 5s v11.0.3", "closedSprints": [ { "id": 968, "state": "closed", "name": "2017 Sprint 23 SDK", "startDate": "2017-11-05T16:37:25.071Z", "endDate": "2017-11-19T16:37:00.000Z", "completeDate": "2017-11-20T18:57:56.565Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "427804", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "body": "Hi,\r\nWe have tested this issue with 6.1.2.GA. So far we have been unable to reproduce this issue.\r\nTest Code\r\n{code}\r\n var win = Ti.UI.createWindow({\r\n title: \"Test\",\r\n backgroundColor: '#fff'\r\n });\r\n \r\n var x = 10;\r\n var y = 20;\r\n var a = eval(\"x * y\");\r\n\r\n var label = Ti.UI.createLabel({\r\n text: a,\r\n color: \"#333\",\r\n font: {\r\n fontSize: 20\r\n }\r\n }); \r\n win.add(label);\r\nwin.open();\r\n{code}\r\n\r\nEnvironment:\r\n{code}\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.11.6\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 4.4.4\r\n npm Version = 2.15.1\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\nTitanium SDK\r\n SDK Version = 6.1.2.GA\r\n{code}\r\n\r\nThanks ", "updateAuthor": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2017-09-12T15:48:40.000+0000", "updated": "2017-09-12T15:48:40.000+0000" }, { "id": "429392", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "This is very much an issue with iOS too. \r\n\r\nMac OS 10.13\r\nTi SDK 6.2.x (they all fail)\r\niOS SDK 11.x (they all fail)\r\n\r\nIt ONLY fails if you install the App via Ad Hoc Dist or direct to device with LiveView turned OFF. If LiveView is ON or it is running in the simulator it works! \r\n\r\nIn app.js; you need the following:\r\n\r\nvar EvalTestClass = require('/lib/EvalTest');\r\nvar evalTest = new EvalTestClass();\r\n\r\nand I have attached EvalTest.js\r\n\r\nif you have the eval in the app.js file it works! This is a major issue as I can't perform a valid Ad Hoc Dist with 6.2.x\r\n", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-22T15:48:40.000+0000", "updated": "2017-10-22T15:48:40.000+0000" }, { "id": "429400", "author": { "name": "lau.yikonn", "key": "lau.yikonn", "displayName": "lau.yikonn", "active": true, "timeZone": "America/Los_Angeles" }, "body": "@Ivan markovic, \r\nand i find out that, if you use the eval like below it works!\r\nvar b = 10;\r\nvar x = \"b\"; \r\ncosole.log(eval(x)); //result = 10\r\n\r\nbut you cant pass string to eval.\r\neval(\"x\"); // fail", "updateAuthor": { "name": "lau.yikonn", "key": "lau.yikonn", "displayName": "lau.yikonn", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-10-23T06:18:39.000+0000", "updated": "2017-10-23T06:18:39.000+0000" }, { "id": "429439", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "body": "Hi [~imarkovi] [~lau.yikonn],\r\nCould you please share a demo project? We can offer you to look into your code and help to identify errors.\r\n\r\nBest,\r\nAxway Appcelerator Support", "updateAuthor": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2017-10-23T17:09:53.000+0000", "updated": "2017-10-23T17:09:53.000+0000" }, { "id": "429445", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "I already posted a file and the core code. That is all you'll need. Turn off live view and install that to device and it'll fail. ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-23T18:53:55.000+0000", "updated": "2017-10-23T18:53:55.000+0000" }, { "id": "429475", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Aminul, I am now back in my office. Let me know how you get on. This is an absolute showstopper. I can't get around this bug, and I can't release anything to a device, either Ad Hoc or for Development. Thanks ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-24T01:47:45.000+0000", "updated": "2017-10-24T01:47:45.000+0000" }, { "id": "429508", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "body": "Hi [~imarkovi],\r\nwe have tested this issue with latest SDK 6.2.2.GA on devices (direct to the device with LiveView turned OFF)\r\nwe also create an EvalTest.js and require that file in app.js. So far we have been unable to reproduce any error. Could you please share app.js and EvalTest.js as gist or dropbox link? We don't get any file.\r\n\r\nThanks \r\n", "updateAuthor": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2017-10-24T17:47:45.000+0000", "updated": "2017-10-24T17:47:45.000+0000" }, { "id": "429513", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Okay I have attached the whole project as well as my build log so you can check all my settings.\r\n\r\nAnd the relief (for me) is that I created a NEW project and did as LITTLE as possible to the settings and it still failed. Same as before. Maybe there is something I can update but from what I have seen everything is updated to the latest and greatest versions and this fails on all flavours of 6.2.x", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-24T18:18:11.000+0000", "updated": "2017-10-24T18:18:11.000+0000" }, { "id": "429514", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "I am not sure if you can see the attachment that I added to the comment above so I am including it here too:\r\n\r\nhttps://www.dropbox.com/s/lmkanwc2uwrbixd/EvalTest.zip?dl=0", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-24T18:22:33.000+0000", "updated": "2017-10-24T18:22:33.000+0000" }, { "id": "429516", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I have tried your sample code on the Android device. I don't see any crash or error in the console. I see a blank alert with {}. I am testing SDK 6.2.2.GA and in Android 7.1.2 device (Nokia 6). [See screenshot|https://ibb.co/kL2zT6]. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-10-24T20:12:16.000+0000", "updated": "2017-10-24T20:12:16.000+0000" }, { "id": "429517", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Please reference the first line of my initial report/comment: \r\n\r\n\"This is very much an issue with iOS too\"\r\n\r\nI don't use Android. This is an issue on iOS. on my iPhone and iPad ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-24T20:19:49.000+0000", "updated": "2017-10-24T20:19:49.000+0000" }, { "id": "429631", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~imarkovi],\r\n\r\nI could not reproduce this issue with the following environment\r\n\r\nAppcelerator Command-Line Interface, version 6.2.4\r\nTi SDK: 6.1.1.GA, 6.1.2.GA\r\niPhone 5s v11.0.3\r\nNode: 6.11.4\r\n\r\nI tested the [~aislam] test code. Did you try with that? Also, review your other code in your App.\r\n\r\nThanks", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-10-26T00:21:24.000+0000", "updated": "2017-10-26T00:21:24.000+0000" }, { "id": "429632", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Motiur, \r\n\r\nThe issue does not arise with 6.1.x, as I mentioned it's all flavours of 6.2.x Please test with 6.2.x and also ensure you have live view turned off; it WORKS with live view turned on! VERY strange.\r\n\r\nYou have the entirety of the App in the dropbox link above, and that App JUST contains those 2 files and nothing more; I didn't adjust the settings or add any modules, as simple and as generic as can be\r\n\r\nThe eval function fails with every single string input I have used. Doesn't matter what the string contains, whether it's a 'dictionary' or a function call, it fails. ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-26T00:39:35.000+0000", "updated": "2017-10-26T00:39:35.000+0000" }, { "id": "429633", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "So yes, Aminul Islam's code very much fails as does any string containing anything\r\n\r\nPlease note that this DOES appear to work if the eval is contained within the app.js file, outside any object structure... so maybe that is part of the issue here. ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-26T00:41:43.000+0000", "updated": "2017-10-26T00:41:43.000+0000" }, { "id": "429721", "author": { "name": "daisyfoto", "key": "daisyfoto", "displayName": "daisyfoto", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have same problem\r\nTi SDK: 6.2.2.GA eval it work on simulator but not work on real device\r\n", "updateAuthor": { "name": "daisyfoto", "key": "daisyfoto", "displayName": "daisyfoto", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-10-27T02:49:31.000+0000", "updated": "2017-10-27T02:49:31.000+0000" }, { "id": "429724", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello!\r\n\r\nStill, I could not reproduce this issue with the real device and yes liveview was disabled. Try to clean build your App and change the Ti SDK version.\r\n\r\nAppcelerator Command-Line Interface, version 6.2.4\r\nTi SDK: 6.2.2.GA,\r\niPhone 5s v11.0.3\r\nNode: 6.11.4\r\n\r\nI tested the following test code\r\n- https://www.dropbox.com/s/lmkanwc2uwrbixd/EvalTest.zip?dl=0\r\n\r\nHere is the screenshot\r\nhttp://oi65.tinypic.com/2ecni8z.jpg\r\n\r\nThanks\r\n\r\n\r\n\r\n", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-10-27T06:01:48.000+0000", "updated": "2017-10-27T06:01:48.000+0000" }, { "id": "429731", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Motiur,\r\n\r\nI have cleaned my project more times than you've had hot dinners... I created a brand new project just to identify this issue (which is the one in DropBox)... I have restarted Studio, I have restarted my Mac, I have triple checked that I am running the latest and greatest of everything. I have tried multiple devices, I have tried it from the command line as well as Studio and everything fails! \r\n\r\nSeems that it's not just me that has this issue too! Can you go through the logs in my project and triple check that my settings and installs match yours and that I am running everything just as you are running it? Also do you have a newer device? A 6 or a 7 or an 8? At this point this is one thing that I see that might be different....\r\n", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-27T11:12:28.000+0000", "updated": "2017-10-27T11:12:28.000+0000" }, { "id": "429732", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Motiur, to be honest at this point I think it's best for me to attempt to start from a clean slate. Can you give me instructions on how to completely, completely, completely clear out my Studio and Ti install and then I will start from scratch with a new install. But I need to clean EVERYTHING out... NodeJS, everything connected to Ti. \r\n\r\nBut before I do that can you double check my logs... I have spent HOURS on this already and it's still failing. I have been working with Ti since version 1.x! So I am not a naieve user... I am keen not to waste too much more of my time on this if at all possible! Thanks.", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-27T11:27:04.000+0000", "updated": "2017-10-27T11:27:04.000+0000" }, { "id": "429737", "author": { "name": "daisyfoto", "key": "daisyfoto", "displayName": "daisyfoto", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi i my problem like Ivan Markovic \r\n\r\n\r\n-eval error on real device\r\n-test ios simulator is success\r\n-try on ti sdk 6.1.2 and 6.2.2 both error\r\n\r\nyou can see in screen shot link\r\n\r\n[link Error Info https://drive.google.com/file/d/0B05s5MczZVCDRWEyZFBJeDFIN1k/view?usp=sharing]\r\n\r\nMy environment\r\n\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.13\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 16.0GB\r\n\r\nNode.js\r\n Node.js Version = 6.11.4\r\n npm Version = 3.10.10\r\n\r\nAppcelerator CLI\r\n Installer = 4.2.9\r\n Core Package = 6.2.4\r\n\r\nTitanium CLI\r\n CLI Version = 5.0.14\r\n node-appc Version = 0.2.41\r\n\r\nTitanium SDKs\r\n 6.2.2.GA\r\n Version = 6.2.2\r\n Install Location = /Users/daisyfoto/Library/Application Support/Titanium/mobilesdk/osx/6.2.2.GA\r\n Platforms = iphone, android, mobileweb\r\n git Hash = 42c7196\r\n git Timestamp = 9/19/2017 23:07\r\n node-appc Version = 0.2.43\r\n 6.1.2.GA\r\n Version = 6.1.2\r\n Install Location = /Users/daisyfoto/Library/Application Support/Titanium/mobilesdk/osx/6.1.2.GA\r\n Platforms = iphone, android, mobileweb\r\n git Hash = c4cd761\r\n git Timestamp = 7/27/2017 23:13\r\n node-appc Version = 0.2.43\r\n 5.3.0.GA\r\n Version = 5.3.0\r\n Install Location = /Users/daisyfoto/Library/Application Support/Titanium/mobilesdk/osx/5.3.0.GA\r\n Platforms = android, mobileweb, iphone\r\n git Hash = 94fa8af\r\n git Timestamp = 06/01/16 10:17\r\n node-appc Version = 0.2.33\r\n\r\n", "updateAuthor": { "name": "daisyfoto", "key": "daisyfoto", "displayName": "daisyfoto", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-10-27T15:53:28.000+0000", "updated": "2017-10-27T15:53:28.000+0000" }, { "id": "429738", "author": { "name": "daisyfoto", "key": "daisyfoto", "displayName": "daisyfoto", "active": true, "timeZone": "America/Los_Angeles" }, "body": "\r\n[link My Screen Shot | https://drive.google.com/file/d/0B05s5MczZVCDRWEyZFBJeDFIN1k/view?usp=sharing]", "updateAuthor": { "name": "daisyfoto", "key": "daisyfoto", "displayName": "daisyfoto", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-10-27T15:58:41.000+0000", "updated": "2017-10-27T15:58:41.000+0000" }, { "id": "429762", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello [~imarkovi],\r\n\r\nFinally, I can reproduce this issue with a new project but working with my old project. Also, WORKS when the liveview turned on! Really, it's a weird behavior.\r\n\r\nIt seem's that the \"eval\" method does not work properly outside the app.js file like any commonJS object structure. Or the \"eval\" method does not detect the variable value outside the app.js file.\r\n\r\nAs a workaround, you can declare the variable to the app.js file then use it anywhere of the App.\r\n\r\nTest Code:\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : 'red',\r\n\tlayout : \"vertical\"\r\n});\r\n\r\n// Create a Button.\r\nvar request = Ti.UI.createButton({\r\n\ttitle : \"Got it\",\r\n\theight : Ti.UI.SIZE,\r\n\twidth : Ti.UI.SIZE,\r\n\ttop : 50\r\n});\r\n\r\n\r\nfunction iWantToKillMyslef() {\r\n\talert(\"This works in the Simulator and in Live View\");\r\n}\r\n\r\nvar X = 10;\r\nvar Y = 20;\r\n\r\nrequest.addEventListener('click', function(e) {\r\n\r\n\tvar EvalTestClass = require('lib/evalTest');\r\n\r\n\tvar evalTest = new EvalTestClass();\r\n\r\n\tevalTest.open();\r\n});\r\n\r\nwin.add(request);\r\n\r\nwin.open();\r\n\r\n{code}\r\n\r\n{code:title=evalTest.js}\r\nfunction view() {\r\n\r\n\tvar win = Ti.UI.createWindow({\r\n\t\ttitle : \"Test\",\r\n\t\tbackgroundColor : '#fff'\r\n\t});\r\n\r\n\tvar a = eval(\"X*Y\");\r\n\r\n\tvar label = Ti.UI.createLabel({\r\n\t\ttext : a,\r\n\t\tcolor : \"#333\",\r\n\t\tfont : {\r\n\t\t\tfontSize : 20\r\n\t\t}\r\n\t});\r\n\twin.add(label);\r\n\r\n\ttry {\r\n\t\teval(\"iWantToKillMyslef()\");\r\n\t} catch (e) {\r\n\t\talert(e);\r\n\t}\r\n\r\n\treturn win;\r\n};\r\n\r\nmodule.exports = view; \r\n{code}\r\n\r\n\r\nTry it then let me know.", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-10-28T09:26:38.000+0000", "updated": "2017-10-28T09:26:38.000+0000" }, { "id": "429763", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Really really pleased that you've managed to reproduce it! But hold on this is anything but closed. \n\nThe example you used is anything but realistic. I use the eval method throughout my code. To read in structures from data files and to execute functions. I'd have to move all that code into app's! That's not feasible I'm afraid. It works fine for this very simple example but it would make a mess of my code ! \n\nWe need a fix for this. I appreciate your effort here to find a work around but it's a hack that would only suffice in an emergency for a simple problem. \n\nWe really need this fixed in the code. Can you reopen this case please? And let us know when we might expect to see a fix? This looks pretty nasty to me... And it may well be hiding other issues that only arise when not using live view! ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-28T10:50:51.000+0000", "updated": "2017-10-28T10:50:51.000+0000" }, { "id": "429797", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "[~imarkovi],\r\n\r\nAlso, you can declare variables outside of a CommonJS module as a global variable instead of app.js. Although we do not recommend that but as a workaround, you can use it.\r\n\r\n{code:title=evalTest.js}\r\nfunction iWantToKillMyslef() {\r\n\talert(\"This works in the Simulator and in Live View\");\r\n}\r\n\r\nvar X = 10;\r\nvar Y = 20;\r\n\r\nfunction view() {\r\n\r\n\tvar win = Ti.UI.createWindow({\r\n\t\ttitle : \"Test\",\r\n\t\tbackgroundColor : '#fff'\r\n\t});\r\n\r\n\tvar a = eval(\"X*Y\");\r\n\r\n\tvar label = Ti.UI.createLabel({\r\n\t\ttext : a,\r\n\t\tcolor : \"#333\",\r\n\t\tfont : {\r\n\t\t\tfontSize : 20\r\n\t\t}\r\n\t});\r\n\twin.add(label);\r\n\r\n\ttry {\r\n\t\teval(\"iWantToKillMyslef()\");\r\n\t} catch (e) {\r\n\t\talert(e);\r\n\t}\r\n\r\n\treturn win;\r\n};\r\n\r\nmodule.exports = view;\r\n\r\n\r\n{code}\r\n\r\nTry it then let me know. Also, I will forward it to our engineering team for more investigation.\r\n\r\nThanks", "updateAuthor": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2017-10-30T02:34:41.000+0000", "updated": "2017-10-30T02:34:41.000+0000" }, { "id": "429800", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Motiur,\r\n\r\nThank you for the suggestion but this wouldn't work. I am not just accessing functions and variables but also reading in objects from files and applying eval to them and if I was to move all the functions and make them global and find workarounds for the other issues it would be an absolute mess and I genuinely don't think this would work for a couple of the situations I have. \r\n\r\nI am sure that others must be having this issue but have not managed to track it down to the eval statement; it cannot be just the couple of us experiencing this. And this is really a rather severe problem! I am very lucky that I have an older version of the SDKs and can distribute on my old system but I am flying off to the US tomorrow and I won't have easy access to that system and that is where I will be attempting to update and deliver the App to my client! Which I obviously can't do at the moment!\r\n\r\nIf you can reopen this case and attach a severe rating to it I think we would all appreciate it. Please keep us updated as to when we might expect a release with a fix for this issue? I hope in the next dot release.\r\n\r\n\r\nThank you.", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-10-30T03:02:12.000+0000", "updated": "2017-10-30T03:02:12.000+0000" }, { "id": "430088", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi All, what's the current status here?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-11-03T19:33:36.000+0000", "updated": "2017-11-03T19:33:44.000+0000" }, { "id": "430102", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Ivan,\r\n\r\nare you *really* sure this does not happen in 6.1.0 as stated above? Honestly, it should never work. You are referencing variables outside of their scope, which is invalid. This may work because the Javascript-context of the Simulator is more lossy and allows those references, but the device-one won't. I'd also wonder if this works in NodeJS generally. [~cwilliams], can you give us some insight of your knowledge here?\r\n\r\nA clean solution (rather the calling it \"workaround\") will be to pass the variables to the common-js file - either in it's constructor or inside the parameters of the method that computes the values.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-03T22:57:43.000+0000", "updated": "2017-11-03T22:58:48.000+0000" }, { "id": "430110", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Hans yes, it works fine in 6.1. It's only in 6.2.x \r\n\r\nI have been releasing versions of this App now for about 2+ years that use the eval function. It's always worked. This is the Mr Brainwash App that you helped with. \r\n\r\nI am confused as to what you are talking about referencing variables outside the scope... the scope of the function? So are you saying that this is not allowable:\r\n\r\nvar x = 5;\r\nvar y = 5;\r\n\r\nfunction addMe() {\r\n eval(\"x = y\");\r\n}\r\n\r\nbecause in my understanding x and y are global and therefore in the scope of the addMe function. This is basically all that I am doing. Exception that my eval looks a bit more like:\r\n\r\neval(myVariable + \"settings()\");\r\n\r\nbut where the function is global and defined within the parent function that the calling function lives in.... this has always worked for me and it works in all the browsers I have tested it on as well as all the previous versions of the Ti SDK. So something has changed recently. \r\n\r\nI am not sure how I would be able to pass in the variables to the function containing the eval statement... in my use there are 12 function that the above eval could possibly call... so I would need to pass all those function objects into the function that called the eval? That would be a bit messy I fear....", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-11-04T09:08:22.000+0000", "updated": "2017-11-04T09:08:22.000+0000" }, { "id": "430112", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I've gone through the 6.2.0 release-notes twice now (because I could not remember any change regarding that kind of functionality) and couldn't find anything. Please attach a anonymized version of you tiapp.xml here to check your general settings.\r\n\r\nRegarding the scope: If you are defining a variable inside another file (like the initial reporter of this ticket), it is not expected to work, because the other common-js file has a whole different scope then the one it's being called from. The only ticket that really touched the kroll-core was TIMOB-24830, but that was in *6.1.2* already. Can you confirm it still worked there?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-04T09:46:46.000+0000", "updated": "2017-11-04T09:51:26.000+0000" }, { "id": "430113", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Hans,\r\n\r\nYou can find everything in the DropBox link that I included in my earlier posting: \r\n\r\nhttps://www.dropbox.com/s/lmkanwc2uwrbixd/EvalTest.zip?dl=0\r\n\r\nYou will find everything you need there... everything, including my build logs. I am not sure what the others are doing in their code but my code was super simple. I define a global variable inside a parent 'function' and then I call that variable from within a function inside the parent function... so all within the scope of the parent and all in the same file... I would never want to try to access variables outside the parent function, that's all too messy. My example is super simple and super clean. \r\n\r\nI am in LA at the moment and I do not have access to my main machine, I am using my alt machine which has a slightly older version of the Ti SDK and as it all works I am not touching it for the time being! But on my laptop, which runs 6.2.x, I am stuffed... \r\n\r\nPrior to 6.2.x I was building and distributing this App with all these eval statements for 2 years or so. \r\n\r\nReally appreciate your help on this. ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-11-04T10:27:22.000+0000", "updated": "2017-11-04T10:27:22.000+0000" }, { "id": "430114", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Checking on Monday. In the mean time, Can you try setting the {{run-on-main-thread}} and check if there is a difference?", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-04T12:17:33.000+0000", "updated": "2017-11-04T12:17:33.000+0000" }, { "id": "430135", "author": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "body": "Hans,\r\n\r\nThe setting run-on-main-thread is true in the project I posted here. I have double checked it here and it's still true here in my test build too. \r\n\r\nI did upgrade the Ti SDK to 6.3 in the hope that it would fix the issue and I actually saw a very different problem, this time the code failed to build! I have attached the log file from the build. It's exactly the same code as posted, no changes whatsoever. \r\n\r\nhttps://www.dropbox.com/s/2rwbz6lxbke3ljo/errorlog.txt?dl=0\r\n\r\nI hope that this helps... ", "updateAuthor": { "name": "imarkovi", "key": "imarkovi", "displayName": "Ivan Markovic", "active": true, "timeZone": "Europe/London" }, "created": "2017-11-05T23:59:47.000+0000", "updated": "2017-11-05T23:59:47.000+0000" }, { "id": "430208", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "The error is *very* likely related to source-encryption (TIMOB-25328) because of the affected version and seen behavior. Resolving as {{Duplicate}}, product management to prioritize the other one.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-07T08:58:23.000+0000", "updated": "2017-11-07T08:58:23.000+0000" }, { "id": "440007", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as a duplicate. If this is in error, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-08-06T17:41:10.000+0000", "updated": "2018-08-06T17:41:10.000+0000" } ], "maxResults": 35, "total": 35, "startAt": 0 } } }