Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27795] Android: WebView crashes when given local HTML URL with parameters as of 8.1.0

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2020-06-09T13:43:58.000+0000
Affected Version/sRelease 8.1.0
Fix Version/sRelease 9.0.3
ComponentsAndroid
Labelsandroid, local, parameters, regression, url, webview
ReporterDonovan Lewis
AssigneeGary Mathews
Created2020-03-09T16:36:04.000+0000
Updated2020-09-15T07:26:03.000+0000

Description

Since SDK version 8.1.0 I have been unable to specify a URL for a webview that uses a local HTML file with variables in the URL. I pass things like the UDID and other variables to a local HTML file in an Android app. This worked fine up till SDK 8.0.2. It says the file is not found when I add any variable to the local file. Using a remote file has no issue.
var win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});


var webview = Ti.UI.createWebView({
   top: '7dp',
   height: '100%',
   width: '100%',
   url: 'http://google.com',
});

win.add(webview);

var testVar = -40.1;

webview.url = '/index.html?data=' + testVar;

win.open();
The above example fails to run with the following error, I have tired with every SDK after 8.0.2.
RROR] :  TiAssetHelper: Error while opening asset "Resources/index.html?data=-40.1":
[ERROR] :  TiAssetHelper: java.io.FileNotFoundException: Resources/index.html?data=-40.1
[ERROR] :  TiAssetHelper: 	at android.content.res.AssetManager.nativeOpenAsset(Native Method)
[ERROR] :  TiAssetHelper: 	at android.content.res.AssetManager.open(AssetManager.java:744)
[ERROR] :  TiAssetHelper: 	at android.content.res.AssetManager.open(AssetManager.java:721)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.kroll.util.KrollAssetHelper.openAsset(KrollAssetHelper.java:140)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.io.TiResourceFile.getInputStream(TiResourceFile.java:71)
[ERROR] :  TiAssetHelper: 	at ti.modules.titanium.ui.widget.webview.TiUIWebView.setUrl(TiUIWebView.java:616)
[ERROR] :  TiAssetHelper: 	at ti.modules.titanium.ui.widget.webview.TiUIWebView.processProperties(TiUIWebView.java:464)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1293)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:511)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:501)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:467)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:518)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:501)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:467)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:607)
[ERROR] :  TiAssetHelper: 	at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:328)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:57)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:573)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:721)
[ERROR] :  TiAssetHelper: 	at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:47)
[ERROR] :  TiAssetHelper: 	at android.app.Activity.performCreate(Activity.java:7136)
[ERROR] :  TiAssetHelper: 	at android.app.Activity.performCreate(Activity.java:7127)
[ERROR] :  TiAssetHelper: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
[ERROR] :  TiAssetHelper: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
[ERROR] :  TiAssetHelper: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
[ERROR] :  TiAssetHelper: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
[ERROR] :  TiAssetHelper: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
[ERROR] :  TiAssetHelper: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
[ERROR] :  TiAssetHelper: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[ERROR] :  TiAssetHelper: 	at android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] :  TiAssetHelper: 	at android.os.Looper.loop(Looper.java:193)
[ERROR] :  TiAssetHelper: 	at android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] :  TiAssetHelper: 	at java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiAssetHelper: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] :  TiAssetHelper: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[ERROR] :  TiExceptionHandler: (main) [668,790] null
[ERROR] :  TiExceptionHandler:
[ERROR] :  TiExceptionHandler:     java.io.Reader.<init>(Reader.java:78)
[ERROR] :  TiExceptionHandler:     java.io.InputStreamReader.<init>(InputStreamReader.java:97)
[ERROR] :  TiExceptionHandler:     ti.modules.titanium.ui.widget.webview.TiUIWebView.setUrl(TiUIWebView.java:617)
[ERROR] :  TiExceptionHandler:     ti.modules.titanium.ui.widget.webview.TiUIWebView.processProperties(TiUIWebView.java:464)
[ERROR] :  TiExceptionHandler:     org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1293)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:511)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:501)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:467)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:518)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:501)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:467)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:607)
[ERROR] :  TiExceptionHandler:     ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:328)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:57)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:573)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:721)
[ERROR] :  TiExceptionHandler:     org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:47)
[ERROR] :  TiExceptionHandler:     android.app.Activity.performCreate(Activity.java:7136)
[ERROR] :  TiExceptionHandler:     android.app.Activity.performCreate(Activity.java:7127)
[ERROR] :  TiExceptionHandler:     android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
[ERROR] :  TiExceptionHandler:     android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
[ERROR] :  TiExceptionHandler:     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
[ERROR] :  TiExceptionHandler:     android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
[ERROR] :  TiExceptionHandler:     android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
[ERROR] :  TiExceptionHandler:     android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
[ERROR] :  TiExceptionHandler:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[ERROR] :  TiExceptionHandler:     android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] :  TiExceptionHandler:     android.os.Looper.loop(Looper.java:193)
[ERROR] :  TiExceptionHandler:     android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] :  TiExceptionHandler:     java.lang.reflect.Method.invoke(Native Method)
[ERROR] :  TiExceptionHandler:     com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] :  TiExceptionHandler:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Comments

  1. Joshua Quick 2020-03-09

    I've confirmed this issue started happening as of Titanium 8.1.0 and higher. This issue does not happen in 8.0.2.
  2. Gary Mathews 2020-03-25

    master: https://github.com/appcelerator/titanium_mobile/pull/11564
  3. Samir Mohammed 2020-06-08

    *FR passed* for master, waiting on backport for 9_0_X.
  4. Ewan Harris 2020-06-08

    [~smohammed] 9_0_X backport at https://github.com/appcelerator/titanium_mobile/pull/11762
  5. Samir Mohammed 2020-06-08

    FR Passed for 9_0_X as well, waiting on Jenkins builds.
  6. Christopher Williams 2020-06-08

    merged to master for 9.1.0 target, 9_0_X for 9.0.3 target
  7. Samir Mohammed 2020-06-09

    Closing ticket, Fix verified SDK version 9.1.0.v20200608174711 and SDK version 9.0.3.v20200608153416 Test and other information can be found at: Master: https://github.com/appcelerator/titanium_mobile/pull/11564 9_0_X: https://github.com/appcelerator/titanium_mobile/pull/11762

JSON Source