{ "id": "122713", "key": "TIMOB-15781", "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": "15711", "description": "2013 Sprint 24", "name": "2013 Sprint 24", "archived": true, "released": true, "releaseDate": "2013-11-29" }, { "id": "15713", "description": "2013 Sprint 24 Core", "name": "2013 Sprint 24 Core", "archived": true, "released": true, "releaseDate": "2013-11-29" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-11-23T01:18:52.000+0000", "created": "2013-11-20T20:44:15.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "4.4", "android", "crash", "kitkat", "merge-3.1.4", "module_webview", "qe-closed-3.2.0", "qe-testadded", "triage", "webview" ], "versions": [], "issuelinks": [], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-03-03T18:30:13.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": "The following code crashes on Android 4.4, does not crash on Android 4.1.2.\r\nThe crash log is:\r\n11-20 22:32:31.861: E/TiExceptionHandler(9656): (main) [0,995] - Message: Uncaught Error: java.lang.Throwable: A WebView method was called on thread 'KrollRuntimeThread'. All WebView methods must be called on the same thread. (Expected Looper Looper{41e338c0} called on Looper{41e52348}, FYI main Looper is Looper{41e338c0})\r\n11-20 22:32:31.861: E/TiExceptionHandler(9656): (main) [0,995] - Source: Ti.API.debug(\"user agent: \" + $.webview.userAgent);\r\n\r\nindex.xml:\r\n{code}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nindex.js:\r\n{code}\r\nTi.API.debug('user agent: ' + $.webview.userAgent); // CRASH HERE ON KitKat\r\n\r\n$.index.open();\r\n{code}\r\n\r\nlib/test.html\r\n{code}\r\n\r\n\r\n\r\n\r\n\r\n\t

Hi there

\r\n\r\n\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "Android: KitKat crash when calling WebView method on wrong thread", "creator": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "subtasks": [], "reporter": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "environment": "SDK 3.1.4, Nexus 7 device, Android 4.4", "comment": { "comments": [ { "id": "280538", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "Prior to KitKat we're used to seeing this warning:\n11-21 16:06:29.515: W/webview_proxy(4299): java.lang.Throwable: Warning: A WebView method was called on thread 'KrollRuntimeThread'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.\n\nLooks like in KitKat they finally made good on their warning. :-(", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-11-21T14:09:36.000+0000", "updated": "2013-11-21T14:09:36.000+0000" }, { "id": "280573", "author": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified this for a non alloy & an alloy app & was able to reproduce the issue.\r\nRemoving the \"useragent\" property in Ti.API.debug does not throw the error.\r\n\r\nEnvironment:\r\nAppcel Studio : 3.2.0.201311200357\r\nTi SDK : 3.2.0.v20131119142443\r\nMac OSX : 10.8.5\r\nAlloy : 1.3.0\r\nCLI - 3.2.0-alpha", "updateAuthor": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-21T17:54:04.000+0000", "updated": "2013-11-21T18:19:58.000+0000" }, { "id": "280575", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "On a general note: In KitKat Google changed the WebView to Chrome, so there may be more issues:\r\nhttps://developers.google.com/chrome/mobile/docs/webview/overview", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-11-21T18:21:40.000+0000", "updated": "2013-11-21T18:21:40.000+0000" }, { "id": "280772", "author": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I was able to reproduce this issue today on a nexus 4 running android 4.3\n\nEnvironment:\nAppcel Studio : 3.2.0.201311211712\nTi SDK : 3.2.0.v20131119142443\nMac OSX : 10.8.5\nAlloy : 1.3.0\nCLI - 3.2.0-alpha", "updateAuthor": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-11-22T19:35:31.000+0000", "updated": "2013-11-22T19:35:31.000+0000" }, { "id": "280837", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Test case:\r\n\r\n{code}\r\n var webview = Titanium.UI.createWebView({url:\"/test.html\", height: 400, width: 400, top: 0});\r\n var window = Titanium.UI.createWindow();\r\n window.add(webview);\r\n window.open({modal:true});\r\n \tvar button = Ti.UI.createButton({\r\n \t\ttitle: 'webview tests',\r\n \t\theight: 200,\r\n \t\twidth: 200,\r\n \t\tbottom: 0\r\n \t});\r\n \twindow.add(button);\r\n \tbutton.addEventListener('click', function(){ \t\t\t\r\n \t\t\twebview.evalJS('console.log(\"test\")');\r\n \t\t\twebview.html = \"Test

Test

\";\r\n \t\t\tTi.API.debug('----------------------------------setHTML: ' + webview.html);\r\n \t\t\tTi.API.debug('----------------------------------user agent: ' + webview.userAgent);\r\n \t\t\twebview.userAgent = \"test\";\r\n \t\t\twebview.setBasicAuthentication('ayeung', 'password123');\r\n \t\t\twebview.canGoBack();\r\n \t\t\twebview.canGoForward();\r\n \t\t\twebview.goBack();\r\n \t\t\twebview.goForward();\r\n \t\t\twebview.reload();\r\n \t\t\twebview.stopLoading(true);\r\n \t\t\tTi.API.debug('----------------------------------pluginState: ' + webview.pluginState);\r\n \t\t\twebview.pause();\r\n \t\t\twebview.resume();\r\n \t\t\twebview.enableZoomControls = true;\r\n \t\t\tTi.API.debug('----------------------------------enableZoomControls: ' + webview.enableZoomControls);\r\n \t\t\twebview.release();\r\n \t\t\talert('DONE, Please check logs');\r\n \t});\r\n{code}\r\n\r\n1. Set your target SDK to API 18 or 19 by putting this in your tiapp.xml:\r\n{code}\r\n \r\n \r\n \r\n \r\n \r\n{code}\r\n\r\n2. Run the test case\r\n3. click the button\r\n4. verify that no warning/errors appear relating to webview method called from wrong thread.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-23T00:09:03.000+0000", "updated": "2013-11-23T00:18:28.000+0000" }, { "id": "280844", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/5016", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-23T00:24:56.000+0000", "updated": "2013-11-23T00:24:56.000+0000" }, { "id": "281197", "author": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed on:\nMac OSX 10.9 Mavericks\nTitanium Studio, build: 3.2.0.201311221859\nTitanium SDK, build: 3.2.0.v20131125103938\nCLI: 3.2.0-alpha\nAlloy: 1.3.0-alpha6\nAndroid Device: Nexus 5, 4.4 (KitKat)\n\nRan test case provided for Alloy and Classic projects.\nThe test.html page is located and displayed correctly on screen.\nNo error is thrown in console log.\nClosing.", "updateAuthor": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-25T19:30:10.000+0000", "updated": "2013-11-25T19:30:10.000+0000" }, { "id": "281374", "author": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "This should be backported to 3.1.X . This bug will crash a lot of apps as KitKat adoption ramps up.", "updateAuthor": { "name": "mokesmokes", "key": "mokesmokes", "displayName": "Mark Mokryn", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2013-11-26T09:07:30.000+0000", "updated": "2013-11-26T09:07:30.000+0000" }, { "id": "281400", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes, it is already scheduled for that. [~ayeung], can we prepare a backport for 3.1.X?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-26T14:40:21.000+0000", "updated": "2013-11-26T14:40:21.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }