Mossop Status Update: 2010-04-30

Done:
Landed the new extension manager

Next:
Tracking down a Ts regression from the new extension manager
Resolving any important issues that users and developers find from the landing…

Done:

  • Landed the new extension manager

Next:

  • Tracking down a Ts regression from the new extension manager
  • Resolving any important issues that users and developers find from the landing

The new add-ons manager is here

Finally, after far too much time, the new add-ons manager is about to land in trunk nightlies. I am putting together the final patches to land now. The bit most people will see is the new UI so I guess I’ll steal Boriss’ image for you to look at here with the same caveats. What you see on trunk over the next few days is just the initial steps to switching to a redesigned UI and (more importantly from my point of view) a totally new extension manager backend that will make it easier for us to improve and build upon in the future. The changes are so large that it is important to get more people testing it now while it still looks fairly unpolished so we can pick up problems that we’ve missed.

New Add-ons Manager UI

Tomorrow (Friday) the QA team are holding a test day on the new add-ons manager, if you want to help test for issues you can join us in #testday on irc.mozilla.org

We are filing bugs with [rewrite] in the status whiteboard and blocking either the backend tracking bug or the UI tracking bug. So you can check the dependency tree to see what issues we already know about and plan to take care of. Please file bugs for anything else you see, especially when it is something that is wrong compared to Firefox 3.6.

There will be some add-ons broken in the new builds. This is fairly normal for any API update. As a general rule if some add-ons work but others don’t then contacting the authors of those broken add-ons is the best idea.

Developers of other applications may find things broken, ultimately this is unavoidable when changing APIs on this scale, please contact me if you need some help getting things working again.

Time for a new Camera

I’ve never been terribly impressed with my current digital camera. It’s an Olympus FE-280 that I bought on the spur of the moment in Boston a few years ago when my previous camera decided it didn’t want to stay charged any longer. Feature-wise the Olympus probably has almost everything I want, but its menu system is so convoluted that I can never find how to enable the things I’m after in a reasonable amount of time. In the past few years it has slowly developed some bad pixels (both on the view screen itself and on the CCD cell and now the battery charger is starting to flash ominously suggesting that the battery is about to go to a better place so I think it is about time to start looking for a replacement and this time I want to do some research.

Sadly I know probably just enough about taking photos to make me dangerous which means that I occasionally want to do things that probably warrant use of some expensive feature-packed camera. While I would love the power of something like a digital SLR the reality is I would barely make use of all its features and I need something smaller otherwise I will never carry it around with me. But here is a list of the features I am after, maybe someone has suggestions for cameras that have all of these and more?

  • An easy to use mode that does fast exposures
  • Good motion stabilization
  • A way to take a quick sequence of images with one press of the shutter
  • Maybe manual focusing to allow shooting through windows
  • Orientation detection, ideally actually orienting the image file but I guess just putting the EXIF orientation marker is a start
  • I’d sort of love to get RAW images to play around with in the occasion the camera hasn’t been clever enough to work out what I want

Update: So I guess everyone is recommending either one of the Lumix series or the Canon S90. The latter seems to provide more control over shooting at first glance but then the Panasonic site doesn’t offer the full instruction manual for the Lumix cameras, only basic instructions which makes figuring out exactly what you can do with them and how a little more tricky. The Lumix cameras do claim a faster fps in burst mode and all have more zoom than the S90’s relatively paltry 3.8x. I wonder how much use zoom is though when I’m not going to be using a tripod for shooting.

Myths and mysconceptions about Firefox on the Palm Pre

Since I posted last week about how I was experimenting with running Firefox on my Palm Pre a number of tech news sites, large and small, picked it up and posted their own take on it. Some of the sites (and some of the readers of those sites) made some fairly odd statements about my work. This is probably because to the uninitiated (and many of the initiated in fact) the internals of Firefox are something of a mystery. I also suspect I made a couple of poor choices of words which led to some misunderstandings so I’d like to try to clarify a couple of points that might make it easier to understand what is going on.

Why this isn’t a port of an Android application

Lots of sites made mention of how this is a port of Firefox for the Pre. This isn’t surprising since even I said that. Many also called it a port of the Android version of Firefox, this is slightly true but really a misnomer. What you have to realise is that the bulk of Firefox’s code is written to work on any platform, only a few fairly small parts of it are platform specific. For the most part this is called the widget code and handles drawing the UI on the screen and receiving mouse and keyboard events. There is a widget implementation for Windows, for Linux, for Mac, for the N900, for Android and would you believe also for BeOS and OS/2.

The largest part of the work of making Firefox run on the Pre was writing this widget implementation. It’s true some of it was copied from the Android widget code, but that is because that already had code to use OpenGL to draw to the screen. No point in trying to rewrite that from scratch when you’re going to do exactly the same thing anyway (especially if you are like me and have never touched OpenGL before). If it makes people feel any better though the Pre version is now using a 2D method of drawing to the screen which is totally written from scratch so hardly any of the copied Android code remains now.

Why user interfaces don’t always need to look nice

Fennec UI on the Palm Pre
Fennec UI on the Palm Pre

I should probably have expected it. Loads of places posted only the screenshot and not the background description to it, my fault really for not getting the blog post up in time. Even then I didn’t say a lot about why I was using the full Firefox UI either so of course lots of people complained about how terrible the UI was and it would never be any use and was this some sort of joke? The thing is that during that early work having nice looking UI is really unimportant, maybe even detrimental to getting things done. All that is important is that you can see enough to see that things are working. Because of this it makes more sense to use Firefox’s desktop UI for testing as it is complicated and uses many different types of UI elements. If anything wasn’t working properly it would be obvious pretty quickly. In contrast the Firefox Mobile (commonly referred to by its codename Fennec) UI is simple and stays out of your way. Most of the time you can’t even see any of the UI, just the webpage. So you wouldn’t actually notice very quickly if a part of the UI was broken.

Once the code to run Firefox on the Pre was working switching between the full Firefox UI and the Fennec UI is actually pretty simple, basically just a different build configuration. Now that things are working I’m mostly testing with the simpler Fennec UI which hopefully looks more usable on the small screen. There may still be some work to do though, The Palm Pre has a smaller screen than I think any other device that the Firefox Mobile team develop for which means it is still perhaps too large to be useful. I’m looking at ways to solve that without having to fork the entire UI.

In the meantime here is a shot of what it looks like right now. This is a screenshot taken straight from the device.

Why the Palm PDK doesn’t suck

At least one site took my comments about problems debugging to mean that I didn’t think much of developing against Palm’s PDK, literally turning my statement that “Debugging is hell” into “Palm Pre coding is like hell”. This couldn’t be much further from the truth. For a mobile platform developing for the Pre seems remarkably easy. Granted this is the first mobile platform that I’ve ever developed for but the fact that it was basically a few hours before I had a command-line program compiled for and running on the phone seems like a testament for just how easy Palm have made this. Yes there are some teething problems with things missing from the PDK, but it is in beta, I’ve seen important bits missing from SDK’s released by Microsoft that are somewhere around their 7th version so in comparison Palm are doing great. And yes debugging is difficult, but debugging is difficult even on desktops. There has been really only one problem where I got completely stuck and had no way to try to figure it out myself, and in that case the Palm developer relations team stepped in and very quickly gave me the solution I needed.

Where are things now?

Since Palm helped me solve the main hanging problem a couple of days ago I’ve been working on resolving the main stumbling blocks to being able to really browse the web on the phone by fixing little things like making characters like “/” and “:” work from the keyboard. I’ve also added orientation detection so you can browse in portrait or landscape mode and fixed ctypes to work, it is this latter bit that will allow a future version of the Weave extension to work on the phone letting you sync bookmarks and history with your desktop. There are still a couple of bits that I’d really like to fix before letting people get their hands on this, like zoom and gesture support but I wouldn’t be surprised if I have those fixed very soon now.

I’m going to be at Palm’s developer day on Saturday if anyone wants to say hi, I’ll try to remember to load a working copy onto my phone to show off before I go.

Firefox running on the Palm Pre (mostly)

One of the first things I did when I moved to the U.S. was to get myself a smartphone, and that phone was the Palm Pre. I’ve always thought it was way ahead of its competition in terms of the potential of its potential capabilities and platform. Sadly I think it is let down some by build quality and hardware issues, but I still love it as a phone and really hope that if Palm get bought they’ll continue work on it and develop a better 2nd gen version.

The browser on the Pre is pretty limited. I won’t deny it is nice to use but I miss things like the awesome bar from Firefox and so ever since Palm announced the PDK (a development kit for developing native apps for the Pre) I’d been wondering how much work it would take to get Firefox ported to the Pre. It turns out not a lot, at least so far. Unless you’re actually interested in the details of what I did you may just want to skip to the end of this post, or just move on to something more interesting.

Getting started

Spidermonkey shell running on a Palm PreI had spoken to Vlad Vukicevic a while ago. He had gone through the process of porting Firefox for Android and he told me the steps to take were pretty straightforward. You basically have to get the core pieces (NSPR, Spidermonkey, XPCOM) compiling for the platform, then you need to write what is called the widget code and deals with displaying graphics on the screen and receiving input events from the device.

On Friday evening I sat down and for the first time seriously looked through the PDK documentation, which is reasonably good. Perhaps not surprisingly I quickly realised that the core libraries that are available in the device are basically the same as those available in Android’s NDK. Added to that I had read that Vlad was simply using OpenGL to draw to the screen, and the PDK provided OpenGL too. So ignoring input events it looked likely that I could just use a lot of the code they had used for the Android port to make things work on the Pre.

This turned out to be pretty much true. Getting Firefox compiling for the Pre took a little under half a day, mostly because of some strange build config problems that I still haven’t properly resolved and have just hacked around for now. The first thing I tried was copying the JS shell over to the device and running it. Aside from some library loading issues it basically worked first time and I could run simple JavaScript code.

Debugging is hell

Firefox running on a Palm PreGetting it to render a UI was slightly more involved. Writing the actual code to do it was simple and maybe took me an hour or two (mostly because I was just copying and adapting the Android code). The thing that took the long time (around 8 hours) was trying to find the one tiny line of code that I missed and was causing Firefox to crash shortly after startup. Firefox’s code is pretty complex, and while you can get so far with adding lots of logging there was just too much going on to find this bug this way so debugging with gdb is generally the solution. Apparently in the Windows version of the PDK Palm include an Eclipse plugin that allow you to remotely debug apps running on the device. Nothing like that seems to be included in the OSX version so I ended up having to find and build a gdb that would debug ARM code (Palm, please just include this in the next OSX PDK) and then set up gdbserver on the device and connect to it. Perhaps because of my self-built GDB symbol tables for shared libraries simply didn’t work right. For some reason my gdb never attempted to load symbols for libraries that the device loaded, I ended up having to use a horrific hack to force it to load them. It paid off though, 5 minutes after I got the symbols to load I found my problem and had Firefox running without crashing, just not displaying much.

Turns out it was trying to but my first attempt to read events from WebOS were blocking the load of images and XUL for the UI. I discovered this completely by accident when I got frustrated with the blank screen and tapped it a few times, moments later the Firefox UI appeared in all its squished glory. I hope you’re all as astounded as I was that it appeared basically pixel perfect the first time around. Credit should go entirely to the guys working on the Android port for that really.

Hot tip for new widget developers, when nsBaseAppShell calls your widget’s ProcessNextNativeEvent and tells it it may block for the next available event, don’t block.

What next?

Once the UI was visible it wasn’t very difficult to start pushing mouse (finger) and keyboard events through from WebOS to Gecko. All in all getting to that point took about two days though probably would have been half that if debugging had worked straight off. There are now a bunch of smallish issues related to mouse and keyboard events that need fixing and should be pretty simple to handle. The repainting code is also very inefficient as it redraws the entire screen in response to a single pixel changing. I’d also like to switch to the Fennec UI. The Firefox UI is good for testing as it is pretty complex and you can quickly see if there are any problems or not, but the Fennec UI will make far better use of the available screen space.

There are some larger issues though that would need to be fixed before I’d consider making this available to others. In particular right now it will randomly hang the entire phone. Once that happens you have to pull the battery to recover it and I’ve lost some settings on my phone because of that. I have no way to debug that right now since once it happens there is no way to see what is going on on the device (maybe someone out there has some suggestions on how to figure this out). As well as that the build system is pretty much hacked to work on my computer. I think there is just one small thing I’m not understanding there and then I can fix that, but finding people knowledgeable enough about Mozilla’s build system to help me figure it out is difficult. Once I’ve ironed out these issues I’ll make the code available, maybe even some test builds and hopefully some other developers might be interested in helping me tackle some of the remaining problems.

Perhaps it goes without saying but I am only working on this in my spare time, not as part of any official Mozilla drive to target the Palm devices. I don’t know if it will ever get to the point where Mozilla would include it as one of the official Firefox Mobile versions, but that isn’t all that much of a big deal. Assuming the main code that deals with the Pre’s hardware and platform is sound, the code should just continue to work whatever they do with the Fennec code and I know the mobile team will always be helpful to talk about how other devices work to help me figure out what the Palm code should do.

Update: Alpha builds of PreFox, a web browser based on the Mozilla source code are now available for testing.

How do restartless add-ons work?

I blogged a short time ago about how we’re adding support for a new form of add-on to Firefox that can install and uninstall without needing to restart the application. Since then I’ve been finalizing a specification for how the platform will load these add-ons, trying to keep it simple but still give developers everything they commonly need. The planned specification is now available and if developers have comments then I’d like to hear them. Currently there isn’t a version of Firefox that implements it but that should change in the next day or so when I make the changes to the add-ons manager project branch and very soon when it all lands on trunk.

My hope is that once on trunk this spec won’t change but obviously this is quite new so we may see changes for a short time if add-on developers come across problems.

Mossop Status Update: 2010-04-12

Done:
Worked on more review comments for the add-ons manager rewrite
Investigated a new issue that QA came across in the rewrite
Met with UX to talk about the Home Tab plans (https://wiki.mozilla.org/Firefox/Projects/Hom…

Done:

  • Worked on more review comments for the add-ons manager rewrite
  • Investigated a new issue that QA came across in the rewrite
  • Met with UX to talk about the Home Tab plans
  • Started playing around with building Firefox for the Palm Pre

Next:

  • Blog about the new restartless add-ons spec
  • Land the extension manager rewrite on trunk
  • Look at starting on the Home Tab project

Mossop Status Update: 2010-04-02

Done:
All major issues taken care of
Ported all the currently applicable tests from the old xpcshell suite to the new API
Finalized spec for restartless extensions

Next:
Address the ne…

Done:

  • All major issues taken care of
  • Ported all the currently applicable tests from the old xpcshell suite to the new API
  • Finalized spec for restartless extensions

Next:

  • Address the next round of review comments
  • Land this sucker
  • Sleep