{ "id": "113580", "key": "AC-1800", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2014-01-02T06:30:58.000+0000", "created": "2013-04-30T15:56:18.000+0000", "labels": [ "android", "sdk3", "webview" ], "versions": [], "issuelinks": [], "assignee": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:40:41.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I am trying to run some JS inside of a webview on Android that fires events within my hybrid app. When using SDK 3.0.2 the evalJS runs fine, but switching to 3.1 (necessary for the persistent Android webview localStorage bugfix) stops it from working.\r\n\r\n{code}\r\nI believe it is caused by the 'window' JS object not being available.\r\n\r\nCode extract from Titanium JS file:\r\n\r\nAPI.fireEvent = function(name, data){\r\n if (data) {\r\n var js = 'window.fireCustomEvent(\"' + name + '\", ' + JSON.stringify(data) + ');';\r\n }else{\r\n var js = 'window.fireCustomEvent(\"' + name + '\");';\r\n }\r\n \r\n webView.evalJS(js);\r\n\r\n log(\"Call EvalJS on Webview: \" + js);\r\n \r\n};\r\n\r\nvar locale = Ti.Locale.getCurrentLocale();\r\nAPI.fireEvent('returnLocale', { locale: locale } );\r\n\r\nCode extract from webview JS file:\r\n\r\nwindow.fireCustomEvent = function(name, data){\r\n alert(\"Fire custom event \" + name);\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "'window' JS element not available to EvalJS on Android WebView, SDK 3.1.0", "creator": { "name": "pauleustice", "key": "pauleustice", "displayName": "Paul Eustice", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "pauleustice", "key": "pauleustice", "displayName": "Paul Eustice", "active": true, "timeZone": "Europe/London" }, "environment": "Mac OSX\r\nTitanium Studio, build: 3.1.0.201304151600\r\nTitanium SDK 3.1.0 GA", "comment": { "comments": [ { "id": "249632", "author": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello Paul,\r\nWhen submitting a bug report it is important that you provide a working test case that is able to be easily pasted into an app.js and when run, clearly shows the problem. This ensures a speedy review and thorough understanding of the problem on both sides. Would you mind editing the bug description to provide this test case? For future reference: https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report. A simple app.js that replicates the issue will suffice. Also be sure to wrap your code in {.code.} tags to ensure persistent formatting. (remove the dots)\r\nThank you for your cooperation,\r\nCarter", "updateAuthor": { "name": "clathrop", "key": "clathrop", "displayName": "Carter Lathrop", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-30T23:47:22.000+0000", "updated": "2013-04-30T23:47:59.000+0000" }, { "id": "249691", "author": { "name": "pauleustice", "key": "pauleustice", "displayName": "Paul Eustice", "active": true, "timeZone": "Europe/London" }, "body": "Hi Carter,\n\nThanks for the reply, and sorry for poor issue-raising etiquette. I've investigated further and my initial suspicion about it being caused by a lack of the 'window' js object wasn't correct. Distilling my code down to something simple enough to demonstrate the bug (it's a large and complex hybrid app) doesn't bare fruit at the moment unfortunately. The bug definitely occurs only on 3.1.0 and not 3.0.2 but at the moment I can't reduce it down to be of help.\n\nIf I find out anything more I'll update this issue.", "updateAuthor": { "name": "pauleustice", "key": "pauleustice", "displayName": "Paul Eustice", "active": true, "timeZone": "Europe/London" }, "created": "2013-05-01T09:21:25.000+0000", "updated": "2013-05-01T09:21:25.000+0000" }, { "id": "283150", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "We have not heard back from you since your last update in May. Not sure if this is still throwing error in your app. If so, please send us details so that we can take next necessary step to fix. If we don't hear back, we will assume the issue is no longer valid and close it. ", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-09T04:42:52.000+0000", "updated": "2013-12-09T04:42:52.000+0000" }, { "id": "286245", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "We have not been able to reproduce this issue with Titanium 3.2.0 GA SDK. If you are still running into the reported error, please let us know your test case. We sure will try to help. If we don't hear back, we will assume the issue has been resolved for you and the ticket can be closed.\r\n\r\nh5. Test Environment:\r\n\r\nMAC OS X 10.8.5\r\nTi SDK 3.2.0.GA\r\nIOS Simulator 7.0.3 \r\nTi CLI 3.2.0 \r\nAndroid 2.3.3, 4.2.2\r\n\r\nh5. Test Code\r\n\r\napp.js\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor : '#fff'\r\n});\r\n\r\nvar webview = Ti.UI.createWebView({\r\n\turl : 'test.html'\r\n});\r\n\r\nvar doc1 = \"Hello world\";\r\n\r\nwebview.addEventListener('beforeload', function(e) {\r\n\twebview.evalJS(\"var message='\" + doc1 + \"';\");\r\n\r\n});\r\n\r\nwin.add(webview);\r\n\r\nwin.open();\r\n\r\n{code}\r\n test.js\r\n\r\n{code}\r\n\r\n\t\r\n\r\n\t\r\n\t\r\n\r\n\t\t

\r\n\t\t\tClick this button\r\n\t\t

\r\n\r\n\t\t\r\n\r\n\t\t\r\n\t\r\n\r\n{code}\r\n\r\nThanks \r\n", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-30T12:13:55.000+0000", "updated": "2014-01-02T06:32:13.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }