<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oxymoronical &#187; addons</title>
	<atom:link href="http://stage.oxymoronical.com/blog/tag/addons/feed" rel="self" type="application/rss+xml" />
	<link>http://stage.oxymoronical.com</link>
	<description>Spouting nonsense from the depths of my spare time</description>
	<lastBuildDate>Wed, 23 Nov 2011 20:15:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>WebApp Tabs, version control and GitHub</title>
		<link>http://stage.oxymoronical.com/blog/2011/11/WebApp-Tabs-version-control-and-GitHub</link>
		<comments>http://stage.oxymoronical.com/blog/2011/11/WebApp-Tabs-version-control-and-GitHub#comments</comments>
		<pubDate>Mon, 07 Nov 2011 00:59:28 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[extensions]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[restartless]]></category>
		<category><![CDATA[thunderbird]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1169</guid>
		<description><![CDATA[The extension I&#8217;ve been working on in my spare time for the past couple of weeks is now available as a first (hopefully not too buggy) release. It lets you open WebApps in Thunderbird, properly handling loading new links into Firefox and making all features like spellchecking work in Thunderbird (most other extensions I found [...]]]></description>
			<content:encoded><![CDATA[<p>The extension I&#8217;ve been working on in my spare time for the past couple of weeks is now available as a first (hopefully not too buggy) release. It lets you open WebApps in Thunderbird, properly handling loading new links into Firefox and making all features like spellchecking work in Thunderbird (most other extensions I found didn&#8217;t do this). You can read more about the actual extension at its <a title="WebApp Tabs for Thunderbird" href="http://www.fractalbrew.com/labs/webapp-tabs/">homepage</a>.</p>
<p>Mostly I&#8217;ve been really encouraged during the development of this at just how far our platform has come for developing restartless add-ons. When we first made it possible in Firefox 4 there was a whole list of things that were quite difficult to do but we&#8217;ve come a long way since then. While there are still things that are difficult there are lots of things that are now pretty straightforward. My add-on loads simple XUL overlays, style overlays, installs JS XPCOM components with category manager registration, all similar to older add-ons. In fact I&#8217;m struggling to think of things that it is still hard to do though I&#8217;m sure other more prolific developers will have plenty of comments on that!</p>
<p>The other thing I&#8217;ve been doing with this extension is experimenting with git and <a title="WebAppTabs at GitHub" href="https://github.com/Mossop/WebAppTabs">GitHub</a>. I think it&#8217;s been an interesting experience, there are continual arguments over which is better between git and mercurial with many pros and cons listed. I think most of these were done some time ago before mercurial and git really matured because from what I&#8217;ve seen there is really little difference between the two. They have slightly different default branching styles, but both can do the same kind of branching that the other can if you want and there are a few other minor differences but nothing that would really make me all that bothered over deciding which to use. I think the only place where git has a bonus is with GitHub, and really as far as I can see there isn&#8217;t a reason why someone couldn&#8217;t develop a similar site backed by mercurial repositories, it&#8217;s just that no-one really has.</p>
<p>GitHub is pretty nice with built-in basic issue tracking and documentation though it still has some frustrating issues. It seems odd for example that you can&#8217;t fork your own project, only someone else&#8217;s, but that&#8217;s only a minor niggle really. As project hosting goes I can&#8217;t say I&#8217;ve come across anything better that I can remember.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/11/WebApp-Tabs-version-control-and-GitHub/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Overlays without overlays in restartless add-ons</title>
		<link>http://stage.oxymoronical.com/blog/2011/10/Overlays-without-overlays-in-restartless-add-ons</link>
		<comments>http://stage.oxymoronical.com/blog/2011/10/Overlays-without-overlays-in-restartless-add-ons#comments</comments>
		<pubDate>Mon, 31 Oct 2011 01:43:46 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[restartless]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1163</guid>
		<description><![CDATA[Perhaps the most common way of making changes to Firefox with an extension has always been using the overlay. For a window&#8217;s UI you can make changes to the underlying XUL document, add script elements to be executed in the context of the normal window&#8217;s code and add new stylesheets to the window to change [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps the most common way of making changes to Firefox with an extension has always been using the overlay. For a window&#8217;s UI you can make changes to the underlying XUL document, add script elements to be executed in the context of the normal window&#8217;s code and add new stylesheets to the window to change how the UI looks.</p>
<p>Restartless add-ons change this around completely, the normal overlay and style-overlay mechanisms just aren&#8217;t available to restartless add-ons and this is likely to remain true for a while, these methods don&#8217;t clean up after themselves when the add-on is uninstalled.</p>
<p>This can make things hard, particularly for porting older add-ons to become restartless. I was in this situation earlier this weekend. I was working on porting <a href="http://blog.ascher.ca/">David Ascher</a>&#8216;s WebTabs for Thunderbird to be restartless. I could have just moved all the script code over to bootstrap.js but in many ways it is nice to keep the code that works on the main UI separate to the code that runs for the preferences UI etc. Plus I like to play around with new ways of doing things so I developed a JS module I&#8217;m calling the <code>OverlayManager</code>.</p>
<p>The <code>OverlayManager</code> watches for new windows being opened and for every new window it can run JS script and apply CSS stylesheets to the window in a way that is easy to undo if the add-on is disabled at runtime. Although it can&#8217;t do any XUL modifications right now (I didn&#8217;t need any for this particular extension) it would be pretty easy to extend this to support a minimum about of XUL overlays.</p>
<p>Stylesheets are loaded by adding a HTML style tag to the XUL document, so they can be removed easily when the add-on is disabled. Scripts are handled in a way that may even be better than normal overlays. In the old system extension scripts all run in the same context as the window they overlay giving rise to the possibility of conflicts. Restartless add-ons shouldn&#8217;t do this since it makes removing the script code again much more troublesome. The <code>OverlayManager</code> handles it by creating a sandbox to run the script in. The sandbox&#8217;s prototype is set to the window the script is being run for meaning the script sees all the functions and objects of the window directly in its own scope but as long as it doesn&#8217;t modify any of the objects in the main window&#8217;s code all we have to do is throw away the sandbox to get rid of its JS.</p>
<p>There are a few things different of course. The script shouldn&#8217;t use load and unload event handlers for the window as it may get loaded well after the window does or unloaded well before. Instead the <code>OverlayManager</code> looks for an <code>OverlayListener</code> object in the script and calls <code>load</code> and <code>unload</code> methods on it, these are called either with the window&#8217;s real <code>load</code> and <code>unload</code> events or while the window is open normally. You also can&#8217;t reference code in the script from JS string blocks, so if you set <code>onclick="myfunc()"</code> on a XUL element it wouldn&#8217;t work because that would run in the main window scope which can&#8217;t see the sandbox code at that point. This tends to be pretty simple to get around by using <code>addEventListener</code> for all your events though.</p>
<p>You can see the existing state of the code <a href="https://github.com/Mossop/WebAppTabs/blob/master/src/modules/OverlayManager.jsm">on github</a> and an example of the structure you&#8217;d pass to <code>OverlayManager.addOverlays</code> is in the <a href="https://github.com/Mossop/WebAppTabs/blob/master/src/bootstrap.js#L42">bootstrap script</a> for the same project. It is appropriately licensed so go nuts!</p>
<p><strong>Update:</strong> I changed the stylesheets to use XML processing instructions to be more like they work currently and just for fun I implemented the very basics of document overlaying, almost totally untested though so YMMV.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/10/Overlays-without-overlays-in-restartless-add-ons/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Adding add-on preferences to the Add-ons Manager</title>
		<link>http://stage.oxymoronical.com/blog/2011/07/Adding-add-on-preferences-to-the-Add-ons-Manager</link>
		<comments>http://stage.oxymoronical.com/blog/2011/07/Adding-add-on-preferences-to-the-Add-ons-Manager#comments</comments>
		<pubDate>Thu, 07 Jul 2011 18:06:32 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[extension manager]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[restartless]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1089</guid>
		<description><![CDATA[For some time now Firefox for mobile has had this nice feature where add-ons could embed their preferences right into the list of add-ons, no need to open a whole a new window like add-ons for desktop have to. During the development of Firefox 4 we were a little jealous of what the mobile team [...]]]></description>
			<content:encoded><![CDATA[<p>For some time now Firefox for mobile has had this nice feature where add-ons could embed their preferences right into the list of add-ons, no need to open a whole a new window like add-ons for desktop have to. During the development of Firefox 4 we were a little jealous of what the mobile team had done and so we drew up some ideas for how the same functionality would look on desktop. We didn&#8217;t get time to implement them then but I&#8217;m excited that someone from the community stepped up and implemented it for us. Not just that but he made the code shared between mobile and desktop, added some new option types and made it work fine for restartless add-ons which are unable to register their own chrome.</p>
<p>The basic idea is simple. Create a XUL file containing a list of <code>&lt;setting&gt;</code> elements. Different types of settings are possible, checkboxes, input boxes, menulists, buttons, etc. Each one shows up as a row in the details view for an add-on in the add-ons manager. The XUL file can either be just added to your XPI (call it <code>options.xul</code>) or referenced by the <code>optionsURL</code> option in your <code>install.rdf</code>.</p>
<p>Get it right and you&#8217;ll see something like this:</p>
<p style="text-align: center;"><a href="http://www.oxymoronical.com/wp/wp-content/uploads/2011/07/Screen-shot-2011-07-07-at-10.57.04.png"><img class="aligncenter size-full wp-image-1090" title="Inline preferences in the Add-ons Manager" src="http://www.oxymoronical.com/wp/wp-content/uploads/2011/07/Screen-shot-2011-07-07-at-10.57.04.png" alt="" width="739" height="631" /></a></p>
<p style="text-align: left;">I want to thank <a href="http://www.darktrojan.net">Geoff Lankow (darktrojan on IRC)</a> for his awesome work getting this done. This feature is now in the <a href="http://www.mozilla.com/firefox/channel/">Aurora</a> builds and it&#8217;d be great to get add-on developers playing with it. Geoff even wrote up some <a href="https://developer.mozilla.org/en/Extensions/Inline_Options">detailed docs</a> to help you out.</p>
<p>As a bonus Geoff also implemented support for in-tab preferences. This makes Firefox load an add-ons options UI in a new tab instead of a new window. Setting the <code><a href="https://developer.mozilla.org/en/Install_Manifests#optionsType">optionsType</a></code> property to 3 enables this.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/07/Adding-add-on-preferences-to-the-Add-ons-Manager/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Unloading JS modules</title>
		<link>http://stage.oxymoronical.com/blog/2011/07/Unloading-JS-modules</link>
		<comments>http://stage.oxymoronical.com/blog/2011/07/Unloading-JS-modules#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:26:44 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[restartless]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1079</guid>
		<description><![CDATA[One of the problems with writing a restartless add-on is that you have to be careful about undoing anything your add-on does when it is told to shutdown. This means that right now some features of the platform can&#8217;t be used as we have no way to undo them. Recently I made this list a [...]]]></description>
			<content:encoded><![CDATA[<p>One of the problems with writing a restartless add-on is that you have to be careful about undoing anything your add-on does when it is told to shutdown. This means that right now some features of the platform can&#8217;t be used as we have no way to undo them. Recently I made this list a little shorter by making it possible to unload JS modules loaded with <code>Components.utils.import()</code>.</p>
<p>Just call <code>Components.utils.unload(uri)</code> and the module loaded from that URI will be unloaded. Take care when you do this because something might still have references into it which will stop working. Firefox also caches the module&#8217;s code for fast loading the next time around. The add-ons manager clears this cache when your add-on is updated or uninstalled so you mostly don&#8217;t have to worry about it but if you do something strange like unload a module, manually alter the file and then import it again you won&#8217;t get the latest code.</p>
<p>This support is in the upcoming <a href="http://www.mozilla.com/firefox/channel/">Aurora</a> build.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/07/Unloading-JS-modules/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making it easier to check that your plugins are up to date</title>
		<link>http://stage.oxymoronical.com/blog/2011/07/Making-it-easier-to-check-that-your-plugins-are-up-to-date</link>
		<comments>http://stage.oxymoronical.com/blog/2011/07/Making-it-easier-to-check-that-your-plugins-are-up-to-date#comments</comments>
		<pubDate>Thu, 07 Jul 2011 16:48:31 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1053</guid>
		<description><![CDATA[Keeping the software you use up to date is a crucial part of keeping yourself safe while browsing online. At Mozilla we work hard to help you get the most up to date version of Firefox and all the add-ons you have installed. For some time now security updates for Firefox have been installed without [...]]]></description>
			<content:encoded><![CDATA[<p>Keeping the software you use up to date is a crucial part of keeping yourself safe while browsing online. At Mozilla we work hard to help you get the most up to date version of Firefox and all the add-ons you have installed. For some time now security updates for Firefox have been installed without you needing to do anything. In Firefox 4 we made extension and theme updates behave similarly.</p>
<p>Plugins, like Flash, Quicktime and Java for example, are a little more difficult to update in this way though. They tend to require explicit permission to install new versions and so we haven&#8217;t quite gotten to the point of doing this completely automatically. Instead we developed the <a href="https://www.mozilla.com/plugincheck/">plugin check page</a> which can quickly and easily tell you which of the plugins you have installed are old and need updating. It will also tell you where to go to update them.</p>
<p>The latest version of Firefox currently in beta makes it easier to get to the plugin check page. Simply go to the Add-ons Manager, click on the Plugins section and there is a link at the top of the page to check if your plugins are up to date.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/07/Making-it-easier-to-check-that-your-plugins-are-up-to-date/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Why do Firefox updates break add-ons?</title>
		<link>http://stage.oxymoronical.com/blog/2011/06/Why-do-Firefox-updates-break-add-ons</link>
		<comments>http://stage.oxymoronical.com/blog/2011/06/Why-do-Firefox-updates-break-add-ons#comments</comments>
		<pubDate>Fri, 24 Jun 2011 23:25:22 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1064</guid>
		<description><![CDATA[Our success in switching to the new rapid release cycle for Firefox has stirred up lots of excitement in the community and I wouldn&#8217;t be surprised if that intensifies when we ship the next update to Firefox in 8 weeks time. People keep pointing out that everytime we update Firefox we break add-ons so surely [...]]]></description>
			<content:encoded><![CDATA[<p>Our success in switching to the new rapid release cycle for Firefox has stirred up lots of excitement in the community and I wouldn&#8217;t be surprised if that intensifies when we ship the next update to Firefox in 8 weeks time. People keep pointing out that everytime we update Firefox we break add-ons so surely faster releases means add-ons will get broken faster. Many people don&#8217;t really understand why Firefox updates should break add-ons anyway so here is my attempt at an explanation and how maybe rapid releases aren&#8217;t such a bad thing after all.</p>
<p>The crux of the matter is in how deeply we allow add-ons integrate with Firefox. Most browsers separate add-ons from their code using what can be called an add-on API. All the add-on can see and use is what the browser makes available through that API and this is normally a restricted set of functionality. Firefox has no such separation. Add-on code runs in exactly the same setting as the browser code, they can call any of the internal functionality that we write to make the browser work in the first place.</p>
<p>There are big advantages to the Firefox way:</p>
<ul>
<li>Add-ons can do basically anything, allowing really complicated add-ons like Firebug and NoScript to exist.</li>
<li>Authors don&#8217;t have to wait for features to be exposed through some API to be able to use it, as soon as the feature is in the application add-ons can use it.</li>
</ul>
<p>There are also some disadvantages:</p>
<ul>
<li>Add-ons can do basically anything so you should be wary about installing add-ons from people you don&#8217;t trust!</li>
<li>Because we aren&#8217;t forced to provide an API specifically for add-ons sometimes what is there can be cumbersome for add-ons to use.</li>
<li>Add-ons rely on internal functions, if we make a change to one then it breaks the add-on.</li>
</ul>
<p>It is that last point which explains why Firefox updates break add-ons. Any time we add, remove or change some code we run a risk that some add-on depends on it and so will break. Some bits of code are more important than others but we have such a vast library of add-ons now that it&#8217;s probably getting to the point where almost everything is in use. When people say that Firefox updates shouldn&#8217;t break add-ons what they don&#8217;t realise is that they&#8217;re asking us to stop making changes to Firefox: no new features, no bug fixes.</p>
<h2>How does the Add-ons SDK fit in?</h2>
<p>With the most recent update to Firefox we also made the first official release of the new <a title="Add-ons SDK and Builder" href="https://addons.mozilla.org/en-US/developers/builder">add-ons SDK</a> available. These are tools designed to make developing add-ons for Firefox easier and faster and they largely serve as an add-ons API sitting between the add-on and Firefox with one difference, the API is actually a part of the add-on so you can actually write your own additional APIs to supplement those in the core SDK.</p>
<p>Add-ons written with the SDK (and only using the core APIs) gain a lot of the benefits of add-ons for other browsers. The APIs in the SDK can be far more stable than those in the browser itself, as the browser code changes the internal SDK code can adapt to match allowing add-ons to work just by rebuilding with the newer SDK. This makes the problem of Firefox updates much smaller for those that can move their add-ons to the SDK.</p>
<p>I don&#8217;t foresee a future where the only add-ons are SDK based though. We&#8217;d lose too many really important add-ons that way so the SDK doesn&#8217;t completely solve the problem.</p>
<h2>How does rapid release affect the problem?</h2>
<p>As I&#8217;ve said, when Firefox updates it breaks add-ons. Ask any add-on author how much fun it was fixing their add-ons to work from Firefox 2 to Firefox 3 or 3.6 to 4 and you&#8217;ll probably get some pained expressions. Now think about how in the past we would do a Firefox update about once a year, now we are talking about it being more than eight times a year. Having given up maintaining my own add-ons I can hardly blame authors who are concerned that they won&#8217;t be able to keep up with the pace.</p>
<p>It actually isn&#8217;t all bad though. It&#8217;s not like we are making more changes than we were before, we&#8217;re just releasing them sooner in bite-sized chunks. Instead of one update a year that probably changes every piece of functionality an add-on might use we do 8 smaller updates, each one touching smaller parts of the code. This means it is more likely that an add-on can survive an update than before.</p>
<p>The stability of updates is a key change too. It used to be that add-on authors might choose to wait for the RC stage of an update before updating their add-ons. We&#8217;d make so many changes even during the beta cycle that sometimes it wasn&#8217;t worth trying to keep up. In our new cycle though there is a full 6 weeks in the beta cycle before release during which time almost nothing changes, no new features, extremely limited bugfixes, just things to solve any stability issues that have been found. Before that there is 6 weeks in the aurora cycle which again should be largely change free. Some new features might get removed at this point and there is the possibility of larger bugfixes, but based on the two aurora cycles we&#8217;ve had so far there are far fewer changes going in than there were in the final beta stages of Firefox 4.</p>
<p>I actually think that rapid releases can make it easier for add-on authors to keep up. Sure you have to check your add-on more often but most of the time it will probably just work, if not the scope of change is likely to be smaller and you have 12 weeks of pretty stable code to build against.</p>
<h2>Why not just mark add-ons as working when they are?</h2>
<p>A pretty common question asked is why we don&#8217;t just mark add-ons as working in the new update of Firefox when we know they are. The good news is that we actually are starting to do this. As we make changes to Firefox we plan to keep track of which changes have the potential to affect add-on compatibility and automatically scan add-ons on AMO to find ones that might break.</p>
<p>In the run up to the most recent update of Firefox we found <a href="http://blog.mozilla.com/addons/2011/05/21/firefox-5-compatibility-bump/">nearly 4,000</a> add-ons that were unlikely to be affected by the update and just marked them as compatible with no need for the add-on author to do anything. For the others we emailed the author to explain what problems we had found. You can read more about the <a href="http://blog.mozilla.com/addons/2011/04/19/add-on-compatibility-rapid-releases/">compatibility checking process</a> we&#8217;ll be using.</p>
<p>As well as automated tools the <a href="https://addons.mozilla.org/en-US/firefox/addon/add-on-compatibility-reporter/">add-on compatibility reporter</a> provides add-on authors valuable feedback on how their add-ons are performing in Firefox. Users can install this tool and then use normally incompatible add-ons and file reports on whether they are working or not.</p>
<h2>Faster releases are good for add-ons</h2>
<p>Rapid release is all about getting new features into users&#8217; hands faster. It has a side effect though, it gets new features and APIs into add-on authors&#8217; hands faster too. Back when I was still writing add-ons I would frequently do so in response to some fantastic new thing that had been added to the Firefox nightlies. It could then be up to a year before I&#8217;d be able to release an add-on that normal users could actually make use of, by which point I&#8217;d often have lost interest in it.</p>
<p>I think that on the whole faster releases will be a good thing for add-ons. Add-on developers can get exciting new features into users&#8217; hands faster and should only need to make smaller updates with each new Firefox. The new automated tools we are building to help authors understand when and why their add-ons are no longer compatible are going to be a massive improvement, especially as we get better at identifying the changes we make in Firefox that will affect add-ons.</p>
<p>Time will tell of course, but I do believe that the overall work an author has to do to keep an add-on up to date with Firefox is going to drop with the new rapid release cycle even though they may have to do something more often.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/06/Why-do-Firefox-updates-break-add-ons/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Creating custom add-on types just got easier</title>
		<link>http://stage.oxymoronical.com/blog/2011/05/Creating-custom-add-on-types-just-got-easier</link>
		<comments>http://stage.oxymoronical.com/blog/2011/05/Creating-custom-add-on-types-just-got-easier#comments</comments>
		<pubDate>Wed, 25 May 2011 18:01:53 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[extension manager]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1055</guid>
		<description><![CDATA[One of the nice features that we added to the add-ons manager in Firefox 4 was support  for custom add-on types that could be treated the same way as the built-in types, even showing up in the same UI if you did a little work. I blogged a basic example of how to do this [...]]]></description>
			<content:encoded><![CDATA[<p>One of the nice features that we added to the add-ons manager in Firefox 4 was support  for custom add-on types that could be treated the same way as the built-in types, even showing up in the same UI if you did a little work. I <a title="How to extend the new Add-ons Manager (or how I built a simple greasemonkey clone in an evening)" href="http://www.oxymoronical.com/blog/2010/07/How-to-extend-the-new-Add-ons-Manager">blogged a basic example</a> of how to do this and I know since then Greasemonkey and Stylish have been using the support.</p>
<p>A few days ago (and now in Aurora builds) I landed some improvements that simplify the hardest part of this, making the UI appear.</p>
<h2>Registering a custom type</h2>
<p>Previously in order to add a new type of add-on and have it appear in the add-ons manager you would have to do two things, first tell the add-ons manager module that you supported add-ons and secondly manually create some elements in the UI to allow the user to view them. These two things have now been combined:</p>
<pre>AddonManagerPrivate.registerProvider(myProvider, [{
  id: "scripts",
  name: "User Scripts",
  uiPriority: 3500,
  viewType: AddonManager.VIEW_TYPE_LIST
}]);
</pre>
<p>This registers the provider as before but also tells the module that your provider supports an AddonType with the ID &#8220;scripts&#8221; and some other information. The <a title="AddonType documentation" href="https://developer.mozilla.org/en/Addons/Add-on_Manager/AddonType">documentation</a> explains a little more about the properties. You&#8217;ll note it passes an array to allow for providers registering multiple types.</p>
<p>Currently you only need to do this if you want your add-on types to show up in the UI, however we may start requiring providers to register their types to help speed up some of the API calls. If you want to register your type and not have the UI automatically show it just don&#8217;t give it a viewType.</p>
<h2>Breaking changes</h2>
<p>Some of the changes we had to make may have broken some add-ons that have been doing this the hard way in the past. Here are the once I&#8217;ve identified and some ways to work around the problems:</p>
<h3>Types must be registered</h3>
<p>The UI now requires that if you&#8217;re displaying your add-ons in the regular list view then it must have been registered. If you only care about supporting Firefox 6 and higher then you can just remove your code for adding your type to the category list, if you want to support both then you should either only do that on versions before Firefox 6, or you could always manually add your type to the UI but also register your type with no viewType.</p>
<h3>Some IDs changed in the UI</h3>
<p>We made some changes to the IDs of elements in the add-ons manager UI, we dropped the &#8220;s&#8221; on the end of the type selectors. category-extensions became category-extension as an example.</p>
<h3>Category items aren&#8217;t in the UI immediately</h3>
<p>Because we now build the list of types to display in the UI (even the built-in types use the same type registration I&#8217;ve talked about here), the elements for those types aren&#8217;t in the UI until after the main initialize function for the window has completed. If you try to use overlays that refer to those elements or if you run script that tries to find these elements before the initialize function completes (it is a load event listener) then they won&#8217;t exist and you&#8217;ll probably find things broken.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/05/Creating-custom-add-on-types-just-got-easier/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to disable extension compatibility checking on Nightly builds of Firefox</title>
		<link>http://stage.oxymoronical.com/blog/2011/05/How-to-disable-extension-compatibility-checking-on-Nightly-builds-of-Firefox</link>
		<comments>http://stage.oxymoronical.com/blog/2011/05/How-to-disable-extension-compatibility-checking-on-Nightly-builds-of-Firefox#comments</comments>
		<pubDate>Tue, 24 May 2011 21:26:58 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1051</guid>
		<description><![CDATA[A long long time ago (I can still remember&#8230;) we changed the preference you use to disable compatibility checking for extensions. We still aim for users to instead use tools like the Add-on Compatibility Reporter to handle this (especially since we are going to start crowdsourcing data from it), but for developers who don&#8217;t want [...]]]></description>
			<content:encoded><![CDATA[<p>A long long time ago (I can still remember&#8230;) we <a title="Changing the checkCompatibility preference" href="http://www.oxymoronical.com/blog/2009/11/Changing-the-checkCompatibility-preference">changed the preference</a> you use to disable compatibility checking for extensions. We still aim for users to instead use tools like the Add-on Compatibility Reporter to handle this (especially since we are going to start crowdsourcing data from it), but for developers who don&#8217;t want to install that but still want to use extensions on their nightly builds the new rapid release model would mean setting a new preference every 6 weeks.</p>
<p>We&#8217;ve now changed this and any nightly, try, or self-made builds (anything not on the aurora, beta or release channels) will instead use the single preference extensions.checkCompatibility.nightly from now on, regardless of version. This will be available from tonight&#8217;s nightly onwards.</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/05/How-to-disable-extension-compatibility-checking-on-Nightly-builds-of-Firefox/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>What&#8217;s next for the Add-ons Manager?</title>
		<link>http://stage.oxymoronical.com/blog/2011/03/Whats-next-for-the-Add-ons-Manager</link>
		<comments>http://stage.oxymoronical.com/blog/2011/03/Whats-next-for-the-Add-ons-Manager#comments</comments>
		<pubDate>Tue, 08 Mar 2011 22:52:14 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[extension manager]]></category>
		<category><![CDATA[help wanted]]></category>
		<category><![CDATA[planning]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1023</guid>
		<description><![CDATA[Firefox 4 is just around the corner and it&#8217;s great to look back over just how far the Add-ons Manager has come since Firefox 3.6. In fact if you want to see the full history look at my earlier post that shows its evolution since Phoenix 0.2. We set out with some pretty lofty goals [...]]]></description>
			<content:encoded><![CDATA[<p>Firefox 4 is just around the corner and it&#8217;s great to look back over just how far the Add-ons Manager has come since Firefox 3.6. In fact if you want to see the full history look at my earlier post that shows its <a title="History of the Add-ons Manager" href="http://www.oxymoronical.com/blog/2010/07/History-of-the-Add-ons-Manager">evolution since Phoenix 0.2</a>. We set out with some pretty lofty goals for Firefox 4 and I&#8217;m pretty excited at just how many of them we achieved. I hope everyone appreciates the hard work that <a href="http://theunfocused.net/">Blair</a>, <a href="http://jboriss.wordpress.com/">Boriss</a>, <a href="http://blog.fligtar.com/">Justin</a>, <a href="http://www.hskupin.info/">Henrik</a>, Ben, myself and all the others put in to get us to where we are today.</p>
<p>Of course, we aren&#8217;t finished. There were a lot of things that we wanted to get done and didn&#8217;t get time for and I&#8217;m sure we&#8217;ll be getting lots of feedback from users of the final release to work on. Since the pressure has been off I&#8217;ve been skimming back over bug reports and notes to try to come up with an idea of what we want to work on over the next few releases of Firefox. As you may know the plan is to move to quarterly releases and not really block a release on any particular projects but we will still be getting an idea of what product drivers will prioritise work on and guess at what other things we can fit in.</p>
<h2>UI refinements</h2>
<p>In the closing stages of Firefox 4 there were a lot of small polish issues identified. We knocked down a lot of them but there are still plenty of tweaks that we&#8217;re going to be bringing to the UI to make sure it is as usable as we can make it. It isn&#8217;t really worth applying a fixed schedule to these as they are small one-off fixes that can just come as and when ready. We already have some that are basically ready to land.</p>
<h2>Incremental API fixes</h2>
<p>There are lots of things that I&#8217;d like to see done for the platform and APIs that developers use. Again there is no fixed schedule for these but the main things on my mind are changes that make developing restartless add-ons or extending the add-ons manager easier. I&#8217;ve already started work on a couple of these and expect to get them landed after the tree reopens.</p>
<h2>Larger projects</h2>
<p>There are of course also larger projects that will require more resources. I&#8217;ve started writing up short project pages for each of these. Each project should start with the people working on it coming to agreement on what the actual goals should be and an implementation plan so until the projects are actually picked up the project pages are mostly made up. I&#8217;ve put down a rough idea of when a project might make it into a Firefox release. These are just guesses, if the project turns out to be larger than expected they&#8217;ll come later, if people volunteer to work on projects or if the product drivers decide they are a priority then they could come sooner.</p>
<ul>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Third_Party_Add-on_Warnings">Warning users when third-party applications install add-ons into Firefox</a> (Firefox 5)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Uninstalling_Third_Party_Add-ons">Allowing users to uninstall add-ons installed by third-party applications</a> (Firefox 5)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Confirm_on_Upgrade">Improvements to the compatibility checking UI after application upgrades</a> (Firefox 5)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Performance_Indicators">Adding some kind of metric about add-on&#8217;s resource usage</a> (Firefox 5/6)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Search_Engines">Including search engines in the add-ons manager</a> (Firefox 5/6)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Add-on_Installation">Streamlining the installation UI</a> (Firefox 6)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Appearance_Pane">Improved theme UI and allowing using personas at the same time as custom themes</a> (Firefox 6)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Embedded_Add-on_Preferences">Embedding add-on preferences into the add-ons manager</a> (Firefox 6/7)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Plugin_Updates">Managing plugin updates in the add-ons manager</a> (Firefox 7)</li>
<li><a href="https://wiki.mozilla.org/Extension_Manager:Projects:Plugin_Discovery">Improved plugin discovery</a> (Firefox 7)</li>
</ul>
<p>You can see that assuming a quarterly release schedule we have enough projects  here to last till the end of 2011 at least, quite likely longer. Over that sort of time I guess it&#8217;s almost guaranteed that priorities and plans will change in the meantime but hopefully this gives an idea of what our thinking is at the moment. Expect to see progress on some of the things at the top of the list very soon!</p>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/03/Whats-next-for-the-Add-ons-Manager/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Playing with windows in restartless (bootstrapped) extensions</title>
		<link>http://stage.oxymoronical.com/blog/2011/01/Playing-with-windows-in-restartless-bootstrapped-extensions</link>
		<comments>http://stage.oxymoronical.com/blog/2011/01/Playing-with-windows-in-restartless-bootstrapped-extensions#comments</comments>
		<pubDate>Wed, 19 Jan 2011 20:14:27 +0000</pubDate>
		<dc:creator>Mossop</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[addons]]></category>
		<category><![CDATA[bootstrapped]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[restartless]]></category>
		<category><![CDATA[sample]]></category>

		<guid isPermaLink="false">http://www.oxymoronical.com/?p=1009</guid>
		<description><![CDATA[Lots of people seem to be playing with the new support for restartless extensions (also known as bootstrapped extensions) coming in Firefox 4. Nothing could make me happier really. I&#8217;m not sure I can remember ever helping implement something which is will hopefully turn out to be a game changer for extension development in the [...]]]></description>
			<content:encoded><![CDATA[<p>Lots of people seem to be <a href="http://starkravingfinkle.org/blog/2011/01/bootstrap-jones-adventures-in-restartless-add-ons/">playing</a> with the new support for restartless extensions (also known as bootstrapped extensions) coming in Firefox 4. Nothing could make me happier really. I&#8217;m not sure I can remember ever helping implement something which is will hopefully turn out to be a game changer for extension development in the future. The technical details of restartless extensions are <a href="https://developer.mozilla.org/en/Extensions/Bootstrapped_extensions">talked about</a> in a <a href="http://www.oxymoronical.com/blog/2010/07/How-to-extend-the-new-Add-ons-Manager">few places</a> but one thing that is missing is what I think is probably going to be the most common code pattern in these extensions.</p>
<p>When you&#8217;re developing an extension it&#8217;s almost certain that you&#8217;re going to want to interact with the main browser window in some way. With the XUL based extensions this was a pretty simple process, normally your extension would be overlaying browser.xul and so any script you add there would automatically run for every new browser window and would have direct access to it (in fact this sometimes confused new developers who assumed their script would run just once and be globally available, not for every browser window opened).</p>
<p>In restartless extensions things are different. You have one script that runs when your extension is started and runs in its own sandbox so you have to take steps to get access to windows. Complicating matters your extension may be started when Firefox starts up and there are no browser windows or after when some already exist. The best way to go is when your extension is started to look for any existing browser windows and make your necessary modifications and then wait for new windows to open and modify those too.</p>
<p>Since this is such a common case (and vlad was trying to figure it out on IRC) I put together a very simple bootstrap script that just does this. It calls the setupBrowserUI function for every window that needs to be initialised by your extension and tearDownBrowserUI for every window that must be cleaned up when your extension is being disabled. This code isn&#8217;t the only way to do all this but it is fairly straightforward and works, feel free to take it and modify it for use in your own extensions. I&#8217;ll probably get it put onto MDC too.</p>
<pre>const Cc = Components.classes;
const Ci = Components.interfaces;

var WindowListener = {
  setupBrowserUI: function(window) {
    let document = window.document;

    // Take any steps to add UI or anything to the browser window
    // document.getElementById() etc. will work here
  },

  tearDownBrowserUI: function(window) {
    let document = window.document;

    // Take any steps to remove UI or anything from the browser window
    // document.getElementById() etc. will work here
  },

  // nsIWindowMediatorListener functions
  onOpenWindow: function(xulWindow) {
    // A new window has opened
    let domWindow = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                             .getInterface(Ci.nsIDOMWindowInternal);

    // Wait for it to finish loading
    domWindow.addEventListener("load", function listener() {
      domWindow.removeEventListener("load", listener, false);

      // If this is a browser window then setup its UI
      if (domWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser")
        WindowListener.setupBrowserUI(domWindow);
    }, false);
  },

  onCloseWindow: function(xulWindow) {
  },

  onWindowTitleChange: function(xulWindow, newTitle) {
  }
};

function startup(data, reason) {
  let wm = Cc["@mozilla.org/appshell/window-mediator;1"].
           getService(Ci.nsIWindowMediator);

  // Get the list of browser windows already open
  let windows = wm.getEnumerator("navigator:browser");
  while (windows.hasMoreElements()) {
    let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);

    WindowListener.setupBrowserUI(domWindow);
  }

  // Wait for any new browser windows to open
  wm.addListener(WindowListener);
}

function shutdown(data, reason) {
  // When the application is shutting down we normally don't have to clean
  // up any UI changes made
  if (reason == APP_SHUTDOWN)
    return;

  let wm = Cc["@mozilla.org/appshell/window-mediator;1"].
           getService(Ci.nsIWindowMediator);

  // Get the list of browser windows already open
  let windows = wm.getEnumerator("navigator:browser");
  while (windows.hasMoreElements()) {
    let domWindow = windows.getNext().QueryInterface(Ci.nsIDOMWindow);

    WindowListener.tearDownBrowserUI(domWindow);
  }

  // Stop listening for any new browser windows to open
  wm.removeListener(WindowListener);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://stage.oxymoronical.com/blog/2011/01/Playing-with-windows-in-restartless-bootstrapped-extensions/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

