I don't think there is any documentation but I've done quite a bit of reverse engineering myself in the past and might be able to loosely explain the architecture. There are 3 classes that are probably of interest to look at in the cordova-android framework:
1. SystemWebChromeClient 2. SystemExposedJsApi 3. CordovaBridge Based on my understanding, SystemWebViewEngine contains the entry point into native side, by using the onJsPrompt hook. This method is normally to handle window.prompt calls but Cordova uses it to deliver a payload to native. The payload is passed to CordovaBridge and it decides if it is a bridge call or if it is a regular window.prompt call. If it is a bridge call, it does some sanity access checks and pushes the messages through a queue system which gets routed to plugins (somehow). SystemExposedJsApi has some JavascriptInterface methods, which are methods exposed directly to the webiew, and JS can call these methods directly which controls bridge state. It also includes a `exec` JavascriptInterface method, which seems to deliver a payload to the bridge, similar to the prompt method. Both of these might be used, and to me it looks like the bridge call implementation strategy might be swapped based on certain conditions. Although based on your log snippets, it seems like it is using the prompt method. Hopefully this at least puts your focus in the right direction. On Sat, 2026-01-17 at 17:45 +0100, Niklas Merz wrote: > Hey everyone, > > As some of you know I'm currently trying out if Servo can be used in > Cordova Android. I've made some good progress on my plugin [1] and > now I > could use some help with getting plugins going. > > If got the bride working with some hacky glue code and now some > messages > like this are exchanged: > > [ServoWS] Call to prompt [] > gap:[1670500204,"Battery","start","Battery1880458036"] servo- > bridge.js > < > http://localhost:5000/plugins/cordova-plugin-servo-webview/www/servo- > bridge.js> [ServoWS] Intercepted gap: call [1670500204, "Battery", > "start", "Battery1880458036"] servo-bridge.js > < > http://localhost:5000/plugins/cordova-plugin-servo-webview/www/servo- > bridge.js> [ServoWS] Call to prompt [false] > gap:[1670500204,"Geolocation","getPermission","Geolocation1880458037" > ] > servo-bridge.js <http://localhost:5000/plugins/cordova-plugin-servo- > webview/www/servo-bridge.js> [ServoWS] Intercepted gap: call > [1670500204, "Geolocation", "getPermission", "Geolocation1880458037"] > servo-bridge.js <http://localhost:5000/plugins/cordova-plugin-servo- > webview/www/servo-bridge.js> [ServoWS] Received message: 51 S11 > Battery1880458036 {"level":59,"isPlugged":true}29 S01 > Geolocation1880458037 n36 servo-bridge.js > < > http://localhost:5000/plugins/cordova-plugin-servo-webview/www/servo- > bridge.js> > Can someone can point me to any kind documentation on how the plugin > bridge works? I've never looked into the part and if someone has any > info I could save some time digging through the code and reverse > engineering stuff. > > The chances are slim, I know, but maybe there is something out there. > > Cheers, > Niklas > > > [1] <https://github.com/NiklasMerz/cordova-plugin-servo-webview> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
