Categories
Firefox Mozilla RTSE

Asynchronous Storage API

That asynchronous storage API I’ve been working on for a while has finally been pushed to mozilla-central. That means you can now run database queries off the main thread without blocking the UI. This includes both read and write statements.

This may not seem like a big deal, but there is a big benefit to using this API over the existing synchronous API. SQLite performs a file system operation called fsync which pushes the data in the file system’s cache to the disk. This operation is inherently synchronous, and on some file systems (like ext3), can take substantial amount of time given the right circumstances. If this is ran on the main thread, the UI is locked up the whole time. By using this new asynchronous API, you won’t have to worry about that fsync holding up the main thread at all!

Perhaps the best part about this new API is that it doesn’t require many code changes. You still create SQL statements the same way, but instead of calling execute or executeStep on the prepared statement, you just have to call executeAsync. The method takes one parameter – a callback that notifies on completion, error, and results. The callback is optional on the off chance that consumers don’t care if something finishes successfully or not.

Iterating through results is not much different from before either. The only difference is that results may be chunked, so the callback may get notified about results several times (with only the new data). Some good example code can be found in the tests that landed with this new API.

I’d really like people to try it out and see if they have any issues with the API. There are already a few refinements with bugs filed, and a few more up in my head that we might want if the need arises.

Categories
Firefox Personal

A New Download Manager in Firefox 3 Brings a New UI

[I use a Mac, so all the images in this post are of the Mac user interface. The UI for other platforms will differ slightly. Click on pictures to view other sizes.]

Firefox 3 brings a brand new download manager to the scene. There were lots of issues that existed with the old download manager both in terms of the UI and in the code that made it work. So for Firefox 3, we redid the whole thing to provide a better experience all around. It’s one of my favorite features in Firefox 3, but then I’m a bit biased. This post discusses the new features of the UI.

Old Meets New – a UI Comparison

fx2-download

The Firefox 2 download manager (above) would display the download’s icon (but not on Linux), its name, its status, and two text links to open and remove the download. In contrast, the Firefox 3 download manager (below) displays the download’s icon (even on Linux now), it’s name, the time of the download, the download size, and where it was downloaded from. For an active download, the size of the download changes to the amount downloaded so far. The main goal was to provide more useful information to the user.

fx3-download

You might notice, however, that there is now primary UI to open or remove the download. The idea here was to provide a less cluttered UI. However, just like before with Firefox 2, you can open your download by selecting it and pressing enter, double clicking it, or selecting open from the context menu. In fact, the context menu has grown a lot too!

fx2-contextfx3-context

The middle two options provide functionality that was once available from the old properties dialog. That dialog was removed because it was out of place. One of the new features of the new download manager is the ability to select more than one download (as hinted to by the “Select All” entry in the context menu). You can select multiple downloads (below) to perform an action on them such as remove, pause, or resume.

fx3-activefx3-paused

Searching

The new download manager also adds the ability to search through your download history. Let’s say that you recently downloaded a bunch of pdf documentation from threadingbuildingblocks.org and want to open it. The folder where all your downloads go is hopelessly cluttered, so you open up the download manager, and search for “pdf threading”. In a matter of moments, you are presented with the documents you wanted so you can now open them, or if they were deleted, you can re-download them.

fx3-search

Status Bar Indication

Perhaps the most useful feature that has been added in Firefox 3 is a little status indicator that can be found at the bottom right of your browser window:

fx3-statusbar

Firefox will now let you know how much time is left for your active downloads. When you click on the indicator, it will open up so you can see more detailed information about your active downloads.

That wraps up the changes to the UI. Stay tuned for a post about what new features have been added to the download manager in Firefox 3!

Categories
Firefox Personal

Awesomebar.awesomeness++

So, Firefox 3 will have this totally awesome new location bar, that shaver has coined the Awesomebar. It really is pure awesome on so many levels because of how it works. Other people can explain this better than me, so go read this post and this post. OK, now brace yourself, because the Awesomebar is about to get awesomer!

Enter Edward. He’s a member of the community and a former intern for the Mozilla Corporation, and he’s gonna make the Awesomebar adaptively learn how to sort the results. He’s got a really cool post about his work here that you should go read right now. It has pictures even! Pictures!

Firefox 3 is gonna rock with these features, and many more. I can’t even use Firefox 2 anymore without feeling like I’m using some ancient, dumb, and slow piece of software. :(

Categories
Firefox Growl

Growl and Firefox

Well, about an hour ago I checked in some code into the Growl subversion repository for an extension that will get Growl working with Firefox. There is still a minor issue with it, and sadly the issue prevents it from working, but I think that can be solved sooner rather than later.

As of now, the only thing it does is enable the download complete notification to work. You might say “but we’ve already got that!“, but I assure you that my approach is much better. First of all, it doesn’t require that you have growlnotify installed anywhere. It uses the same code that I’m using for Bug 362685, with a few changes for it to work on the 1.8.0 and 1.8 branches (Firefox 1.5 and 2.0 respectively).

I’m starting off small, but it can get much more advanced as things go on. This will, of course, be more useful for extension authors (as consumers) as opposed to browser functionality (the only thing nsIAlertsService is used for is the download complete notification). I can add more notifications down the line though, and I also plan to support at least Thunderbird, and maybe even Sunbird too! I’ll try to keep anyone interested in this updated here.

Categories
Code Firefox Personal

Web Forms 2.0

I’ve recently picked up the task of implementing part of the Web Forms 2.0 spec from the WHATWG. So far I’ve got some work done on the RepetitionEvent Model and the RepetitionElement interface.

Well, my initial plans were to use XBL to implement a large portion of the code as per conversations with my co-conspirator Alex. Well, bz brought up an intersting point – XBL isn’t applied to elements that have a CSS property of display:none. Well, seeing as how repetition templates are supposed to be hidden with that CSS property, I couldn’t use XBL.

As a result, I get to test my knowledge of C++. Yey! I’d like to state right now that my skills in C++ are not great. In fact, I have very little expereice with it. I mean, I only have had two classes in C++, and one was a very basic course. I feel it goes without saying that I really have my work cut out for myself.

All is not lost, however. There are some really useful tools that are making this so much easier. For example, lxr lets me easily look at existing code and see how things are done the “right” way. Then, there is always a ton of documentation available on Devmo, XUL Planet, and occasionally Google comes into play. Then of course I always have the wonderful folks on irc in #developers. Folks like biesi, bz, and timeless have helped me countless times, and I am really greatful.

This is going to be a long and and winding road, but it will be very beneficial for me. I’ve already learned a lot, and I’ve got a lot more to learn.