[AC-3033] Android: CommonJS brakes when trying to use global scope reference inside exported function
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2011-12-21T19:56:26.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Ivan Skugor |
Assignee | Shak Hossain |
Created | 2011-11-16T04:19:57.000+0000 |
Updated | 2016-03-08T07:48:04.000+0000 |
Description
Hi.
See this simple code:
//app.js
var testModule = require('test');
testModule.doTest();
//test.js
var moduleScope = this;
exports.doTest = function() {
Ti.API.debug(moduleScope);
};
It brakes the app and, IMHO, it shouldn't brake in a way it brakes now ("StackOverflowError"), in worst case "moduleScope" should throw "ReferenceError" ("moduleScope" is not defined).
I'm not sure how CommonJS and module scope behaves, but this also could be legal code and it shouldn't brake at all.
Ah yes, I forgot about Q/A link: http://developer.appcelerator.com/question/128188/commonjs-brakes-when-trying-to-use-global-scope-reference-inside-function
Ivan, the test case is now not showing the error as of Titanium 1.8.0.1 (2011/12/17 19:53 c903964) + Android APIs 2.2. This could have been fixed in the meantime. See logcat output below.
I'll close this for now, but reopen it if you still see the problem.
I can confirm that it has been fixed. Thanks.