As Firefox Mobile has support for WebGL, I'm tinkering with it and trying to find out what can be done.
The first thing you'll need, once you go past the rotating cube demo stage and start anything remotely complex, is accessing the error console, or at least some way to see what you're doing wrong, and probably output logging messages too.
Turns out there are two complementary methods to get this sort of information out of the phone: 1) The debugger. You can connect an instance of desktop Firefox to the Android instance, using the desktop debugger that shows under the Tools Web Developer Remote Debugger option. This basic debugger allows you to stop/pause/step through the scripts running in the mobile.
2) The error console. It can be accessed using Android's adb, as detailed in this post.
Apparently the console could be accessed from the phone in earlier versions of Firefox Mobile (version 10 or less), but it was removed lately.
adb logcat | grep Gecko
I haven't tried the entire family of methods, only log and warn. I found that their output is slightly different, as you can see below:
console.log('This is a log'); console.warn('This is a warning');
Since both are reported as Errors they will show up in red in ddms or your favourite IDE. I was hoping for warnings to be reported as warnings, info as info, etc., with their corresponding and different colours. Yes, sometimes my error logging gets very sophisticated ;-)
Personally, I would rather have the error console integrated with the Firefox Remote Debugger--the user experience would be way nicer.
As an example, I recently reinstalled my computer, and so I didn't have the Android SDK installed, not even Java! But I had to install everything so that adb could work, and then I had to deal with the infamous udev rules so that my device would be recognised by the computer when USB debugging was enabled. And had to reboot too, since not even reloading the rules would convince the computer to recognise the phone. All this could be avoided if the debugger integrated the console. Edit: turns out there's already work under way to accomplish this! See bug 768096.
And while we are on it, two more suggestions for the Mozilla developers:
- it would be terrific if the debugger remembered the last IP address... (bug 790556)
- ... specially because there's just too little time to press OK in the dialog that asks if you want to allow a debugger to connect to your phone, and thus you have to re-enter the IP address again and again! (bug 790553)
Minor issues apart, this is great news, and really, really exciting! Deployment speed is totally unlike developing for native Android, as you just need to reload the page and it never takes as long as uploading APKs to the phone. Plus, of course, you get to many more platforms with just ONE version (HTML).
I'm really liking the latest Firefox updates for Android, so much that I'm even considering using it as the main browser, as I'm finding it more responsive than Chrome. And, of course, has WebGL support ;-)