[TIMOB-6372] Android: Back button not closing windows in CommonJS modules
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2011-12-05T13:00:52.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | n/a |
Components | Android |
Labels | branch-v8, dr-list |
Reporter | Matthew Apperson |
Assignee | Allen Yeung |
Created | 2011-11-29T19:29:13.000+0000 |
Updated | 2012-01-11T13:32:57.000+0000 |
Description
Description:
On android app builds and runs correctly, but after the first click, the app ceases to respond to further clicks. This does not occur on Win 7 or Linux 10.04.
Steps to reproduce:
1) Create a new mobile project and replace contents of resources dir with contents of attached zip
2) Launch in android emulator
3) Click the button
4) Click "back" hardware button
5) Click the button again
Result:
App does nothing with further clicks of the button
Expected:
Each button click opens the second window
Note:
If you add an event listener like so:
detailContainerWindow.addEventListener('android:back', function(e) {
detailContainerWindow.close();
});
The code works as expected
Attachments
File | Date | Size |
---|---|---|
Resources 2.zip | 2011-11-29T19:29:13.000+0000 | 739177 |
Issue already resolved due to a fix in an unknown ticket
Hello. It seems that this issue still exists and is not directly connected to CommonJS. The problem seem to exist when heavyweight window is created and "android:back" event listener is attached to it. Here is my test case:
Environment on which I'm testing on: * Titanium SDK version: 1.8.0.1 (12/08/11 23:42 00e9d8f...) * Android 3.1 (Thinkpad tablet) * Windows XP * Titanium Studio, build: 1.0.7.201112080131 To see the issue, you need to run this example, click on button and then press hardware back-button. You should see that green window didn't close. Furthermore, in DDMS output you should see: undefined function [object global] That is second issue that I noticed, "this" inside window's event handler is wrongly set to global object instead of window object. Hope this clears this issue. If you have questions, please let me know. Cheers.
Further investigation has shown that there exists one more issue - window "close" event is being fired twice. Modified test case looks like this:
The output in DDMS: Close event [object global] Close event [object TiBaseWindow] So, as you can see, "close" event is fired twice and in first case "this" is set to incorrect value. Also, if following line is added to window's "close" event handler:
internal Titanium workings are revealed, which shouldn't be desirable. Cheers.