{ "id": "135198", "key": "AC-756", "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": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2015-09-15T04:07:01.000+0000", "created": "2014-08-22T18:04:12.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:37:01.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "I'm using social.js to make integrated social-network login to my app. Apparently this line in social.js (line 381 or so) prevented the twitter login to behave as it should:\r\n\r\nvar response = e.source.evalJS('(p = document.getElementById(\"oauth_pin\")) && p.innerHTML;');\r\n\r\nI managed to work it out by removing the semicolon in the expression to eval.", "attachment": [], "flagged": false, "summary": "WebView.evalJS does not return the correct value when the expression is suffixed by semicolon", "creator": { "name": "loenk2x", "key": "loenk2x", "displayName": "Titus Wiguno", "active": true, "timeZone": "Asia/Jakarta" }, "subtasks": [], "reporter": { "name": "loenk2x", "key": "loenk2x", "displayName": "Titus Wiguno", "active": true, "timeZone": "Asia/Jakarta" }, "environment": null, "comment": { "comments": [ { "id": "320087", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "hi,\r\n\r\nI think you don't need a semicolon in string, Like the example in Document. Ref: [http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-method-evalJS]\r\n\r\nRegards,\r\nShuo", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-08-25T06:40:13.000+0000", "updated": "2014-08-25T06:40:13.000+0000" }, { "id": "361667", "author": { "name": "rmitro", "key": "rmitro", "displayName": "Rakhi Mitro", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hello,\r\nI have tested this issue in updated environment. [evalJS |http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.WebView-method-evalJS] function evaluates a JavaScript expression inside the context of the web view and optionally, returns a result.The JavaScript expression must be passed in as a I think you don't need a semicolon in string. This is not a bug for latest Appcelerator version. Not sure if this is still an issue for you. It doesn't appear to be based on our latest tests. Please let me know how I can help further. \r\n\r\n*Test Environments:*\r\n\r\nCLI Version :4.0.1\r\n\r\nTitanium SDK Version:4.1.0.GA\r\nAndroid: Google Galaxy Nexus:4.1.1 - API 16 - 720x1280\r\nAppc Studio: Appcelerator Studio, build: 4.1.1.201507141126\r\nAlloy: 1.7.3\r\n\r\n\r\n\r\n*Test code:*\r\n\r\n*app.js*\r\n\r\n{code}\r\n\r\n var win = Titanium.UI.createWindow();\r\n var webview = Ti.UI.createWebView({\r\n url: 'test.html'\r\n });\r\n win.add(webview);\r\n \r\n webview.addEventListener('load',function(e) {\r\n \r\n var response = e.source.evalJS('(p = document.getElementById(\"oauth_pin\")) && p.innerHTML;'); \r\n var response2 = e.source.evalJS('(p = document.getElementById(\"oauth_pin\")) && p.innerHTML');\r\n Ti.API.info( \"# of response with semicolon -> \" + response.length );\r\n Ti.API.info( \"# of of response without semicolon -> \" + response2.length );\r\n \r\n });\r\n \r\n win.open();\r\n \r\n{code}\r\n\r\n*test.html*\r\n\r\n{code}\r\n\r\n\r\n\r\n\r\n\r\n

My First Heading

\r\n\r\n

My first paragraph.

\r\n\r\n\r\n\r\n\r\n{code}\r\n\r\n\r\n\r\n*Test Steps:*\r\n\r\n# Create web view on app.js .\r\n# Create a html page text.html .\r\n# Add load event listener on window\r\n# Call evalJS function into load event. \r\n# Run the project\r\n\r\n\r\n*Test Result:*\r\nProject builds successfully .WebView.evalJS does return the correct value when the expression is not suffixed by semicolon and with semicolon it works as expected.\r\n\r\n*Ti logs:*\r\n\r\n[WARN] : EGL_genymotion: eglSurfaceAttrib not implemented\r\n[INFO] : # of response with semicolon -> 19\r\n[INFO] : # of of response without semicolon -> 19\r\n[INFO] : APSAnalyticsService: Analytics Service Started\r\n[INFO] : APSAnalyticsService: Stopping Analytics Service\r\n\r\n\r\nThanks", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-08-30T06:10:48.000+0000", "updated": "2015-09-15T04:06:51.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }