Adblock Plus and (a little) more

Faster extension development cycle: install changes automatically · 2012-01-13 16:33 by Wladimir Palant

The usual extension development cycle is less than optimal: change something, create a new extension build, install it in the browser (gonna love warnings), restart the browser, finally test it. I don’t like repeating this cycle all the time and so in the past years I’ve been using a test environment in which most extension files are loaded directly from my source code checkout (thanks to a manipulated chrome.manifest file). With this test environment many changes could be tested by simply reopening the extension window, for others you would restart the browser.

Unfortunately, this approach is less useful when working on restartless extensions — it requires me to restart the browser where updating the extension without a browser restart should be sufficient. And it completely broke down when I started testing Adblock Plus on an Android phone. My development machine and the browser where I test the extension are physically separated now. Add to this that getting Firefox Mobile to install an extension from the development machine is a rather complicated affair, and the result is that most of my “development” suddenly has nothing to do with writing code.

So I created a simple extension called Extension Auto-Installer that would listen for HTTP connections on a port. It would take the POST data of the incoming requests and install it as an extension. And if the extension isn’t restartless then it will also restart the browser automatically. Which means that installing an extension to a browser running Extension Auto-Installer can be done from the command line with a tool like wget:

wget --post-file=extension.xpi http://localhost:8888/

Instead of localhost it can also be the IP address of the phone running Firefox Mobile. To simplify things even further I integrated this functionality into the build tools used for my extensions so that I can write: autoinstall 8888

It will create an extension package and send it to port 8888 on localhost automatically. I guess that I can get rid of the old testenv command soon, I merely need to make Adblock Plus a restartless extension (all of my other extensions already are).

Now this extension is quite a security hole of course. I made sure that it doesn’t do anything by default and that it doesn’t use a predefined port, the user rather chooses a port himself. I’ve also added some warnings to the description. Already after uploading the extension it occurred to me that I can add a configuration option to define whether connections should be limited to loopback (defaulting to “yes”). Well, I was too focused on debugging mobile phones, probably in the next release…

Edit: Fixed the security issues in version 1.1 – there is now a whitelist for IP addresses that are allowed to install extensions. By default only is on that list.


Comment [2]

  1. pd · 2012-01-14 14:36 · #

    AFAIK the Jetpack SDK is designed to allow for the sort of live development you would prefer, see for starters. Note: it’s been a long time since I toyed with the SDK so things might have changed but I doubt it.

    Reply from Wladimir Palant:

    I know but I only have one SDK add-on. And this won’t work on mobile anyway.

  2. Mick · 2012-02-03 07:44 · #

    I tried to block the adds on google and wiped out the whole page. how do we unblock something that has been accidentally blocked.

Commenting is closed for this article.