{ "id": "119250", "key": "TIMOB-15009", "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": [ { "id": "15695", "description": "2013 Sprint 20", "name": "2013 Sprint 20", "archived": true, "released": true, "releaseDate": "2013-10-04" }, { "id": "15698", "description": "2013 Sprint 20 Tooling", "name": "2013 Sprint 20 Tooling", "archived": true, "released": true, "releaseDate": "2013-10-04" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-09-25T22:45:13.000+0000", "created": "2013-08-29T15:00:03.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-closed-3.2.0" ], "versions": [], "issuelinks": [ { "id": "31523", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "119386", "key": "TIMOB-15029", "fields": { "summary": "LiveView: Alloy.Globals not visible in modules when using LiveView", "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": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "32640", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "121123", "key": "TIMOB-15466", "fields": { "summary": "Apps crash after enabling LiveView", "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 } } } }, { "id": "31528", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "118692", "key": "TIMOB-14903", "fields": { "summary": "LiveView: TypeError thrown when an instance of new Backbone.Collection() is created", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-12-13T09:07:04.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": "13600", "name": "LiveView", "description": "Live preview of Titanium apps" } ], "description": "h2. Problem description\r\nWhen using LiveView, the global variable Alloy.Globals is not defined in modules. Disabling LiveView would not throw the error.\r\n\r\nh2. Code to reproduce\r\nCreate an Alloy app with this code:\r\n\r\nindex.js\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:'#ffffff'\r\n});\r\n\r\nTi.API.info(Alloy.Globals.test);\r\n\r\nvar Test = require('test');\r\nnew Test();\r\n\r\nwin.open();\r\n{code}\r\n\r\nlib/test.js\r\n{code}\r\nfunction Test() {\r\n\tTi.API.info(Alloy.Globals.test);\r\n};\r\n\r\nmodule.exports = Test;\r\n{code}\r\n\r\nAdd the global variable in alloy.js:\r\n\r\n{code}\r\nAlloy.Globals.test = \"TEST\";\r\n{code}\r\n\r\nh2. Actual behavior\r\nWhen running the app with LiveView on, the following error is thrown:\r\n\r\n{code}\r\n[INFO] : [LiveView] Error Evaluating app.js @ Line: 2\r\n[ERROR] : TypeError: 'undefined' is not an object (evaluating 'Alloy.Globals')\r\n[ERROR] : File: app.js\r\n[ERROR] : Line: 2\r\n[ERROR] : SourceId: 323744256\r\n[ERROR] : Backtrace:\r\n[ERROR] : #0 Controller() at :21\r\n[ERROR] : #1 () at :214\r\n[ERROR] : #2 anonymous() at :15\r\n[ERROR] : #3 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:628\r\n[ERROR] : #4 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:493\r\n[ERROR] : #5 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:460\r\n[ERROR] : #6 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:392\r\n[ERROR] : #7 () at file://localhost/Users/dcassenti/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/4822E77B-90A1-4555-8E22-DA55E5976F16/DavideAlloyTestApp.app/app.js:663\r\n{code}\r\n\r\nWithout LiveView, the error is not shown. Note that in index.js the error is not thrown.", "attachment": [], "flagged": false, "summary": "LiveView: cannot see Alloy.Globals in modules when using LiveView", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "SDK 3.1.2\r\nAlloy 1.2.1\r\nAppcelerator Studio", "comment": { "comments": [ { "id": "269307", "author": { "name": "mxia", "key": "mxia", "displayName": "Michael Xia", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Marking TIMOB-14903 a duplicate of this since this has a simpler reproducible case.\n", "updateAuthor": { "name": "mxia", "key": "mxia", "displayName": "Michael Xia", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-03T17:35:10.000+0000", "updated": "2013-09-03T17:35:10.000+0000" }, { "id": "269636", "author": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I found an easy fix for this by removing all the `var`s from the variable declarations in the alloy generated app.js this allows for my original fix to work. \n\nTo test do the following:\n\n1. disable the alloy plugin so it doesn't overwrite you app.js\n2. In your app.js generated by alloy remove `var` everywhere you see it.\n3. Run {code} $ ti build -p ios --liveview {code}\n\nThis should fix the error {code}[ERROR] TypeError: 'undefined' is not an object (evaluating 'Alloy.Globals'){code}", "updateAuthor": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-04T23:39:01.000+0000", "updated": "2013-09-04T23:39:01.000+0000" }, { "id": "269651", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "As stated in a conversation with [~csullivan] offline, we should in theory be able to do that, but I don't think I'm comfortable doing so on a patch release of Alloy. Given that there are known (and likely unknown) disparities between how global scope is handled on our runtimes/platforms, there seems a high change for some sort of regression to result from this, if not many. I think a change like this should likely wait for a minor release of Alloy, namely 1.3.0. If this is a course of action that we all agree on, a ticket should be logged to ALOY covering all the particulars and I can look into implementing it. After that comes the real task, which will be the extensive testing that will have to be done to ensure that everything still behaves as expected.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-05T00:26:12.000+0000", "updated": "2013-09-05T00:26:12.000+0000" }, { "id": "269686", "author": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We might actually want to fix this via liveview so it also covers non alloy apps that rely on this same global scope feature/bug. I am looking into the fix now. I will have to make sure to only remove the var from local lexical scope vars", "updateAuthor": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-05T12:15:48.000+0000", "updated": "2013-09-05T12:15:48.000+0000" }, { "id": "272745", "author": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~mxia] or [~tlukasavage] here is the pr on master https://github.com/appcelerator/liveview/pull/58 if one of you could please test to verify this does in fact solve the issue for you. I am unable to reproduce the above test case with this PR.", "updateAuthor": { "name": "csullivan", "key": "csullivan", "displayName": "Christian Sullivan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-24T23:12:09.000+0000", "updated": "2013-09-24T23:18:53.000+0000" }, { "id": "272761", "author": { "name": "mxia", "key": "mxia", "displayName": "Michael Xia", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes, I'll do the testing here.\n", "updateAuthor": { "name": "mxia", "key": "mxia", "displayName": "Michael Xia", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-25T03:44:52.000+0000", "updated": "2013-09-25T03:44:52.000+0000" }, { "id": "272899", "author": { "name": "mxia", "key": "mxia", "displayName": "Michael Xia", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Local testing looks good. Merged the PR.\n", "updateAuthor": { "name": "mxia", "key": "mxia", "displayName": "Michael Xia", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-09-25T22:50:07.000+0000", "updated": "2013-09-25T22:50:07.000+0000" }, { "id": "284192", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested Environment:\r\n\r\nAppcelerator Studio: 3.2.0.201312121648\r\nSDK:3.2.0.v20131212122847\r\nalloy: 1.3.0-cr\r\nacs: 1.0.10\r\nnpm: 1.3.2\r\ntitanium: 3.2.0-cr3\r\ntitanium-code-processor: 1.1.0-cr2\r\nXcode:5.0.2\r\nOS: Mac OSX 10.9\r\nDevice: iphone simulator(v7.0.3)\r\n\r\nCould see Alloy.Globals declared values in app.js while liveview enabled.\r\nHence verified and closing.", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-13T09:07:04.000+0000", "updated": "2013-12-13T09:07:04.000+0000" } ], "maxResults": 24, "total": 24, "startAt": 0 } } }