Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13606] Android: propertyAccessors lost after closing main activity

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-07-13T18:29:07.000+0000
Affected Version/sRelease 3.0.2
Fix Version/sn/a
ComponentsAndroid, Core
Labelsn/a
ReporterJeff English
AssigneeEric Merriman
Created2013-04-17T20:38:54.000+0000
Updated2017-07-13T18:29:07.000+0000

Description

Android modules that declare properties using the 'propertyAccessors' annotation will lose the ability for javascript to access those properties after the main activity is closed under certain circumstances. Custom properties are not affected by this issue. I have been able to reproduce this with a very simple module: Attached is a reproduction case. It's a simple module that declares a proxy ('exampleProxy') and that proxy has a propertyAccessor ('name') as well as a custom property ('phone'). The app.js in the example folder demonstrates the issue: 1. Unzip the module 2. Build the module ('ant') 3. Create a new Titanium application in Studio 4. Copy the app.js from the module's example folder into your application 5. Run the application 6. Notice that the label displays 'Jeff 555-1212'. The 'Jeff' comes from the propertyAccessor and the '555-1212' comes from the custom property. 7. Hit the Android Back button (the activity closes but the process is still active) 8. Tap on the application in the Android app launcher 9. Notice that the label displays 'undefined 555-1212'. You can also see the 'E/Proxy ( 2221): Unable to lookup Proxy.prototype.getProperty' error message in the log. For further weirdness, uncomment lines 29-31 in the app.js file and re-run steps 5-8 again. This time you will notice that everything works correctly. The only difference here is that a 2nd instance of the proxy is being created with a call from JS rather than the one that is being created internally. A couple of observations: 1. The onStop and onDestroy methods are getting called when the activity closes (check the messages output to the log file) 2. The process is still active after closing the activity 3. On the 2nd launch of the main activity you will notice a log message that it is registering an existing module again even though the module was supposedly destroyed. Probably expected behavior, but perhaps not. I've tried a number of different things but have not been able to change this behavior. I also tried 'exitOnClose: true' and 'exitOnClose: false' with no change in behavior. I've confirmed that the module is creating the proxy and calling setProperty on the 'name' property, but for some reason the 'name' property does not make its way back up to javascript land (ie. the application). Other properties that are defined with Kroll.getProperty are still accessible. It's just those defined in the propertyAccessors that are getting lost. Thinking that perhaps something in the way propertyAccessors are bound is not occurring the 2nd time the module is loaded by the process.

Attachments

FileDateSize
property.zip2013-04-17T20:38:54.000+000015040

Comments

  1. Jeff English 2013-04-17

    Custom properties do not exhibit this issue.
  2. Lee Morris 2017-07-13

    Closing ticket due to time passed and lack of progress for a number of years. Please open a new ticket if there are any problems.

JSON Source