<?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>Gavin's blog</title>
	<atom:link href="http://www.gavinsharp.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gavinsharp.com/blog</link>
	<description>blog?</description>
	<lastBuildDate>Sat, 26 Jun 2010 01:36:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>mise a jour</title>
		<link>http://www.gavinsharp.com/blog/2010/06/25/mise-a-jour/</link>
		<comments>http://www.gavinsharp.com/blog/2010/06/25/mise-a-jour/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 01:36:09 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=101</guid>
		<description><![CDATA[On Monday I finally landed the new &#8220;PopupNotifications&#8221; JS module, used to display popup-style notifications (as discussed earlier). Since then I&#8217;ve spent some time fixing followups, but there&#8217;s still a bunch of work to be done (including fleshing out the MDC documentation and trying to find help making menu-buttons nicer). Dave&#8216;s already got a patch [...]]]></description>
			<content:encoded><![CDATA[<p>On Monday I finally landed the new &#8220;PopupNotifications&#8221; JS module, used to display popup-style notifications (as <a href="http://www.gavinsharp.com/blog/2010/04/16/notifications-progress/">discussed</a> <a href="http://www.gavinsharp.com/blog/2010/04/09/notification-notifications/">earlier</a>). Since then I&#8217;ve spent some time <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=574230">fixing</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=574530">followups</a>, but there&#8217;s still a bunch of work to be done (including fleshing out the <a href="https://developer.mozilla.org/en/JavaScript_code_modules/PopupNotifications.jsm">MDC documentation</a> and trying to find help <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=573599">making menu-buttons nicer</a>). <a href="http://www.oxymoronical.com/">Dave</a>&#8216;s already got a patch up to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=552965">use the new notifications for the Addons Manager</a>, and <a href="http://home.kairo.at/">Robert</a> is working on getting them working in SeaMonkey.</p>
<p>I completed <a href="https://bugzilla.mozilla.org/buglist.cgi?field0-3-0=flagtypes.name&amp;type0-1-0=changedby&amp;field0-1-0=flagtypes.name&amp;field0-0-0=flagtypes.name&amp;emailtype1=notequals&amp;value0-3-0=2010-06-26&amp;query_format=advanced&amp;emailassigned_to1=1&amp;value0-2-0=2010-06-20&amp;value0-1-0=gavin.sharp%40gmail.com&amp;type0-3-0=changedbefore&amp;field0-2-0=flagtypes.name&amp;email1=gavin.sharp%40gmail.com&amp;type0-0-0=substring&amp;value0-0-0=review&amp;type0-2-0=changedafter">some reviews</a>, including some for relatively exciting patches from <a href="http://en.design-noir.de/">Dão</a>:</p>
<ul>
<li><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=574435">Turning on</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=574434">fixing the position</a> of the &#8220;Firefox&#8221; menu button on Windows Vista/7</li>
<li>Making <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=571992">tabs-on-top the default on Windows</a> (see <a href="http://blog.mozilla.com/faaborg/2010/06/24/why-tabs-are-on-top-in-firefox-4/">Alex&#8217;s post</a> for more details)</li>
</ul>
<p>I also spent a bit of time reviewing <a href="https://bugzilla.mozilla.org/buglist.cgi?bug_id=573225,573238,573808,573130">fixes</a> for <a href="http://blog.mozilla.com/dolske/">dolske</a>&#8216;s <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=563274">prompting code rewrite</a> that landed last week as well as <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=574137">cleaning up</a> the <a href="http://daviddahl.blogspot.com/2010/06/toast-has-landed-butter-side-up.html">new HUD panel</a>&#8216;s styling.</p>
<p>Next week, I plan on trying to wrap up as much of the notification-related stuff as possible, and move on to getting some patches up for the <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=571409">Account Manager</a> work. Also need to do a bit of prep for the <a href="https://wiki.mozilla.org/index.php?title=Summit2010">Summit</a> which is coming up quickly!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/06/25/mise-a-jour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notifications progress</title>
		<link>http://www.gavinsharp.com/blog/2010/04/16/notifications-progress/</link>
		<comments>http://www.gavinsharp.com/blog/2010/04/16/notifications-progress/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 21:55:30 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=81</guid>
		<description><![CDATA[I&#8217;ve made some progress since my last post: Still rather ugly, but at least it&#8217;s functional! Some things I&#8217;ll be looking into next: the dismissal behavior &#8211; currently dismissing the notification (i.e. clicking elsewhere on the screen) denies the geolocation request. I think we want to instead keep the request pending and allow you to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made some progress since my last post:</p>
<p style="text-align: center;"><img class="aligncenter" title="geo screenshot" src="http://gavinsharp.com/blog/wp-content/uploads/2010/04/geo1-300x122.png" alt="screenshot of early-stage new geolocation notification UI" width="300" height="122" /></p>
<p style="text-align: left;">Still rather ugly, but at least it&#8217;s functional!</p>
<p style="text-align: left;">Some things I&#8217;ll be looking into next:</p>
<ul>
<li>the dismissal behavior &#8211; currently dismissing the notification (i.e. clicking elsewhere on the screen) denies the geolocation request. I think we want to instead keep the request pending and allow you to access it later from the site-identity menu, but that requires some extra work (tracking shown/unshown notifications, etc.)</li>
<li>make notifications triggered from background tabs/windows behave correctly (right now they&#8217;re just ignored)</li>
<li>multiple-notification stacking</li>
<li>support for different priorities (not sure this will be needed)</li>
<li>styling! &#8211; <a href="http://stephenhorlander.com/">Stephen</a> is working on mockups for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=509642">menu-buttons</a>, which is probably the most obvious issue</li>
</ul>
<p style="text-align: left;">The current working API is very similar to the <a href="https://developer.mozilla.org/en/XUL/notificationbox">existing notificationbox API</a>. It&#8217;s definitely not set in stone. Right now it looks like this:</p>
<p style="text-align: left;">
<blockquote>
<pre>var mainAction = {
  label: "Share Location",
  accessKey: "S",
  callback: function() {
    request.allow();
  },
};

var secondaryActions = [
  {
    label: "Always Share",
    accessKey: "A",
    callback: function () {
      Services.perms.add(requestingURI, "geo", ALLOW_ACTION);
      request.allow();
    }
  },
  {
    label: "Never Share",
    accessKey: "N",
    callback: function () {
      Services.perms.add(requestingURI, "geo", DENY_ACTION);
      request.cancel();
    }
  }
];

var dismissalAction = {
  callback: function() {
    request.cancel();
  }
};

Notification.show("geolocation", "title", message,
                  "chrome://browser/skin/Geo.png",
                  mainAction, secondaryActions,
                  dismissalAction, browser);
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/04/16/notifications-progress/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>notification: notifications</title>
		<link>http://www.gavinsharp.com/blog/2010/04/09/notification-notifications/</link>
		<comments>http://www.gavinsharp.com/blog/2010/04/09/notification-notifications/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 23:58:13 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=78</guid>
		<description><![CDATA[Just recently I started working on implementing a new notification system for Firefox. It&#8217;s been discussed and blogged about before, and both Neil and MattN have worked on it before, so the task mostly involves just updating, cleaning up and completing their work. It&#8217;s being tracked by bug 398776, and I&#8217;m still in the early [...]]]></description>
			<content:encoded><![CDATA[<p>Just recently I started working on implementing a <a href="https://wiki.mozilla.org/Firefox/Projects/Doorhanger_notifications">new notification system</a> for Firefox. It&#8217;s been <a href="http://groups.google.com/group/mozilla.dev.apps.firefox/browse_thread/thread/be7413a3f28d69bd?pli=1">discussed</a> and <a href="http://blog.mozilla.com/faaborg/2007/03/06/would-you-like-to-redesign-notification-in-firefox-yes-not-now-never/">blogged about</a> before, and both <a href="http://enndeakin.wordpress.com/">Neil</a> and <a href="http://matthew.noorenberghe.com/blog">MattN</a> have worked on it before, so the task mostly involves just updating, cleaning up and completing their work. It&#8217;s being tracked by <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=398776">bug 398776</a>, and I&#8217;m still in the early stages. Here&#8217;s what I threw together just so that I could test the API:</p>
<p><a href="http://www.gavinsharp.com/blog/wp-content/uploads/2010/04/mac_screenshot.png"><img class="aligncenter size-full wp-image-79" title="mac_screenshot" src="http://www.gavinsharp.com/blog/wp-content/uploads/2010/04/mac_screenshot.png" alt="Screenshot of an initial attempt at a new notification popup, unstyled and ugly" width="280" height="98" /></a></p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=509642"> </a>That still needs some CSS tweaking, obviously (in general, and for the button specifically: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=509642">bug 509642</a>), and <a href="http://enndeakin.wordpress.com/2010/04/09/status-update-for-april-9/">Neil&#8217;s work</a> in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=554937">bug 554937</a> should make showing the actual popup even easier.</p>
<p>I also did a few other things of note this week:</p>
<ul>
<li>worked on some <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=557665">search service changes</a> to enable <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=511017">changes to the Google search plugin</a> that should make the search experience better</li>
<li>did a bit of experimenting with moving some browser.js code to a JS module &#8211; nothing real yet</li>
<li>worked on a security bug</li>
<li>did <a href="https://bugzilla.mozilla.org/buglist.cgi?field0-3-0=flagtypes.name&amp;type0-1-0=changedafter&amp;field0-1-0=flagtypes.name&amp;field0-0-0=flagtypes.name&amp;value0-3-0=gavin.sharp%40gmail.com&amp;value0-2-0=review&amp;value0-1-0=2010-04-01&amp;type0-3-0=changedby&amp;field0-2-0=flagtypes.name&amp;type0-0-0=changedbefore&amp;value0-0-0=2010-04-10&amp;type0-2-0=substring">some code reviews</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/04/09/notification-notifications/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>brace yourself</title>
		<link>http://www.gavinsharp.com/blog/2010/04/02/brace-yourself/</link>
		<comments>http://www.gavinsharp.com/blog/2010/04/02/brace-yourself/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 13:08:07 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=73</guid>
		<description><![CDATA[The topic of code style guidelines has come up again just recently in the newsgroups. This isn&#8217;t the first time, and probably won&#8217;t be the last. Everyone has an opinion &#8211; some strongly held &#8211; about where control statement braces should go (K&#38;R baby!), how you should wrap multi-line conditions (logical operators at EOL!), and [...]]]></description>
			<content:encoded><![CDATA[<p>The topic of code style guidelines has come up again just recently in <a href="http://groups.google.com/group/mozilla.dev.platform">the newsgroups</a>. This isn&#8217;t the first time, and probably won&#8217;t be the last. Everyone has an opinion &#8211; some strongly held &#8211; about where control statement braces should go (K&amp;R baby!), how you should wrap multi-line conditions (logical operators at EOL!), and how many spaces (or tabs! ew!) should be used for indentation (2!).</p>
<p>Usually the justification that fuels long debates about determining the One True Mozilla Code Style is that well-defined, strictly enforced, project-wide guidelines will help new contributors and make the code easier to maintain. Some people seem to also be suggesting that the guidelines be applied equally to all of Mozilla&#8217;s C++ and JavaScript code, since the two languages share much of their syntax. I don&#8217;t buy it.</p>
<p>I think that the benefits to a common style are often oversold. Consistency tends to be highly valued by us software developer types, sometimes to an unhealthy degree. I may find a particular bracing or indentation style unappealing when I approach new code, but I think it very rarely significantly impacts my ability to understand or contribute to it, assuming it&#8217;s at least internally consistent. I&#8217;m sympathetic to the idea that a common style can be beneficial at the file- (or maybe even module-) level, even if only for aesthetic reasons, but I think that trying to create and enforce more ambitious policies usually ends up being more trouble than it&#8217;s worth, especially for a project the size of Mozilla. The benefits to cross-module style guidelines just seem mostly theoretical to me, even more so for policies that attempt to span Mozilla&#8217;s loosely defined front-end/platform and JS/C++ boundaries.</p>
<p>Finding a single policy that covers all aspects of code style while satisfying even just a plurality of developers in a project this large can be costly just in terms of time spent debating. Add to that the time spent attempting to normalize the code base with large style-only cleanup patches, which would be necessary given our current state of affairs, and I think the scales are already tipped in favor of more tightly scoped code-style policies.</p>
<p>In practice, the project has settled into an fairly stable equilibrium already &#8211; we have a <a href="https://developer.mozilla.org/En/Developer_Guide/Coding_Style">style guide</a>, but the economics of making all of our code follow it, which would require both carefully auditing new code and fixing up old code, just haven&#8217;t worked out. I think we should stop kidding ourselves into thinking that they someday will, or that they should.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/04/02/brace-yourself/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Accessing/modifying the Firefox tab context menu from extensions</title>
		<link>http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/</link>
		<comments>http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 17:04:46 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=67</guid>
		<description><![CDATA[I recently made a few add-on-relevant changes to Firefox&#8217;s tab context menu on the Firefox trunk, and wanted to mention them here. They were triggered by evaluating some of the extension bustage that bug 347930 caused. Accessing the tab context menu One of bug 347930&#8216;s changes was moving the tabbrowser context menu from the &#60;tabbrowser&#62;&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>I recently made a few add-on-relevant changes to Firefox&#8217;s tab context menu on the Firefox trunk, and wanted to mention them here. They were triggered by evaluating some of the extension bustage that <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=347930">bug 347930</a> caused.</p>
<h3>Accessing the tab context menu</h3>
<p>One of <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=347930">bug 347930</a>&#8216;s changes was moving the tabbrowser context menu from the &lt;tabbrowser&gt;&#8217;s anonymous content to the tab container&#8217;s anonymous content. The tab container is also no longer a child of the tabbrowser, so <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=554165#c0">some common methods of accessing the context menu</a> &lt;menupopup&gt; element broke. I tried to address this in <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=554165">bug 554165</a> by making two changes:</p>
<ol>
<li>Adding a gBrowser.mStrip compatibility shim JS object to keep some of the common references working</li>
<li>Introducing a gBrowser.tabContextMenu property as a supported tabbrowser API. The hope is that extensions will make use of this property rather than the hacky alternatives they&#8217;ve been required to use in the past. We can keep this property working regardless of the underlying implementation details, which could potentially change again in the future.</li>
</ol>
<h3>Adding elements to the tab context menu</h3>
<p>MozillaZine community member &#8220;onemen&#8221; <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=554279#c16">pointed out</a> that putting the tab context menu in anonymous content made it a pain to modify (requires modifying it dynamically from code). So I filed and fixed <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=554991">bug 554991</a>, the net effect of which is that the &#8220;tabContextMenu&#8221; &lt;menupopup&gt; is now defined in browser.xul, and can be modified using normal XUL overlays. It&#8217;s also still accessible via gBrowser.tabContextMenu, of course.</p>
<p>Both of these changes only apply to Firefox trunk builds, which means they don&#8217;t apply to 3.6 or earlier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/03/31/accessingmodifying-the-firefox-tab-context-menu-from-extensions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>browser.js cleanup ideas</title>
		<link>http://www.gavinsharp.com/blog/2010/03/30/browser-js-cleanup-ideas-2/</link>
		<comments>http://www.gavinsharp.com/blog/2010/03/30/browser-js-cleanup-ideas-2/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 14:00:23 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=54</guid>
		<description><![CDATA[browser.js is probably the most important file in the Firefox front-end, since it contains most of the JS code used by the main browser window. It&#8217;s also one of the biggest, at ~7500 lines. It&#8217;s a bit of a dumping ground, since it&#8217;s the most obvious place for main-window-scoped JS code to live, and there&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js">browser.js</a> is probably the most important file in the Firefox front-end, since it contains most of the JS code used by the main browser window. It&#8217;s also one of the biggest, at ~7500 lines. It&#8217;s a bit of a dumping ground, since it&#8217;s the most obvious place for main-window-scoped JS code to live, and there&#8217;s a lot of unrelated code spread throughout the file.</p>
<p>The idea of cleaning it up has been brought up several times in the past. We have made some changes that help &#8211; <a href="http://www.gavinsharp.com/blog/2010/02/25/services-jsm/">Services.jsm</a> landed recently and helps reduce some of the XPCOM boilerplate overhead (though there&#8217;s a bunch of it left!), and <a href="http://en.design-noir.de/">Dão</a>, Mano, and others have done some <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=448669">good work</a> with piecemeal cleanup of cruft in various areas. It remains a gigantic file, though, and I&#8217;d like to try taking some bigger steps towards improving maintainability and approachability. I suspect those words could mean different things to different people, though, so I&#8217;m looking for some feedback or ideas about what exactly should be done. Here what I was thinking:</p>
<h3>Split it up into multiple files</h3>
<p>Splitting the code into several separate files and combining them at build time could help make things more organized. The idea would be to group pieces of code that are related to each other or that share the same purpose. We already do this for for <a href="http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser-places.js">some of the places code</a>, for example. I&#8217;m not sure how much of a benefit we could get out of extending this technique, though, since there are a lot of small unrelated pieces, and hundreds of small scattered files could certainly end up sucking more than one humongous file. Getting the right balance might be tricky.</p>
<h3>Move &#8220;static&#8221; methods to a common JS module</h3>
<p>Some code in the file is general enough that it doesn&#8217;t need to be loaded for each browser window, and some pieces of code can be re-factored to make this possible. This would have the additional benefit of reducing the amount of JS that needs to be loaded/parsed for subsequent window opens, since JS modules are shared globally and only loaded once.</p>
<h3>Just delete stuff!</h3>
<p>The most obvious way to make browser.js more manageable is to just outright remove code! We&#8217;re always on the lookout for dead code, but I&#8217;m sure there&#8217;s a bunch of dead(ish) code still present that&#8217;s ripe for removal. There&#8217;s also not-so-dead code that we need to take a very hard look at. Going down that path <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513147">can certainly be controversial</a>, but we have <a href="https://bugzilla.mozilla.org/buglist.cgi?status_whiteboard_type=allwordssubstr&amp;status_whiteboard=%5Bkillthem%5D&amp;resolution=---">bugs filed</a> for several such ideas already, and I think it&#8217;s a path we need to explore further.</p>
<p>Have any other ideas?  Let me know in the comments, or even better, file a bug and mark it blocking <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=448669">bug 448669</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/03/30/browser-js-cleanup-ideas-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Services.jsm</title>
		<link>http://www.gavinsharp.com/blog/2010/02/25/services-jsm/</link>
		<comments>http://www.gavinsharp.com/blog/2010/02/25/services-jsm/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 19:29:26 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=37</guid>
		<description><![CDATA[<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512784">bug 512784</a> [...] adds a new module to the toolkit whose sole purpose is to expose memoized getters for common XPCOM services on a simple "Services" JS object]]></description>
			<content:encoded><![CDATA[<p>I <a href="https://hg.mozilla.org/mozilla-central/rev/78e5543c0bc4">just landed</a> the patch for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512784">bug 512784</a> on mozilla-central. It adds a new module to the toolkit whose sole purpose is to expose <a href="http://en.wikipedia.org/wiki/Memoization">memoized</a> getters for common XPCOM services on a simple &#8220;Services&#8221; JS object. The first pass involved adding getters for the prefs service, observer service, window mediator, permission manager, IO Service, prompt service, and search service. This patch also updates Firefox&#8217;s browser.js to make use of the module, which means that trunk-based extensions that run code in Firefox chrome windows can start making use of it if they&#8217;d like.</p>
<p>Here&#8217;s an example of one of the changes:</p>
<blockquote><pre>
+// Services = object with smart getters for common XPCOM services
+Components.utils.import("resource://gre/modules/Services.jsm");</code>
</pre>
</blockquote>
<blockquote><pre>
 function getTopWin()
 {
-  var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1']
-                                .getService(Components.interfaces.nsIWindowMediator);
-  return windowManager.getMostRecentWindow("navigator:browser");
+  return Services.wm.getMostRecentWindow("navigator:browser");
 }
</pre>
</blockquote>
<p>I expect to add some other services to it as I look at expanding use of the module (Mossop has <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512784#c21">some suggestions</a> in the bug). We might also add an equivalent in Firefox for browser-specific services, if that proves to be useful. The end goal is to remove a lot of the XPCOM boilerplate junk we see spread around our front-end JS code, and a side benefit is the reduction of unnecessary getService() calls for services that are already guaranteed to be otherwise instantiated and kept around for the app&#8217;s lifetime. This necessarily implies that JS scopes where the module was imported will now have permanent references to services after their first use, which is worth keeping in mind, both when making use of of the module and when adding additional getters to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/02/25/services-jsm/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>reviews, crashing plugins, and tab matches</title>
		<link>http://www.gavinsharp.com/blog/2010/02/05/reviews-crashing-plugins-and-tab-matches/</link>
		<comments>http://www.gavinsharp.com/blog/2010/02/05/reviews-crashing-plugins-and-tab-matches/#comments</comments>
		<pubDate>Sat, 06 Feb 2010 00:15:31 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=31</guid>
		<description><![CDATA[I&#8217;m going to give weekly blog status updates a shot. I suspect planet already gets inundated with them near the end of the week, so maybe I&#8217;ll try adjusting my schedule by a few days. Or maybe I&#8217;ll end up just posting them on wikimo instead. Either way I&#8217;ll try to keep them interesting! I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to give weekly blog status updates a shot. I suspect planet already gets inundated with them near the end of the week, so maybe I&#8217;ll try adjusting my schedule by a few days. Or maybe I&#8217;ll end up just posting them on <a href="https://wiki.mozilla.org/User:GavinSharp">wikimo</a> instead. Either way I&#8217;ll try to keep them interesting!</p>
<p>I didn&#8217;t think I was going to end up doing this, so I didn&#8217;t take detailed notes of everything I&#8217;ve done this week. I&#8217;m going to try to get better at that.</p>
<p>Accomplished this week:</p>
<ul>
<li>tried to keep the review queue cleanup rolling from last week, but I think I netted out even (or slightly negative). Current state: <a href="https://bugzilla.mozilla.org/request.cgi?action=queue&amp;requestee=gavin.sharp%40gmail.com">33 pending requests</a>.</li>
<li>reviewed <a href="http://blog.mozilla.com/dolske/">dolske</a>&#8216;s plugin crashing UI patches (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=539848">bug 539848</a>, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=538910">bug 538910</a>)</li>
<li>helped test the 1.9.3 alpha 1 branding changes (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=543564">bug 543564</a>)</li>
<li>wrote some additional tests for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512784">bug 512784</a> (consolidated smart getters for common services). ready to land once it gets rs=<a href="http://www.oxymoronical.com/">Mossop</a></li>
<li>spent some time reviewing patch for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=480350">bug 480350</a> (tab matches in awesomebar)</li>
<li>wasted a bit of time arguing with RSnake on <a href="http://ha.ckers.org/blog/20100204/releasesmozillaorg-ssl-and-update-fail/">his blog</a></li>
</ul>
<p>Up next (roughly in priority order):</p>
<ul>
<li><a href="http://blog.stephenhorlander.com/">shorlander</a>&#8216;s going to be filing bugs for proposed theme/UX changes, will need to triage/prioritize those with <a href="http://design-noir.de/log/">dao</a></li>
<li>need to make progress on <a href="http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js">browser.js</a> cleanup/simplification &#8211; I want to get a list of actionable items by mid-next-week and get patching</li>
<li>I have some mobile blog post ideas and notes that I really need to turn into posts</li>
<li>try not to give up too much ground on review queue clearing</li>
<li>want speak to <a href="http://screwedbydesign.com/blog/">Ryan</a> about some changes required for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=511017">bug 511017</a> (allow default search plugins to be updated, allowing them to get locale-specific search URLs to avoid redirects through google.com)</li>
<li>would like to resolve <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=479334">bug 479334</a> (improved en-US spellcheck dictionary, including better merge scripts to ease taking changes from upstream hunspell and chromium). just needs a final test run and a couple of tweaks before landing, I think.</li>
</ul>
<p>Ideally I think my &#8220;upcoming&#8221; tasks would be as granular and clearly defined as my &#8220;completed&#8221; tasks, I guess, but they&#8217;ll probably be easier to split out into specific tasks once some of the planning/exploratory work is done.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/02/05/reviews-crashing-plugins-and-tab-matches/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Transition</title>
		<link>http://www.gavinsharp.com/blog/2010/01/05/transition/</link>
		<comments>http://www.gavinsharp.com/blog/2010/01/05/transition/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 03:40:32 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=23</guid>
		<description><![CDATA[For the last year and a half or so my Mozilla work has been primarily focused on the Fennec project (Firefox for mobile devices). It&#8217;s been a great experience for a number of reasons, not least because we basically set out to create an entirely new Gecko-based browser front-end from scratch. That forced us to [...]]]></description>
			<content:encoded><![CDATA[<p>For the last year and a half or so my Mozilla work has been primarily focused on the <a href="https://wiki.mozilla.org/fennec">Fennec project</a> (Firefox for mobile devices). It&#8217;s been a great experience for a number of reasons, not least because we basically set out to create an entirely new Gecko-based browser front-end from scratch. That forced us to re-evaluate design decisions made in Firefox, and let us try something new with far fewer compatibility constraints. We ended up with new ways of doing default bookmarks, a trimmed-down version of the awesomebar, <a href="http://froystig.wordpress.com/2009/08/20/rendering-with-tiles-in-fennec/">a new way of displaying pages so that panning is faster</a>, entirely different UIs for many of the important browser functions (<a href="http://madhava.com/egotism/archive/005040.html">bookmarks</a>, download manager, <a href="http://madhava.com/egotism/archive/005038.html">add-ons</a>, <a href="http://madhava.com/egotism/archive/005024.html">preferences</a>, <a href="http://starkravingfinkle.org/blog/2009/09/fennec-prompts-alerts-and-dialogs-oh-my/">common dialogs</a>, etc.), among others. Some of the work we did also benefited Firefox directly, and a lot of the work that didn&#8217;t still has the potential to benefit Firefox with a little bit of extra porting/re-factoring effort.</p>
<p>In addition to being a fun project to work on code-wise, it also gave me the opportunity to work in a team that&#8217;s been rapidly growing. Since I got involved, a bunch of new contributors have joined in with contributions to the front-end: <a href="http://unwiredben.livejournal.com/">bcombee</a>, <a href="http://stechz.com/">stechz</a>, <a href="http://vingtetun.org/">vingtetun</a>, <a href="https://addons.mozilla.org/en-US/mobile/user/3263448">fabrice</a>, <a href="http://froystig.wordpress.com/">froystig</a> and <a href="http://aluminum.sourmilk.net/">mwu</a>, to name a few. Combined with the rest of the mobile team and the Mozilla project in general, the project&#8217;s in pretty good shape to kick butt in 2010 and beyond.</p>
<p>With the mobile team in good shape, and with Fennec 1.0 in the RC stage, I&#8217;m taking advantage of the new year to transition out of my focus on mobile and return my primary focus to &#8220;desktop-edition&#8221; Firefox. While I&#8217;ve had a great time on-loan to the mobile team, I&#8217;ve also missed working closely with the Firefox team on pieces of the product that got me involved with Mozilla in the first place, and I feel that I have <a href="https://bugzilla.mozilla.org/request.cgi?action=queue&amp;type=all&amp;requestee=gavin.sharp%40gmail.com">some responsibilities</a> that I haven&#8217;t been able to keep up with as much as I should while focusing entirely on Mobile.</p>
<p>So in the immediate future, I&#8217;m looking forward to contributing more actively to the <a href="https://wiki.mozilla.org/Firefox/Goals/2010Q1">Firefox team&#8217;s Q1 goals</a>, but I&#8217;m not disappearing from mobile, either. I expect to continue doing some reviews for changes to the mobile code I know well and will generally help out where I can. I&#8217;m also still quite interested in eliminating many of the things that cause us to treat the projects as separate entities (on a code-level as well as organizationally). I think that ideally, having to choose between focusing on either &#8220;Fennec or Firefox&#8221; should make less sense as the two projects evolve and as mobile gets more established, and I&#8217;d like to work towards making that happen.</p>
<p>To that end, I&#8217;ll be writing up some of the lessons we&#8217;ve learned in mobile in the coming weeks, and talking about how to integrate those into Firefox.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2010/01/05/transition/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>404 Error Pages</title>
		<link>http://www.gavinsharp.com/blog/2009/08/30/404-error-pages/</link>
		<comments>http://www.gavinsharp.com/blog/2009/08/30/404-error-pages/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 16:54:14 +0000</pubDate>
		<dc:creator>gavin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://www.gavinsharp.com/blog/?p=17</guid>
		<description><![CDATA[Curtis Bartley wrote an update for Planet Firefox, but his blog isn&#8217;t hooked up yet. My blog is hooked up already, but I haven&#8217;t written any updates. So we&#8217;re going to combine forces to bring you the latest in status updates. (I will also shamelessly use this opportunity to bump my blog&#8217;s latest post into [...]]]></description>
			<content:encoded><![CDATA[<p>Curtis Bartley wrote an update for <a href="http://planet.firefox.com">Planet Firefox</a>, but his blog isn&#8217;t hooked up yet. My blog is hooked up already, but I haven&#8217;t written any updates.</p>
<p>So we&#8217;re going to combine forces to bring you the latest in status updates. (I will also shamelessly use this opportunity to bump my blog&#8217;s latest post into this year &#8211; welcome to 2009, readers!).</p>
<p>Here&#8217;s a teaser:</p>
<blockquote><address>&#8220;We want Firefox to override [...] the user [...] bad news&#8221;<br />
</address>
</blockquote>
<p>Check out <a title="Curtis' 404 Error Pages progress update" href="http://curtisb.posterous.com/404-error-page-status-0">Curtis&#8217; update over on his blog</a> to get the full scoop.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavinsharp.com/blog/2009/08/30/404-error-pages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
