[TIMOB-2204] 1.5.0 regression: Errors accessing custom attributes off of tableViewRow objects (includes testcase)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:58:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 M02 |
Components | Android |
Labels | android, android_refactor, date, defect, javascript, refactor, regression |
Reporter | Robby |
Assignee | Don Thorp |
Created | 2011-04-15T03:13:26.000+0000 |
Updated | 2011-04-17T01:58:24.000+0000 |
Description
Seems to have happened recently. Here's a small test case. This same code works under 1.4.1 fine and iPhone fine:
var testDate = new Date();
var dateObj = {bla:"foo", testDateObj:testDate};
var noDateObj = {bla:"foo"};
var row = Ti.UI.createTableViewRow({
_dateObj: dateObj,
_noDateObj: noDateObj,
_testDate: testDate
});
Ti.API.info("works: " + row._noDateObj.bla);
Ti.API.info("fails: " + row._dateObj.bla); //Constructor for "Date" not found
Ti.API.info("fails: " + row._dateObj.testDateObj);
Ti.API.info("fails: " + row._testDate);
//Also, may be of interest:
//Ti.API.info("1: " + row._noDateObj); //"cannot find default value for object" ...is that what should happen?
//Ti.API.info("2: " + row._dateObj); //"cannot find default value for object" as well
Comments
- Robby 2011-04-15
One thing to note: Simple types like string and int work fine. More complex objects like Date seem to be the problem here.
- Robby 2011-04-15
It appears this bug may even affect things like accessing "label.font.fontSize" as well...
org.appcelerator.titanium.kroll.KrollCallback@45404e50], message: TypeError: Cannot read property "fontSize" from undefined (file:///android_asset/Resources/shared.js#733) [TRACE] E/KrollCallback( 1009): org.mozilla.javascript.EcmaError: TypeError: Cannot read property "fontSize" from undefined (file:///android_asset/Resources/shared.js#733)
Ouch!
- Marshall Culpepper 2011-04-15
(from [c640e0f9613717e649b361cc9a0a2b5690565c9b]) reference the Date constructor from the top level KrollBridge scope, and keep Date references around when converting to avoid new object creation when we unwrap. added test case to kroll test suite [#2204 state:fixed-in-qa] https://github.com/appcelerator/titanium_mobile/commit/c640e0f9613717e649b361cc9a0a2b5690565c9b"> https://github.com/appcelerator/titanium_mobile/commit/c640e0f96137...
- Thomas Huelbert 2011-04-15
confirmed on emulator (2.1) and G2 (2.2) using provided code sample Titanium SDK version: 1.5.0 (12/03/10 09:29 33c2058)