Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25468] Android: HTML Key is missing under the source object for web view

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-12-15T19:37:00.000+0000
Affected Version/sRelease 6.2.2
Fix Version/sRelease 7.0.1
ComponentsAndroid
Labelsmerge-7.0.1, webview
Reporter Ricardo Ramirez
AssigneeGary Mathews
Created2017-11-01T17:47:12.000+0000
Updated2017-12-19T18:58:41.000+0000

Description

Issue Description

Hi team, i have found an issue after upgrading the appcelerator SDK from 6.0.4 to 6.2.2. HTML Key is missing under the source object. i used that key to find out whether the response(url response data) is success/error based on it. Added the Info method to capture the response in the code. For example added google.com in the web view url. Please let me know if there is any change to the source object or if i need to use any other method/object.
{"type":"load","source":{"lightTouchEnabled":true,"overScrollMode":0,"url":"https://www.google.com/","disableContextMenu":false,"pluginState":0,"userAgent":"Mozilla/5.0 (Linux; Android 6.0.1; SM-G930V Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/61.0.3163.98 Mobile Safari/537.36","enableZoomControls":true,"hiddenBehavior":4,"enabled":true,"visible":true,"touchEnabled":true,"borderRadius":0,"backgroundRepeat":false,"height":"fill","width":"fill","keepScreenOn":false,"children":[],"size":{"height":560,"width":360,"y":0,"x":0},"rect":{"height":560,"width":360,"y":80,"x":0},"apiName":"Ti.UI.WebView","bubbleParent":true,"id":"termsWebView","soundEffectsEnabled":true,"horizontalWrap":true,"enableJavascriptInterface":true,"_events":{"error":{},"load":{}}},"url":"https://www.google.com/","bubbles":true,"cancelBubble":false} 

Comments

  1. Ricardo Ramirez 2017-11-07

    In IOS, For the error we are getting the below fields.
       "success": false, 
       "code": -1005, 
       "error": "error", 
       
    logs below for success and error
       success Response: 
       { 
       "url": "https://www.google.com/", 
       "bubbles": true, 
       "type": "load", 
       "source": { 
       "autoDetect": [ 
       1 
       ], 
       "willHandleTouches": true, 
       "horizontalWrap": true, 
       "visible": true, 
       "touchEnabled": true, 
       "id": "termsWebView", 
       "width": "FILL", 
       "height": "FILL", 
       "url": "https://www.google.com/" 
       }, 
       "cancelBubble": false 
       } 
       
       Error response: 
       { 
       "message": "The network connection was lost.", 
       "url": "https://www.gle.com/", 
       "errorCode": -1005, 
       "bubbles": true, 
       "type": "error", 
       "source": { 
       "autoDetect": [ 
       1 
       ], 
       "willHandleTouches": true, 
       "horizontalWrap": true, 
       "visible": true, 
       "touchEnabled": true, 
       "id": "termsWebView", 
       "width": "FILL", 
       "height": "FILL", 
       "url": "https://www.gle.com" 
       }, 
       "success": false, 
       "code": -1005, 
       "error": "error", 
       "cancelBubble": false 
       } 
       
    Let me know if you need more details.
  2. Ricardo Ramirez 2017-11-15

    Hi guys ! I have created the testcase: app.js file
       var win = Ti.UI.createWindow();
       var webview = Ti.UI.createWebView({
       	url: 'http://www.google.com'
       });
       win.add(webview);
       win.open();
       console.log(JSON.stringify(webview));
       
    If you see the console output, the object doesn't include the html attribute
  3. Hans Knöchel 2017-11-22

    I validated all commits back to 6.0.x and we did not remove / change any "html" keys in the "load" event. In fact, the "html" key was never documented as part of the event, so maybe you received it through the "source.html" property? Let's fix it! *EDIT*: Actually it works fine. Tested with kroll- and main-thread. Also with appcelerator.com and google.com:
       
       var win = Ti.UI.createWindow({
           backgroundColor: '#fff'
       });
       
       var btn = Ti.UI.createButton({
           title: 'Trigger'
       });
       
       var webview = Ti.UI.createWebView({
         url: 'https://appcelerator.com'
       })
       
       webview.addEventListener('load', function(e) {
         Ti.API.warn(e.source.html);
       })
       
       win.add(webview);
       win.open();
       
  4. Ricardo Ramirez 2017-11-28

    Hello [~hknoechel] This is also happening on Android please see here: https://gist.github.com/aminulaust/65c2a1ed20a035aaad71a2149174de1d Should I file a new Jira or we can keep working on this one ?
  5. Gary Mathews 2017-11-30

    master: https://github.com/appcelerator/titanium_mobile/pull/9643
  6. Lokesh Choudhary 2017-12-12

    [~gmathews], Can you please provide a backport for this.
  7. Lokesh Choudhary 2017-12-13

    Found issues, left comment in the PR.
  8. Gary Mathews 2017-12-13

    7_0_X: https://github.com/appcelerator/titanium_mobile/pull/9686
  9. Lokesh Choudhary 2017-12-15

    FR passed for master & backport. Confirmed with [~gmathews], the errors seen (commented in the PR) are not related to this ticket & a separate PR will be made for it.
  10. Lokesh Choudhary 2017-12-19

    Verified the fix with SDK 7.0.1.v20171218104141 & 7.1.0.v20171218101353. Closing. Studio Ver: 5.0.0.201712081732 SDK Ver: 7.0.1.v20171218104141, 7.1.0.v20171218101353 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.11 Appc CLI: 7.0.1-master.5 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.10 Node Ver: 8.9.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1

JSON Source