[TIMOB-26325] Android: Ti.UI.WebView not firing events in 7.x
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-08-21T20:06:07.000+0000 |
Affected Version/s | Release 7.0.0, Release 7.1.1, Release 7.3.0, Release 7.2.1 |
Fix Version/s | Release 7.3.1 |
Components | Android |
Labels | android, events, issue, webview |
Reporter | kedomuz |
Assignee | Christopher Williams |
Created | 2018-08-20T21:20:29.000+0000 |
Updated | 2018-08-23T09:41:35.000+0000 |
Description
Setting custom UserAgent for WebView (Android) causes WebView to not fire events (ex. load, beforeLoad and etc.).Using default UserAgent - expected behaviour, events firing.
Hello, Thanks for sharing with us. Are you experiencing this in all android devices? It would be great if you can share a simple test case to reproduce this on our end.
Also, is this happening on SDK 7.3.0 only? Could you do me a favor and check if it worked on 7.2.0.GA? Moving to TIMOB already.
Cannot edit this issue description anymore, message appeared - no permissions. Latest SDK i used 6.2.2 GA, as it was very stable, now just installed 7.3.0 GA, i have no 7.2.0 GA. Example for this issue:
This is a regression of [this commit](https://github.com/appcelerator/titanium_mobile/commit/ff006d7bd16d61fcca3aefee67cb28970c05a5e6) and is happening since 7.0.0 (via TIMOB-25462), assigning to [~gmathews].
This is certainly related to TIMOB-25462:
I think this "hack" is causing the bug experienced here. I think the important thing here is: - The user agent should be set earlier in processProperties, before we attempt to set the URL/content to avoid a reload. (Maybe it doesn't matter? It's not the use case triggered here) - If the developer sets the user agent after the web view is up, I think it makes sense to reload and potentially get 2 load/beforeLoad events. Websites can offer different content based on a user agent, which is likely why Chromium does the reload. So, to avoid the double events, developers should set the user agent in the creation properties. - If we still want to keep a hack flag around for the post-load change, then I think we need the hack to be smarter and have it track event count per url. Right now it looks like we basically just swap the flag after the first load. My personal preference is to remove this "hack", and add a note in the docs about point #2 above: set the user agent in the creation dictionary to avoid a reload/multiple events firing (as changing user agent can trigger a reload). cc [~gmathews] [~ybanev]
I am OK with reverting the "hack" part and describing the behavior resulting from changing the userAgent after the proxy creation in the documentation.
7_3_X: https://github.com/appcelerator/titanium_mobile/pull/10273
Merged to 7_3_X and master.
Verified the fix in SDK 7.3.1.v20180822075516. Closing.