Where
app/src/main/java/com/ds/avare/webinfc/, in the three WebApp*Interface classes that push state into the embedded WebViews:
WebAppAircraftInterface.java
WebAppMapInterface.java
WebAppPlanInterface.java
Each one builds a small JS snippet and ships it via mWebView.loadUrl("javascript:..."+...). Examples:
mWebView.loadUrl("javascript:list_clear()");
String func = "javascript:plan_add(" + (String)msg.obj + ")";
mWebView.loadUrl(func);
mWebView.loadUrl("javascript:wnb_set('" + data + "')");
There are 26 such calls in total across the three files.
Why this matters
loadUrl("javascript:...") is the legacy way of running JS in a WebView and it counts as a navigation. Each call pushes an entry into the WebView back/forward list, can fire onPageStarted / onPageFinished, and races with whatever the page is doing at the time. In Avare this fires constantly while the user is on the map, the plan, the W&B, the aircraft, etc. windows, because state changes (weather, plan add, list update, etc.) come in as Message posts on mHandler.
WebView.evaluateJavascript(script, callback) is the recommended replacement. It runs the script without touching navigation and is available on every API level Avare currently targets.
Suggested fix
Strip the "javascript:" prefix from each JS snippet and switch the call site to mWebView.evaluateJavascript(script, null). No other behaviour changes.
I have a small PR ready that does exactly that across the three files.
Where
app/src/main/java/com/ds/avare/webinfc/, in the threeWebApp*Interfaceclasses that push state into the embedded WebViews:WebAppAircraftInterface.javaWebAppMapInterface.javaWebAppPlanInterface.javaEach one builds a small JS snippet and ships it via
mWebView.loadUrl("javascript:..."+...). Examples:There are 26 such calls in total across the three files.
Why this matters
loadUrl("javascript:...")is the legacy way of running JS in a WebView and it counts as a navigation. Each call pushes an entry into the WebView back/forward list, can fireonPageStarted/onPageFinished, and races with whatever the page is doing at the time. In Avare this fires constantly while the user is on the map, the plan, the W&B, the aircraft, etc. windows, because state changes (weather, plan add, list update, etc.) come in asMessageposts onmHandler.WebView.evaluateJavascript(script, callback)is the recommended replacement. It runs the script without touching navigation and is available on every API level Avare currently targets.Suggested fix
Strip the
"javascript:"prefix from each JS snippet and switch the call site tomWebView.evaluateJavascript(script, null). No other behaviour changes.I have a small PR ready that does exactly that across the three files.