Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24737] Android: Reading property "WebView.disableContextMenu" causes crash if never assigned

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-05-26T18:46:12.000+0000
Affected Version/sRelease 6.1.0
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsandroid, regression, webview
ReporterAnthony Chung
AssigneeGary Mathews
Created2017-05-25T18:06:38.000+0000
Updated2017-06-14T17:58:45.000+0000

Description

*Edit from [~jquick]:* The stack-trace indicates that this is actually a WebView bug, not a ListView bug. Please see my comment below this post. *Original Post:* Please check/test 6.1.0.Rc on Android with Listview error, console log attached with file. This error occurs when I use 6.1.0.RC with a listview in our production app. Switching back to 6.0.4.GA, the error goes away. Version I was testing with 6.1.0.v20170524102117 iOS does not seem to be affected. Only on Android. Cannot share full code as production code. Listview has a headerView. ListItem is...
var listitem = {
	template: 'template',
	title: {text: item.title},
	subtitle: {text: item.subtitle},
	properties: {
		accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE,
		itemId: item.itemId,
		modname: item.modname,
		resourcetype: item.template
	}
};
Output:
[WARN] :   W/System.err: java.lang.IllegalArgumentException: Unable to convert null to boolean.
[WARN] :   W/System.err: 	at org.appcelerator.titanium.util.TiConvert.toBoolean(TiConvert.java:357)
[WARN] :   W/System.err: 	at ti.modules.titanium.ui.WebViewProxy.getDisableContextMenu(WebViewProxy.java:354)
[WARN] :   W/System.err: 	at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] :   W/System.err: 	at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[WARN] :   W/System.err: 	at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:872)
[WARN] :   W/System.err: 	at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1095)
[WARN] :   W/System.err: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:360)
[WARN] :   W/System.err: 	at ti.modules.titanium.ui.widget.listview.ListViewProxy.handleMessage(ListViewProxy.java:320)
[WARN] :   W/System.err: 	at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err: 	at android.os.Looper.loop(Looper.java:148)
[WARN] :   W/System.err: 	at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:118)
[ERROR] :  TiExceptionHandler: (main) [103,25598] ----- Titanium Javascript Runtime Error -----
[ERROR] :  TiExceptionHandler: (main) [0,25598] - In ti:/titanium.js:207,24
[ERROR] :  TiExceptionHandler: (main) [0,25598] - Message: Uncaught Unable to convert null to boolean.
[ERROR] :  TiExceptionHandler: (main) [0,25598] - Source: 			serialized[k] = this[k];
[DEBUG] :  ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{99b1dd3 V.E...... R.....I. 0,0-0,0}
[ERROR] :  V8Exception: Exception occurred at ti:/titanium.js:207: Uncaught Unable to convert null to boolean.
[ERROR] :  V8Exception: Unable to convert null to boolean.
[WARN] :   TiBlob: (KrollRuntimeThread) [41,25639] getNativePath not supported for non-file blob types.
[WARN] :   TiBlob: (KrollRuntimeThread) [0,25639] getFile not supported for non-file blob types.

Comments

  1. Anthony Chung 2017-05-25

    In the production scenario where error is occuring: The headerview being applied to listsection headerview in this scenario is an Android webview.
  2. Hans Knöchel 2017-05-26

    Looks like an issue inside the Web-View (do you embed one in your list-view)? Especially, do you use the disableContextMenu property? If you use the web-view inside the list-view, but don't use the above property, it may be something with default-values.
  3. Joshua Quick 2017-05-26

    I've confirmed that this is a WebView bug. It crashes when reading the "WebView.disableContextMenu" property if the property was never assigned. The following code reproduces this issue:
       var window = Ti.UI.createWindow();
       var webView = Ti.UI.createWebView(
       {
       	url: "https://appcelerator.com",
       //	disableContextMenu: true,
       });
       window.add(webView);
       window.open();
       
       // Crashes when accessing "disableContextMenu" if property was never assigned.
       Ti.API.info("- webView.disableContextMenu: " + webView.disableContextMenu.toString());
       
    We're looking into fixing this bug now. Thanks for reporting this issue. *Work-around:* Set the "disableContextMenu" property to true/false in your createWebView() function call.
  4. Gary Mathews 2017-05-26

    [~jquick] Sorry, I forgot to mark it as In Progress when I assigned it to myself. It's an easy fix, I'm not sure if this issue is a regression though. master: https://github.com/appcelerator/titanium_mobile/pull/9092 6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9093
  5. Samir Mohammed 2017-06-14

    Closing ticket as fix is verified in 6.1.0.GA, 6.1.1.v20170609153006 and 6.2.0.v20170612114319. Test and other information can be found at: master: https://github.com/appcelerator/titanium_mobile/pull/9092 6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9093

JSON Source