cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <>
Subject [Android] New Bridge: evaluateJavascript
Date Thu, 10 Mar 2016 18:36:39 GMT
So, apparently some people are reporting that the ONLINE_EVENT bridge that
we currently use by default in Android has a race condition when you start
using more than one WebView in an application.  Even though we decided to
not support the case of having multiple webviews in an Application, it's
still being used this way.

Ideally, I would like to see us figure out how we can change the bridge
modes so that we don't have so many static classes, or at least change them
such that we're not tracing mutable states in static classes.  However,
someone asked about evaluateJavascript and using that for the bridge.  I
implemented that really quick here:

Basically, this should get around the whole bridge state problem since
we're executing the JS on the right webview every time instead of trying to
manipulate a static variable that may or may not correspond to the webview
that we're using.  Also, the benchmarking on this initially seems
comparable to ONLINE_EVENT.

There's also the fact that it's a lot less code than ONLINE_EVENT, due to
the whole state thing.  The main thing that ONLINE_EVENT has over
evaluateJavascript is that it works on Jellybean (4.3 and lower).

This branch does add a method to the API, and Crosswalk would have to add
the same two lines of code to their WebView to allow evaluateJavascript to
work there as well as it does here.  I did check to make sure their API
does support it before I added it.

So, is this useful? Should we merge it in? Do we increment a major version
number for this?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message