{ "id": "91984", "key": "TIMOB-9387", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13408", "description": "Sprint 2012-12 API", "name": "Sprint 2012-12 API", "archived": true, "released": true, "releaseDate": "2012-06-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-06-18T12:54:41.000+0000", "created": "2012-05-18T07:56:57.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "module_window", "qe-testadded", "regression" ], "versions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13272", "description": "Release 2.0.1", "name": "Release 2.0.1", "archived": true, "released": true, "releaseDate": "2012-04-16" } ], "issuelinks": [], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-12-10T06:19:54.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h4.Problem\r\nA call to a window's close() method is ignored when it is executed from that window's \"open\" event handler.\r\n\r\nWorks in SDK 1.8.2\r\nBroken in SDK 2.0.2.GA\r\n\r\nh4.Expected behavior\r\nThe window should open for a moment, fully display, and then close.\r\n\r\nh4.Actual behavior\r\nThe window opens, shows, and stays there, as if no close() were called.\r\n\r\napp.js:\r\n{code}\r\nvar win1 = Ti.UI.createWindow({ \r\n backgroundColor:'#fff',\r\n exitOnClose:true,\r\n navBarHidden:false\r\n});\r\n\r\nvar label1 = Ti.UI.createLabel({\r\n color:'#999',\r\n text:'I am Window 1',\r\n font:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n textAlign:'center',\r\n width:Ti.UI.SIZE,\r\n top:100\r\n});\r\nwin1.add(label1);\r\n\r\nvar btn1 = Ti.UI.createButton({\r\n title:'Open 2nd window',\r\n width:Ti.UI.SIZE,\r\n left:10,\r\n top:175\r\n});\r\nfunction DoBtn1Click()\r\n{\r\n var win2=Ti.UI.createWindow({\r\n url:'win2.js',\r\n layout:'vertical',\r\n exitOnClose:false,\r\n navBarHidden:false\r\n });\r\n win2.open();\r\n}\r\nbtn1.addEventListener('click',DoBtn1Click);\r\nwin1.add(btn1);\r\nwin1.open();\r\n{code}\r\n\r\nh6. \r\n\r\nwin2.js:\r\n{code}var win2=Ti.UI.currentWindow;\r\n\r\nTi.API.info('setting open event handler');\r\nwin2.addEventListener('open',Win2Load);\r\nfunction Win2Load()\r\n{\r\n Ti.API.info('open event handler executing');\r\n win2.close();\r\n Ti.API.info('open event handler done');\r\n}\r\n\r\nvar label2 = Ti.UI.createLabel({\r\n color:'red',\r\n text:'I am Window 2.\\nIf you can read this, then the close() failed.',\r\n font:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n textAlign:'center',\r\n width:Ti.UI.SIZE,\r\n top:100\r\n});\r\nwin2.add(label2);\r\n\r\nTi.API.info('end of js code');\r\n{code}\r\n\r\nh2. Additional notes\r\nBy replacing:\r\n\r\n{code}\r\nwin2.close();\r\n{code}\r\n\r\nwith this:\r\n\r\n{code}\r\nsetTimeout(function() {\r\n win2.close();\r\n}, 500);\r\n{code}\r\n\r\nThe window closes correctly also in 2.0.2.GA", "attachment": [], "flagged": false, "summary": "Android: close() is ignored when executed from an \"open\" event handler", "creator": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "- Android 2.2 emulator\r\n- Titanium Mobile SDK 2.1.0.v20120416160358\r\n- Titanium Studio 2.0.1.201204132053\r\n\r\n", "comment": { "comments": [ { "id": "198523", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Another test case: \r\n{code}\r\nvar win1 = Ti.UI.createWindow({ \r\n backgroundColor:'#fff',\r\n exitOnClose:true,\r\n navBarHidden:false\r\n});\r\n \r\nvar label1 = Ti.UI.createLabel({\r\n color:'#999',\r\n text:'I am Window 1',\r\n font:{fontSize:20,fontFamily:'Helvetica Neue'},\r\n textAlign:'center',\r\n width:Ti.UI.SIZE,\r\n top:100\r\n});\r\nwin1.add(label1);\r\n \r\nvar btn1 = Ti.UI.createButton({\r\n title:'Open 2nd window',\r\n width:Ti.UI.SIZE,\r\n left:10,\r\n top:175\r\n});\r\nfunction DoBtn1Click()\r\n{\r\n var win2=Ti.UI.createWindow({\r\n //url:'win1.js',\r\n layout:'vertical',\r\n exitOnClose:false,\r\n navBarHidden:false\r\n });\r\n \r\n win2.addEventListener('open',Win2Load);\r\n function Win2Load()\r\n {\r\n win2.close();\r\n }\r\n win2.open();\r\n}\r\nbtn1.addEventListener('click',DoBtn1Click);\r\nwin1.add(btn1);\r\nwin1.open(); \r\n{code}\r\n\r\n1. Click on button. You should see another window opens for a split second then closes.", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-14T12:15:59.000+0000", "updated": "2012-06-14T12:17:18.000+0000" }, { "id": "199002", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue\r\n\r\nTested with Ti Studio build 2.1.0.201206172244\r\nTi Mobile SDK2.1.0.v20120618134156 hash r00905cd0\r\nOSX Lion 10.7.3\r\nNexus S OS 4.0.4\r\n\r\nThe expected behavior is shown", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-18T16:06:52.000+0000", "updated": "2012-06-18T16:06:52.000+0000" }, { "id": "283503", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4967\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T06:19:54.000+0000", "updated": "2013-12-10T06:19:54.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }