Secure It (A ToggleButton Example)

By Erik Vold

I’ve always liked the secure redirection idea of HTTPS Everywhere but I was never a fan of how it was built or distributed. So I’ve wanted to build my own version for some time now and finally got around to a first iteration last week, which I am calling Secure It.

Secure It also turned out to be a good example of using the new Add-on SDK ToggleButton API.

Secure It

The main difference between Secure It and HTTPS Everywhere is that the former is manual where the latter is automatic. I might add some automatic bits later but for now it is completely manual, meaning the user has to take the inititive to turn on the https redirection for specific domains. They do this with a button for now, but I wish to add this functionality to a history viewer in the future.

Implementation

The first interesting bit (which will irrelevant fairly soon), is the part that uses Widget when ToggleButton is not available, in a way that the SDK 1.15 will allow.

The second interesting part when you compare using a Widget versus a Toggle button, the latter requires a little more effort to make sure all tab states are correct, but it will result in a better user experience, since the state for each tab is known before it is visited.

If you’d like to review the code or help out then the code is on Github as always.

You can install this add-on over at AMO here.