{ "id": "100659", "key": "TIMOB-10837", "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": "15939", "description": "2014 Sprint 07", "name": "2014 Sprint 07", "archived": true, "released": true, "releaseDate": "2014-04-11" }, { "id": "15940", "description": "2014 Sprint 07 SDK", "name": "2014 Sprint 07 SDK", "archived": true, "released": true, "releaseDate": "2014-04-11" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": null, "resolutiondate": null, "created": "2012-09-09T14:56:25.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "core", "module_webview", "qe-3.4.1", "qe-closed-3.3.0", "qe-testadded" ], "versions": [ { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" } ], "issuelinks": [ { "id": "40882", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "136051", "key": "TIMOB-17613", "fields": { "summary": "Unable to execute javascript code using evalJS on Android with SDK 3.3.0.GA", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2018-02-28T20:03:39.000+0000", "status": { "description": "This issue was once resolved, but the resolution was deemed incorrect. From here issues are either marked assigned or resolved.", "name": "Reopened", "id": "4", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Problem\r\n\r\nWhen trying to evalJS a string with code that starts with `var` it doesn't work and I get this error message in Console:\r\n\r\n{code}\r\n[INFO][TiWebChromeClient.console( 1229)] (main) [493,23278] Uncaught SyntaxError: Unexpected token var (1:http://www.google.com/)\r\n{code}\r\n\r\nh2. Expected Behavior\r\n\r\nShould not throw and instead replace the site contents with \"test\". Works on iOS.\r\n\r\n\r\nh2. Test case\r\n\r\n\r\n{code:lang=javascript|title=app.js}\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar webView = Ti.UI.createWebView({\r\n\turl: 'http://google.com',\r\n\ttop: 0,\r\n\tbottom: 0,\r\n\theight: Ti.UI.FILL,\r\n});\r\n\r\nwin.add(webView);\r\n\r\nwin.open({\r\n modal: true,\r\n animated: false\r\n});\r\n\r\nwebView.addEventListener('load', function() {\r\n\twebView.evalJS('var a=\"test\";document.body.innerHTML=a'); // doesn't works\r\n\t//webView.evalJS('document.body.innerHTML=\"test\"'); // works\r\n});\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: webView throws on evalJS when string starts with `var`", "creator": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "subtasks": [], "reporter": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "environment": "Titanium Studio, build: 2.1.2.201208301612\r\nTitanium SDK version: 2.1.2 (08/24/12 14:46 ed7f777)\r\nAndroid SDK 4.1 Google API on WVGA800 emulator", "comment": { "comments": [ { "id": "240340", "author": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "body": "bump", "updateAuthor": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "created": "2013-03-01T09:42:08.000+0000", "updated": "2013-03-01T09:42:08.000+0000" }, { "id": "267224", "author": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "body": "bump", "updateAuthor": { "name": "mofle", "key": "mofle", "displayName": "Sindre Sorhus", "active": true, "timeZone": "Europe/Oslo" }, "created": "2013-08-19T22:25:03.000+0000", "updated": "2013-08-19T22:25:03.000+0000" }, { "id": "287820", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "\r\nIf passed in value is not an expression but a statement block, extract the last statement and add prepend 'return'.\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5210", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-01-11T14:15:33.000+0000", "updated": "2014-01-11T14:15:33.000+0000" }, { "id": "302680", "author": { "name": "prastogi", "key": "prastogi", "displayName": "Pragya Rastogi", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Verified the fix using:\r\nOSX: 10.9.2\r\nXcode: 5.1.1\r\nStudio - 3.3.0.201404251359\r\nSDK - 3.3.0.v20140425191906\r\nacs-1.0.14\r\nalloy-1.4.0-dev\r\nnpm-1.3.2\r\ntitanium-3.3.0-dev\r\ntitanium-code-processor-1.1.1-beta1\r\nDevice: LG-P970 (4.0.4) & ipod touch 2 (7.1)", "updateAuthor": { "name": "prastogi", "key": "prastogi", "displayName": "Pragya Rastogi", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-04-28T08:32:39.000+0000", "updated": "2014-04-28T08:32:39.000+0000" }, { "id": "322237", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Based on the regressions caused by this issue, reopening. We need to find a solution with less side effects.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-07T22:04:07.000+0000", "updated": "2014-09-07T22:04:07.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }