Project: titanium
Issue TIMOB-15009: LiveView: cannot see Alloy.Globals in modules when using LiveView
h2. Problem description When using LiveView, the global variable Alloy.Globals is not defined in modules. Disabling LiveView would not throw the error. h2. Code to reproduce Create an Alloy app with this code: index.js {code} var win = Ti.UI.createWindow({ backgroundColor:'#ffffff' }); Ti.API.info(Alloy.Globals.test); var Test = require('test'); new Test(); win.open(); {code} lib/test.js {code} function Test() {	Ti.API.info(Alloy.Globals.test); }; module.exports = Test; {code} Add the global variable in alloy.js: {code} Alloy.Globals.test = "TEST"; {code} h2. Actual behavior When running the app with LiveView on, the following error is thrown: {code} [INFO] : [LiveView] Error Evaluating app.js @ Line: 2 [ERROR] : TypeError: 'undefined' is not an object (evaluating 'Alloy.Globals') [ERROR] : File: app.js [ERROR] : Line: 2 [ERROR] : SourceId: 323744256 [ERROR] : Backtrace: [ERROR] : #0 Controller() at :21 [ERROR] : #1 () at :214 [ERROR] : #2 anonymous() at :15 [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 [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 [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 [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 [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 {code} Without LiveView, the error is not shown. Note that in index.js the error is not thrown.
Story points: 13