## My first Firefox contribution

When I started ImageTweak a few years ago, the decision of building an extensions was mostly due to the fact that the Firefox codebase looked, frankly, quite scaring. Even only attempting to compile Firefox on Windows looked like an impossible endeavor, let alone building a modified version.

Compared to this, writing an extensions looked like a piece of cake (looking back, this was a rather naïve evaluation, but that’s another story…).

Fast forward a few years: ImageTweak has gotten pretty mature, so the question pops up again. Wouldn’t it be better to tackle the source of all problems (pun intended) and bring at least a subset of ImageTweak to all Firefox users? And so, on a fine spring day, while working on my MSc thesis, I finally found the courage to make a real attempt at producing a patch that would at least bring feature parity with ImageTweak 0.9, i.e. centering stand-alone images on a dark background.

After a few rounds of patches, I finally managed to produce a working patch that had a single, HUGE, issue. It produced an awful lot of failed tests in the regression tests. If you add to this that, by the time the working patch was ready, I was on the eve of my dissertation (that would be followed by a fair amount of AFK holidays and by a close-to-immediate hiring for a consultancy firm) the amount of time I could devote to Mozilla-related tasks dropped rather quickly to nil.

Luckily, my (clumsy) attempt at a patch had the effect of setting the proverbial ball rolling: somebody (Jared Wein) over at BMO picked up where I left off and fixed all regression tests. And, just like that, a couple of weeks ago, I received a notification about the fact that my patch had been pushed to mozilla-central and that it will be part of Firefox 11. Proudness ensued.

Obviously, as with any other user-facing change, this is prone to (hopefully constructive) discussion. And that’s good, I guess, because those are yet more proverbially rolling balls.

update: Unlike Daniel Glazman, Jared Wein seems to like it: Blinded by the light! – An improved image viewing experience in Firefox

## Drag&drop not really working properly in ImageTweak

When I released ImageTweak 0.19 I wrote in the changelog that the main change was the support for proper image drag&drop.

It actually works correctly but this change had the side effect of changing the normal mouse pointer used by ImageTweak to indicate that you’re moving an image around the window. I noticed this before releasing the update, but it seemed like a minor annoyance worth the additional functionality. I actually tried to fix it but found no way, and since there were a lot of people writing negative reviews on AMO for the lack of drag&drop support I decided to release it without fixing it.

Fast forward some weeks, and it turns out that actually the new behaviour is quite confusing and many are complaining about the mouse pointer showing the “forbidden” shape while moving the image. Fewer than they were complaining before about the lack of drag&drop, but still…

So I set out to find a solution for this problem but apparently there’s no way to freely control the mouse pointer shape during a drap&drop operation. The only thing that comes closer is setting the mozCursor property of the DOMDataTransfer interface to “default”, but that works only on win32 and simply switch the cursor from “forbidden” to the default arrow.

I’m therefore pretty much stuck in a fix: I have to fix this problem but I have no idea of how. If you know how to do this, or know somebody that might help me in fixing this, please let me know.

## ImagetTweak 0.19 finally available

After a month or so in the AMO review queue, ImageTweak 0.19 is finally available. Current users should be notified of the update soon.

## Netbook browsing tips for Firefox

Having recently bought a netbook (MSI U123) I had to readjust my browsing habits since normally I work on a 24″ Dell 2407WFP with a resolution of 1920×1200, whereas the MSI has a meager 10.1″ at 1024×600.

As a result I had to tweak my browser of choice to be able to work nicely on such a small screen. Fortunately enough, Firefox allows you to tailor almost exactly as you want, and to reclaim much of the needed vertical screen space.

So, let’s get started. Continue reading

## ImageTweak 0.19: proper drag&drop

A few months and a complete change of location (I’m in Helsinki right now!) later, ImageTweak is going to reach version 0.19.

I had to scrape all the work I already did for 0.19 because I hit a few roadblocks, and so I had to start over with a minor but longstanding bug: proper drag&drop support. What it means is that you won’t have to hold CTRL anymore when performing drag&drop. The price is that I had to drop support for firefox 2.x and 3.0.x.

I just added it on AMO. As soon as it gets reviewed it will be available for download.

p.s. I also enabled donations on AMO, so if you feel like it please support the development of ImageTweak.

## HTML5 Web Sockets API reloaded

One of the most exciting upcoming features of HTML5 is the ability to open persistent bidirectional sockets to a remote host.

As far as I know, one of the early proposals was about allowing web applications almost complete control over sockets, including the ability to create raw sockets and to listen for incoming connections exactly like a typical network daemon/server, but this proposal was later scraped because of security implications.

Fast forward to today and the Web Sockets API, even if still under development, are starting to get a stable shape and they will probably be implemented soon by the most forward-looking browser vendors.

The problem is, though, that the original proposal got crampled along the way and therefore there won’t be any means to create peer-to-peer connections between users, something that could enable all kinds of cool distributed systems.

That is, unless someone does something: what I’m thinking about right now is a kind of wrapper/extension around the Web Sockets API that does simply a few things:

1. allows a web application to register for incoming connections
2. opens up the required ports on the firewall/NAT
3. when a connection arrives, perform the handshaking required by the ws:// protocol and forwards a WebSocket object representing the connection to the application

Talking IDL, that would mean (the WebSocket interface is the current WHATWG proposal, while WebSocketListener is my addition):

[Constructor(in DOMString url, optional in DOMString protocol)]
interface WebSocket {

const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSED = 2;

// networking
attribute Function onopen;
attribute Function onmessage;
attribute Function onclose;
boolean send(in DOMString data);
void close();
};

[Constructor(optional in short port, optional in DOMString protocol)]
interface WebSocketListener {

const unsigned short OPENING = 0;
const unsigned short LISTENING = 1;
const unsigned short CLOSED = 2;

// networking
attribute Function onconnection;
void close();
};

Talking about the Mozilla platform, points 1 and 3 are straightforward (once the Web Sockets API has been implemented), whereas point 2 will be platform-dependent and, therefore, trickier. Nevertheless, I think that all of this can be handled (with some work) by a Firefox extension.

Once Firefox will gain Web Sockets support I’ll definitely try to see if it is possible to add it.

I just noticed that ImageTweak passed the 2M downloads mark and is steadily above 200K active daily users. That’s quite something! A big thanks to all my users (well, maybe not really all of them).
Just in case someone is wondering: I’m open to new contributors for ImageTweak. It really isn’t a big codebase, but it needs maintenance and further development… if you know javascript (and possibly a little about developing Firefox extensions) and you’re willing to contribute please leave a comment here.

## The footlights went off

A few days ago ImageTweak lost the “reccomended” status on AMO due to the regular extensions turnover and, as expected, the daily downloads fell from 7k+ to about 1k+.
I just wish to thank all the folks behind AMO for their support.
Time to restart working on 0.19…

## A DHT for Mozilla?

I’ve been thinking in the last few days about writing a DHT implementation for Mozilla, some kind of generic library (packaged as an add-on) that may be used in a tons of different ways, like:

• a distributed version of Weave (for Firefox)
• a shared cache/proxy/CDN system (that would allow users to reach otherwise unreachable resources, be it because of server downtime or because of censorship policies)
• a file sharing platform (for Songbird: imagine being able to see in your library not only your songs, but also everyone else’s)
• a distributed computing platform (more on this in a later post)
• the Next Big Thing™

BTW, much of this is partly already implemented in any bittorrent client (and the rest is already on track), what’s needed is just glueing the pieces together. As soon as my exams are over I’ll give it a try…