Welp, I did it.

As I mentioned in a previous post, I wasn’t really excited by the new MacBooks that were announced this year. And the more I read the less compelling they seemed… As I talked with my co-workers, I heard some really good reviews of a couple of models of Windows computers, and since 90% of Firefox’s users are using Windows it’s probably not such a bad idea if I use it, too, both to help me understand the problems they’re running into, and to make sure that the code I’m writing will work for them.

Read more…

Hey! Let’s Write a WebExtension!

(This article is also posted on Mozilla Hacks.)

You might have heard about Mozilla’s WebExtensions, our implementation of a new browser extension API for writing multiprocess-compatible add-ons. Maybe you’ve been wondering what it was about, and how you could use it. Well, I’m here to help! I think MDN’s WebExtensions Docs have a pretty great definition:

WebExtensions are a new way to write Firefox extensions.

The technology is developed for cross-browser compatibility: to a large extent the API is compatible with the extension API supported by Google Chrome and Opera. Extensions written for these browsers will in most cases run in Firefox with just a few changes. The API is also fully compatible with multiprocess Firefox.

The only thing I would add is that while Mozilla is implementing most of the API that Chrome and Opera support, we’re not restricting ourselves to only that API. Where it makes sense, we will be adding new functionality and talking with other browser makers about implementing it as well. Finally, since the WebExtension API is still under development, it’s probably best if you use Firefox Nightly for this tutorial, so that you get the most up-to-date, standards-compliant behaviour. But keep in mind, this is still experimental technology — things might break!

Starting off

Okay, let’s start with a reasonably simple add-on. We’ll add a button, and when you click it, it will open up one of my favourite sites in a new tab.

Read more…

ES6 Templates

One of my favourite upcoming features in ES6 is Template Strings. I’ve used JQuery’s templates in some previous code I’ve worked on, and while it was very useful in finishing the feature on time, it’s aged now and relying on third-party libraries which we don’t have time to keep up to date isn’t the best idea and so we’re in the middle of some work to remove them. So having said that, I’m quite happy to see something similar arriving in the base language, so that we can take advantage of it without having to add any extra code.

As an aside, all the code below was tested in Firefox 34, using the Scratchpad. The comments are pasted in below the code when you select it and choose the Execute » Display menu item or hit Ctrl+L (Cmd+L on Mac). I hear they also work in Chrome, but they didn’t seem to in the version I was running (39.0.2171.95), and I didn’t want to start messing with an --es-staging flag. If someone can confirm whether they work or not, I would certainly appreciate it! :)

Read more…

New Year’s Resolutions…

Well, I managed to spend New Year’s Eve lying sick on the couch, and then went to bed semi-delirious from lack of sleep at 12:08, which kind of sucked, but I’m still hopeful that 2015 will be better than 2014 was. I mean, it almost has to be, right?

Anyways, my first, and so far only, resolution is to consume less and create more. When I look back on the year, I find I have spent more of my free time than I’ld like passively consuming other people’s content instead of making new things of my own, and that kind of bothers me. I’m very glad that a large part of my job involves making things, and that has definitely been rewarding, but there are also a lot of personal projects I want to start or finish or just push forward. And it doesn’t have to be code. I’ld like to write more blog posts, to explain the things I’m doing, and why they interest me enough to spend time on.