[TIMOB-2642] Android : Kroll get method for properties does not work correctly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:59:41.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M02 |
Components | Android |
Labels | android, defect, kroll, release-1.6.0 |
Reporter | Opie Cyrus |
Assignee | Opie Cyrus |
Created | 2011-04-15T03:25:38.000+0000 |
Updated | 2011-04-17T01:59:41.000+0000 |
Description
Kroll get method returns undefined due to the "get" name check in KrollBindingUtils.java : createAccessorMethod never actually being passed when a get method is invoked. The name that is checked for either "get" or "set" is actually the name of the property without either of the prefixed modifiers.
The "get" check always fails so the execution passes to the "set" block and so set calls work correctly. When a get call is made, a null value is returned because the set logic is executed but no argument is passed in for a new value like a real set call would contain.
Attachments
File | Date | Size |
---|---|---|
app.js | 2011-04-15T03:25:38.000+0000 | 668 |
(from [717ec1ad88b14e60a630c6aaa23bf2172627e208]) [#2642 state:fixed-in-qa] Modified Kroll property binding so get methods will return actual values
createAccessorMethod now takes a boolean isSet argument to specifc if the accessor request is for the get or set method. Value returned is not the actual stored value rather than null.
https://github.com/appcelerator/titanium_mobile/commit/717ec1ad88b14e60a630c6aaa23bf2172627e208"> https://github.com/appcelerator/titanium_mobile/commit/717ec1ad88b1...
Please verify the fix via the attached test app. Basically, if you are able to set the property via both methods made available in the test app then the fix is good. The issue was with the default kroll generated get methods. So before the win.getTitle()call would fail.
Verified on G1/1.6 and Nexus One/2.2.1 using build #e1cb22a
Used this modified version of app.js. It wasn't using the property.