New DOM Inspector Peers

Today, I’ve officially made Neil Rashbrook and Colby Russel peers for DOM Inspector code. If you have a patch you’d like to get reviewed for it, you can now ask either one of them to review it in addition to me now.

Happy patching!


Bugzilla Helper 0.4.1 Released

You can get it over at AMO. This version includes the integration of Thunzilla, an add-on originally created by Justin Dolske. I also made some minor improvements on the detection algorithm for what e-mails you can reply to.


Did you know we have a style guide?

I’ve been surprised at the number of people who were unaware that Mozilla has a coding style guide. It contains the rules for new files for both JavaScript and C++. You can save your reviewer a whole bunch of time by making sure your code conforms to this before asking for review.

Mozilla Personal

Bluetooth Tethering with the N900 and T-Mobile

I’ve been spending the last few train rides to and from work every day trying to figure out how to tether my N900 to my laptop. While Firefox Mobile is nice, there are some things my desktop does better. I first tried using the PC Suite from Nokia, but that wasn’t successful (it apparently doesn’t support the N900). I then tried JoikuSpot, which is in beta. Sadly, I encountered the “phone reboots when clients connect” bug. However, if they fix that, that piece of software looks very promising. I finally went down the road to Bluetooth Networking.

In order to pull this off, you’ll need to get a handy little application from the Application Manager. Under the Network section, look for “Bluetooth Dial-Up Networking” in the Extras repository. After you install that, you will want to restart your device. Next, pair your N900 with you laptop (this varies per operating system. I used Windows 7 and these instructions will assume that). After pairing the device, add a new Dial-Up connection on that modem. The phone number will be *99# and you will leave the user name and password blank. Save the connection, but cancel it when it tries to dial (it will fail anyway). Now, launch the device manager, and find the Bluetooth modem that should have been installed when you paired the N900 to your computer. Open its properties, and go to the Advanced tab and set the Extra initialization commands to at+cgdcont=1,"IP","". After this, you should be able to connect to the Internet though your phone.

To prove that it works, I wrote this on the train, and I’m posting while still on the train. :P

I found this particular wiki page to very useful in setting this up, but I found translating the instructions to Windows 7 to be a bit difficult at times.


NetUtil.jsm Just Got More Useful

Recently, a few bugs have landed enabling a bunch of nice things for consumers of NetUtil.jsm:

  • NetUtil.newURI can take a string (plus optional character set and base URI) or an nsIFile.
  • A new method for creating channels has been created. NetUtil.newChannel can take an nsIURI, a string (plus optional character set and base URI), or an nsIFile.
  • NetUtil.asyncFetch can take an nsIChannel, an nsIURI, a string (plus optional character set and base URI), or an nsIFile.

This means, among other things, that it now requires less code to read a file asynchronously than it does synchronously. The old way to do this asynchronously can be seen here on MDC. This would give the consumer a byte array of the data in the file. Compared to the synchronous case, which can be seen here. Both are pretty verbose and clunky to use. The new way looks like this:

NetUtil.asyncFetch(file, function(aInputStream, aResult) {
  if (!Components.isSuccessCode(aResult)) {
    // Handle Error
  // Consume input stream

One function call, with a callback passed in. There is a slight difference from the old asynchronous method, however. NetUtil.asyncFetch gives the consumer an nsIInputStream instead of a byte array. The input stream is a bit more useful than a raw byte array, although it can be painful to use in JavaScript at times (maybe we need an easy method to convert an input stream to a string?). I look forward to patches using this method to read files instead of doing it synchronously.