{ "id": "133215", "key": "ALOY-1296", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "16920", "name": "Alloy 1.7.1", "archived": false, "released": true, "releaseDate": "2015-07-22" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-08-25T03:17:06.000+0000", "created": "2014-07-15T21:09:34.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "TCSupport", "liveview" ], "versions": [ { "id": "16876", "name": "Alloy 1.6.2", "archived": false, "released": true, "releaseDate": "2015-06-11" } ], "issuelinks": [], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2015-08-25T03:17:06.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "h4. Problem Description \r\nWhen you create a new alloy project and define a function inside alloy.js, If you are using LiveView the application will crash \r\n\r\nh4. Sample Code \r\n\r\nalloy.js\r\n{code} \r\nfunction sum(a,b){\r\n\treturn a+ b ;\r\n};\r\n{code}\r\n\r\nindex.xml\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.tss\r\n{code}\r\n\".container\": {\r\n\tbackgroundColor:\"white\"\r\n},\r\n\"Label\": {\r\n\twidth: Ti.UI.SIZE,\r\n\theight: Ti.UI.SIZE,\r\n\tcolor: \"#000\"\r\n}\r\n{code}\r\n\r\nindex.js\r\n{code}\r\nfunction doClick(e) {\r\n alert($.label.text);\r\n}\r\n$.index.open();\r\n{code}\r\n \r\nh4. Steps to reproduce \r\n\r\n- Create a simple alloy project.\r\n- Update alloy.js, index.xml, index.tss and index.js file with test code\r\n- Enable LiveView in Appcelerator Studio\r\n- Run on iOS simulator\r\n- Project crash and produce errors.\r\n\r\nh4. Actual Results\r\n{code}\r\n[ERROR] : SyntaxError: Parse error\r\n[ERROR] : File: app\r\n[ERROR] : Line: 1\r\n[ERROR] : SourceId: 316582208\r\n[ERROR] : Backtrace:\r\n[ERROR] : #0 () at file:///Users/rmitro/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F7F894E3-3A78-4E1D-9E4E-A54A4DDE7746/QnA_Alloy.app/app.js:502\r\n[ERROR] : #1 () at file:///Users/rmitro/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F7F894E3-3A78-4E1D-9E4E-A54A4DDE7746/QnA_Alloy.app/app.js:469\r\n[ERROR] : #2 () at file:///Users/rmitro/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F7F894E3-3A78-4E1D-9E4E-A54A4DDE7746/QnA_Alloy.app/app.js:403\r\n[ERROR] : #3 () at file:///Users/rmitro/Library/Application%20Support/iPhone%20Simulator/7.1/Applications/F7F894E3-3A78-4E1D-9E4E-A54A4DDE7746/QnA_Alloy.app/app.js:676\r\n{code}\r\n\r\nh4. Extra info\r\n\r\nThis is the error shown:\r\n\r\n{code}\r\n[INFO] : alloyJSHatesFunctions/1.0 (3.2.3.GA.b958a70)\r\n[LiveView] Client connected\r\n[INFO] : [LiveView] Error Evaluating app @ Line: 1\r\n[ERROR] : SyntaxError: Parse error\r\n[ERROR] : File: app\r\n[ERROR] : Line: 1\r\n[ERROR] : SourceId: 350635136\r\n[ERROR] : Backtrace:\r\n[ERROR] : #0 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/4A49D81E-DEF2-43ED-A74C-437076DE3B4E/alloyJSHatesFunctions.app/app.js:502\r\n[ERROR] : #1 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/4A49D81E-DEF2-43ED-A74C-437076DE3B4E/alloyJSHatesFunctions.app/app.js:469\r\n[ERROR] : #2 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/4A49D81E-DEF2-43ED-A74C-437076DE3B4E/alloyJSHatesFunctions.app/app.js:403\r\n[ERROR] : #3 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/4A49D81E-DEF2-43ED-A74C-437076DE3B4E/alloyJSHatesFunctions.app/app.js:676\r\n[LiveView] Client disconnected\r\n{code}\r\n", "attachment": [ { "id": "49777", "filename": "alloyJSHatesFunctions.zip", "author": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-07-15T21:09:34.000+0000", "size": 5920253, "mimeType": "application/zip" }, { "id": "50505", "filename": "truncated.txt", "author": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-15T19:33:43.000+0000", "size": 107390, "mimeType": "text/plain" } ], "flagged": false, "summary": "LiveView: functions in Alloy.js crash fail to build", "creator": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "Appcelerator Studio, OSX, Android\r\nSDK: 4.1.0.GA\r\nCLI: 4.1.1\r\niOS: 8.4\r\nAndroid 4.2.2", "closedSprints": [ { "id": 478, "state": "closed", "name": "2015 Sprint 17 Tooling", "startDate": "2015-08-17T16:09:49.717Z", "endDate": "2015-08-29T01:09:00.000Z", "completeDate": "2015-09-10T19:57:06.855Z", "originBoardId": 121 } ], "comment": { "comments": [ { "id": "316247", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hello! \r\n\r\nI tested this in 3.3.0 without problem. My testcase:\r\n\r\n1. Create a new mobile project with alloy default app.\r\n2. Run it in the iOS simulator.\r\n3. Modify the alloy.js with this:\r\n{code}\r\n\r\nfunction sum(a,b){\r\n\treturn a+ b ;\r\n};\r\n{code}\r\n4. The app didn't crash. \r\n\r\nAfter that, I re-run the app with the modified alloy.js without any issues.\r\n\r\nCan you please update and retest with the latest Ti Studio and Mobile SDK? \r\n\r\nThanks! ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-30T05:03:10.000+0000", "updated": "2014-07-30T05:03:10.000+0000" }, { "id": "316719", "author": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You did not do all the required steps to reproduce this error.\r\n\r\n1. Create a new mobile project with Alloy default app\r\n2. ***** Enable LiveView in AppceleratorStudio *****\r\n3. Modify the alloy.js file with this:\r\n{code}\r\nfunction sum(a,b){\r\n return a+ b ;\r\n};\r\n{code}\r\n4. Run the Simulator\r\n5. Watch it crash and produce this error:\r\n{code}\r\n[INFO] : [LiveView] Error Evaluating app @ Line: 1\r\n[ERROR] : SyntaxError: Parse error\r\n[ERROR] : File: app\r\n[ERROR] : Line: 1\r\n[ERROR] : SourceId: 332969088\r\n[ERROR] : Backtrace:\r\n[ERROR] : #0 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/04BCA961-3CC0-4746-B1A9-9BDAA7BB8E73/lol.app/app.js:502\r\n[ERROR] : #1 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/04BCA961-3CC0-4746-B1A9-9BDAA7BB8E73/lol.app/app.js:469\r\n[ERROR] : #2 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/04BCA961-3CC0-4746-B1A9-9BDAA7BB8E73/lol.app/app.js:403\r\n[ERROR] : #3 () at file:///Users/andrewmcelroy/Library/Application%20Support/iphone%20simulator/7.1-64/Applications/04BCA961-3CC0-4746-B1A9-9BDAA7BB8E73/lol.app/app.js:676\r\n{code}", "updateAuthor": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-02T00:26:14.000+0000", "updated": "2014-08-02T00:28:10.000+0000" }, { "id": "318924", "author": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "body": "any progress or information i need provide?", "updateAuthor": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-15T19:33:08.000+0000", "updated": "2014-08-15T19:33:08.000+0000" }, { "id": "318925", "author": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "body": "to make this ticket more readable. I dumped the environment info and npm info and sdk info in this file.", "updateAuthor": { "name": "sophrinix", "key": "sophrinix", "displayName": "Andrew McElroy", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-15T19:33:43.000+0000", "updated": "2014-08-15T19:33:43.000+0000" }, { "id": "321413", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "One of our other Titans independently discovered this bug recently. In his investigations, it was due to a hoisting issue. He found a workaround is to use the function statement form rather than function declaration. So, in alloy.js:\r\n\r\n{code}\r\nvar sum = function(a,b){\r\n return a+ b ;\r\n};\r\n{code}", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-09-02T19:50:21.000+0000", "updated": "2014-09-02T19:50:21.000+0000" }, { "id": "321417", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "Yep, that was me and the statement method solved it as Tim said. ", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2014-09-02T19:55:35.000+0000", "updated": "2014-09-02T19:55:35.000+0000" }, { "id": "328017", "author": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "body": "Problem with this solution\r\n\r\nIf you do\r\n\r\n{code:javascript}\r\nvar sum = function(a,b){\r\n return a+ b ;\r\n};\r\n{code}\r\n\r\nyou end up creating a global variable/function.", "updateAuthor": { "name": "jkneen", "key": "jkneen", "displayName": "Jason Kneen", "active": false, "timeZone": "Africa/Ceuta" }, "created": "2014-10-14T13:21:41.000+0000", "updated": "2014-10-14T13:21:41.000+0000" }, { "id": "350161", "author": { "name": "AndrewNatoli42", "key": "andrewnatoli42", "displayName": "Andrew Natoli", "active": true, "timeZone": "America/New_York" }, "body": "Jason, alloy.js houses global variables and functions.\r\n\r\nThe problem with the solution is that doing a normal function declaration still doesn't work. Having this issue with SDK 3.5.1.\r\n\r\nI did however rewrite my alloy.js to use \"var eggo = function()\" instead of \"function eggo()\" and it resolved the issue.", "updateAuthor": { "name": "AndrewNatoli42", "key": "andrewnatoli42", "displayName": "Andrew Natoli", "active": true, "timeZone": "America/New_York" }, "created": "2015-04-20T20:24:58.000+0000", "updated": "2015-04-20T20:44:27.000+0000" }, { "id": "350162", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "Isn't that what I said? rewrite function foo() to var foo = function() and it works.", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2015-04-20T20:47:12.000+0000", "updated": "2015-04-20T20:47:12.000+0000" }, { "id": "350163", "author": { "name": "AndrewNatoli42", "key": "andrewnatoli42", "displayName": "Andrew Natoli", "active": true, "timeZone": "America/New_York" }, "body": "You did. I was just confirming that it worked as I added that line in after I posted my original comment.", "updateAuthor": { "name": "AndrewNatoli42", "key": "andrewnatoli42", "displayName": "Andrew Natoli", "active": true, "timeZone": "America/New_York" }, "created": "2015-04-20T20:55:38.000+0000", "updated": "2015-04-20T20:55:38.000+0000" }, { "id": "350166", "author": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "body": "cool. Credit to Tim for the solution ;)", "updateAuthor": { "name": "jasonkneen", "key": "jasonkneen", "displayName": "Jason Kneen", "active": true, "timeZone": "Europe/London" }, "created": "2015-04-20T21:02:37.000+0000", "updated": "2015-04-20T21:02:37.000+0000" }, { "id": "360982", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR: https://github.com/appcelerator/liveview/pull/89", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2015-08-24T20:25:23.000+0000", "updated": "2015-08-24T20:25:23.000+0000" }, { "id": "361019", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Approved. PR merged.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-08-25T03:16:51.000+0000", "updated": "2015-08-25T03:16:51.000+0000" } ], "maxResults": 18, "total": 18, "startAt": 0 } } }