{ "id": "64002", "key": "TIMOB-3370", "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": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "15273", "description": "2013 Sprint 05 API", "name": "2013 Sprint 05 API", "archived": true, "released": true, "releaseDate": "2013-03-11" }, { "id": "15646", "description": "2013 Sprint 18", "name": "2013 Sprint 18", "archived": true, "released": true, "releaseDate": "2013-09-06" }, { "id": "15690", "description": "2013 Sprint 18 API", "name": "2013 Sprint 18 API", "archived": true, "released": true, "releaseDate": "2013-09-06" }, { "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-09-06T16:51:36.000+0000", "created": "2011-04-15T03:43:23.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "event", "load", "module_webview", "parity", "qe-testadded", "webview" ], "versions": [], "issuelinks": [ { "id": "26195", "type": { "id": "10011", "name": "Includes", "inward": "is included by", "outward": "includes" }, "inwardIssue": { "id": "105162", "key": "TIMOB-11810", "fields": { "summary": "Ti API: Address common WebView deficiencies", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "6", "description": "gh.issue.epic.desc", "name": "Epic", "subtask": false } } } }, { "id": "15765", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "87972", "key": "TIMOB-8018", "fields": { "summary": "Android: WebView: beforeload event fires twice if url is invalid", "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": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "15758", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "87967", "key": "TIMOB-8013", "fields": { "summary": "iOS: WebView: beforeload event fires twice if URL is valid", "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": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-25T08:49:14.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "I am using the following code to listen for the load event of a WebView:\r\n\r\n{code}\r\n webView.addEventListener('load', function(evt) {\r\n mapView.evalJS(\"alert('\" + evt.url + \"');\");\r\n });\r\n{code}\r\n\r\nWhen running this in the iPhone simulator, the load event appears to be getting fired 10 times. This listener is triggered 10 times and thus I get 10 alert's that pop up after the WebView has loaded.\r\n\r\n*Update: The original PR created a side effect of if the remote webpage loaded uses JavaScript to POST a form to itself (i.e. the same URL), the WebView load event never fires.*", "attachment": [], "flagged": false, "summary": "iOS: WebView: fires load event multiple times", "creator": { "name": "timothyf", "key": "timothyf", "displayName": "timothyf", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "timothyf", "key": "timothyf", "displayName": "timothyf", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "186502", "author": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Bug still occurs on both iPhone/iPad. Load event is fired twice.\r\n\r\nDoes not occur on Android (load event fires once correctly).\r\n\r\nSDK: 1.8.2 githash=59b3a90s, 2.0.0.v20120314120250\r\nStudio: 2.0.0.201203121914\r\nOS: Snow Leopard\r\nDevices Tested: iPad 4.3.5, iPhone Simulator 5.0\r\n\r\nSteps to Reproduce:\r\n\r\n1. Run code, press 'Open Google'.\r\n\r\n{code:title=app.js}\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor:'blue'\r\n});\r\n\r\nvar buttonGoogle = Ti.UI.createButton({\r\n\ttitle:'Open Google',\r\n\ttop:'20%',\r\n\theight:'30%',\r\n\tleft:'10%',\r\n\tright:'10%'\r\n});\r\n\r\nbuttonGoogle.addEventListener('click', function(){\r\n\tvar webView = Ti.UI.createWebView({\r\n\t\t\turl:'http://www.google.com'\r\n\t\t});\r\n\t\r\n\twebView.addEventListener('load', function(){\r\n\t\talert('load: ' + webView.url);\r\n\t\t});\r\n\t\r\n\twebView.addEventListener('beforeload', function(){\r\n\t\talert('beforeload: ' + webView.url);\r\n\t\t});\r\n\t\t\r\n\twebView.addEventListener('error', function(){\r\n\t\talert('error: ' + webView.url);\r\n\t\t});\r\n\t\t\r\n\twin.add(webView);\r\n\t\r\n\tvar button = Ti.UI.createButton({\r\n\t\ttitle:'Close',\r\n\t\tright:0,\r\n\t\tbottom:0,\r\n\t\theight:'10%',\r\n\t\twidth:'20%'\r\n\t});\r\n\t\r\n\tbutton.addEventListener('click', function(){\r\n\t\twin.remove(webView);\r\n\t});\r\n\t\r\n\twebView.add(button);\r\n});\r\n\r\nwin.add(buttonGoogle);\r\n\r\nvar buttonInvalid = Ti.UI.createButton({\r\n\ttitle:'Open Invalid URL',\r\n\tbottom:'20%',\r\n\theight:'30%',\r\n\tleft:'10%',\r\n\tright:'10%'\r\n});\r\n\r\nbuttonInvalid.addEventListener('click', function(){\r\n\tvar webView = Ti.UI.createWebView({\r\n\t\t\turl:'http://xxx'\r\n\t\t});\r\n\t\r\n\twebView.addEventListener('load', function(){\r\n\t\talert('load: ' + webView.url);\r\n\t\t});\r\n\t\r\n\twebView.addEventListener('beforeload', function(){\r\n\t\talert('beforeload: ' + webView.url);\r\n\t\t});\r\n\t\t\r\n\twebView.addEventListener('error', function(){\r\n\t\talert('error: ' + webView.url);\r\n\t\t});\r\n\t\t\r\n\twin.add(webView);\r\n\t\r\n\tvar button = Ti.UI.createButton({\r\n\t\ttitle:'Close',\r\n\t\tright:0,\r\n\t\tbottom:0,\r\n\t\theight:'10%',\r\n\t\twidth:'20%'\r\n\t});\r\n\t\r\n\tbutton.addEventListener('click', function(){\r\n\t\twin.remove(webView);\r\n\t});\r\n\t\r\n\twebView.add(button);\r\n});\r\n\r\nwin.add(buttonInvalid);\r\n\r\nwin.open();\r\n{code}\r\n\r\nExpected Result:\r\n\r\nOnly one load event should fire.\r\n\r\nActual Result:\r\n\r\nTwo load events fire.", "updateAuthor": { "name": "dhyde", "key": "dhyde", "displayName": "Dustin Hyde", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-14T14:26:39.000+0000", "updated": "2012-03-14T14:26:39.000+0000" }, { "id": "192036", "author": { "name": "plainprograms", "key": "plainprograms", "displayName": "James Thompson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I am seeing this same issue on iOS under 1.8.2. It appears to only happen under certain conditions though. Attempting to isolate those conditions, thinking it may be the result of DOM changes within the WebView content.", "updateAuthor": { "name": "plainprograms", "key": "plainprograms", "displayName": "James Thompson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-04-20T10:55:31.000+0000", "updated": "2012-04-20T10:55:31.000+0000" }, { "id": "239883", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/3909", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-02-26T23:02:48.000+0000", "updated": "2013-02-26T23:02:48.000+0000" }, { "id": "242200", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with:\r\nSDK: 3.1.0.v20130313215655\r\nStudio: 3.0.2.201302191606\r\nDevice: iPad2(v 5.1)\r\nOS: OSX 10.7.5\r\n\r\nload event is fired only once as expected.", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-03-14T09:53:58.000+0000", "updated": "2013-03-14T09:53:58.000+0000" }, { "id": "248194", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "This created an equally bad side-effect. If the remote webpage loaded uses JavaScript to POST a form to itself (i.e. the same URL), the WebView load event never fires.", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2013-04-18T18:30:15.000+0000", "updated": "2013-04-18T18:30:15.000+0000" }, { "id": "248196", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "Looking at the PR, I'm guessing that any form of navigating back to the same URL probably will have the same issue.", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2013-04-18T18:35:09.000+0000", "updated": "2013-04-18T18:35:09.000+0000" }, { "id": "252148", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~vduggal] Can you please investigate?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-15T19:43:42.000+0000", "updated": "2013-05-15T19:43:42.000+0000" }, { "id": "252155", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Probably should check for navigationType in shouldStartLoad delegate method and clear out the history is nav type is anything other than UIWebViewNavigationTypeOther", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-05-15T19:59:38.000+0000", "updated": "2013-05-15T19:59:38.000+0000" }, { "id": "252239", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "I think that makes sense. The simplest test would be to create a HTML form that posts to itself. The next step up would be a link that uses javascript to reload a page.", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2013-05-16T02:53:35.000+0000", "updated": "2013-05-16T02:53:35.000+0000" }, { "id": "258939", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "Marked as resolved fixed, but without any additional code changes or tickets? I think this one slipped past QA.", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2013-06-21T05:47:14.000+0000", "updated": "2013-06-21T05:47:14.000+0000" }, { "id": "262352", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It appears we didn't resolve the secondary issue brought up later. Reopening and scheduling for 3.2.0", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-07-18T18:39:11.000+0000", "updated": "2013-09-06T16:42:40.000+0000" }, { "id": "266179", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Issue occurs on the following environment:\n\nSDK: 3.1.2.v20130809141556\nAppcelertaor Studio: 3.1.2.201308091728\nOS: OSX 10.8.4\nDevice: iPhone5(v 6.1.4)\nXcode: 4.6.3", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-08-13T09:24:56.000+0000", "updated": "2013-08-13T09:24:56.000+0000" }, { "id": "269850", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "Wait, how could this possibly have been fixed without any code changes?", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2013-09-05T22:29:22.000+0000", "updated": "2013-09-05T22:29:22.000+0000" }, { "id": "270751", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "Is there any workaround to the secondary problem that Shannon brought up? Any method of the webview that I can call to \"reset\" things so that the load event will refire when the javascript reloads the same page? I'm using 3.1.2.GA.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2013-09-11T14:52:37.000+0000", "updated": "2013-09-11T14:52:37.000+0000" }, { "id": "275115", "author": { "name": "prastogi", "key": "prastogi", "displayName": "Pragya Rastogi", "active": true, "timeZone": "Asia/Kolkata" }, "body": "Tested With:\r\nOSX: 10.8.5\r\nXcode:5.0\r\nAppcelerator Studio: 3.2.0.201310112258\r\nSDK:3.2.0.v20131014204636\r\nacs:1.0.7\r\nalloy:1.2.2\r\nnpm:1.3.2\r\ntitanium:3.2.0\r\ntitanium-code-processo:1.0.3\r\nDevice: iPod touch2 (viOS7)", "updateAuthor": { "name": "prastogi", "key": "prastogi", "displayName": "Pragya Rastogi", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2013-10-15T11:14:36.000+0000", "updated": "2013-10-15T11:14:36.000+0000" }, { "id": "277233", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~bitshftr] Following up here. Did a second ticket get created for the additional problem you were inquiring about?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-29T20:15:08.000+0000", "updated": "2013-10-29T20:15:08.000+0000" }, { "id": "277245", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "Ingo, are you talking about this: \"If the remote webpage loaded uses JavaScript to POST a form to itself (i.e. the same URL), the WebView load event never fires.\" ? If so, then no, I was assuming that this was part of the 3.2.0 fix for this ticket. Otherwise, please remind me what the \"additional problem\" was.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2013-10-29T20:48:56.000+0000", "updated": "2013-10-29T20:48:56.000+0000" }, { "id": "281113", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil test case added.\nPR link:\nhttps://github.com/appcelerator/titanium_mobile/pull/5020", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-25T08:49:14.000+0000", "updated": "2013-11-25T08:49:14.000+0000" } ], "maxResults": 22, "total": 22, "startAt": 0 } } }