<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom">

   <title>Paul O’Shannessy (mozilla)</title>
   
   <link href="http://zpao.com" />
   <updated>2012-05-29T13:09:13-07:00</updated>
   <id>http://zpao.com/feeds/mozilla</id>
   <author>
     <name>Paul O’Shannessy</name>
   </author>



  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/zpao/mozilla" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="zpao/mozilla" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry>
    <title type="html">Making restore_on_demand Accessible</title>
    <link href="http://zpao.com/posts/making-restore-on-demand-accessible" />
    <updated>2012-05-29T13:00:00-07:00</updated>
    <id>http://zpao.com/posts/making-restore-on-demand-accessible</id>
    <content type="html">&lt;p&gt;I know I just wrote about &lt;a href="/posts/session-restore-changes-in-firefox-15"&gt;some changes to Session Restore coming in Firefox 15&lt;/a&gt;, but here&amp;rsquo;s another one&amp;hellip;&lt;/p&gt;

&lt;p&gt;Since Firefox 8, &lt;a href="/posts/max-concurrent-tabs-is-dead/"&gt;we&amp;rsquo;ve had a visible preference to restore tabs &amp;ldquo;on demand&amp;rdquo;&lt;/a&gt;. This surfaced as a checkbox on the &amp;ldquo;General&amp;rdquo; preference pane. The checkbox would only be accessible if you enabled Session Restore (by setting Firefox to &amp;ldquo;Show my windows and tabs from last time&amp;rdquo;). This was a bit unfortunate because the preference had effects even if you didn&amp;rsquo;t have Session Restore enabled, namely, that preference was honored when restoring a session following a crash or when returning from Private Browsing mode. In order to change the preference, Session Restore had to be enabled temporarily.&lt;/p&gt;

&lt;p&gt;We&amp;rsquo;ll be changing that in Firefox 15 now that &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=720154"&gt;bug 720154&lt;/a&gt; landed. The checkbox has been moved from the &amp;ldquo;General&amp;rdquo; pane to the &amp;ldquo;Tabs&amp;rdquo; pane and we&amp;rsquo;ve removed the dependency on Session Restore being enabled.&lt;/p&gt;

&lt;p&gt;&lt;a href="/img/posts/originals/making-restore-on-demand-accessible.png"&gt;&lt;img src="/img/posts/making-restore-on-demand-accessible.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Session Restore Changes in Firefox 15</title>
    <link href="http://zpao.com/posts/session-restore-changes-in-firefox-15" />
    <updated>2012-05-22T14:23:00-07:00</updated>
    <id>http://zpao.com/posts/session-restore-changes-in-firefox-15</id>
    <content type="html">&lt;p&gt;There are a few changes coming in Firefox 15&amp;rsquo;s Session Restore. There are a few under the hood changes which should be transparent to anybody using the API, but there are also some changes to the format of the &lt;code&gt;JSON&lt;/code&gt; that is exposed.&lt;/p&gt;

&lt;h2&gt;Form Data&lt;/h2&gt;

&lt;p&gt;All of the changes have to do with the &lt;code&gt;formdata&lt;/code&gt; object that is used to store (wait for it&amp;hellip;) form data. Historically we&amp;rsquo;ve done our best to save the data so that when you recover from a crash or resume a session, we can do our best to get you going again. When we&amp;rsquo;ve saved the data in the past, it was just in a flat object that looked something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"formdata": {
  "#elementID": "value for form field with id",
  "/xpath/string": "value for form field without id"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Starting with Firefox 15, &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=697903"&gt;we&amp;rsquo;ve broken that up a bit further&lt;/a&gt;, with &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;xpath&lt;/code&gt; keys to scoped data. The other key difference is that we no longer prepend &lt;code&gt;#&lt;/code&gt; to the element&amp;rsquo;s id (it was only being used to distinguish id vs xpath). The updated format looks like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"formdata": {
  "id": {
    "elementID": "value for form field with id"
  },
  "xpath": {
    "/xpath/string": "value for form field without id"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This was a part of making some of Session Restore more usable to other components. In this case it was something originally thought up for Sync to be able to reuse code when syncing tabs between devices.&lt;/p&gt;

&lt;h2&gt;Better Restoration of &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; Elements&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=662743"&gt;The other change&lt;/a&gt; will result in better restoration of &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; elements. For the simple case (no &lt;code&gt;multiple&lt;/code&gt;) we would simply store the &lt;code&gt;selectedIndex&lt;/code&gt; and move on. When restoring, we would re-select that index (unless it was suddenly out of bounds). This resulted in the wrong &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; being selected if &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt;s were added or removed. This has been a problem for years with Bugzilla where a new product or component would get added and then people would accidentally save changes to bugs and make changes they didn&amp;rsquo;t intend.&lt;/p&gt;

&lt;p&gt;So now we save the value of the selected &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; and check that when restoring the form. If the value at &lt;code&gt;selectedIndex&lt;/code&gt; doesn&amp;rsquo;t match what we saved, we&amp;rsquo;ll look through all of the &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt;s until we find a match. It&amp;rsquo;s a simple change but should result in more reliable form restoration.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"selectEl": 1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;becomes&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"selectEl": {
  "selectedIndex": 1,
  "value": "option value"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Backwards Compatability&lt;/h2&gt;

&lt;p&gt;As with all changes in Session Restore, we&amp;rsquo;ll be maintaining compatability with the old format for some extended period of time. We will continue to be able to read the old format, but we won&amp;rsquo;t write it back out. If you&amp;rsquo;re an API consumer, you should update accordingly. Extension authors should be ready to handle both formats while supporting Firefox 14 and below.&lt;/p&gt;

&lt;h2&gt;Not Me!&lt;/h2&gt;

&lt;p&gt;I didn&amp;rsquo;t write code for any of this! Thanks to Andres and Bellindira from AppCoast for picking up half-written patches and taking them the rest of the way. Tim Taubert helped out a bunch with reviews too. There are other Session Restore changes that this group is working on so there&amp;rsquo;s more to come!&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Building Firefox on OS X Mountain Lion</title>
    <link href="http://zpao.com/posts/building-firefox-on-os-x-mountain-lion" />
    <updated>2012-05-14T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/building-firefox-on-os-x-mountain-lion</id>
    <content type="html">&lt;p&gt;In a similar vein to &lt;a href="/posts/building-firefox-on-os-x-lion"&gt;my article about building on 10.7&lt;/a&gt;, here are some issues that have come up while building Firefox on 10.8. I&amp;rsquo;ve had Mountain Lion installed for a few weeks now and while there were a few hiccups, things have been pretty smooth. Currently I have DP3 update 2 and Xcode 4.4 preview 5 installed.&lt;/p&gt;

&lt;h2&gt;Xcode &amp;amp; Command Line Tools&lt;/h2&gt;

&lt;p&gt;If you&amp;rsquo;ve installed Mountain Lion (MoLo) then you&amp;rsquo;ve probably realized that you need to reinstall Xcode. This is available on the pre-release software page. Make sure you download &amp;amp; install the Command Line Tools as well. I had issues installing the CL tools from within Xcode, so the separate download was necessary.&lt;/p&gt;

&lt;h2&gt;&lt;code&gt;egrep&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;You will likely see an error about &lt;code&gt;egrep&lt;/code&gt;. We have a &amp;ldquo;fixed &lt;code&gt;egrep&lt;/code&gt;&amp;rdquo; command we&amp;rsquo;ve been using since Lion to work around an issue. It seems we no longer need to work around that issue. I have a patch in &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=750574"&gt;bug 750574&lt;/a&gt; that makes sure our workaround is only used on Lion.&lt;/p&gt;

&lt;h2&gt;&lt;code&gt;clang&lt;/code&gt; &amp;amp; &lt;code&gt;ccache&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;I&amp;rsquo;ve been using &lt;code&gt;clang&lt;/code&gt; to build Firefox for a few months now and have been using &lt;code&gt;ccache&lt;/code&gt; for years. While I didn&amp;rsquo;t have any issue before, on MoLo the 2 didn&amp;rsquo;t play together nicely. I got build errors while building Growl. Specifically, &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=754988"&gt;there were issues with an (un?)expanded NSParameterAssert macro&lt;/a&gt;. The fix is to ensure that you set the &lt;code&gt;CCACHE_CPP2&lt;/code&gt; environment variable to &lt;code&gt;yes&lt;/code&gt; (&lt;code&gt;export CCACHE_CPP2=yes&lt;/code&gt;). Peter Eisentraut explains why this &lt;code&gt;ccache&lt;/code&gt; setting works on &lt;a href="http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html"&gt;his blog&lt;/a&gt;. We now have a &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=755145"&gt;bug on file to make this automatic&lt;/a&gt; so you don&amp;rsquo;t have to set environment variables to get a working build.&lt;/p&gt;

&lt;h2&gt;homebrew&lt;/h2&gt;

&lt;p&gt;This isn&amp;rsquo;t directly related, but I had some issues with packages installed via &lt;code&gt;brew&lt;/code&gt;. In my case &lt;code&gt;imagemagick&lt;/code&gt; didn&amp;rsquo;t cooperate. That&amp;rsquo;s not required to build Firefox, but just a heads up that you may have issues. &lt;a href="https://gist.github.com/1860902"&gt;These steps&lt;/a&gt; got everything working for me.&lt;/p&gt;

&lt;h2&gt;That&amp;rsquo;s it&lt;/h2&gt;

&lt;p&gt;There&amp;rsquo;s a good chance that this isn&amp;rsquo;t even relevant by the time you install 10.8. If so, then I&amp;rsquo;ve done my job!&lt;/p&gt;

&lt;p&gt;If you&amp;rsquo;re interested in working on features for Mountain Lion, let me know or follow &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=728102"&gt;the tracking bug&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">hg amend</title>
    <link href="http://zpao.com/posts/hg-amend" />
    <updated>2012-05-07T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/hg-amend</id>
    <content type="html">&lt;p&gt;Mercurial 2.2 introduced a new &lt;code&gt;--amend&lt;/code&gt; option to &lt;code&gt;commit&lt;/code&gt;. If you&amp;rsquo;ve ever used Git, then you are probably thinking &amp;ldquo;finally&amp;rdquo;. For those of you who haven&amp;rsquo;t used it, it&amp;rsquo;s a quick way to modify the last commit.&lt;/p&gt;

&lt;p&gt;My workflow with Mercurial is quite different than my workflow with Git, so &lt;code&gt;amend&lt;/code&gt; is not going to be as critically important. With Git I typically just have a series of commits on a branch. With Mercurial I typically use a patch queue (because that&amp;rsquo;s just easier with posting patches to Bugzilla). But there have been plenty of times where I&amp;rsquo;ve &lt;code&gt;qfinish&lt;/code&gt;ed a patch only to realize I didn&amp;rsquo;t update the commit message to include the reviewer. Previously this was a 3 step process to fix: &lt;code&gt;qimport -r tip; qrefresh -e; qfinish qtip&lt;/code&gt;). Now it&amp;rsquo;s 1: &lt;code&gt;hg commit --amend&lt;/code&gt;. You can do the same with files you forgot to add.&lt;/p&gt;

&lt;p&gt;I haven&amp;rsquo;t played with it much, but the &lt;a href="http://mercurial.selenic.com/wiki/WhatsNew#Mercurial_2.2_.282012-05-01.29"&gt;release notes&lt;/a&gt; mention that this is a &amp;ldquo;safe&amp;rdquo; operation since it uses Mercurial &lt;a href="http://mercurial.selenic.com/wiki/Phases"&gt;phases&lt;/a&gt;. Essentially this simply stops you from editing history in patches that you&amp;rsquo;ve already pushed to a remote repository.&lt;/p&gt;

&lt;p&gt;So there you have it. And a little bonus for people who like to cut down on typing &amp;ndash; alias the option to a new command. I&amp;rsquo;ve been doing this with Git for ages, but now I can finally add it to my &lt;code&gt;.hgrc&lt;/code&gt; too:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[alias]
amend = commit --amend
&lt;/code&gt;&lt;/pre&gt;
</content>
  </entry>



  <entry>
    <title type="html">Lion Full Screen Coming to Firefox</title>
    <link href="http://zpao.com/posts/lion-full-screen-coming-to-firefox" />
    <updated>2012-03-22T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/lion-full-screen-coming-to-firefox</id>
    <content type="html">&lt;p&gt;For the past little while, I&amp;rsquo;ve been working on adding support for &lt;a href="https://www.apple.com/macosx/whats-new/full-screen.html"&gt;OS X Lion&amp;rsquo;s native Full Screen mode&lt;/a&gt; to Firefox. This was something that others had started before Lion was even released but nobody ever finished it. Since then, every other major browser has shipped support for the feature.&lt;/p&gt;

&lt;p&gt;I decided to start working on it in December since nobody else was. Having never really touched Objective C(++) or Cocoa, the task took a bit longer for me than it would have others, but now it&amp;rsquo;s done and I have more experience with our &lt;code&gt;widget/&lt;/code&gt; code. At the end of the day, the changes need to hook everything up were suprisingly minimal. If you want to check out the process, the work was done in &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=639705"&gt;bug 639705&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The patches were landed the other day and are currently in &lt;a href="http://nightly.mozilla.org"&gt;Firefox Nightly&lt;/a&gt;. Assuming there are no major issues, this should ship in Firefox 14. Since this landed early in the release cycle, there should be plenty of time to catch any fallout. There are a few known bugs to follow up with (see below) but if you notice any other issues on the Firefox side, please &lt;a href="https://bugzilla.mozilla.org/enter_bug.cgi?blocked=639705&amp;amp;cc=paul%40oshannessy.com&amp;amp;component=General&amp;amp;op_sys=Mac%20OS%20X&amp;amp;product=Firefox&amp;amp;rep_platform=x86"&gt;file a new bug&lt;/a&gt; (already setup for a new bug in Firefox:General with me CCed).&lt;/p&gt;

&lt;h2&gt;Adding Support to Your Gecko Application&lt;/h2&gt;

&lt;p&gt;Since the feature is enabled down in the core, it&amp;rsquo;s now easy to support Lion Full Screen in your Gecko application. All that you need to do is add &lt;code&gt;fullscreenbutton="true"&lt;/code&gt; to your &lt;code&gt;&amp;lt;window&amp;gt;&lt;/code&gt;. Thunderbird &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=711750"&gt;is in the process of doing this&lt;/a&gt;. If you&amp;rsquo;d like your application to make UI changes (beyond just titlebar hiding), the &lt;code&gt;fullscreen&lt;/code&gt; event is fired on the window after the transition is complete.&lt;/p&gt;

&lt;h2&gt;But wait, there&amp;rsquo;s more&lt;/h2&gt;

&lt;p&gt;What I&amp;rsquo;ve done so far is really just the baseline support. There are a few followup bugs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=703724"&gt;support resizing content area&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=716450"&gt;figure out &amp;lsquo;background themes&amp;rsquo; support&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=714172"&gt;update menu with new string/shortcut&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=714186"&gt;add top padding?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;and surely some other theme related tweaks&lt;/li&gt;
&lt;/ul&gt;

</content>
  </entry>







  <entry>
    <title type="html">What&amp;rsquo;s the Deal With V8Monkey &amp;amp; SpiderNode?</title>
    <link href="http://zpao.com/posts/whats-the-deal-with-v8monkey-spidernode" />
    <updated>2012-01-23T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/whats-the-deal-with-v8monkey-spidernode</id>
    <content type="html">&lt;p&gt;&lt;strong&gt;tl;dr&lt;/strong&gt; Neither are being actively worked on and could use some love.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;After NodeConf, development of &lt;a href="https://github.com/zpao/v8monkey"&gt;V8Monkey&lt;/a&gt; &amp;amp; &lt;a href="https://github.com/zpao/spidernode"&gt;SpiderNode&lt;/a&gt; slowed. We all got a bit burnt out in the weeks preceding NodeConf and took a little break. Shortly after, Shawn left Mozilla to work at Facebook with Rob on &lt;em&gt;[redacted]&lt;/em&gt; and the little break became longer. I was in the middle of planning a wedding &amp;amp; helping the (now-)wife with &lt;a href="http://onetruelovevintage.com"&gt;her company&lt;/a&gt;. Shawn &amp;amp; Rob were busy with work and some other &lt;a href="https://github.com/sdwilsh/tree-bot"&gt;side&lt;/a&gt; &lt;a href="https://github.com/mozilla/rust"&gt;projects&lt;/a&gt;. Mozilla opened an office in SF in August, so I stopped riding the train down the peninsula with Shawn &amp;amp; Rob as often. Long story short, we lost interest.&lt;/p&gt;

&lt;p&gt;In October I pulled current mozilla-central into the V8Monkey tree &amp;amp; tried to update from there. But some core things changed. APIs changed around Typed Arrays in SpiderMonkey. &lt;code&gt;JSScript&lt;/code&gt; stopped being a &lt;code&gt;JSObject&lt;/code&gt; which broke some of our assumptions with our implementation. I have &lt;a href="https://gist.github.com/1665805"&gt;a patch locally&lt;/a&gt; to try to fix those, but they&amp;rsquo;re incomplete (it immediately segfaults). It&amp;rsquo;s been 3 months and the JS engine doesn&amp;rsquo;t idle, so it&amp;rsquo;s entirely possible the world changed again.&lt;/p&gt;

&lt;p&gt;SpiderNode is untouched. But Node has definitely changed &amp;ndash; it&amp;rsquo;s gone from 0.4.x to 0.6.x and works on Windows! It&amp;rsquo;s now using a newer version of V8, and further, using more V8 APIs that V8Monkey hasn&amp;rsquo;t ported. It also looks like Buffers got a pretty big overhaul (I started to merge that, but it got messy). There&amp;rsquo;s surely some other work that needs to be done.&lt;/p&gt;

&lt;h2&gt;The Future&lt;/h2&gt;

&lt;p&gt;There has been &lt;a href="https://twitter.com/#!/BrendanEich/status/158326339039010817"&gt;some mention&lt;/a&gt; of the JS team here at Mozilla implementing the V8 API. Not me or somebody doing it in their free time, but a full-time employee. I haven&amp;rsquo;t seen that happen, but that&amp;rsquo;s the best possible outcome. Assuming we have 100% compatibility (which is the only target that makes sense), then the path to reviving SpiderNode from there is easy. Basically we&amp;rsquo;d just need to fix the build system again to compile SpiderMonkey &amp;amp; use that. Brendan has also &lt;a href="https://twitter.com/#!/BrendanEich/status/158328492709257217"&gt;threatened to unbitrot V8Monkey&lt;/a&gt;, but he&amp;rsquo;s a busy guy, so we&amp;rsquo;ll see.&lt;/p&gt;

&lt;p&gt;If that doesn&amp;rsquo;t happen, then the future is grim. I don&amp;rsquo;t have the time or drive to do this myself. If you&amp;rsquo;re interested in helping out though, keep reading&amp;hellip;&lt;/p&gt;

&lt;h2&gt;Want to help?&lt;/h2&gt;

&lt;p&gt;Awesome! Get in touch &amp;amp; I can help get you started. I&amp;rsquo;m more than happy to get that going because I&amp;rsquo;d like to see these projects live on. Keep in mind that the real work mostly happens in V8Monkey &amp;mdash; it&amp;rsquo;s 100% C++ and you&amp;rsquo;re implementing one JS engine&amp;rsquo;s API with another.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">And Just Like That I&amp;rsquo;m a Firefox Peer</title>
    <link href="http://zpao.com/posts/and-just-like-that-im-a-firefox-peer" />
    <updated>2011-10-26T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/and-just-like-that-im-a-firefox-peer</id>
    <content type="html">&lt;p&gt;Not-so-long story short, as of a couple weeks ago Firefox review policies changed and now I can review any code going into Firefox (&lt;code&gt;browser/&lt;/code&gt;)! In actuality though, if a review request came my way in an area I wasn&amp;rsquo;t familiar with, I would just give feedback and redirect the review to somebody more familiar with that code.&lt;/p&gt;

&lt;p&gt;Read up on the &lt;a href="https://wiki.mozilla.org/Firefox/Code_Review"&gt;new Firefox review policy&lt;/a&gt; and see &lt;a href="https://wiki.mozilla.org/Modules/Firefox"&gt;who else can review your patches&lt;/a&gt; to Firefox.&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">max_concurrent_tabs is Dead; Long Live restore_on_demand</title>
    <link href="http://zpao.com/posts/max-concurrent-tabs-is-dead" />
    <updated>2011-08-17T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/max-concurrent-tabs-is-dead</id>
    <content type="html">&lt;p&gt;Since &lt;a href="/posts/cascaded-session-restore-a-hidden-bonus"&gt;last September&lt;/a&gt;, you could set &lt;code&gt;browser.sessionstore.max_concurrent_tabs&lt;/code&gt; to 0, and you would essentially have a built-in BarTab. I slipped that in later in the Firefox 4 release cycle as a part of cascaded session restore, but it required going into &lt;code&gt;about:config&lt;/code&gt; and changing a preference value (or installing something like &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/bartab-lite/"&gt;BarTab Lite&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Starting with the latest nightly (and soon to be Aurora 8), &lt;code&gt;browser.sessionstore.max_concurrent_tabs&lt;/code&gt; is no more. We&amp;rsquo;re no longer allowing you to specify a specific number of tabs to restore concurrently. Instead we now allow you to either restore on demand, or use the hard-coded 3 tabs at a time value. The new preference is called &lt;code&gt;browser.sessionstore.restore_on_demand&lt;/code&gt;. If you had customized &lt;code&gt;max_concurrent_tabs&lt;/code&gt; and set it to 0, then &lt;code&gt;restore_on_demand&lt;/code&gt; will be migrated to true. Unlike the old preference, &lt;code&gt;restore_on_demand&lt;/code&gt; is exposed in the Preferences/Options dialog to make it accessible to a larger audience.&lt;/p&gt;

&lt;p&gt;&lt;img src="/img/posts/restore_on_demand.png" alt="" /&gt;&lt;/p&gt;

&lt;p&gt;For the details, check out &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=648683"&gt;bug 648683&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">hg qedit</title>
    <link href="http://zpao.com/posts/hg-qedit" />
    <updated>2011-08-09T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/hg-qedit</id>
    <content type="html">&lt;p&gt;Mercurial queues are still far from my ideal workflow, but they mostly &lt;em&gt;just work&lt;/em&gt; so I still use them. I haven&amp;rsquo;t gotten into qqueues because that seems like even more management I don&amp;rsquo;t need. If I had a 17 part patch then I would probably give those a go, but I don&amp;rsquo;t.&lt;/p&gt;

&lt;p&gt;Instead I end up reordering the patches in my queue more often that I want. I run &lt;code&gt;vim .hg/patches/series&lt;/code&gt;, press a &lt;code&gt;j&lt;/code&gt;, &lt;code&gt;k&lt;/code&gt;, &lt;code&gt;d&lt;/code&gt;, &amp;amp; &lt;code&gt;p&lt;/code&gt; a few times, then quit. But sometimes I forget that I&amp;rsquo;m not at &lt;code&gt;hg root&lt;/code&gt; so that doesn&amp;rsquo;t work (usually tab completion is a good indicator but then I need to &lt;code&gt;cd&lt;/code&gt; a bit). &lt;a href="https://github.com/zpao/dotfiles/commit/51cdfb838c672f80db5b005eca1fe9972c23dab6"&gt;Enter &lt;code&gt;hg qedit&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[alias]
qedit = !vim $(hg root)/.hg/patches/series
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Just add the above to your .hgrc and you now have a new command which will pop open vim so you can reorder your patches. And of course if you want this to use your editor of choice, you can change &amp;ldquo;vim&amp;rdquo; to &amp;ldquo;$EDITOR&amp;rdquo; to make that happen.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;A couple people have mentioned that there are easier ways to move things around in your queue without editing your series file&amp;hellip;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.gavinsharp.com/blog/"&gt;Gavin&lt;/a&gt; told me about &lt;a href="http://mercurial.selenic.com/wiki/QupExtension"&gt;qup&lt;/a&gt;, and &lt;a href="http://www.oxymoronical.com/"&gt;Dave&lt;/a&gt; said that &lt;code&gt;hg qpush --move &amp;lt;name&amp;gt;&lt;/code&gt; achieves the same thing.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Building Firefox on OS X Lion</title>
    <link href="http://zpao.com/posts/building-firefox-on-os-x-lion" />
    <updated>2011-07-23T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/building-firefox-on-os-x-lion</id>
    <content type="html">&lt;p&gt;I know there are people here at Mozilla who have been building Firefox on Lion releases for a while now, but I couldn&amp;rsquo;t find anything that described all the problems. So here I am.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Reinstall XCode &amp;amp; apply a &lt;a href="https://bugzilla.mozilla.org/attachment.cgi?id=547774"&gt;couple&lt;/a&gt; &lt;a href="https://bugzilla.mozilla.org/attachment.cgi?id=547889"&gt;patches&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;Mercurial&lt;/h2&gt;

&lt;p&gt;I had originally installed Mercurial via &lt;code&gt;easy_install&lt;/code&gt;, so your results may be different. Regardless it was broken. Apparently you can edit the executable and it works, but I didn&amp;rsquo;t try. Attempting to install Mercurial again failed with &lt;code&gt;Python headers are required to build Mercurial&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Reinstall XCode then reinstall Mercurial and you&amp;rsquo;re set.&lt;/p&gt;

&lt;h2&gt;&lt;code&gt;make&lt;/code&gt; Not Found&lt;/h2&gt;

&lt;p&gt;Reinstalling XCode fixes that too.&lt;/p&gt;

&lt;h2&gt;Build Fails with &lt;code&gt;expected initializer before ‘NS_NORETURN’&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Your build will probably fail. The patch in &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=655339"&gt;bug 655339&lt;/a&gt; works to get past this.&lt;/p&gt;

&lt;h2&gt;Build Fails with &lt;code&gt;$MACOSX_DEPLOYMENT_TARGET mismatch&lt;/code&gt; error&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;distutils.errors.DistutilsPlatformError: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.6" but "10.7" during configure&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I first thought this was a problem with specifying the wrong target SDK, but I was wrong. This is apparently a python bug. &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=659881"&gt;Bug 659881&lt;/a&gt; has more details (and a workaround patch). The bug talks about python via MacPorts, but I&amp;rsquo;m not using MacPorts nor any non-default python installs.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Simple Tab Stats Script</title>
    <link href="http://zpao.com/posts/simple-tab-stats-script" />
    <updated>2011-06-17T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/simple-tab-stats-script</id>
    <content type="html">&lt;p&gt;My Firefox usage has always been a bit excessive. I used to open windows to group my different tasks. Then Panorama came along and I started using groups. Then I had too many groups so I started opening new windows. Luckily I set &lt;code&gt;max_concurrent_tabs&lt;/code&gt; to 0 so I avoid loading all of those pages at startup (&lt;a href="/posts/cascaded-session-restore-a-hidden-bonus"&gt;it&amp;rsquo;s that BarTab-like thing&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;img src="/img/posts/simple-tab-stats.png" alt="" /&gt;&lt;/p&gt;

&lt;p&gt;My curiosity got the better of me so I wrote &lt;a href="https://gist.github.com/1020014"&gt;a little script&lt;/a&gt; to tell me some facts about my usage. There are extensions that do some or all of this, but I didn&amp;rsquo;t actually want to install anything, I just wanted a quick snapshot of what was up. (That said I might turn it into an &lt;em&gt;about:something&lt;/em&gt; sort of extension.) You can see what it tells you &amp;ndash; it&amp;rsquo;s not much but it told me what I wanted to know. My usage was higher earlier today, and I&amp;rsquo;m sure there are people who are much more abusive of Firefox, so no judging.&lt;/p&gt;

&lt;script src="https://gist.github.com/1020014.js?file=run-this.js"&gt;&lt;/script&gt;


&lt;p&gt;Judging me on coding style? I would be. I started writing this in the error console, so I left out whitespace and used shitty variable names. Then it grew up and got all awkward.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">SpiderNode at NodeConf 2011</title>
    <link href="http://zpao.com/posts/spidernode-at-nodeconf-2011" />
    <updated>2011-05-19T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/spidernode-at-nodeconf-2011</id>
    <content type="html">&lt;p&gt;Two weeks ago, I traveled with Shawn and Rob to Portland for the inaugural NodeConf. To summarize: it was a great experience and a well run conference. Other people have done overviews, so I’m not going to go there, but read a few &lt;a href="http://www.sauria.com/blog/2011/05/09/nodeconf-2011/"&gt;here&lt;/a&gt;, &lt;a href="http://www.claassen.net/geek/blog/2011/05/reflections-on-jsconf-and-nodeconf-by-a-language-geek.html"&gt;here&lt;/a&gt;, and &lt;a href="http://www.adamchristian.com/archives/10435"&gt;here&lt;/a&gt;. I’m going to talk about SpiderNode at NodeConf instead.&lt;/p&gt;

&lt;h2&gt;A Quick Aside on the State of Things&lt;/h2&gt;

&lt;p&gt;We got SpiderNode running on the train ride shortly before getting on a plane to Portland. Under 24 hours before NodeConf. It didn’t pass all tests (still doesn’t) and we had to hack around Node’s Buffers pretty majorly. Ryan&amp;rsquo;s classic &lt;a href="https://github.com/ry/node_chat"&gt;node_chat&lt;/a&gt; ran and that was a great state to be in going into NodeConf. As for other demos, those were written right before the presentation so they were a bit unpolished.&lt;/p&gt;

&lt;h2&gt;Back to NodeConf&lt;/h2&gt;

&lt;p&gt;As we&amp;rsquo;d suspected for a while, Brendan Eich was the “Mozilla Person Secret Talk” listed on the schedule. He talked a little bit about ES.next and SpiderNode, with a couple demos. In typical Brendan fashion, it was a lot of information to get in a short period of time. If you want to see the slides, &lt;a href="http://brendaneich.com/2011/05/mozillas-nodeconf-presentation/"&gt;Brendan has them on his blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Overall, I think the reception we got was really positive. People seemed excited. Some viewed it as a way to run Node on architectures that V8 doesn’t support (before we left NodeConf I had an email from somebody telling me he had patches to get SpiderNode building on Solaris/Sparc). Others were just excited that this could open up the doors to making Node faster (more benchmarks to compete on). Other people were excited because they just really want block scoping (&lt;code&gt;let&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Other people weren’t so excited. And that’s fair. But there seemed to be some misconceptions about the project and why we were at NodeConf contributing to what felt a bit like disdain.&lt;/p&gt;

&lt;h2&gt;Selling You&lt;/h2&gt;

&lt;p&gt;There were some people who seemed convinced that we were there to sell people on using SpiderNode. I think Brendan made this pretty clear during his talk, but here it is again: we’re not trying to sell you. We don’t think you should use it right now. We’re getting closer, but it might be a little while before we suggest people use it for anything besides experimenting. We don’t pass all of the Node tests and we’re almost certainly not faster at this point.&lt;/p&gt;

&lt;p&gt;I think &lt;a href="http://brendaneich.com/2011/05/mozillas-nodeconf-presentation/"&gt;Brendan put it best&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;We are not out to make a maintained, competing fork of Node, just a friendly downstream that should go away as soon as possible. We aren’t selling anything to Node users.&lt;/p&gt;&lt;/blockquote&gt;

&lt;h2&gt;Splitting the Community&lt;/h2&gt;

&lt;p&gt;The Node community is pretty awesome and we really don’t want to split it in anyway. I’m sorry that some of you felt that’s what we were doing. If that was you, I’d love to find out what you meant.&lt;/p&gt;

&lt;p&gt;The only angle I can see on this one is that the JavaScript one would write using SpiderMonkey’s JS extensions wouldn’t run on normal (V8) Node. This goes back to the experiment thing. If you’re writing Node modules or code you want to share widely using the JS extensions STOP.&lt;/p&gt;

&lt;h2&gt;Contributing Back&lt;/h2&gt;

&lt;p&gt;I didn’t see any comments about this topic, but I wanted to make it clear that we’re most certainly going to be contributing back to Node. We created &lt;a href="https://github.com/sdwilsh/spidernode-upstreaming"&gt;a repository&lt;/a&gt; to start that process now. We’re waiting for somebody to handle &lt;a href="https://github.com/joyent/node/pull/1021"&gt;this pull request&lt;/a&gt;, which should make some uses of Buffer faster.&lt;/p&gt;

&lt;p&gt;There will surely be other things that can be upstreamed outside of our use of V8Monkey (and the build system changes required to support that).&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;I hope this clears some things up for people. Let me know if it doesn’t or you have other concerns about SpiderNode’s existence.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">About That Hybrid “V8Monkey” Engine</title>
    <link href="http://zpao.com/posts/about-that-hybrid-v8monkey-engine" />
    <updated>2011-04-14T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/about-that-hybrid-v8monkey-engine</id>
    <content type="html">&lt;p&gt;I&amp;rsquo;ve sort of been working on this thing&amp;hellip;&lt;/p&gt;

&lt;p&gt;Several weeks ago I was curious about why there was no implementation of &lt;a href="http://nodejs.org/"&gt;Node.js&lt;/a&gt; using the &lt;a href="https://developer.mozilla.org/En/SpiderMonkey"&gt;SpiderMonkey&lt;/a&gt; JavaScript engine (the one we use in Firefox). So &lt;a href="https://twitter.com/#!/zpao/status/42780850177327105"&gt;I tweeted&lt;/a&gt; about it and several people said they wanted such a thing and would help work on it.&lt;/p&gt;

&lt;p&gt;After some poking around the source, we realized that Node was tied pretty closely to &lt;a href="http://code.google.com/apis/v8/"&gt;V8&lt;/a&gt;, and there really wouldn&amp;rsquo;t be any way to use SpiderMonkey without ripping Node apart and rebuilding it. Not only would that suck now, but it would likely suck long into the future as Node gets updated. This port would fall behind and nobody wants that.&lt;/p&gt;

&lt;h2&gt;V8Monkey&lt;/h2&gt;

&lt;p&gt;So we decided that we would implement the V8 API on top of SpiderMonkey. That way we can just plug our work into Node, and it would &amp;ldquo;just work&amp;rdquo;. We&amp;rsquo;ve been chugging along on this project and have made some great progress. Thanks to John Ford we even have an automated build system running all of our tests on every checkin.&lt;/p&gt;

&lt;p&gt;The JS team at Mozilla is also really interested in just having this API around. It has potential for other projects like this, but also raises awareness of API differences and might help push forward changes to the SpiderMonkey API. We&amp;rsquo;ve already pushed for additions to the SpiderMonkey API (for example, there was previously no exposed API to check &lt;code&gt;==&lt;/code&gt;, only &lt;code&gt;===&lt;/code&gt;). There have also been discussions about turning the SpiderMonkey API into a C++ API (not just C).&lt;/p&gt;

&lt;p&gt;It also turns out that we&amp;rsquo;re not the first people to go down this track. There&amp;rsquo;s a team at Yahoo! who is very interested in Node and even did a very similar project. They even put the &lt;a href="https://github.com/bfrancojr/v8monkey/commit/95464c1ccc07e2ab10ba637de3938b5dcd924403"&gt;code out there to prove it&lt;/a&gt; and it&amp;rsquo;s been a helpful reference for us. They stopped short to get Node mostly running, while our goal is a bit more ambitious and implement the whole V8 API.&lt;/p&gt;

&lt;h2&gt;SpiderNode&lt;/h2&gt;

&lt;p&gt;SpiderNode is what we&amp;rsquo;re calling our fork of Node. Once we have our V8 binding working, we&amp;rsquo;ll shift our work over here and focus on integrating SpiderMonkey into the Node build system. Ideally we&amp;rsquo;d love to get this upstreamed and give Node developers a choice.&lt;/p&gt;

&lt;p&gt;We think V8 is great and the fact that Node has become so widely used is a testament to that. But we also think there&amp;rsquo;s room for competition here. Browser based competition is old-hat. Let&amp;rsquo;s move this battle to the servers :)&lt;/p&gt;

&lt;p&gt;With some hackery from John, we now have a way to build SpiderNode. As of Tuesday &lt;code&gt;node.cc&lt;/code&gt; compiles (OMG AWESOME) but that&amp;rsquo;s it.&lt;/p&gt;

&lt;h2&gt;Can You Help?&lt;/h2&gt;

&lt;p&gt;Absolutely. The code for both &lt;a href="https://github.com/zpao/v8monkey"&gt;v8monkey&lt;/a&gt; and &lt;a href="https://github.com/zpao/spidernode"&gt;SpiderNode&lt;/a&gt; are on GitHub for now. We have a &lt;a href="https://github.com/zpao/v8monkey/wiki/Hacking"&gt;&amp;ldquo;hacking&amp;rdquo; wiki page&lt;/a&gt; there, as well as a general &lt;a href="https://github.com/zpao/v8monkey/wiki/TODO"&gt;TODO page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We also chat a lot on IRC: &lt;a href="irc://irc.mozilla.org/spidernode"&gt;#spidernode on irc.mozilla.org&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;It&amp;rsquo;s Not Just Me&lt;/h2&gt;

&lt;p&gt;That&amp;rsquo;s for damn sure. &lt;a href="https://twitter.com/robarnold"&gt;Rob Arnold&lt;/a&gt; and &lt;a href="https://twitter.com/sdwilsh"&gt;Shawn Wilsher&lt;/a&gt; have been doing most of the heavy lifting. Rob has done some work on SpiderMonkey in a past life and is really good at this sort of language stuff. Shawn is also really smart and definitely no stranger to using SpiderMonkey. This project would be nowhere without these guys. &lt;a href="https://twitter.com/john_h_ford"&gt;John Ford&lt;/a&gt; set up a buildbot for us, which has been incredibly helpful for catching all the tests I break. Having a build engineer helping out has been really great.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/BrendanEich"&gt;Brendan Eich&lt;/a&gt; (you may have heard of him) said he&amp;rsquo;s going to start contributing. My intern &lt;a href="http://twitter.com/mehdiisdumb"&gt;Mehdi Mulani&lt;/a&gt; submitted a couple patches early on and others have stepped up and are working on patches right now.&lt;/p&gt;

&lt;h2&gt;My Experience So Far&lt;/h2&gt;

&lt;p&gt;Honestly, this is the first large scale C/C++ project I&amp;rsquo;ve worked on. I took &amp;frac12; a semester of C my freshman year in college (over 6 years ago) and I&amp;rsquo;ve written some random pieces of C++ at Mozilla. Mostly though, I write JavaScript and before that Ruby &amp;amp; PHP &amp;ndash; a lot of scripting languages. It&amp;rsquo;s a drastic change from what I&amp;rsquo;m used to and it&amp;rsquo;s taken me a while to get comfortable. Luckily I&amp;rsquo;m working with friends who have helped teach me as I go. Learning C++ while making one JavaScript engine work on top of another has been a real sink or swim experience.&lt;/p&gt;

&lt;p&gt;It&amp;rsquo;s been fun though. I really needed something entirely different from Firefox for a little while and this has fit the bill perfectly.&lt;/p&gt;

&lt;p&gt;Expect to see more from me and others in the coming days &amp;amp; weeks. And hey, perhaps you&amp;rsquo;ll see one of us at NodeConf.&lt;/p&gt;
</content>
  </entry>







  <entry>
    <title type="html">Multiple Assignment in JS With Objects</title>
    <link href="http://zpao.com/posts/multiple-assignment-in-js-with-objects" />
    <updated>2011-02-25T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/multiple-assignment-in-js-with-objects</id>
    <content type="html">&lt;p&gt;Note: Turns out this only works in Firefox since it is the only browser to include versions of JavaScript beyond 1.5. Perhaps something will show up in ECMAScript N/Harmony/whatever.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Alright, JavaScript is pretty cool. There are plenty of &amp;ldquo;tricks&amp;rdquo; that still boggle my mind. I just found another cool trick in &lt;a href="https://github.com/Mardak/restartless/blob/examples%2Fl10nDialogs/bootstrap.js#L37"&gt;Mardak code&lt;/a&gt; (he would do this&amp;hellip;).&lt;/p&gt;

&lt;p&gt;This is about multiple assignment in JS. Well, it&amp;rsquo;s actually about destructuring assignment, but potato, potato.&lt;/p&gt;

&lt;p&gt;Hopefully by now we all know that it can be done with arrays.&lt;/p&gt;

&lt;script src="https://gist.github.com/844787.js?file=assignment_array.js"&gt;&lt;/script&gt;


&lt;p&gt;What I didn&amp;rsquo;t know is that it can also be done using objects.&lt;/p&gt;

&lt;script src="https://gist.github.com/844787.js?file=assignment_object.js"&gt;&lt;/script&gt;


&lt;p&gt;This mostly makes sense now that I know it works, I was just a bit surprised. The syntax is strange, but it&amp;rsquo;s oddly satisfying (and follows from the assignment from an array).&lt;/p&gt;

&lt;p&gt;Turns out this works for nested objects too&amp;hellip;&lt;/p&gt;

&lt;script src="https://gist.github.com/844787.js?file=assignment_object_nested.js"&gt;&lt;/script&gt;


&lt;p&gt;Just keep in mind the same rules for object references applies. If I change &lt;code&gt;obj2.foo.dude&lt;/code&gt;, that changes &lt;code&gt;e.dude&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And last but not least, we can also access values directly with nested objects.&lt;/p&gt;

&lt;script src="https://gist.github.com/844787.js?file=assignment_object_nested2.js"&gt;&lt;/script&gt;


&lt;p&gt;Modifying &lt;code&gt;obj2.foo.dude&lt;/code&gt; here will have no effect on &lt;code&gt;g&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Add this to the list of cool things that have been implemented in JS &lt;a href="https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.6"&gt;1.6&lt;/a&gt;, &lt;a href="https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.7"&gt;1.7&lt;/a&gt;, and &lt;a href="https://developer.mozilla.org/en/JavaScript/New_in_JavaScript/1.8"&gt;1.8&lt;/a&gt;, but yet still aren&amp;rsquo;t available in all browsers (sigh). Generators, Iterators, array comprehensions, block scoping with &lt;code&gt;let&lt;/code&gt;&amp;hellip; all cool things that are used regularly within the Firefox codebase.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">2 Years at Mozilla</title>
    <link href="http://zpao.com/posts/2-years-at-mozilla" />
    <updated>2011-02-23T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/2-years-at-mozilla</id>
    <content type="html">&lt;p&gt;On February 23rd, 2009 I started full-time at Mozilla. So much has happened since then, yet it still feels like it was just a couple months ago.&lt;/p&gt;

&lt;p&gt;In addition to my time as an intern, I feel like I&amp;rsquo;ve seen a lot at Mozilla. With Firefox 4 I&amp;rsquo;ll be seeing my 4th release; 3.0 came out very shortly into my internship, followed by 3.5 soon after I started. 3.6 was my first version where I was around for the whole release, and 4 is so close I can taste it. I&amp;rsquo;ve had 4 bosses (Connor, Beltzner, Dietrich, and Dolske). We&amp;rsquo;re now on our 2nd CEO; I&amp;rsquo;ve seen 1 VP Engineering leave. I&amp;rsquo;ve met awesome people, and attended 2 summits.&lt;/p&gt;

&lt;p&gt;I&amp;rsquo;ve worked on the password manager, satchel, session restore, the Jetpack prototype, the Add-on SDK, per tab network prioritization, and a whole bunch of random front-end stuff. I ported the Sync extension into Firefox and helped make Firefox work on Windows CE. I&amp;rsquo;ve even written docshell &amp;amp; widget code (even if it didn&amp;rsquo;t all get checked in)! The fact that I&amp;rsquo;ve gotten to work on such varying parts of Firefox is one of my favorite things about my job.&lt;/p&gt;

&lt;p&gt;A lot has happened in my personal life as well. I lived by myself for the first time while Amanda was back at school (actually by myself, not counting dorm life or sharing a house). I&amp;rsquo;ve cleaned up more cat puke than I ever thought I would. I&amp;rsquo;ve made new friends and grown apart from older friends. &lt;em&gt;I got engaged!&lt;/em&gt; I helped my fiancée start a company.&lt;/p&gt;

&lt;p&gt;I guess it&amp;rsquo;s actually been a pretty long 2 years.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Updated Firefox Extension: Always Ask 2.0pre</title>
    <link href="http://zpao.com/posts/updated-firefox-extension-always-ask-2.0pre" />
    <updated>2011-02-22T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/updated-firefox-extension-always-ask-2.0pre</id>
    <content type="html">&lt;p&gt;&lt;img src="/img/posts/always-ask-2.0pre.png" title="The dialog that Always Ask shows when it has determined Firefox will quit without prompting" alt="" /&gt;&lt;/p&gt;

&lt;p&gt;Around the endgame for Firefox 3.6, &lt;a href="/posts/just-released-always-ask"&gt;I wrote an extension called Always Ask&lt;/a&gt; to make sure I always got a prompt when quitting. I used it for a while and then forgot about it when it was no longer compatible as Firefox 3.7 (now 4) moved forward.&lt;/p&gt;

&lt;p&gt;Now that we&amp;rsquo;re at the endgame for Firefox 4, and especially with all the changes surrounding the quit dialog, I figured it should be updated. So I&amp;rsquo;m releasing v2.0pre today which updates the extension to work with component registration changes and &lt;a href="/posts/just-quit-it"&gt;quit dialog&lt;/a&gt; &lt;a href="/posts/about-that-quit-dialog"&gt;changes&lt;/a&gt; in Firefox 4. This also includes the translations that were submitted via Babelzilla (most of them over a year ago). Thanks to all of you who took the time to translate those strings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/always-ask/"&gt;Get it now&lt;/a&gt;&lt;/strong&gt;. Or &lt;a href="https://github.com/zpao/alwaysAsk"&gt;look at the code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Why 2.0 &amp;ldquo;pre&amp;rdquo;?&lt;/h2&gt;

&lt;p&gt;Mostly just in case there are any further changes needed to be compatible with Firefox 4 (there better not be though).&lt;/p&gt;

&lt;h2&gt;Why not restartless?&lt;/h2&gt;

&lt;p&gt;This would probably work really well as a restartless extension. But I was really lazy and didn&amp;rsquo;t feel like figuring out the l10n part of that (though it looks like &lt;a href="http://erikvold.com/blog/index.cfm/2011/2/18/restartless-firefox-addons-part-4-localization-l10n"&gt;Erik Vold has that figured out already&lt;/a&gt;).&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">New Firefox Extension: switch-to-tab Blacklist</title>
    <link href="http://zpao.com/posts/new-firefox-extension-switch-to-tab-blacklist" />
    <updated>2011-02-18T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/new-firefox-extension-switch-to-tab-blacklist</id>
    <content type="html">&lt;p&gt;Switch To Tab is a pretty cool feature that will be a part of Firefox 4. I didn&amp;rsquo;t work much on it, but I contributed a bit to it last year (see &lt;a href="/posts/switch-to-tab-closing-empty-tabs"&gt;this post&lt;/a&gt; for one example).&lt;/p&gt;

&lt;p&gt;For the most part, I really like this new feature. It&amp;rsquo;s saved me much tab duplication over the past several month. However there are some sites that it doesn&amp;rsquo;t play well with, namely some JavaScript &amp;ldquo;applications&amp;rdquo; and pages with frames. I&amp;rsquo;ve quietly dealt with it and worked around the issues.&lt;/p&gt;

&lt;p&gt;But a couple weeks ago after trying to do multiple Google Maps search, I decided that I&amp;rsquo;d had enough. I never wanted Google Maps to show up in switch to tab and I was going to write an add-on to make that possible. So I spent a bit of time figuring out how I might do that and looking at this new bootstrapped extension stuff (which is pretty awesome by the way). I didn&amp;rsquo;t get far enough to make it actually work and stalled. Then I got back to work and fixed some more blockers and promptly forgot about this idea.&lt;/p&gt;

&lt;p&gt;Yesterday I started working on it again but my current approach wasn&amp;rsquo;t working (turns out &lt;code&gt;gBrowser._placesAutocomplete&lt;/code&gt; is readonly and it means it). So I asked &lt;a href="http://shawnwilsher.com/"&gt;Shawn&lt;/a&gt; about it and he came up with the answer: cheat. Don&amp;rsquo;t try to intercept the additions to the database, just revert them after the fact. Smart guy.&lt;/p&gt;

&lt;p&gt;I wrote a quick and dirty version and iterated. I released a &amp;ldquo;good enough&amp;rdquo; version 1.0 last night. &amp;ldquo;Good enough&amp;rdquo; meant it was restartless but required restarting to re-process the blacklist preference, which was&amp;hellip; dumb. Over lunch today I finished v1.1 to fix that and a couple other small issues.&lt;/p&gt;

&lt;h2&gt;Let me have it&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://addons.mozilla.org/firefox/addon/switch-to-tab-blacklist/"&gt;switch-to-tab Blacklist on AMO&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Can I see the code?&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/zpao/switchToTabBlacklist"&gt;It&amp;rsquo;s on github&lt;/a&gt;. I need to clean it up because it&amp;rsquo;s a bit hard to look at, so don&amp;rsquo;t judge me too much.&lt;/p&gt;

&lt;h2&gt;This picture is not worth 1000 words&lt;/h2&gt;

&lt;p&gt;Previously, that autocomplete result would have been said &amp;ldquo;Switch to tab:&amp;rdquo;.
&lt;img src="/img/posts/switch-to-tab-blacklist.png" alt="" /&gt;&lt;/p&gt;

&lt;h2&gt;Customizing the blacklist&lt;/h2&gt;

&lt;p&gt;I&amp;rsquo;m storing a JSON array of regular expressions (stored as strings which get turned into regular expressions with &lt;code&gt;new RegExp(...)&lt;/code&gt;). This is stored in a preference: &lt;code&gt;extension.switchToTabBlacklist.blacklist&lt;/code&gt;. You need to edit it by hand for now.&lt;/p&gt;

&lt;h2&gt;Where&amp;rsquo;s my GUI&lt;/h2&gt;

&lt;p&gt;I don&amp;rsquo;t have visual basic on this computer so I couldn&amp;rsquo;t make one.&lt;/p&gt;

&lt;p&gt;To be honest, I just didn&amp;rsquo;t care enough to make it. I made this extension for me and I know how to edit a preference. I would gladly take patches though if somebody wants to make one.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">About That Quit Dialog&amp;hellip;</title>
    <link href="http://zpao.com/posts/about-that-quit-dialog" />
    <updated>2011-02-07T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/about-that-quit-dialog</id>
    <content type="html">&lt;p&gt;Remember when we &lt;a href="/posts/just-quit-it"&gt;turned it off a couple weeks ago&lt;/a&gt;? We did that by just flipping the &lt;code&gt;browser.warnOnQuit&lt;/code&gt; preference to &lt;code&gt;false&lt;/code&gt;. I mentioned that you could get old behavior back by flipping that preference back to &lt;code&gt;true&lt;/code&gt;. That&amp;rsquo;s not going to work anymore.&lt;/p&gt;

&lt;p&gt;I just landed &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=629485"&gt;bug 629485&lt;/a&gt; to change things again, so pay attention. When we turned off the quit dialog, we took away any way of stopping the last window from closing without any warning, even if you explicitly set the visible pref &lt;code&gt;browser.tabs.warnOnClose&lt;/code&gt; which would show the window closing warning (when you have multiple tabs). That wasn&amp;rsquo;t so cool. So we played around with the logic and made that possible. But in order to do so, we had to change the default value of &lt;code&gt;browser.warnOnQuit&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; and create a new preference which controls the quit dialog (&lt;code&gt;browser.showQuitDialog&lt;/code&gt;). I know this sounds a bit inane, but there really wasn&amp;rsquo;t a better way to do it and maintain &lt;code&gt;browser.warnOnQuit == false&lt;/code&gt; as an override.&lt;/p&gt;

&lt;p&gt;It&amp;rsquo;s all a bit confusing, so I&amp;rsquo;ve &lt;a href="http://hg.mozilla.org/mozilla-central/file/84921e24be9c/browser/components/nsBrowserGlue.js#l443"&gt;documented the conditions&lt;/a&gt; under which we won&amp;rsquo;t show a dialog, as well as the rules for choosing which dialog to show. Some of that comment is perfectly clear; the rest requires a little bit of understanding of the code (but it shouldn&amp;rsquo;t be too hard to figure out if you want).&lt;/p&gt;

&lt;p&gt;Don&amp;rsquo;t expect me to write another post like this. I don&amp;rsquo;t expect any further changes to how this stuff works.&lt;/p&gt;

&lt;h2&gt;TL;DR&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We enabled the window closing dialog when closing the last window would otherwise just quit (mostly important to Windows and Linux users).&lt;/li&gt;
&lt;li&gt;If you want the quit dialog back, set &lt;code&gt;browser.showQuitWarning&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt; and make sure &lt;code&gt;browser.warnOnQuit&lt;/code&gt; is also &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;hr /&gt;

&lt;p&gt;&lt;strong&gt;Update: Feb. 8, 2011:&lt;/strong&gt; Yup. I fucked that up a little bit. We aren&amp;rsquo;t showing the quit dialog if you close the last window, even with the prefs mentioned above. That should be fixed in the next nightly.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">The New Firefox Default Home Page is Seriously Sexy</title>
    <link href="http://zpao.com/posts/the-new-firefox-default-home-page-is-seriously-sexy" />
    <updated>2011-01-31T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/the-new-firefox-default-home-page-is-seriously-sexy</id>
    <content type="html">&lt;p&gt;&lt;a href="/img/posts/originals/new-firefox-default-home-page.png"&gt;&lt;img src="/img/posts/new-firefox-default-home-page.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The new Firefox default home page is seriously sexy. &lt;strong&gt;Seriously.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A couple weeks ago &lt;a href="http://www.stephenhorlander.com/"&gt;Stephen Horlander&lt;/a&gt; designed an updated default home page for Firefox. Over the weekend, we landed most of it. So first off, a huge thanks to him.&lt;/p&gt;

&lt;p&gt;Mihai Sucan did an awesome job converting the HTML &amp;amp; CSS Steven prototyped into something we could check in, which involved a lot of fun with media queries  (seriously, resize your window with it open), as well as a lot of work to make sure it worked with RTL locales.&lt;/p&gt;

&lt;p&gt;And then finally, I hooked up the &amp;ldquo;Restore Previous Session&amp;rdquo; button. Not the HTML &amp;amp; CSS (that was Stephen &amp;amp; Mihai), just the parts that made it hide when appropriate and work when pressed. Now hopefully a few people realize that feature exists :)&lt;/p&gt;

&lt;p&gt;I also can&amp;rsquo;t forget to mention &lt;a href="http://blog.bonardo.net/"&gt;Marco Bonardo&lt;/a&gt;, who hooked up &lt;code&gt;about:home&lt;/code&gt; back in August so that we could even get to this point.&lt;/p&gt;

&lt;p&gt;Keep in mind, the image I&amp;rsquo;m showing here is the unbranded &amp;ldquo;Minefield&amp;rdquo; version of the page. When loading this in Firefox it won&amp;rsquo;t look like your computer is going to explode. I think there is a little bit more tweaking that will be done, but it already looks so much better than it used to.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">The California DMV has Terrible Browser Recommendations</title>
    <link href="http://zpao.com/posts/the-california-dmv-has-terrible-browser-recommendations" />
    <updated>2011-01-31T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/the-california-dmv-has-terrible-browser-recommendations</id>
    <content type="html">&lt;p&gt;It appears as though the California DMV has not updated their website in the past 10 years&amp;hellip;&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;To be able to use this online application, your computer will need to have one of the latest versions of either the Internet Explorer, Netscape Communicator/Navigator, or equivalent web browsers. For Internet Explorer you must have version 4.0 or higher. We suggest you use Netscape Communicator/Navigator version 6.0 or higher to eliminate any possible printer problems.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;&amp;mdash; &lt;a href="https://www.dmv.ca.gov/online/dlrbi/faqbrowser.htm"&gt;California DMV Browser Requirements&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Internet Explorer 4 came out in 1997. Netscape 6 came out in 2000. How far we&amp;rsquo;ve come&amp;hellip;&lt;/p&gt;

&lt;p&gt;In related news, the next available appointment (to take the &amp;ldquo;written&amp;rdquo; test) at the DMV in San Francisco is halfway through March. I bet I could get a new passport sooner.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Just Quit It</title>
    <link href="http://zpao.com/posts/just-quit-it" />
    <updated>2011-01-21T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/just-quit-it</id>
    <content type="html">&lt;p&gt;For a long time now, if you didn&amp;rsquo;t have Firefox set to restore your session then Firefox would prompt you before quitting. A dialog with 3 buttons and a checkbox. It looked like this:&lt;/p&gt;

&lt;p&gt;&lt;img src="/img/posts/just-quit-it.png" alt="" /&gt;&lt;/p&gt;

&lt;p&gt;That mostly just gets in your way though. You&amp;rsquo;ve already decided you want to quit. You don&amp;rsquo;t also need to decide if you want to reopen your tabs next time. So starting with the next nightly (January 21st) and Firefox 4 beta 10, you will no longer see that prompt. Of course if you already checked the box to &amp;ldquo;not ask next time&amp;rdquo; you weren&amp;rsquo;t seeing this anyway.&lt;/p&gt;

&lt;p&gt;Essentially, all we did was flip a preference that has been there since Firefox 3 (that was almost 3 years ago for those of you keeping track at home). &lt;code&gt;browser.warnOnQuit&lt;/code&gt; was added as hidden preference to override other conditions that might cause a dialog shown at quit. We set that to &lt;code&gt;false&lt;/code&gt;. &lt;strike&gt;If you want Firefox 3.* behavior, then just flip the pref back to &lt;code&gt;true&lt;/code&gt;.&lt;/strike&gt;&lt;/p&gt;

&lt;p&gt;If you&amp;rsquo;re interested, this was done in &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=592822"&gt;bug 592822&lt;/a&gt; (it was originally planned as part of &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=588482"&gt;bug 588482&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;Dude, Where&amp;rsquo;s My Session?&lt;/h2&gt;

&lt;p&gt;I know it&amp;rsquo;s been a while since &lt;a href="/posts/restore-previous-session"&gt;I wrote about it&lt;/a&gt;, but it&amp;rsquo;s now possible to restore your session on demand after startup. There is work underway to make that feature more visible, namely &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=593421"&gt;bug 593421&lt;/a&gt; (to add a button on the start page) and &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=589665"&gt;bug 589665&lt;/a&gt; (to add a button in Panorama).&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;strong&gt;Update (Feb. 7, 2011):&lt;/strong&gt; We had to make some further changes. We kept the dialog turned off by default but had to do some work with preferences. Setting &lt;code&gt;browser.warnOnQuit&lt;/code&gt; is no longer good enough to show the quit dialog. &lt;a href="/posts/about-that-quit-dialog"&gt;Read more&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">Use a Pager with Mercurial</title>
    <link href="http://zpao.com/posts/use-a-pager-with-mercurial" />
    <updated>2011-01-14T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/use-a-pager-with-mercurial</id>
    <content type="html">&lt;p&gt;In the spirit of sharing Mercurial extensions this week, did you know that there&amp;rsquo;s a &lt;a href="http://mercurial.selenic.com/wiki/PagerExtension"&gt;pager extension&lt;/a&gt; that ships with Mercurial? After using Git for a while and having a nice pager when looking at diffs, I got really annoyed by the fact that I constantly had to scroll my terminal for &lt;code&gt;hg diff&lt;/code&gt;. I found the Pager extension and there was much rejoicing.&lt;/p&gt;

&lt;p&gt;So turn it on and be happy. It&amp;rsquo;ll only page when you need to. And while you&amp;rsquo;re in your &lt;code&gt;.hgrc&lt;/code&gt;, enable the also-shipped-but-not-on-by-default &lt;a href="http://mercurial.selenic.com/wiki/ColorExtension"&gt;Color extension&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">hg-prompt Makes My Eyes Happier</title>
    <link href="http://zpao.com/posts/hg-prompt-makes-my-eyes-happier" />
    <updated>2011-01-10T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/hg-prompt-makes-my-eyes-happier</id>
    <content type="html">&lt;p&gt;For a long time I&amp;rsquo;ve had Git info in my terminal prompt. At Mozilla, we mostly use Mercurial though, so a Git aware terminal wasn&amp;rsquo;t super helpful. A couple times I tried to hack together something for Mercurial to show me my current branch or applied patch queue. Every time though I either didn&amp;rsquo;t get everything I wanted or was too lazy to make it work like I wanted (and play nicely with my other customizations).&lt;/p&gt;

&lt;p&gt;This morning I started on this problem again. But this time I started by searching for a solution first and voilà, I found hg-prompt. Take a look at &lt;a href="http://sjl.bitbucket.org/hg-prompt/documentation/samples/"&gt;the samples&lt;/a&gt; and then customize it with the &lt;a href="http://sjl.bitbucket.org/hg-prompt/documentation/keywords/"&gt;extended list of keywords available&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>







  <entry>
    <title type="html">Amazon and HTML5</title>
    <link href="http://zpao.com/posts/amazon-and-html5" />
    <updated>2010-11-10T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/amazon-and-html5</id>
    <content type="html">&lt;p&gt;&lt;a href="/img/posts/originals/amazon-and-html5.png"&gt;&lt;img src="/img/posts/amazon-and-html5.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Apparently Amazon is stepping right into HTML5 and using &lt;code&gt;type="email"&lt;/code&gt; in their sign in form. You can see the built-in form validation in action there. This is pretty awesome to actually see out in the wild, especially from such a big name.&lt;/p&gt;

&lt;p&gt;Client-side form validation without various JS libraries is pretty cool. &lt;a href="http://blog.oldworld.fr/index.php?post/2010/11/17/HTML5-Forms-Validation-in-Firefox-4"&gt;Read more about it&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Reset Panorama from the Error Console.</title>
    <link href="http://zpao.com/posts/reset-panorama-from-the-error-console" />
    <updated>2010-10-21T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/reset-panorama-from-the-error-console</id>
    <content type="html">&lt;p&gt;&lt;a href="http://www.azarask.in/blog/post/designing-tab-candy/"&gt;Panorama&lt;/a&gt; is this cool new feature coming to Firefox 4. Most of the big issues have been fixed, but there&amp;rsquo;s still &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=598600"&gt;the occasional issue&lt;/a&gt; with orphan tabs.&lt;/p&gt;

&lt;p&gt;Last week I wrote &lt;a href="http://gist.github.com/626761"&gt;a script&lt;/a&gt; that would strip the Panorama data out of Session Restore. That worked but would require a restart. &lt;a href="http://www.iangilman.com/"&gt;Ian Gilman&lt;/a&gt; (one of the Panorama developers) used that script for the basis of &lt;a href="http://gist.github.com/637583"&gt;a script&lt;/a&gt; that worked much better (it actually called into Panorama and told it to reset properly). The only problem is that it left tabs hidden, so it would require jumping into and then out of TabView to bring everything back to normal. I forked that and just added a call that made sure all tabs were shown.&lt;/p&gt;

&lt;p&gt;So if you ever get into a confusing state and don&amp;rsquo;t mind wiping out your current Panorama data, this script is for you:&lt;/p&gt;

&lt;script src="http://gist.github.com/638855.js"&gt; &lt;/script&gt;

</content>
  </entry>







  <entry>
    <title type="html">&amp;lt;3 Firefox Sync</title>
    <link href="http://zpao.com/posts/firefox-sync" />
    <updated>2010-09-24T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/firefox-sync</id>
    <content type="html">&lt;p&gt;Today I accidentally deleted my primary Firefox profile (mostly through user error). I was cleaning testing profiles out via the &lt;a href="http://support.mozilla.com/kb/managing+profiles"&gt;Profile Manager&lt;/a&gt; and managed to delete &lt;code&gt;default&lt;/code&gt;. Since that actually deletes the whole profile folder from disk instead of moving to the trash can, I just said &amp;ldquo;Fuck&amp;rdquo;. This is a profile I&amp;rsquo;ve had for a while. It had a lot of history, passwords, bookmarks, extensions. All of it lost in an instant.&lt;/p&gt;

&lt;p&gt;Luckily though, I&amp;rsquo;d set this profile up to use Firefox Sync years ago when early versions of Weave were just being released. At that point I&amp;rsquo;d set it up for backup primarily. Since then I&amp;rsquo;ve synced that profile to multiple computers.&lt;/p&gt;

&lt;p&gt;The nice thing about it is I lost almost 0 time. I created a new profile, set up Sync, and within a couple minutes had the vital information I needed in my profile. I lost a couple things: extensions, some prefs. I don&amp;rsquo;t use many extensions so that&amp;rsquo;s not a huge issue. I don&amp;rsquo;t even remember what prefs I&amp;rsquo;ve tweaked, but I&amp;rsquo;m going to guess not too many. Some prefs were restored by Sync, but there&amp;rsquo;s only a handful that get synced. I even had all of my tabs a click away on the list of tabs from other computers.&lt;/p&gt;

&lt;p&gt;If you&amp;rsquo;re not using Firefox Sync, &lt;a href="http://www.mozilla.com/en-US/firefox/beta/features/"&gt;it&amp;rsquo;s built in to Firefox 4&lt;/a&gt; and is also &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/10868/"&gt;available as an extension&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">I Already Love It</title>
    <link href="http://zpao.com/posts/i-already-love-it" />
    <updated>2010-09-21T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/i-already-love-it</id>
    <content type="html">&lt;blockquote&gt;&lt;p&gt;I already love it. I had to wait several minutes til my 100+ tabs are loaded. Now i can start to surf immediately.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;—&lt;a href="http://forums.mozillazine.org/viewtopic.php?p=9915641&amp;amp;sid=5169dfe4ca931dad2c643f083536b945#p9915641"&gt;trolly on mozillazine&lt;/a&gt; about &lt;a href="/posts/cascaded-session-restore-a-hidden-bonus"&gt;Cascaded Session Restore&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Cascaded Session Restore + a Hidden Bonus</title>
    <link href="http://zpao.com/posts/cascaded-session-restore-a-hidden-bonus" />
    <updated>2010-09-17T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/cascaded-session-restore-a-hidden-bonus</id>
    <content type="html">&lt;p&gt;&lt;em&gt;In the tradition of announcing major things on Friday nights&amp;hellip;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I did this thing where we don&amp;rsquo;t load all of your pages at once when we restore your session. That should keep your Firefox (and computer in general) a bit more usable when you start up Firefox with a large session. See &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=586068"&gt;bug 586068&lt;/a&gt; if you&amp;rsquo;re interested in the juicy details.&lt;/p&gt;

&lt;h2&gt;Other Details&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Switching tabs should cause the selected tab to start loading immediately, even if it wasn&amp;rsquo;t loading before&lt;/li&gt;
&lt;li&gt;This works with Panorama (so changing groups re-prioritizes your load order).&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;Preference Controlled&lt;/h2&gt;

&lt;p&gt;We load a certain number of tabs based on the &lt;code&gt;browser.sessionstore.max_concurrent_tabs&lt;/code&gt; preference. We&amp;rsquo;ve set the default to 3 for now.&lt;/p&gt;

&lt;h2&gt;Hidden Bonus&lt;/h2&gt;

&lt;p&gt;Set the pref to 0. It&amp;rsquo;s basically a built-in &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/67651"&gt;BarTab&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Quirks&lt;/h2&gt;

&lt;p&gt;We show the page title and favicon at start up, before we try to load the page. So you might see some slightly odd behavior. Panorama&amp;rsquo;s thumbnail caching isn&amp;rsquo;t perfect, so there will probably be missing thumbnails at start up if you switch into the Panorama view.&lt;/p&gt;

&lt;p&gt;Please email me (link below!) or file a bug blocking 586068 if you see anything weird.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">Restore Previous Session</title>
    <link href="http://zpao.com/posts/restore-previous-session" />
    <updated>2010-09-10T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/restore-previous-session</id>
    <content type="html">&lt;p&gt;I landed &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=588482"&gt;bug 588482&lt;/a&gt; today (September 10&lt;sup&gt;th&lt;/sup&gt;), so starting with tomorrow&amp;rsquo;s nightly version of Firefox (AKA Minefield), you&amp;rsquo;ll be able to restore your previous session at any point after start up. This means that you no longer have to restore your whole session immediately at start up. This will be available through a menu item in the History menu, as shown below.&lt;/p&gt;

&lt;p&gt;&lt;img src="/img/posts/restore-previous-session.png" alt="Screenshot of History Menu" /&gt;&lt;/p&gt;

&lt;p&gt;This feature will be in Firefox 4 &lt;strike&gt;beta 6&lt;/strike&gt; beta 7, due out in the next couple weeks.&lt;/p&gt;

&lt;h2&gt;Details&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Restoring your previous session after you&amp;rsquo;ve browsed around will merge the sessions. You shouldn&amp;rsquo;t lose any new data by restoring your previous session.&lt;/li&gt;
&lt;li&gt;We didn&amp;rsquo;t break existing behavior. If you have Firefox set to show your windows and tabs from last time, we&amp;rsquo;ll continue to do so and you won&amp;rsquo;t even notice this feature exists&lt;/li&gt;
&lt;li&gt;App tabs still behave the same.&lt;/li&gt;
&lt;li&gt;This doesn&amp;rsquo;t break any existing APIs, but it does add some new ones.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=593421"&gt;Discoverability is suboptimal&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=592822"&gt;You are still prompted to save your session when quitting&lt;/a&gt; (assuming default prefs).&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;Why?&lt;/h2&gt;

&lt;p&gt;We did this primarily for 2 reasons.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We want faster start up times. By encouraging users to always resume their previous sessions, we give the impression that Firefox takes a long time to load up. But really, you&amp;rsquo;re loading 20, 50, 100+ tabs and that&amp;rsquo;s what is slow.&lt;/li&gt;
&lt;li&gt;When you&amp;rsquo;re quitting, you there&amp;rsquo;s a good chance you have no idea if you&amp;rsquo;ll need your tabs next time.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;(Keep in mind, if you&amp;rsquo;re reading this post, you aren&amp;rsquo;t the typical user. You&amp;rsquo;re probably a developer of some sort who drags your 400 tabs around to each session. You know it&amp;rsquo;s slow, but you really never got the hang of bookmarks, so you just keep tabs open.)&lt;/p&gt;

&lt;h2&gt;Privacy&lt;/h2&gt;

&lt;p&gt;Obviously, in order for us to restore your session, we need to save it to disk. We save this data in a plain-text JSON file in your &lt;a href="http://support.mozilla.com/kb/Profiles"&gt;profile&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We currently consider sessions a little differently than some other browsers. We consider your session cookies (and a few other things) as part of your session. This means we write that information to disk. Under a normal session restore that you&amp;rsquo;ve explicitly opted-in to, that&amp;rsquo;s fine. We have a hidden preference (&lt;code&gt;browser.sessionstore.privacy_level&lt;/code&gt;) that specifies what level of privacy to use. &lt;strong&gt;The default value is 1&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;There are 3 levels of privacy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;0&lt;/strong&gt; = Save private information for HTTP and HTTPS sites.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;1&lt;/strong&gt; = Save private information for HTTP sites.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2&lt;/strong&gt; = Don&amp;rsquo;t save any private information.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;For deferred sessions, we created a new preference (&lt;code&gt;browser.sessionstore.privacy_level_deferred&lt;/code&gt;) with a different default value. Since people are not making an informed decision to restore at shutdown, we don&amp;rsquo;t want to expose information that can be used to, for example, log in to GMail. This new preference has the same possible values but &lt;strong&gt;the default value is 2&lt;/strong&gt;, so that no session cookies will be restored.&lt;/p&gt;

&lt;h2&gt;Safari&lt;/h2&gt;

&lt;p&gt;Yea. They&amp;rsquo;ve been doing this for ages. But as far as I know, they still don&amp;rsquo;t allow you to restore your entire session at start up.&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">Jetpack SDK 0.5 &amp;amp; the Request API</title>
    <link href="http://zpao.com/posts/jetpack-sdk-0-5-the-request-api" />
    <updated>2010-06-29T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/jetpack-sdk-0-5-the-request-api</id>
    <content type="html">&lt;p&gt;&lt;a href="http://mozillalabs.com/jetpack/2010/06/24/announcing-jetpack-sdk-0-5/"&gt;Jetpack SDK 0.5&lt;/a&gt; hit the streets last week. There&amp;rsquo;s a bunch of new APIs in there. I worked on the &lt;code&gt;Request&lt;/code&gt; API, which enables a simple way to make XML HTTP Requests (XHR, or AJAX if you must). The API is a wrapper around the Gecko HXR object.&lt;/p&gt;

&lt;p&gt;Like jQuery, MooTools, Prototype (or pretty much any JS library), it makes the ugly stuff go away. You simple provide a URL, some data, and a callback, and we&amp;rsquo;ll do the rest (you can set some more things if you&amp;rsquo;d like). In the callback, you have access to the response headers and content as JSON/XML/text. &lt;a href="https://jetpack.mozillalabs.com/sdk/0.5/docs/#module/jetpack-core/request"&gt;Read the documentation&lt;/a&gt; for the specifics.&lt;/p&gt;

&lt;p&gt;Keep in mind that this is meant to be a simple API. You can&amp;rsquo;t make complicated requests. For example, you can&amp;rsquo;t send files with it. The plan is to keep this API simple. It is a first version, so if people need more functionality, we can add more. Or we can take those additional needs and create another API. If you have feedback, please post to the &lt;a href="https://groups.google.com/group/mozilla-labs-jetpack"&gt;Google Group&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I wrote up a basic example using the Twitter API, which I&amp;rsquo;ve included below. It&amp;rsquo;s not too fancy, but gets your feet wet.&lt;/p&gt;

&lt;script src="http://gist.github.com/457704.js?file=gistfile1.js"&gt;&lt;/script&gt;

</content>
  </entry>





  <entry>
    <title type="html">Switch to Tab &amp;amp; Closing Empty Tabs</title>
    <link href="http://zpao.com/posts/switch-to-tab-closing-empty-tabs" />
    <updated>2010-06-15T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/switch-to-tab-closing-empty-tabs</id>
    <content type="html">&lt;p&gt;Firefox 4 will be introducing a &lt;a href="https://wiki.mozilla.org/Firefox/Projects/Tab_Matches_in_Awesomebar"&gt;new feature&lt;/a&gt; called &amp;ldquo;Switch to Tab&amp;rdquo; or &amp;ldquo;Tab Matches in Awesomebar&amp;rdquo;, a feature that attempts to see if the page you&amp;rsquo;re looking for is already open. If it is (and you explicitly select that location bar suggestion), you&amp;rsquo;ll be taken to that open tab instead of opening a new one. This is great step forward &amp;amp; I&amp;rsquo;ve already found it quite helpful. I tend to open the same bug several times over the course of a day or week. Now instead of having 3 copies, I can just have one and switch to it quickly.&lt;/p&gt;

&lt;p&gt;Even though &lt;a href="http://theunfocused.net"&gt;Blair&lt;/a&gt; toiled away on it, there were still a few bugs with the initial implementation. Blair immediately jumped into another small project (redesigning the Add-ons Manager is pretty trivial right?), so many of the followup bugs went unowned. I took two of those bugs; I fixed &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=556061"&gt;one&lt;/a&gt; a few weeks ago and finally fixed the &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=555767"&gt;other&lt;/a&gt; today.&lt;/p&gt;

&lt;p&gt;The second one is the one that will make more of a difference for user experience. My common workflow goes like this (notice the brokenness at the end):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open a new tab&lt;/li&gt;
&lt;li&gt;Start typing new URL&lt;/li&gt;
&lt;li&gt;Sweet, a match! Switch to it.&lt;/li&gt;
&lt;li&gt;Repeat 1-3&lt;/li&gt;
&lt;li&gt;WTF? I have 15 blank tabs open?&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;With &lt;a href="http://hg.mozilla.org/mozilla-central/rev/2333f6d349d7"&gt;my patch&lt;/a&gt; &lt;em&gt;we&amp;rsquo;ll now close that empty tab after we switch focus&lt;/em&gt;. No more step 5. That is all.&lt;/p&gt;
</content>
  </entry>







  <entry>
    <title type="html">Now Using JSON.parse in Session Restore</title>
    <link href="http://zpao.com/posts/now-using-json-parse-in-session-restore" />
    <updated>2010-06-09T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/now-using-json-parse-in-session-restore</id>
    <content type="html">&lt;p&gt;Back in March, &lt;a href="/posts/partially-dropping-support-for-firefox-2-0-3-0"&gt;I partially dropped support for sessions from Firefox 2.0 &amp;amp; 3.0&lt;/a&gt;. For Firefox 4.0, we&amp;rsquo;ll be dropping backwards compatibility of sessions for Firefox 2.0 &amp;amp; 3.0. That means that sessions created with nightlies starting tomorrow, will no longer be loadable by versions of Firefox prior to 3.5. With &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=387859"&gt;bug 387859&lt;/a&gt;, Session Restore will now use &lt;code&gt;JSON.parse&lt;/code&gt; instead of &lt;code&gt;evalInSandbox&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;So why use &lt;code&gt;JSON.parse&lt;/code&gt;?&lt;/h2&gt;

&lt;p&gt;Mostly, it&amp;rsquo;s faster. &lt;code&gt;evalInSandbox&lt;/code&gt; involved going through XPConnect and a whole bunch of object wrapping for security needed to be done. By using &lt;code&gt;JSON.parse&lt;/code&gt;, we don&amp;rsquo;t have to worry about that overhead. We also don&amp;rsquo;t have to worry about changes made to Chrome Object Wrappers (changes which have broken about:sessionrestore recently).&lt;/p&gt;

&lt;h2&gt;What does this mean for me? Not Much.&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If for some reason you&amp;rsquo;re bouncing between nightlies and Firefox 3.0, then you&amp;rsquo;ll want to load your session in Firefox 3.5 or 3.6 before loading it in Firefox 3.0 again. If this describes you, then you should really &lt;a href="http://www.mozilla.com/firefox/firefox.html"&gt;just upgrade&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The contents of &lt;code&gt;sessionstore.js&lt;/code&gt; will no longer have wrapping parenthesis. Those were added so that sessions could still be loaded by Firefox 3.0-.&lt;/li&gt;
&lt;li&gt;The keys that were only ever used internally are now excluded from exported sessions. This includes &lt;code&gt;_tabStillLoading&lt;/code&gt;, &lt;code&gt;_hosts&lt;/code&gt;, and &lt;code&gt;_formDataSaved&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

</content>
  </entry>





  <entry>
    <title type="html">waitForClipboard now available to Mochitests</title>
    <link href="http://zpao.com/posts/waitforclipboard-now-available-to-mochitests" />
    <updated>2010-06-02T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/waitforclipboard-now-available-to-mochitests</id>
    <content type="html">&lt;p&gt;Testing is a part of life. Sadly, that means we have to write tests for things that involve the clipboard. The clipboard is complicated enough with all of this flavor and transferable stuff we have going on. Throw in the fact that the clipboard can be asynchronous (thanks Linux), and it gets worse. We&amp;rsquo;ve had a number of tests that fail due to expectations that the clipboard be synchronous. Most of those tests have been changed to use a &amp;ldquo;polling&amp;rdquo; strategy &amp;ndash; essentially waiting for the clipboard to have the expected value. If it doesn&amp;rsquo;t have the right value after a few seconds, then the test fails. I know of at least 3 tests that use this strategy now, and they all ended up having similar code, perhaps even copy-pasted directly from another test.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.gavinsharp.com/"&gt;Gavin&lt;/a&gt; made me use polling for the test in &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=556061"&gt;a bug&lt;/a&gt; I fixed recently. Then the following week there was a password manager bug that I saw doing clipboard stuff (without polling) so I passed along the &amp;ldquo;polling is good&amp;rdquo; requirement.&lt;/p&gt;

&lt;p&gt;Instead of making everybody rewrite the wheel, I decided to write &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=567870"&gt;&lt;code&gt;SimpleTest.waitForClipboard&lt;/code&gt;&lt;/a&gt; to take care of this polling stuff for us. It only works with the global clipboard, and only with &lt;code&gt;text/unicode&lt;/code&gt; strings (&lt;code&gt;text/plain&lt;/code&gt; should work too since it&amp;rsquo;s available on the clipboard in the unicode flavor). It works by setting the clipboard to a known value (different than your expected value), then polling for that value. After the known value is found, your setup function is called, and we poll again. When we find the value, we add a &lt;strong&gt;PASS&lt;/strong&gt; &amp;amp; then your success function is called. If at any point we timeout waiting for the expected value, we add a &lt;strong&gt;FAIL&lt;/strong&gt; &amp;amp; then your failure function is called.&lt;/p&gt;

&lt;p&gt;Following are the arguments and then a simple example test. Hopefully it&amp;rsquo;s clear how to make use of &lt;code&gt;waitForClipboard&lt;/code&gt; in tests you write in the future. I&amp;rsquo;ve already converted a few tests to use this method. If there are any existing [orange]s that you think could benefit from this, please convert them!&lt;/p&gt;

&lt;script src="http://gist.github.com/423041.js"&gt;&lt;/script&gt;

</content>
  </entry>







  <entry>
    <title type="html">Problem Report: Cat</title>
    <link href="http://zpao.com/posts/problem-report-cat" />
    <updated>2010-05-01T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/problem-report-cat</id>
    <content type="html">&lt;p&gt;&lt;a href="/img/posts/originals/problem-report-cat.png"&gt;&lt;img src="/img/posts/problem-report-cat.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Fact: Cats make things happen that you never expect. Like crash your computer. &lt;a href="http://twitter.com/zpao/status/10605017612"&gt;See also&lt;/a&gt;.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">A Followup to Flash on Windows</title>
    <link href="http://zpao.com/posts/a-followup-to-flash-on-windows" />
    <updated>2010-04-27T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/a-followup-to-flash-on-windows</id>
    <content type="html">&lt;p&gt;Last week I went on a &lt;a href="/posts/how-to-install-flash-on-windows-or-a-cleveland-steamer-is-a-better-experience"&gt;little rant&lt;/a&gt; about Adobe&amp;rsquo;s inane method of installing Flash on Windows (in Firefox). I received a few emails from people pointing out the much better way of installing Flash &amp;ndash; just download the .exe installer! Sounds simple, but good luck actually finding that on Adobe&amp;rsquo;s website (while using Firefox anyway &amp;ndash; they do UA sniffing to make you use the extension). I&amp;rsquo;d known that this existed and this was exactly what I was expecting. I just couldn&amp;rsquo;t find that page with minimal effort, so I thought I&amp;rsquo;d rant.&lt;/p&gt;

&lt;p&gt;I was also directed towards the &lt;a href="http://support.mozilla.com/en-US/kb/Installing+the+Flash+plugin"&gt;Installing the Flash Plugin article&lt;/a&gt; on the Mozilla Support website. The support moderators have dealt with the experience I had and spent a lot of time getting the support article right.&lt;/p&gt;

&lt;p&gt;That article explain 2 methods of installing Flash, neither of with involves Adobe DLM:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Flash through the missing plugin dialog. This involves simply going to &lt;a href="http://www.adobe.com/software/flash/about/"&gt;a page that requires Flash&lt;/a&gt; (without the usual JS fallback, ie. not YouTube) and getting prompted by Firefox to install Flash for you.&lt;/li&gt;
&lt;li&gt;Installing via the .exe installer. There is a &lt;a href="http://get.adobe.com/flashplayer/thankyou/?installer=Flash_Player_10_for_Windows_-_Other_Browsers"&gt;direct link to the page on Adobe&amp;rsquo;s site&lt;/a&gt; where you can download the actual installer.&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;So there are sane ways to get Flash installed. Adobe just doesn&amp;rsquo;t promote them.&lt;/p&gt;
</content>
  </entry>



  <entry>
    <title type="html">How to Install Flash on Windows OR A Cleveland Steamer is a Better Experience</title>
    <link href="http://zpao.com/posts/how-to-install-flash-on-windows-or-a-cleveland-steamer-is-a-better-experience" />
    <updated>2010-04-21T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/how-to-install-flash-on-windows-or-a-cleveland-steamer-is-a-better-experience</id>
    <content type="html">&lt;p&gt;I got a 2nd computer at work which I&amp;rsquo;ve installed Windows 7 onto. So I wanted to finally see the &lt;a href="http://www.mozilla.com/en-US/firefox/3.6.4/whatsnew/#oopp"&gt;Out Of Process Plugins coming in Firefox 3.6.4&lt;/a&gt;. It&amp;rsquo;s a new computer, so I still need to install Flash. No problem, right? &lt;em&gt;Wrong!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pretend for a moment that a helpful Adobe customer service agent is helping your mother install Flash:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You need Flash! Go download it.&lt;/li&gt;
&lt;li&gt;Oh and by the way, we&amp;rsquo;re going to trick you into installing some McAffee product that you don&amp;rsquo;t want! I mean, we&amp;rsquo;re not tricking you, we&amp;rsquo;re helping you&amp;hellip;&lt;/li&gt;
&lt;li&gt;Oh you&amp;rsquo;re using Firefox? We have an &lt;em&gt;awesome&lt;/em&gt; way of installing Adobe products: an extension! You know that way you normally install things on a Windows computer, fuck it! Trust us, this is &lt;em&gt;wayyyy better&lt;/em&gt;!&lt;/li&gt;
&lt;li&gt;Ok, so since we&amp;rsquo;re not doing this like you would expect, you&amp;rsquo;re probably confused by what&amp;rsquo;s happening now. So we&amp;rsquo;re going to give you a link to a &lt;a href="http://www.adobe.com/products/reader/dlm/firefox_steps.html"&gt;page that&amp;rsquo;s going to make you more confused&lt;/a&gt;! Oh yea, we&amp;rsquo;re going to make you edit Firefox options that you didn&amp;rsquo;t know existed. We&amp;rsquo;re also going to show you instructions for an old version of Firefox (we know, Firefox 2 came out 4 years ago, but it&amp;rsquo;s still awesome!), so those pictures don&amp;rsquo;t match up with what&amp;rsquo;s actually happening to you. Oh and one more thing. We know you&amp;rsquo;re installing Flash, but these instructions are for Adobe Reader. I mean, they&amp;rsquo;re the same, so that big title that says &amp;ldquo;Adobe Reader Installation Instructions&amp;rdquo; shouldn&amp;rsquo;t confuse you at all. If it does, you&amp;rsquo;re dumb!&lt;/li&gt;
&lt;li&gt;Our bad, just click that &amp;lsquo;Allow&amp;rsquo; button up at the top of Firefox, but under the tabs. It&amp;rsquo;s a little yellow. It&amp;rsquo;s really easy to see. Found it yet? No? That&amp;rsquo;s cool, I guess we didn&amp;rsquo;t explain this very well. Moving on.&lt;/li&gt;
&lt;li&gt;Sweet, so now we&amp;rsquo;re installing an extension! WOOOOO!! It&amp;rsquo;s called &amp;lsquo;Adobe DLM&amp;rsquo;, not Flash. Oh you didn&amp;rsquo;t read the fine print? Yea we said we might use the Adobe Download Manager, so we&amp;rsquo;re doing that. But we didn&amp;rsquo;t actually want to say &amp;lsquo;Download Manager&amp;rsquo; when you were installing &amp;ndash; we thought that might get confusing.&lt;/li&gt;
&lt;li&gt;Right, so since this is a Firefox extension, we&amp;rsquo;re going to need you to restart Firefox. I mean, we needed to do that anyway, so let&amp;rsquo;s just get it out of the way. Go ahead, you definitely want to do that. BUT we&amp;rsquo;re going to make you figure that out yourself. Oh? You didn&amp;rsquo;t notice that little bar in Firefox that said you need to restart? Oh well. Find it and press it. We&amp;rsquo;re almost done now!&lt;/li&gt;
&lt;li&gt;So now you&amp;rsquo;ve restarted Firefox, you get an &lt;em&gt;awesome&lt;/em&gt; Windows alert asking if you want to let Adobe DLM make changes to your computer. You definitely want to press &amp;lsquo;Yes&amp;rsquo;. Still with us? Ok, so just let Adobe Download Manager do it&amp;rsquo;s thing (yes, DLM is an abbreviation for &amp;lsquo;Download Manager&amp;rsquo;, you didn&amp;rsquo;t figure that out on your own?).&lt;/li&gt;
&lt;li&gt;And we&amp;rsquo;re done!&lt;/li&gt;
&lt;li&gt;By the way, we&amp;rsquo;re just going to leave this extension installed. That way when we want to fuck you in the ass, we can. Have a nice day ;)&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;&lt;strong&gt;FUCK YOU ADOBE!&lt;/strong&gt;&lt;/p&gt;
</content>
  </entry>









  <entry>
    <title type="html">On Rude Recruiters</title>
    <link href="http://zpao.com/posts/on-rude-recruiters" />
    <updated>2010-04-09T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/on-rude-recruiters</id>
    <content type="html">&lt;p&gt;Recruiters are part of how the world works. For the most part, I don&amp;rsquo;t mind being contacted by them. They&amp;rsquo;re doing their job. However, I do mind when they lack manners. I probably shouldn&amp;rsquo;t complain that I&amp;rsquo;m being contacted, but the lack of manners is one of my biggest pet peeves so I&amp;rsquo;m bitching. Here&amp;rsquo;s a few recent examples.&lt;/p&gt;

&lt;p&gt;Last month I got one that included:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;If for some reason you are not interested &amp;hellip;&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I think it&amp;rsquo;s a bit presumptuous to assume I would be interested. It&amp;rsquo;s probably a form footer, which doesn&amp;rsquo;t make it any better.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Currently I am crazy searching for 4 positions in the bay.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;This is the first sentence from somebody I haven&amp;rsquo;t ever talked to. No &amp;ldquo;Hello&amp;rdquo;, no &amp;ldquo;My name is &lt;strong&gt;&lt;strong&gt;&lt;em&gt; and I&amp;rsquo;m reaching out to you because &lt;/em&gt;&lt;/strong&gt;&lt;/strong&gt;&amp;rdquo;. Also, you&amp;rsquo;re &amp;ldquo;crazy searching&amp;rdquo;? Really?&lt;/p&gt;

&lt;p&gt;Earlier today I had somebody call my work extension (which is not in any public place that I know of, nor have I given it to anybody outside the company). How did she get my number? Not only that, but she flat-out lied about what is on my LinkedIn profile:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;I actually came across your LinkedIn profile and um&amp;hellip; I see blatantly there that you&amp;rsquo;re um&amp;hellip; um&amp;hellip; in a position to look for something new.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Go ahead and look at &lt;a href="http://www.linkedin.com/in/pauloshannessy"&gt;my profile&lt;/a&gt;. If you see anything there that says I&amp;rsquo;m interested in something new, let me know so I can remove it. I have zero plans to leave Mozilla.&lt;/p&gt;

&lt;p&gt;Obviously not all recruiters are rude. I like to think we have an awesome recruiting team at Mozilla, and I&amp;rsquo;ve been contacted by very polite people. I remember the nice ones and I&amp;rsquo;ve even reached out to the some when friends have been looking for positions.&lt;/p&gt;

&lt;p&gt;So recruiters, here are some simple rules for contacting people:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Say some sort of greeting.&lt;/li&gt;
&lt;li&gt;Introduce yourself, let me know where you work.&lt;/li&gt;
&lt;li&gt;Tell me how you got my name/email/phone number, etc.&lt;/li&gt;
&lt;li&gt;Then tell me about the awesome position that you think I&amp;rsquo;m qualified for and will love.&lt;/li&gt;
&lt;li&gt;DON&amp;rsquo;T MAKE SHIT UP (especially about me, I mean seriously)&lt;/li&gt;
&lt;li&gt;You&amp;rsquo;re going to say &amp;ldquo;if you know anybody else who might be interested please forward this along&amp;rdquo; or something along those lines. We all know it.&lt;/li&gt;
&lt;li&gt;If you&amp;rsquo;ve done the above, I&amp;rsquo;ll respond in a similarly polite fashion and maybe forward the position on to somebody who might be looking for a job.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;&lt;a href="http://freelancewritinggigs.com/businesstips/wp-content/uploads/2009/07/Dewey-Bridge-Fire.jpg"&gt;This is a picture of a burning bridge.&lt;/a&gt;&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">Shaver Facts</title>
    <link href="http://zpao.com/posts/shaver-facts" />
    <updated>2010-03-26T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/shaver-facts</id>
    <content type="html">&lt;p&gt;&lt;a href="/img/posts/originals/shaver-facts.png"&gt;&lt;img src="/img/posts/shaver-facts.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I had absolutely nothing to do with &lt;a href="http://shaverfacts.com"&gt;shaverfacts.com&lt;/a&gt;. Absolutely nothing.&lt;/p&gt;
</content>
  </entry>





  <entry>
    <title type="html">(Partially) Dropping Support for Firefox 2.0/3.0 Sessions</title>
    <link href="http://zpao.com/posts/partially-dropping-support-for-firefox-2-0-3-0" />
    <updated>2010-03-15T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/partially-dropping-support-for-firefox-2-0-3-0</id>
    <content type="html">&lt;p&gt;&lt;strong&gt;&lt;em&gt;Note: This does not affect Firefox 3.5 or 3.6 users!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Today &lt;a href="http://hg.mozilla.org/mozilla-central/rev/55b6bc4c0b92"&gt;I landed a patch&lt;/a&gt; for &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=551285"&gt;bug 551285&lt;/a&gt;, which removes support for certain parts of sessions created in Firefox 2.0 and 3.0. &lt;em&gt;This means that if you upgrade directly from 2.0 or 3.0 to Firefox.next (currently 3.7), you will lose some session data.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The data you would lose is limited to the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Form data (2.0 and 3.0)&lt;/li&gt;
&lt;li&gt;Session Cookies (2.0 only)&lt;/li&gt;
&lt;li&gt;Tab XUL Attributes (2.0 and 3.0)&lt;/li&gt;
&lt;li&gt;Session History Post Data (2.0 only)&lt;/li&gt;
&lt;li&gt;Session History Owner (2.0 only)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;If losing any of this data particularly bothers you, then it&amp;rsquo;s as simple as upgrading to &lt;a href="http://www.mozilla.com/en-US/firefox/firefox.html"&gt;Firefox 3.6&lt;/a&gt; or &lt;a href="http://www.mozilla.com/firefox/all-older.html"&gt;Firefox 3.5&lt;/a&gt; first. Alternatively, some session management add-ons could update your session file for you (for example, the author of &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2324"&gt;Session Manager&lt;/a&gt; is updating his add-on to do that).&lt;/p&gt;
</content>
  </entry>











  <entry>
    <title type="html">Just Released: Always Ask</title>
    <link href="http://zpao.com/posts/just-released-always-ask" />
    <updated>2009-12-21T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/just-released-always-ask</id>
    <content type="html">&lt;p&gt;No, I didn&amp;#8217;t mean to press ⌘Q, I just wanted to close that tab. Sure, all I have to do is start Firefox again. You&amp;#8217;re right, I didn&amp;#8217;t really need those minutes of my life. Yea, go ahead and install those updates I intentionally was putting off. I probably didn&amp;#8217;t lose any important information. Oh wait, Session Restore doesn&amp;#8217;t save form data on https sites (read: Bugzilla) by default? &lt;strong&gt;&lt;span class="caps"&gt;FFFFFFFFFFFFUUUUUUUUUUUUUUUUUU&lt;/span&gt;!!!!!!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/55824/"&gt;Always Ask&lt;/a&gt;&lt;/strong&gt; is an add-on that adds an additional prompt to Firefox when you are quitting. The prompt only shows up if Firefox has determined that you don&amp;#8217;t need a prompt. This includes when you have &lt;a href="http://support.mozilla.com/en-US/kb/Session+Restore"&gt;Session Restore&lt;/a&gt; enabled, if you&amp;#8217;ve changed either of the &lt;code&gt;browser.warnOn*&lt;/code&gt; prefs, or if you don&amp;#8217;t have Session Restore enabled &amp;amp; are closing multiple tabs. There&amp;#8217;s probably some other combination of conditions that change the outcome here.&lt;/p&gt;
&lt;p&gt;Since I work on Session Restore, I&amp;#8217;ve had it turned on for a long time. In the past I&amp;#8217;ve intentionally changed my preferences so that it wouldn&amp;#8217;t automatically quit, but that has led to me accidentally setting prefs and disabling the prompt. Then I have the same problem.&lt;/p&gt;
&lt;p&gt;So this extension is pretty simple. It&amp;#8217;s currently available in English (en-US) but if you&amp;#8217;d like to see it in your language, feel free to &lt;a href="http://www.babelzilla.org/index.php?option=com_wts&amp;amp;extension=5271"&gt;help out on Babelzilla&lt;/a&gt;. Code is available &lt;a href="http://github.com/zpao/alwaysAsk"&gt;on Github&lt;/a&gt; (thanks to hg-git).&lt;/p&gt;
&lt;p&gt;&lt;img src="http://farm3.static.flickr.com/2682/4203971167_45d442d2eb.jpg" title="Always Ask in action" alt="Always Ask in action" /&gt;&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Status Update: November 9, 2009</title>
    <link href="http://zpao.com/posts/status-update-nov-09-2009" />
    <updated>2009-11-09T00:00:00-08:00</updated>
    <id>http://zpao.com/posts/status-update-nov-09-2009</id>
    <content type="html">&lt;p&gt;Not much exciting happened this past week. We had some out-of-towners (&lt;a href="http://beltzner.ca/mike"&gt;beltzner&lt;/a&gt;, &lt;a href="http://blog.johnath.com/"&gt;johnath&lt;/a&gt;, and &lt;a href="http://autonome.wordpress.com/"&gt;dietrich&lt;/a&gt;) down in the Mountain View office. It&amp;#8217;s good to see the boss face-to-face every once in a while. Otherwise it was business as usual.&lt;/p&gt;
&lt;h2&gt;What I got done last week:&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=522545"&gt;Bug 522545&lt;/a&gt;:&lt;/strong&gt; Third time&amp;#8217;s the charm. I finally found an acceptable approach to solving the problem. The problem of&amp;#8230; &lt;span class="caps"&gt;ZOMBIE&lt;/span&gt; &lt;span class="caps"&gt;TABS&lt;/span&gt;. Interestingly, this bug is fallout from a different bug I worked on. Read the bug for full details.&lt;/li&gt;
	&lt;li&gt;&lt;strong&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=525635"&gt;Bug 525635&lt;/a&gt; &amp;amp; &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=521233"&gt;Bug 521233&lt;/a&gt;:&lt;/strong&gt; Both of these are needed to get Per Tab Network Prioritization into Firefox 3.6. Bug 525635 was about the test that was randomly timing out on Linux. It&amp;#8217;s using the test framework added in bug 521233 (waitforFocus in browser-chrome tests), which obviously is not quite right. &lt;a href="http://design-noir.de/log"&gt;Dão&lt;/a&gt; is continuing to try to find the right fix, but until then, I&amp;#8217;ve worked around the issue in a better way than I was. This should make it OK to land everything needed on branch.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What&amp;#8217;s happening this week:&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;Finish bug 522545. Blockers come first. I already have a large portion of the work done &amp;amp; have a good start on tests, so this shouldn&amp;#8217;t be too much work.&lt;/li&gt;
	&lt;li&gt;Land Per Tab Network Prioritization on branch. Not too much involved here, but it has to happen.&lt;/li&gt;
	&lt;li&gt;Work on &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=526545"&gt;bug 526545&lt;/a&gt; (Crash reporter still can send wrong &lt;span class="caps"&gt;URL&lt;/span&gt; when crashing during pageload). This is another blocker. The partial solution should be pretty easy and actually dovetails nicely with the work I&amp;#8217;m doing for bug 522545. The full solution might be a bit harder, and might not be worth it.&lt;/li&gt;
&lt;/ul&gt;</content>
  </entry>



  <entry>
    <title type="html">Per Tab Network Prioritization Update</title>
    <link href="http://zpao.com/posts/per-tab-network-prioritization-update" />
    <updated>2009-10-30T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/per-tab-network-prioritization-update</id>
    <content type="html">&lt;p&gt;Progress on this was not as fast as I&amp;#8217;d hoped it would be. It got stalled behind some other work, going to the &lt;span class="caps"&gt;CMU&lt;/span&gt; job fair, &lt;a href="http://twitter.com/zpao/status/5076044119"&gt;I was poisoned&lt;/a&gt;, and I had to figure out how the focus tests work. But that&amp;#8217;s enough with the negativity, this is supposed to be good news.&lt;/p&gt;
&lt;p&gt;I finally got all my ducks in row and &lt;a href="http://hg.mozilla.org/mozilla-central/rev/bbeaa4e518ee"&gt;landed the feature today&lt;/a&gt;! If you don&amp;#8217;t remember what the feature does (or never knew), read through &lt;a href="/posts/per-tab-network-prioritization/"&gt;my original article on it&lt;/a&gt;. While the underlying implementation changed a fair amount, the basic concept is still the same. The only change made is that we adjust the priority instead of just changing it to pre-determined values. By doing it this way, we won&amp;#8217;t interfere with an add-on that, for example, gave Gmail a super high network priority.&lt;/p&gt;
&lt;p&gt;We&amp;#8217;ve talked about getting this into Firefox 3.6. It&amp;#8217;ll need to &amp;#8220;bake&amp;#8221; a little while on trunk, but it landed cleanly and doesn&amp;#8217;t have any compatibility issues, so it should be ok. Then again, &lt;acronym title="I Am Not A Driver"&gt;&lt;span class="caps"&gt;IANAD&lt;/span&gt;&lt;/acronym&gt;.&lt;/p&gt;
&lt;p&gt;Going along with this, I&amp;#8217;ve updated the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/14138"&gt;mozNetworkPrioritizer extension&lt;/a&gt; to reflect the change in compatibility. It should no longer be used with Firefox 3.7a1pre (and beyond). It will interact poorly with the built-in functionality and could lead to some weird priorities. It won&amp;#8217;t actually break anything, but there&amp;#8217;s no need to use it. I&amp;#8217;ll release another update if/when this goes into Firefox 3.6.&lt;/p&gt;
&lt;p&gt;And that&amp;#8217;s it. I&amp;#8217;ll post again about future landings. Otherwise, I&amp;#8217;m going to be working on some session restore blockers and starting another project soon.&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Status Update: September 25, 2009</title>
    <link href="http://zpao.com/posts/status-update-sept-25-2009" />
    <updated>2009-09-27T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/status-update-sept-25-2009</id>
    <content type="html">&lt;p&gt;I haven&amp;#8217;t updated on the blog recently, so here&amp;#8217;s the past 3 weeks all at once.&lt;/p&gt;
&lt;p&gt;The week of September 7, I was working on a &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=514751"&gt;couple&lt;/a&gt; &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=497730"&gt;blockers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The week of September 14, I was in Pittsburgh recruiting at the Carnegie Mellon &lt;acronym title="Technical Opportunities Conference"&gt;&lt;span class="caps"&gt;TOC&lt;/span&gt;&lt;/acronym&gt; (job fair). I also did some work on Per Tab Network Prioritization (&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=514490"&gt;bug 514490&lt;/a&gt;) and a password manager performance bug (&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=492197"&gt;bug 492197&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;This past week I worked on a few different things. I finished the password manager bug (which I hadn&amp;#8217;t finished because of a non-syntax-error-syntax-error). While helping &lt;a href="http://www.hskupin.info/"&gt;Henrik&lt;/a&gt; as he was using the storage &lt;span class="caps"&gt;API&lt;/span&gt;, &lt;a href="http://shawnwilsher.com/"&gt;Shawn&lt;/a&gt; mentioned that one of the methods I used was deprecated (though never explicitly). So I filed &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=518434"&gt;the bugs&lt;/a&gt; and &lt;a href="http://hg.mozilla.org/mozilla-central/pushloghtml?changeset=5e6a413226d2"&gt;fixed the places&lt;/a&gt; that used the deprecated code (hint: use &lt;code&gt;executeStep()&lt;/code&gt; instead of &lt;code&gt;step()&lt;/code&gt; and don&amp;#8217;t use &lt;code&gt;mozIStorageStatementWrapper&lt;/code&gt;). Filing the bugs took longer than fixing them.&lt;/p&gt;
&lt;p&gt;But all of that was unrelated to &amp;#8230;&lt;/p&gt;
&lt;h2&gt;Per Tab Network Prioritization Status&lt;/h2&gt;
&lt;h3&gt;Progress&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;Made it a JS module. This was advice from &lt;a href="http://autonome.wordpress.com/"&gt;Dietrich&lt;/a&gt; to cut down on overhead. Since it was only being used from JS code, there was no need to use &lt;span class="caps"&gt;XPCOM&lt;/span&gt;.&lt;/li&gt;
	&lt;li&gt;Made it pref enabled. Right now it&amp;#8217;s &lt;code&gt;browser.networkprioritizer.enabled&lt;/code&gt; but that&amp;#8217;s easy to change.&lt;/li&gt;
	&lt;li&gt;Got a first pass look from Shawn, fixed a few things up.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Next Steps&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;Reviews. It seems like Boris is the guy for the job. Still need a browser person. Gavin said sometime after Fennec stuff, Connor said 2 weeks. Dolske said &amp;#8220;soon&amp;#8221;, so he&amp;#8217;ll probably be the lucky guy, even if he isn&amp;#8217;t a peer.&lt;/li&gt;
&lt;/ul&gt;</content>
  </entry>



  <entry>
    <title type="html">Per Tab Network Prioritization</title>
    <link href="http://zpao.com/posts/per-tab-network-prioritization" />
    <updated>2009-09-04T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/per-tab-network-prioritization</id>
    <content type="html">&lt;p&gt;&lt;strong&gt;First!&lt;/strong&gt; (before you get distracted) &lt;a href="https://build.mozilla.org/tryserver-builds/poshannessy@mozilla.com-try-11a9e78a8cb5/"&gt;Try server builds!&lt;/a&gt; and &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/14138/"&gt;the extension!&lt;/a&gt; (Firefox 3.5+)&lt;/p&gt;
&lt;h2&gt;The Idea In Summary&lt;/h2&gt;
&lt;p&gt;An idea that&amp;#8217;s likely been tossed around before has been brought to the forefront more recently by Firefox&amp;#8217;s newest designer &lt;a href="http://limi.net/"&gt;Alexander Limi&lt;/a&gt;, the idea of &lt;a href="https://wiki.mozilla.org/Firefox/Projects/Per_Tab_Network_Prioritization"&gt;per tab network prioritization&lt;/a&gt;. The premise of the idea is that what you&amp;#8217;re doing right now is more important that what you were doing 5 minutes ago. So to account for the relative importance, we should make what you&amp;#8217;re looking at right now load faster. This is really part of a grander scheme to improve perceived performance, but has been reduced to try to make some improvement achievable for Firefox 3.6.&lt;/p&gt;
&lt;h2&gt;In More Detail&lt;/h2&gt;
&lt;p&gt;For this pass, we divided tabs into level of importance (shown in descending order):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Selected Tab in a Focused Window&lt;/li&gt;
	&lt;li&gt;Background Tab in a Focused Window &amp;amp; Selected Tab in a Background Window&lt;/li&gt;
	&lt;li&gt;Background Tab in a Background Window&lt;/li&gt;
	&lt;li&gt;Any Tab in a Minimized Window&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the most part that makes sense, except for maybe one thing: the 2^nd^ level of importance has 2 items. We decided that (at least in general terms) background tabs in your current window and the focused tab in a background window should get the same level of network priority.&lt;/p&gt;
&lt;p&gt;I then used this ranking to assign relative priorities. You can read more in the implementation section, but otherwise you can skip down to the progress report.&lt;/p&gt;
&lt;h2&gt;Implementation&lt;/h2&gt;
&lt;p&gt;My original plan was to do this all in browser/base/content (browser.js, tabbrowser.xml), but I ran into a roadblock of some sort. So I wrote it as an extension. After fixing an observer topic, I could do this with relative ease. I set my JS up much like the SessionStore component, observed a number of topics, and listened for a number of events. I was using an observer topic (xul-window-visible) which I was told I shouldn&amp;#8217;t use. When a tab was selected it&amp;#8217;s network priority gets bumped up and the previously selected tab gets dropped down. Same concept for windows.&lt;/p&gt;
&lt;p&gt;I had to &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=511503"&gt;create some new events&lt;/a&gt; so that I could accurately know which window was focused. Then I brought it into our actual tree instead of living externally as an extension. I cleaned it up a bit, made sure I wasn&amp;#8217;t doing to too much, and then finally got around to &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=514490"&gt;filing the bug&lt;/a&gt;. I would go into further detail, but it&amp;#8217;s not super interesting. However, if you are interested, &lt;a href="https://bugzilla.mozilla.org/attachment.cgi?id=398441&amp;amp;action=diff#a/browser/components/networkprioritizer/src/nsNetworkPrioritizer.js_sec1"&gt;take a look at the code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;While there are some implementation details to improve upon (or just straight up change), it&amp;#8217;s doing what it was supposed to be doing. At this point I could move this back into browser/base/content but since it&amp;#8217;s working, there&amp;#8217;s no value in it (until we decide the project is a final go).&lt;/p&gt;
&lt;h2&gt;Progress Report&lt;/h2&gt;
&lt;p&gt;Initial results showed some improvement when loading large groups of tabs. It was most noticeable when loading many tabs from the same site (e.g. the default &lt;span class="caps"&gt;BBC&lt;/span&gt; livemarks). It was somewhat noticeable during a typical (for me) session restore. There was no difference during normal browsing.&lt;/p&gt;
&lt;p&gt;But I&amp;#8217;m just one person. I know this is all the way at the bottom of this article, but &lt;strong&gt;&lt;span class="caps"&gt;PLEASE&lt;/span&gt; &lt;span class="caps"&gt;PLEASE&lt;/span&gt; &lt;span class="caps"&gt;PLEASE&lt;/span&gt; use &lt;a href="https://build.mozilla.org/tryserver-builds/poshannessy@mozilla.com-try-11a9e78a8cb5/"&gt;a try server build&lt;/a&gt;&lt;/strong&gt; (or &lt;strong&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/14138/"&gt;the extension&lt;/a&gt;&lt;/strong&gt;) for a little bit and see if there&amp;#8217;s any noticeable difference. Even if it&amp;#8217;s just to load up that 500 tab session you&amp;#8217;ve been building up over the years.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Next Steps:&lt;/strong&gt; Get Feedback! If people use it and the results are positive, this will get more attention (tests, better implementation, checked in). If it turns out that we didn&amp;#8217;t quite achieve what we were hoping, then this will get shelved or used as part of another project.&lt;/p&gt;
&lt;p&gt;So again: &lt;strong&gt;&lt;a href="https://build.mozilla.org/tryserver-builds/poshannessy@mozilla.com-try-11a9e78a8cb5/"&gt;try server builds&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/14138/"&gt;the extension&lt;/a&gt;&lt;/strong&gt;!&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Updated September 4^th^ with links to the extension&lt;/em&gt;&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Oops, I Broke That</title>
    <link href="http://zpao.com/posts/oops-i-broke-that" />
    <updated>2009-08-28T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/oops-i-broke-that</id>
    <content type="html">&lt;p&gt;While making the &amp;#8220;Set as Desktop Background&amp;#8221; feature work on Windows CE, &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512524"&gt;I accidentally broke it on other Windows systems&lt;/a&gt;. &lt;span class="caps"&gt;OOOOOPS&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;This went unnoticed for ~3 weeks on the nightlies! It was even in Firefox 3.6 alpha 1. The fix was easy and was checked into trunk today. It&amp;#8217;ll be checked into the Firefox 3.6 branch soon.&lt;/p&gt;
&lt;p&gt;I don&amp;#8217;t think mistakes like that are too uncommon, especially in areas where testing isn&amp;#8217;t automated. We probably have &lt;a href="https://litmus.mozilla.org/"&gt;Litmus tests&lt;/a&gt; for this so it would have been caught before a final release anyway, but still&amp;#8230;&lt;/p&gt;
&lt;p&gt;This just goes to show how important testing is! (And yes, I &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513349"&gt;filed a bug&lt;/a&gt; to add tests here)&lt;/p&gt;
&lt;p&gt;This also goes to show just how little people use that feature :)&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Better Session Restore Behavior</title>
    <link href="http://zpao.com/posts/better-session-restore-behavior" />
    <updated>2009-08-06T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/better-session-restore-behavior</id>
    <content type="html">&lt;p&gt;Last week &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=354894"&gt;bug 354894&lt;/a&gt; &lt;a href="http://hg.mozilla.org/mozilla-central/rev/cd25ab8c2f30"&gt;landed&lt;/a&gt; to, surprisingly, little fanfare. It&amp;#8217;s a big deal though (more so on Windows &amp;amp; Linux).&lt;/p&gt;
&lt;p&gt;Ever since Firefox introduced Session Restore, there has been one particularly annoying problem: if you close your last browser window but accidentally left a non-browser window open (eg. Downloads), then your session was fucked. End of story.&lt;/p&gt;
&lt;p&gt;Well, no longer. Nils Maier (co-author of &lt;a href="http://www.downthemall.net/"&gt;DownThemAll&lt;/a&gt;) finally got fed up with this problem &amp;amp; decided to do something about it. This is the first &amp;#8220;major&amp;#8221; piece of code he&amp;#8217;s contributed, so a round of applause.&lt;/p&gt;
&lt;p&gt;A super quick summary of the changes (assuming you have enabled session restore):&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;If you leave a non-browser window open, just close it. Your session will be saved (assuming you aren&amp;#8217;t on OS X anyway).&lt;/li&gt;
	&lt;li&gt;If you&amp;#8217;ve gotten down to that last non-browser window &amp;amp; realized your mistake, opening Firefox again (e.g. from the start menu) reopens your last closed window.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As a tangential comment, it&amp;#8217;s things like this that really make me proud to be a part of the Mozilla community. So much of our browser &amp;amp; platform comes from people like Nils who give their time freely to help make the web a better place.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Minor changes based on email with Nils.&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Undo Close Window Has Landed!</title>
    <link href="http://zpao.com/posts/undo-close-window-has-landed" />
    <updated>2009-04-24T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/undo-close-window-has-landed</id>
    <content type="html">&lt;p&gt;I&amp;#8217;m happy to announce the landing of &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=394759"&gt;Undo Close Window&lt;/a&gt;. This adds a menu &amp;amp; keyboard shortcut for reopening your previously closed windows. By default we store 3 windows (though sometimes more due to special cases involving pop-up windows). I&amp;#8217;m not going to go into further implementation details (because really, I know you don&amp;#8217;t care), but if you&amp;#8217;re interested, you can take a look at the patches on the bug.&lt;/p&gt;
&lt;h2&gt;A Little History&lt;/h2&gt;
&lt;p&gt;Sometime before Firefox 2, there were APIs in place for handling recently closed windows. The only thing missing at that point was the front-end work to tie it together. But that never happened. Instead, since the code wasn&amp;#8217;t even being published for extensions to use, all that was happening is that we were eating memory for no good reason. So the &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=344642"&gt;code was taken out&lt;/a&gt; late in the 2.0 development cycle.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=360408"&gt;Bug 360408&lt;/a&gt; was added for Firefox 3, making it possible for extensions to be able to implement their own Undo Close Window if they wanted. The description of that bug was unclear though, since it didn&amp;#8217;t actually adding any APIs, it just made sure the data was kept around long enough to be saved by somebody else.&lt;/p&gt;
&lt;p&gt;Along comes &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=394759"&gt;Bug 394759 &amp;#8211; Add undo close window feature&lt;/a&gt;, which sat untouched for almost a year. After I finished the &lt;a href="/posts/passwordmgr-storage"&gt;primary project I worked on during my internship&lt;/a&gt;, I still had a week left, so I looked for bugs that I found interesting and allowed me to explore a new area of the code. I found this bug and wrote a &amp;#8220;working&amp;#8221; patch over a weekend. At that point I was really surprised that we didn&amp;#8217;t have this already. We&amp;#8217;ve had Undo Close Tab for a while, and this seemed like the sensible next step. In all honesty, somebody familiar with the code involved here could have written that patch in an hour or two. That&amp;#8217;s when I found out that I had essentially reimplemented the code that had been taken out and added the front-end to it.&lt;/p&gt;
&lt;p&gt;I worked on it a bit more before I was done interning, then went back to school and time to work on this became increasingly rare. I dropped the ball a bit, and then suddenly we were at string freeze, and this wasn&amp;#8217;t done. Fast forward a few months; I graduated &amp;amp; started working for Mozilla full time. I found out we were still going to have another string freeze for beta 4, so I got my patch out of bitrot and continued working on it. It needed more work and testing by then due to Private Browsing and a few other changes that were made. Strings went in right before we froze them &amp;amp; the actual patch went in very last minute, and only because code freeze had slipped for other reasons.&lt;/p&gt;
&lt;p&gt;A huge thanks to Simon for all the reviewing he did and help he gave me, &lt;a href="http://autonome.wordpress.com/"&gt;Dietrich&lt;/a&gt; for the heroic &amp;#8220;today is code freeze&amp;#8221; review and help, &lt;a href="http://en.design-noir.de/"&gt;Dão&lt;/a&gt; for fixing the problems that popped up as this had a rocky landing (there was no time to bake on trunk), and &lt;a href="http://beltzner.ca/mike/"&gt;Beltzner&lt;/a&gt; for approving this without the normal bake time.&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Changing Tab Load Order</title>
    <link href="http://zpao.com/posts/changing-tab-load-order" />
    <updated>2009-04-01T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/changing-tab-load-order</id>
    <content type="html">&lt;p&gt;During the Firefox work week last month, somebody had the idea of loading visible tabs first. It&amp;#8217;s one of those things that just make sense. Since I had done some work in the SessionStore component before, I volunteered to head up this task.&lt;/p&gt;
&lt;h2&gt;What does it do exactly?&lt;/h2&gt;
&lt;p&gt;When you open Firefox using session restore (and through some other paths), you often load several tabs. I know I&amp;#8217;ve personally restored windows with 50+ open tabs. It takes a lot of time to load 50 tabs. One optimization that was done previously was to (roughly speaking) prioritize the selected tab, so that it would in theory load first. This change make it so that the tabs visible in your tab strip are also prioritized.&lt;/p&gt;
&lt;h2&gt;How does it work?&lt;/h2&gt;
&lt;p&gt;When we were doing this for just the selected tab, it was extremely simple &amp;#8211; we just reordered the array of tab data so that the selected one was first. Now we prioritize a set of tabs (keeping the selected tab first). &lt;em&gt;That&amp;#8217;s it.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To be clear&lt;/strong&gt;, this does not &lt;em&gt;actually&lt;/em&gt; improve performance. All it does is make the browser feel faster. But hey, isn&amp;#8217;t that just as almost as important.&lt;/p&gt;
&lt;p&gt;Go ahead and try it out. It&amp;#8217;s been in Minefield (mozilla-central) for over a week and landed in Shiretoko (mozilla-1.9.1) yesterday.&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Is The Tree Green? For Your Desktop</title>
    <link href="http://zpao.com/posts/is-the-tree-green-for-your-desktop" />
    <updated>2009-03-24T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/is-the-tree-green-for-your-desktop</id>
    <content type="html">&lt;p&gt;&lt;a href="http://projects.tynsoe.org/geektool/"&gt;GeekTool&lt;/a&gt; is awesome. &lt;a href="http://isthetreegreen.com"&gt;Is the Tree Green?&lt;/a&gt; is awesome. So together they are &lt;span class="caps"&gt;SUPER&lt;/span&gt; &lt;span class="caps"&gt;AWESOME&lt;/span&gt;!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/zpao/3382045487/"&gt;&lt;img src="http://farm4.static.flickr.com/3588/3382045487_01114ff567.jpg" title="isthetreegreen.py + GeekTool by zpao, on Flickr" alt="isthetreegreen.py + GeekTool by zpao, on Flickr" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Python?&lt;/h2&gt;
&lt;p&gt;Historically, I&amp;#8217;m a Ruby guy, but I started learning Python for a Django project I&amp;#8217;m (barely) working on. So I picked up a book here at work &amp;amp; decided to flex my pythons a little bit. You can laugh, it&amp;#8217;s punny.&lt;/p&gt;
&lt;p&gt;The first pass of this took me ~20 minutes, and I just tidied it up this morning so it would take command line options.&lt;/p&gt;
&lt;h2&gt;How?&lt;/h2&gt;
&lt;p&gt;If you&amp;#8217;re reading this and actually need to know whether or not the tree is green, then you should be able to figure it out. GeekTool is OS X only, but there are similar programs for Windows and Linux.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s easy enough to do what I did in the image above. The program can take 2 arguments &lt;code&gt;treename&lt;/code&gt; and &lt;code&gt;output&lt;/code&gt;. Run it with &lt;code&gt;-h&lt;/code&gt; for usage.&lt;/p&gt;
&lt;h2&gt;Code?&lt;/h2&gt;
&lt;script src="http://gist.github.com/84210.js"&gt;&lt;/script&gt;&lt;p&gt;A big thanks to Justin Dolske for &lt;a href="http://isthetreegreen.com"&gt;Is the Tree Green?&lt;/a&gt;. He deserves more credit for this than I.&lt;/p&gt;</content>
  </entry>





  <entry>
    <title type="html">Here I Am, Back Again</title>
    <link href="http://zpao.com/posts/here-i-am-back-again" />
    <updated>2009-03-10T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/here-i-am-back-again</id>
    <content type="html">&lt;p&gt;I&amp;#8217;m now into my third week here at Mozilla, working on Firefox. It&amp;#8217;s been a tiring 2 weeks so far, but I&amp;#8217;ve enjoyed every second.&lt;/p&gt;
&lt;p&gt;For those of you who don&amp;#8217;t know, I was an intern on the Firefox team last summer. I primarily worked on the password manager and a performance analysis tool. I was offered a full-time position soon after the summer ended, and while I did some looking around, I realized that I wanted to be at Mozilla. I loved the company, the people, and the work I would do &amp;#8212; so overall it was right for me.&lt;/p&gt;
&lt;p&gt;After an extended winter break, I flew out here with Amanda on February 17^th^, a Tuesday. Amanda had been looking at apartment stuff like a fiend, and while I helped, she found a bunch of great places for us to see and did the real work with that. So we spent Wednesday &amp;amp; Thursday looking at ~20 apartments. CitiApartments may (apparently) be the spawn of Satan when it comes to housing in SF, but Hilary was an incredibly helpful agent, if perhaps a little unconventional. It turns out that the apartment we really wanted was the first one we saw on Wednesday morning. Friday was spent making sure our application went through, and jumping through hoops to get my money from my bank in Pennsylvania in order to get certified checks. It all worked out; we signed our lease on Saturday and moved in Monday/Tuesday. We&amp;#8217;re working on making the place a bit more homey, but it&amp;#8217;s coming along and hopefully we&amp;#8217;ll have a little housewarming when there are places for people to sit.&lt;/p&gt;
&lt;h2&gt;Back to Work&lt;/h2&gt;
&lt;p&gt;I joined the team as we&amp;#8217;re wrapping up Firefox &lt;del&gt;3.1&lt;/del&gt; 3.5, and since I&amp;#8217;m already relatively familiar with the code base, I got to start working on fixing blockers &amp;amp; participating in &lt;a href="https://wiki.mozilla.org/Firefox3.1/Sprints"&gt;sprints&lt;/a&gt;. My first week was also a Firefox &amp;#8220;work week,&amp;#8221; where the Firefox team physically gets together (we&amp;#8217;re spread out around the world), and gets stuff done face-to-face. We came up with a bunch of good ideas for what we want to be and how to make people excited about Firefox &amp;#8212; that&amp;#8217;s where our sprints came from.&lt;/p&gt;
&lt;p&gt;I look forward to working with everybody here and meeting those of you who I haven&amp;#8217;t met yet. Remember, I&amp;#8217;m not an intern this time around :)&lt;/p&gt;</content>
  </entry>









  <entry>
    <title type="html">Making the New Password Manager Storage Faster</title>
    <link href="http://zpao.com/posts/passowrdmgr-storage-faster" />
    <updated>2008-08-28T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/passowrdmgr-storage-faster</id>
    <content type="html">&lt;p&gt;When I first wrote the new storage module for the Password Manager, I took a few &amp;#8220;shortcuts,&amp;#8221; trying to keep my code &lt;span class="caps"&gt;DRY&lt;/span&gt;. Partially this was because of the first patch by Mrinal Kant, but mostly it was because I like to reuse code. This bit us just a bit.&lt;/p&gt;
&lt;p&gt;I mentioned in my &lt;a href="/posts/passwordmgr-storage"&gt;first post about this change&lt;/a&gt; that we were initially considerably slower in the critical &lt;code&gt;countLogins&lt;/code&gt; method. While it got improved before being checked in, it was still marginally slower (milliseconds on an abnormally large dataset).&lt;/p&gt;
&lt;p&gt;As I said before, this was most likely since we were doing a &lt;code&gt;SELECT *&lt;/code&gt; on the &lt;code&gt;moz_logins&lt;/code&gt; table, and looping over the results and counting. This allowed me to reuse more code. Loops are a kind of slow, and since this was so important, I decided to speed it up.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=451479"&gt;I filed a bug&lt;/a&gt; just over a week ago entitled &amp;#8220;storage-mozStorage should use &lt;span class="caps"&gt;COUNT&lt;/span&gt; in countLogins&amp;#8221; &amp;#8211; which pretty much explains what the solution to the above problem. I created a patch which essentially just switched the mosStorage module to use &lt;code&gt;SELECT COUNT(1)&lt;/code&gt;. I reran the performance tests I created and we&amp;#8217;re doing much better now. There&amp;#8217;s still a miniscule loss in speed from the legacy storage module, but at this point, we&amp;#8217;ve done all that we can, and where the difference was milliseconds, its closer to millisecond.&lt;/p&gt;
&lt;p&gt;This was &lt;a href="http://hg.mozilla.org/mozilla-central/rev/ce557eb9ef4a"&gt;checked in&lt;/a&gt; today (thanks Justin!).&lt;/p&gt;
&lt;p&gt;And that&amp;#8217;s it. I have another patch in the pipeline and hopefully I&amp;#8217;ll have time to get it finished, approved, and reviewed for the freeze (whenever that is now).&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Password Manager now uses mozStorage</title>
    <link href="http://zpao.com/posts/passwordmgr-storage" />
    <updated>2008-08-18T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/passwordmgr-storage</id>
    <content type="html">&lt;p&gt;The other day &lt;a href="http://hg.mozilla.org//mozilla-central/index.cgi/rev/c2f416981fa3"&gt;my patch landed&lt;/a&gt; switching the Password Manager to use &lt;a href="http://developer.mozilla.org/en/docs/Storage"&gt;mozStorage&lt;/a&gt; (our wrapper around SQLite).  &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=288040"&gt;The bug&lt;/a&gt; had been up on Bugzilla for a long time, over 3 years, when I came across it at the end of June. I had been doing some Password Manager related work already by that point, so I decided I would do it. This is the story of that bug: the process, the hardships, the code (at least a bit). Keep in mind I was also doing work on my &lt;a href="/posts/dtrace-treemaps-part-1"&gt;DTrace Treemaps&lt;/a&gt; at the time, went to Summit, and encountered more edge cases than I wanted, so this took longer than expected.&lt;/p&gt;
&lt;h2&gt;Quick Features &amp;amp; Change Summary&lt;/h2&gt;
&lt;p&gt;Some of this is discussed further down, so bear with me. One of the primary differences in the switch to using mozStorage is that we now store data in a database. Previously we were storing data in a text file, using lines and periods to separate data fields. Open &lt;code&gt;signons3.txt&lt;/code&gt; in your &lt;a href="http://support.mozilla.com/en-US/kb/Profiles"&gt;profile directory&lt;/a&gt; and take a look at it (assuming you&amp;#8217;ve saved a password before). All information was kept in memory, and when a new password was saved, the whole file would need to be rewritten. The same thing happened if you ever removed a saved password. Using a database means that we don&amp;#8217;t have to keep any (potentially) sensitive information in memory. It also means faster reading and writing since we don&amp;#8217;t have to read the whole file every time. These speed boosts are apparent especially in the speed tests, attached to the bug and summarized below.&lt;/p&gt;
&lt;p&gt;Since this is really just a drop in change that must implement an &lt;span class="caps"&gt;API&lt;/span&gt;, to the outside world nothing has changed. Although the inner workings are different, it&amp;#8217;s the same to anybody who happens to use it (extensions or other parts of Firefox).&lt;/p&gt;
&lt;h2&gt;v0.1 &amp;#8211; The beginning&lt;/h2&gt;
&lt;p&gt;I began work by really taking a look at the &lt;a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/src/storage-Legacy.js"&gt;legacy storage module&lt;/a&gt; to make sure I knew what was supposed to be happening. Then I looked at the initial attempts by other developers. The first attempts were made before Password Manager got rewritten, so those weren&amp;#8217;t relevant. Mrinal Kant came in (over 2 years after the first patches) and wrote what I used as the basis for my code. I don&amp;#8217;t think I ran it as it was, but it looked functional, at least at the core.&lt;/p&gt;
&lt;p&gt;I actually started by just copying the legacy storage file, removing all of the code from methods that would need to be changed, and started fresh. I copied in some code from Mrinal&amp;#8217;s work and used some of the conventions, but the bulk of it was rewritten. I opted to use the wrapper we have for Storage, which makes it easy to do parameter replacement. This also automatically binds the parameters to a type &amp;#8211; so when you give it a string, it will ensure it&amp;#8217;s treated as a string. It&amp;#8217;s very handy.&lt;/p&gt;
&lt;p&gt;This first version &amp;#8220;worked&amp;#8221; (at least as far as I remember), though it definitely had problems. I brought it up at our &lt;a href="http://wiki.mozilla.org/Firefox3.1/StatusMeetings/"&gt;weekly status meeting&lt;/a&gt; and it became one of the &amp;#8220;nice to have&amp;#8221; features for 3.1. That gave it some attention it needed and I got some quick feedback from &lt;a href="http://shawnwilsher.com"&gt;Shawn&lt;/a&gt; and &lt;a href="http://blog.mozilla.com/dolske/"&gt;Justin&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;v0.2 &amp;#8211; Database details&lt;/h2&gt;
&lt;p&gt;One of the primary changes here was some of the database stuff. Shawn had pointed out that I needed a way to version the database. All I had was a method to create the tables. In order to future-proof this, I needed to make sure the schema was stored somewhere and there was a procedure for migrating the database.&lt;/p&gt;
&lt;p&gt;I took a look at &lt;a href="http://mxr.mozilla.org/mozilla-central/source/toolkit/components/contentprefs/src/nsContentPrefService.js"&gt;nsContentPrefService&lt;/a&gt; (which stores your preferences for specific sites, like remembering zoom settings) since that was another component using storage and written in JavaScript. I &amp;#8220;hijacked&amp;#8221; the code related to the database stuff, and modified it a bit to fit my needs.&lt;/p&gt;
&lt;p&gt;The other major change here was to replace &lt;code&gt;var&lt;/code&gt; with &lt;code&gt;let&lt;/code&gt; &amp;#8211; &amp;#8220;&lt;code&gt;let is the new var&lt;/code&gt;&amp;#8221; as my shirt says. A number of other changes were also made &amp;#8211; cleaning up queries, hard-coding the table names, and making sure I was using statements correctly.&lt;/p&gt;
&lt;h2&gt;v0.3, v0.4 &amp;#8211; Cleanup &amp;amp; Optimization&lt;/h2&gt;
&lt;p&gt;These versions were pretty light &amp;#8211; mostly involving cleanup. &lt;code&gt;modifyLogin&lt;/code&gt; and the process involved got improved. I also reduced the number of queries we were making by hand and so all &lt;code&gt;SELECT&lt;/code&gt;s were done from just 2 places (one for each table).&lt;/p&gt;
&lt;h2&gt;v0.5 &amp;#8211; Importing&lt;/h2&gt;
&lt;p&gt;v0.5 focused on importing from the legacy module. The basics were in the original code Mrinal wrote, but all of the edge cases were difficult to handle. The one case that caused a lot of problems were the &amp;#8220;user has a master password, but presses cancel when we import&amp;#8221;. We needed to handle that gracefully, and Justin and I decided the best way was to introduce a &lt;code&gt;_deferredInit&lt;/code&gt; method, which did the bulk of the initialization work. At the beginning of each public method, we then check the initialization state and try to import again. It can get annoying, but everything about the master password is annoying.&lt;/p&gt;
&lt;p&gt;This also resulted in a couple bugs being spun off to help us with importing: &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=449810"&gt;one bug&lt;/a&gt; was just a few lines added to the legacy module and the password manager UI to handle an additional error, and &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=449095"&gt;the other&lt;/a&gt; was just to ensure the legacy module didn&amp;#8217;t create an empty file if it was never used.&lt;/p&gt;
&lt;h2&gt;v0.6 &amp;#8211; Tests&lt;/h2&gt;
&lt;p&gt;I finally got to writing the tests, which involved a lot of copy &amp;amp; paste from the legacy tests, then making small modifications. It&amp;#8217;s not the most efficient way, but it works ok. Since the mozStorage module works slightly differently, the code duplication is a necessity for now. In theory they can be cleaned up, but that&amp;#8217;ll be a task for the next intern :)&lt;/p&gt;
&lt;p&gt;At this point I thought I was pretty much done, and I was. There were still a few problems though, and also not quite enough test coverage.&lt;/p&gt;
&lt;h2&gt;v0.7, v0.8 &amp;#8211; Cleanup, Tests, Corrupt Databases&lt;/h2&gt;
&lt;p&gt;v0.7 involved a lot of cleanup and adding tests. v0.8 was an important milestone in that I finally added the handling of a corrupt database. Before this point, if we encountered a corrupt database, we would fail and then as with a failed import, just try again and again. This was bad, really bad. So a &amp;#8220;thank you&amp;#8221; to Shawn for catching that. Now we backup the corrupt database and just create a new one. It should be difficult to get a corrupt database, but just in case (and to cover the case when people think they know what they&amp;#8217;re doing, but don&amp;#8217;t).&lt;/p&gt;
&lt;h2&gt;v0.9, v1.0 &amp;#8211; Performance&lt;/h2&gt;
&lt;p&gt;In one of the recent status meetings, &lt;a href="http://shaver.off.net/diary/"&gt;Mike Shaver&lt;/a&gt; asked me about performance. At that point I hadn&amp;#8217;t really done much except throw it up on the try server. The try server gives decent ball park figures, but it&amp;#8217;s not perfect. So Justin worked on getting &lt;a href="http://wiki.mozilla.org/StandaloneTalos"&gt;Standalone Talos&lt;/a&gt; working while I wrote some &lt;span class="caps"&gt;XPC&lt;/span&gt; shell &amp;#8220;tests&amp;#8221;. I discovered that while we were generally faster &amp;#8211; faster init, faster add, faster remove &amp;#8211; we were considerably slower for &lt;code&gt;countLogin&lt;/code&gt;, which is a critical path, since it gets called on every page. Over 90% of the that time was actually spent initializing &lt;code&gt;nsLoginInfo&lt;/code&gt; objects (since I tried to reuse code). This got improved, though we are still a couple milliseconds slower. This could likely be improved a little bit since we are still doing a &lt;code&gt;SELECT&lt;/code&gt; and looping over the results. A little bit more work needs to be done that way, so making the query use &lt;code&gt;COUNT&lt;/code&gt; would cut that out. Maybe I&amp;#8217;ll write another patch to do that before Beta 1. For now though, we&amp;#8217;ll keep doing it how we&amp;#8217;re doing it.&lt;/p&gt;
&lt;h2&gt;And that&amp;#8217;s all&amp;#8230; almost&lt;/h2&gt;
&lt;p&gt;After this got checked in, the Windows boxes turned orange on Tinderbox. This was because of the tests (trying to delete files). Justin and I thought we had a quick fix, committed that. As I was packing to come home, I got pinged on &lt;span class="caps"&gt;IRC&lt;/span&gt; since the boxes were still orange and it was my fault. So the tests for my changeset got backed out and we switched back to the legacy module, but the code was still in there.&lt;/p&gt;
&lt;p&gt;On Sunday, my module &lt;a href="http://hg.mozilla.org/mozilla-central/index.cgi/rev/063c145b2a09"&gt;was re-enabled&lt;/a&gt; (thanks Justin!). There was &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=451040"&gt;another hiccup&lt;/a&gt; related to packages-static, but that was fixed as well. If you have any problems &lt;a href="https://bugzilla.mozilla.org/enter_bug.cgi?component=Password%20Manager&amp;amp;product=Toolkit"&gt;please report them on Bugzilla&lt;/a&gt;.&lt;/p&gt;</content>
  </entry>





  <entry>
    <title type="html">DTrace and Treemaps: Part 1</title>
    <link href="http://zpao.com/posts/dtrace-treemaps-part-1" />
    <updated>2008-07-24T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/dtrace-treemaps-part-1</id>
    <content type="html">&lt;p&gt;One of my goals for this summer at Mozilla was improving performance when Firefox starts. Admittedly, I&amp;#8217;ve done nothing of the sort. Instead I&amp;#8217;ve tackled this from a more general angle &amp;#8211; making a tool that uses DTrace and creates a treemap of the output. This serves as a way of analyzing performance in a very visual way. Before I go further, a little background.&lt;/p&gt;
&lt;h2&gt;DTrace&lt;/h2&gt;
&lt;p&gt;&amp;#8220;DTrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting system and application problems in real time.&amp;#8221;&lt;a href="#fn1"&gt;&lt;sup class="footnote" id="fnr1"&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/a&gt; It was originally in Solaris and OpenSolaris, but has since been ported to OS X and was &lt;a href="http://arstechnica.com/reviews/os/mac-os-x-10-5.ars/5#dtrace"&gt;included in Leopard&lt;/a&gt;. In a nutshell, it lets you take a look at the inner workings of applications and kernel activity, with a low overhead.  You can do everything from looking at file IO to time spent in functions to analyzing system call times. It&amp;#8217;s pretty powerful and I&amp;#8217;ve only just touched the surface of it.&lt;/p&gt;
&lt;p&gt;Developers at Mozilla have done a lot of work getting probes into Firefox so that we can take advantage of all DTrace has to offer. One of these places where probes have gone is into JavaScript execution. This opens up the doors to using DTrace to track what&amp;#8217;s happening in JavaScript, which is especially useful at Mozilla since a lot of our front-end code is JavaScript.&lt;/p&gt;
&lt;h2&gt;Treemaps&lt;/h2&gt;
&lt;p&gt;&amp;#8220;Treemapping is a method for displaying tree-structured data using nested rectangles.&amp;#8221;&lt;a href="#fn2"&gt;&lt;sup class="footnote" id="fnr2"&gt;&lt;a href="#fn2"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/a&gt; In other words, pretty damn cool. One of the coolest uses I&amp;#8217;ve seen recently is &lt;a href="http://marumushi.com/apps/newsmap/"&gt;newsmap&lt;/a&gt; &amp;#8211; which takes the news as aggregated by Google News, and builds a beautiful representation of what&amp;#8217;s &amp;#8220;hot&amp;#8221; in the news.&lt;/p&gt;
&lt;h2&gt;What I&amp;#8217;ve done&lt;/h2&gt;
&lt;p&gt;The work that I&amp;#8217;ve been doing so far is pretty simple. I&amp;#8217;ve taken the output of a single DTrace script (js_functime, &lt;a href="http://blogs.sun.com/brendan/entry/dtrace_meets_javascript"&gt;available on Brendan Gregg&amp;#8217;s blog&lt;/a&gt;) and used that to create a treemap. This DTrace script measures the time spent in Javascript functions. It&amp;#8217;s not the most accurate measurement since the output is the overlapping times, but it&amp;#8217;s still a good place to start. The output contains the number of times each function was called, the average time spent in the function, and the total time spent (across calls). From there I build these treemaps.&lt;/p&gt;
&lt;p&gt;I&amp;#8217;ve used a modified version of the &lt;a href="http://rubytreemap.rubyforge.org/"&gt;RubyTreemap&lt;/a&gt; gem to create &lt;acronym title="Scalable Vector Graphics"&gt;&lt;span class="caps"&gt;SVG&lt;/span&gt;&lt;/acronym&gt;s of this output. I create 3 different high-level maps, each representing the bits of information I get (count, average time, total time). Each of these maps is made from a tree 3 levels deep (though the root node is insignificant). The topmost level is the file from which the function is in. The second level is the function name. Size is determined from the measurement type (thus 3 maps). Each of these maps can then be broken down further, stepping into each individual file. So from these 3 &amp;#8220;index&amp;#8221; SVGs, I&amp;#8217;ve linked down into the second level, and a new &lt;span class="caps"&gt;SVG&lt;/span&gt; is generated for each file, making it a bit easier to read the smaller nodes. Colors are consistent between runs and based on an adapted hashing algorithm.&lt;/p&gt;
&lt;p&gt;I can&amp;#8217;t hand out the source yet since the original RubyTreemap is GPL&amp;#8217;ed and I&amp;#8217;m not ready to redistribute. The changes aren&amp;#8217;t huge, but are very focused for this task, so might not even be able to be merged back. Also, my code is pretty ugly right now and that would just lead to embarrassment.&lt;/p&gt;
&lt;p&gt;So without further ado, here&amp;#8217;s the page on playground: &lt;strong&gt;&lt;a href="http://playground.zpao.com/dtrace_treemaps/"&gt;DTrace Treemaps&lt;/a&gt;&lt;/strong&gt;. Keep in mind that this is not complete and what you see may very well change soon. Here are the direct links to the SVGs if you are a bit impatient: &lt;a href="http://playground.zpao.com/dtrace_treemaps/js_functime_count/index.svg"&gt;count&lt;/a&gt;, &lt;a href="http://playground.zpao.com/dtrace_treemaps/js_functime_avg/index.svg"&gt;average&lt;/a&gt;, &lt;a href="http://playground.zpao.com/dtrace_treemaps/js_functime_sum/index.svg"&gt;sum&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Future Directions&lt;/h2&gt;
&lt;p&gt;From here I plan on using the output from some of the scripts in the &lt;a href="http://opensolaris.org/os/community/dtrace/dtracetoolkit/"&gt;DTrace Toolkit&lt;/a&gt; to create other visuals, likely more treemaps. I also need to do a number of things to package this nicely so it&amp;#8217;s easy to adapt and use for different DTrace outputs. Last, but certainly not least, I need to make the code much better &amp;#8211; it&amp;#8217;s my own personal Frankenstein right now, and needs to suck less.&lt;/p&gt;
&lt;div class="footnotes"&gt;
&lt;p class="footnote" id="fn1"&gt;&lt;a href="#fnr1"&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/DTrace"&gt;Wikipedia DTrace article&lt;/a&gt;&lt;/p&gt;
&lt;p class="footnote" id="fn2"&gt;&lt;a href="#fnr2"&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Treemap"&gt;Wikipedia Treemapping article&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</content>
  </entry>



  <entry>
    <title type="html">On Open Source</title>
    <link href="http://zpao.com/posts/on-open-source" />
    <updated>2008-07-20T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/on-open-source</id>
    <content type="html">&lt;p&gt;Two weeks ago, while working on a project yet to be revealed (unless you happen to stalk me on &lt;a href="https://bugzilla.mozilla.org"&gt;Bugzilla&lt;/a&gt; &amp;#8211; I&amp;#8217;ll write about it soon, I promise), I happened to make Minefield seg fault.  I was talking to &lt;a href="http://shawnwilsher.com/"&gt;Shawn Wilsher&lt;/a&gt; about what I was working on, so he had some familiarity with the code, and told me it &lt;em&gt;shouldn&amp;#8217;t&lt;/em&gt; be crashing.  But it was.  Shawn told me to file a bug, create a test case, and get a stack trace with &lt;a href="http://sourceware.org/gdb/"&gt;&lt;span class="caps"&gt;GDB&lt;/span&gt;&lt;/a&gt;.  I was a bit annoyed because it took time away from what I was working on.  But I did all that, filed &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=444233"&gt;the bug&lt;/a&gt;, and went along my way.&lt;/p&gt;
&lt;p&gt;The other day, I got to work and found a few Bugzilla emails waiting.  Apparently somebody had written a patch for the bug, and it had been r+ed and checked in.  I figured somebody was looking at it, but a lot happened at once.  So I took a look at the &lt;a href="http://hg.mozilla.org/index.cgi/mozilla-central/rev/3c1f72eddf61"&gt;commit log&lt;/a&gt; and it turns out that the test case I had written had been included!  That makes perfect sense &amp;#8211; we want to keep the test around to make sure we don&amp;#8217;t regress in the future &amp;#8211; but it still surprised me.  I never came to Mozilla expecting to touch such a random place in the code base.  And while I wasn&amp;#8217;t fixing the C++ code, I was still contributing.  It felt good.&lt;/p&gt;
&lt;p&gt;I think &lt;em&gt;that&lt;/em&gt; is part of the power of open source.&lt;/p&gt;</content>
  </entry>





  <entry>
    <title type="html">Introducing LOLcanvas</title>
    <link href="http://zpao.com/posts/introducing-lolcanvas" />
    <updated>2008-06-26T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/introducing-lolcanvas</id>
    <content type="html">&lt;p&gt;Work has been going forward in (what will likely be) Firefox 3.1.  While there are definitely changes happening in the front-end, there are also a number of changes happening in the backend (&lt;span class="caps"&gt;AKA&lt;/span&gt; Gecko 1.9.1) as well.&lt;/p&gt;
&lt;p&gt;Gecko 1.9.1 is going to have even more improved CSS3 support, as &lt;a href="http://dbaron.org/log/20080603-new-selectors"&gt;David Baron writes about&lt;/a&gt;.  He&amp;#8217;s landed support for some additional &lt;span class="caps"&gt;CSS&lt;/span&gt; selectors.  Rob Arnold has recently done work on &lt;code&gt;border-image&lt;/code&gt;, and I know at least one other intern is working on some CSS3 stuff.&lt;/p&gt;
&lt;p&gt;More relevantly though, &lt;a href="http://www.ericbutler.net/blog/2008/06/html-canvas-in-firefox-31/"&gt;Eric Butler&lt;/a&gt; has done work on &lt;code&gt;canvas&lt;/code&gt; support. One thing that he&amp;#8217;s worked on is getting the &lt;code&gt;canvas&lt;/code&gt; element text drawing up to speed, and more up to spec. I had some free time so I worked on a little demo to show off the new stuff.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s called &lt;a href="http://playground.zpao.com/lolcanvas"&gt;LOLcanvas&lt;/a&gt; and uses &lt;code&gt;canvas&lt;/code&gt; to draw text on a flickr image, client side. This is similar to another project I worked on before &amp;#8211; &lt;a href="http://flolcatr.com"&gt;flolcatr&lt;/a&gt; &amp;#8211; however now it&amp;#8217;s all done right in the browser. Anyway, a picture is worth a thousand words, so here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/evapro/385650640/"&gt;&lt;img src="http://zpao.com/images/lioncat.png" title="omg surprize it&amp;#39;s Lion cat" alt="omg surprize it&amp;#39;s Lion cat" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The details are on the &lt;a href="http://playground.zpao.com/lolcanvas"&gt;LOLcanvas homepage&lt;/a&gt;, so give it a try and have fun.  If you have some additional phrases to add, let me know. I&amp;#8217;ll be throwing the readable source up somewhere soon so that you can see exactly what&amp;#8217;s happening.&lt;/p&gt;
&lt;p&gt;Original image is &lt;a href="http://creativecommons.org/licenses/by/2.0/deed.en"&gt;CC licensed&lt;/a&gt; and &lt;a href="http://www.flickr.com/photos/evapro/385650640/"&gt;available here&lt;/a&gt;.&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">It’s Awesome for a Reason</title>
    <link href="http://zpao.com/posts/its-awesome-for-a-reason" />
    <updated>2008-06-18T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/its-awesome-for-a-reason</id>
    <content type="html">&lt;p&gt;Firefox 3 came out yesterday to much fanfare and &lt;a href="http://www.spreadfirefox.com/en-US/worldrecord"&gt;a world record&lt;/a&gt;.  The world seems to like it, at least in general, though I have heard a bit of complaining.  One thing in particular: the &lt;a href="http://blog.mozilla.com/blog/2008/04/21/a-little-something-awesome-about-firefox-3/"&gt;Awesome Bar&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This has been the number one complaint I&amp;#8217;ve heard, and to be fair, I can&amp;#8217;t blame people.  When I first downloaded a beta (or maybe a nightly) back in January, I &lt;span class="caps"&gt;HATED&lt;/span&gt; the Awesome Bar.  I spent a couple hours with it and bitched to Rob (who was and still is an intern).  I just wanted URLs to be matched as they always had been, with the first few letters and then a bunch of arrow pressing as I chose the right page.  By the end of those hours I was frustrated as all hell and wanted out.  Rob told me about the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/6227"&gt;oldbar&lt;/a&gt; extension &amp;#8211; which makes the Awesome Bar behave much like the old location bar &amp;#8211; and installed it.  I used Firefox &amp;amp; Safari roughly equally over the next couple weeks, and then I interviewed with Mozilla.&lt;/p&gt;
&lt;p&gt;During one of my interviews (with &lt;a href="http://steelgryphon.com/blog/"&gt;Mike Connor&lt;/a&gt; I believe), I was asked, &amp;#8220;If you could change one thing about Firefox, what would it be?&amp;#8221;  I thought about it a second, and the first thing that came to mind was my new found hatred of the Awesome Bar, so I said that.  I explained myself, and said some of the things that I said to Rob.  My biggest gripe was that I just wanted URLs to be matched before titles of pages.  Mike talked a bit about how it worked and how it used machine learning to adapt to how I used it.  So if I just behaved like I used to and chose the page I was looking for, it would remember that for next time.  He said it was still being tweaked and it wasn&amp;#8217;t perfect yet, but that I really should give it another shot.&lt;/p&gt;
&lt;p&gt;So I did, and since I knew a little bit more about it, I felt a little less apprehensive about using it.  So I set out to &amp;#8220;train&amp;#8221; it.  I bit the bullet and got some inaccurate results over the next week or two.  At one point in there I opened my browser and could not for the life of me think of the domain or &lt;span class="caps"&gt;URL&lt;/span&gt; for a page I knew I had been to a couple days before.  I did however know what the page was about (it was something specific about Java or some such nonsense for an assignment).  So I just typed the topic into the Awesome Bar.  Luckily the word I was thinking had been in the page title, and &lt;del&gt;viola&lt;/del&gt; voil&amp;agrave; &amp;#8211; the first result after I had typed the word was the exact page I was looking for.  It had proved itself to me.  I probably would have spent another 20 minutes trying to remember exactly what I searched for on Google.  I&amp;#8217;ve been using it since and absolutely love it.&lt;/p&gt;
&lt;p&gt;So just give it a shot and quit complaining.  Yes, it is a complete paradigm shift.  But it&amp;#8217;s not called the Awesome Bar for nothing; it really is awesome once you give it a chance.&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">My First Patch</title>
    <link href="http://zpao.com/posts/my-first-patch" />
    <updated>2008-06-12T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/my-first-patch</id>
    <content type="html">&lt;p&gt;Today I put created my first patch for Firefox.  It&amp;#8217;s nothing major, but it still counts.  It still hasn&amp;#8217;t been r+ed yet (c&amp;#8217;mon &lt;a href="http://blog.mozilla.com/dolske/"&gt;dolske&lt;/a&gt;!).  Basically, it creates a public function that exposes a private function in the Password Manager.  This makes it so that a user can have Firefox remember passwords, disable the feature to autofill login forms on page load, yet still expose the functionality to fill in the form.  This opens it up for an extension to do that work.&lt;/p&gt;
&lt;p&gt;I think Justin probably &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=359675#c26"&gt;said it better&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;#8230;it seems like a legitimate use case for those who want this as an option. At the very least by adding some flags to the existing code, so an extension could drive the UI side. [Eg, currently the password manager form-fill code can only be triggered by page loads, but it should be easy to expose this as an interface for extensions.]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Better?&lt;/p&gt;
&lt;p&gt;So if you&amp;#8217;d like to read some more about it, there&amp;#8217;s &lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=359675"&gt;the discussion on Bugzilla&lt;/a&gt; and &lt;del&gt;&lt;a href="https://bugzilla.mozilla.org/attachment.cgi?id=324865&amp;amp;action=diff"&gt;the diff for the patch&lt;/a&gt;&lt;/del&gt;.  It&amp;#8217;s not checked into source yet, but soon.  So yea, this isn&amp;#8217;t terribly exciting&amp;#8230; unless you&amp;#8217;re me.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; The original patch got canceled since we decided it would be better to expose just the functionality to fill a form as opposed to the whole document, at least as a first step.  There&amp;#8217;s a &lt;del&gt;&lt;a href="https://bugzilla.mozilla.org/attachment.cgi?id=325053&amp;amp;action=diff"&gt;new patch&lt;/a&gt;&lt;/del&gt; in that&amp;#8217;s now waiting for a review.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Update 2:&lt;/b&gt; I was very preemptive here. I should have just waited until it actually got committed.  I ended up getting r-ed a couple times, but it made it in.  So without further ado, &lt;a href="http://hg.mozilla.org/mozilla-central/index.cgi/rev/055a716092aa"&gt;the changeset.&lt;/a&gt;&lt;/p&gt;</content>
  </entry>



  <entry>
    <title type="html">Interning at Mozilla: Week 1</title>
    <link href="http://zpao.com/posts/mozilla-week-1" />
    <updated>2008-05-31T00:00:00-07:00</updated>
    <id>http://zpao.com/posts/mozilla-week-1</id>
    <content type="html">&lt;p&gt;I&amp;#8217;ve just finished my first week at Mozilla.  So far it&amp;#8217;s been a blast.  They&amp;#8217;ve put us up in a really nice temporary living apartment complex (&lt;a href="http://www.oakwood.com/furnished-apartments/furnished/US/CA/Mountain-View/prop17/showPictures.html"&gt;pictures&lt;/a&gt; and yes that &lt;em&gt;is&lt;/em&gt; a 40 person hot tub), the other interns are all really nice, and well, it&amp;#8217;s California.&lt;/p&gt;
&lt;p&gt;This week we had a poker game / movie night.  I was in on poker and turned $10 into $30, which should keep from an &lt;span class="caps"&gt;ATM&lt;/span&gt; a little bit longer.  They&amp;#8217;ve also been feeding us lunch this week; there&amp;#8217;s a stock of good snacks &amp;amp; cereal, so I don&amp;#8217;t have to eat breakfast before work (although I have been).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Anyway, on to Firefox.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So I am on the Firefox team for the summer.  My initial goals include working on profiling startup and improving shutdown.  Neither of these are one day tasks, not even 1 week.  In fact, both seem pretty lofty and fun to work on.&lt;/p&gt;
&lt;p&gt;The improving shutdown part is where I&amp;#8217;ve been focusing first &amp;#8211; it&amp;#8217;s something that has bothered me personally.  The behavior is both inconsistent and can be pretty annoying.  For example, if you close the last window vs. doing File|Exit (and have &amp;#8220;Clear Privacy on Exit&amp;#8221;) checked, you will have different outcomes when you try to restore your session.  Not only that, but there are several different dialogs that can pop up.  Then take into account leaving the Downloads window up when you close the last window &amp;#8212; your session restore is screwed (at least last I remember).  That is not the expected behavior.&lt;/p&gt;
&lt;p&gt;So all this week I&amp;#8217;ve been digging through the Firefox source code with &lt;a href="http://mxr.mozilla.org/mozilla-central/source/"&gt;&lt;span class="caps"&gt;MXR&lt;/span&gt;&lt;/a&gt;.  I haven&amp;#8217;t written a single line, just reading &amp;amp; taking notes.  It&amp;#8217;s not simple.  Shutdown (or &amp;#8220;Exit&amp;#8221; or &amp;#8220;Quit&amp;#8221;) goes through a number of steps and then broadcasts a &lt;code&gt;quit-application-requested&lt;/code&gt; message.  Other objects observe specific messages, so all the ones that observe &lt;code&gt;quit-application-requested&lt;/code&gt; are then triggered.  Some of these in turn trigger dialogs, set preferences, close windows, and so on.  Assuming all goes well there, &lt;code&gt;quit-application-granted&lt;/code&gt; and subsequently &lt;code&gt;quit-application&lt;/code&gt; are broadcast.  These events can be triggered in either JavaScript or C++, not to mention that sometimes the JavaScript is being called from &lt;span class="caps"&gt;XUL&lt;/span&gt;, or &lt;span class="caps"&gt;XUL&lt;/span&gt; is &amp;#8220;run&amp;#8221; from Javascript.  It&amp;#8217;s even more complicated than it may sound here, so maybe in a future post I&amp;#8217;ll break it down even more.  I still haven&amp;#8217;t finished working it out completely.  I&amp;#8217;ve looked at some of the &amp;#8220;Close Window&amp;#8221; code as well to track down where differences lie and how that can be made more consistent&amp;#8230; All in all, it&amp;#8217;s hurts my brain a little bit.&lt;/p&gt;
&lt;p&gt;That said, it&amp;#8217;s been a fun (albeit exasperating at times) week and I&amp;#8217;m looking forward to the rest of the summer.&lt;/p&gt;</content>
  </entry>





</feed>

