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

<channel>
	<title>Indistinguishable from Jesse</title>
	<atom:link href="http://www.squarefree.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.squarefree.com</link>
	<description>Jesse Ruderman on Firefox, security, and more</description>
	<lastBuildDate>Tue, 05 Jun 2012 15:53:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Mobile apps for car-free living</title>
		<link>http://www.squarefree.com/2012/04/16/car-free-apps/</link>
		<comments>http://www.squarefree.com/2012/04/16/car-free-apps/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 06:17:49 +0000</pubDate>
		<dc:creator>Jesse Ruderman</dc:creator>
				<category><![CDATA[Transportation]]></category>

		<guid isPermaLink="false">http://www.squarefree.com/?p=840</guid>
		<description><![CDATA[Swings on BART (photo by Audrey Penven) Each of these apps makes transit more efficient or convenient. Together, they can do something almost magical: make transit attractive to urbanites who previously saw owning a car as a necessity. Planning your trips These apps try to find the best way to reach your destination by combining [...]]]></description>
				<content:encoded><![CDATA[<div style="margin: 1em 0; text-align: center;">
  <div style=""><img src="http://www.squarefree.com/blogimages/swings-on-bart.jpg" width="427" height="640" alt="A man swings through the aisle of a train."></div>
  <div style="font-style: italic; font-size: smaller;"><a href="http://www.flickr.com/photos/audreypenven/3482041699/">Swings on BART</a> (photo by <a href="http://audreypenven.net/">Audrey Penven</a>)</div>
</div>


<p>Each of these apps makes transit more efficient or convenient. Together, they can do something almost magical: make transit <em>attractive</em> to urbanites who previously saw owning a car as a necessity.</p>


<h4>Planning your trips</h4>

<p>These apps try to find the best way to reach your destination by combining timetables from multiple transit agencies:</p>

<p><a href="http://maps.google.com/">Google Maps</a><sup>[<a href="http://www.google.com/intl/en/landing/transit/" title="Using Google Maps for public transportation">Learn more</a>]</sup> shows your current location along with walking, transit, or driving directions. In the iPhone app, you can double-tap the locator button to align the map with the iPhone's compass.</p>

<p><a href="http://www.hopstop.com/search">HopStop</a><sup>[<a href="http://itunes.apple.com/us/artist/hopstop.com/id303217147" title="HopStop for iOS">iOS</a> | <a href="http://hopstop.com/?action=mobile_android" title="HopStop for Android">Android</a>]</sup> lets you specify whether you prefer trains or buses, and whether you prefer walking or waiting for a transfer. It shows a zoomed-in map for each transfer.</p>

<p><a href="http://codeforamerica.org/?cfa_project=transportation-choices">Reroute.it</a> lets you <a href="http://codeforamerica.org/2011/09/27/introducing-reroute-it/">quickly compare modes of transportation</a> before getting directions.</p>


<h4>Catching your ride</h4>

<p><a href="http://routesy.com/">Routesy</a>, <a href="http://nextransit.org/apps/nextime/">Nextime</a>, and <a href="http://www.nextbus.com/homepage/">Nextbus</a> use real-time transit data to help you make quick decisions on familiar routes.  For example, you'll know when to walk to your stop, when to run, and when to wait inside.</p>


<h4>Not missing your stop</h4>

<p>A location-based alarm, such as <a href="http://itunes.apple.com/us/app/get-off-now!-predictive-gps/id415576580?mt=8">Get Off Now</a> or <a href="http://itunes.apple.com/us/app/gpsalarms/id447537468?mt=8">GPSAlarms</a>, can allow you to nap, read, or work without worrying about missing your stop.</p>

<p>These  apps can run in the background and have surprisingly little effect on  battery life. They use power-hungry GPS only when cell/wifi location  data indicates that you are somewhat close.</p>


<h4>Staying productive and entertained</h4>

<p>One of the biggest advantages of public transportation is being able to <a href="http://www.squarefree.com/2009/04/16/how-i-use-gtd/">get things done</a> while in transit.  Some people check email, watch TV shows, or even <a href="http://itunes.apple.com/app/chipotle-ordering/id327228455?mt=8">order from Chipotle</a> using their phones.</p>

<p>I often use time on the train to read articles. Whenever I find myself with <a href="http://xkcd.com/214/">too many Wikipedia tabs open</a>, I send them to my phone using the <a href="http://www.instapaper.com/">Instapaper</a> or <a href="https://getspool.com/">Spool</a> bookmarklet.  Sometimes I read books on my phone using the <a href="http://www.amazon.com/gp/feature.html?docId=1000493771">Amazon Kindle app</a>.</p>


<h4>Getting a car when you need one</h4>

<p>The <a href="http://www.zipcar.com/mobile/">Zipcar app</a> lets you borrow cars from <a href="http://www.zipcar.com/find-cars">Zipcar locations</a>, while <a href="http://www.getaround.com/">Getaround</a> lets you borrow cars from awesome neighbors.</p>

<p>Or you can pay for a ride using <a href="http://taximagic.com/">Taxi Magic</a> or <a href="https://www.uber.com/">Uber</a>.</p>


<h4>More reading</h4>

<p>Some transit authorities recommend apps for their cities: <a href="http://www.511.org/apps-3rd-party-apps.asp">San Francisco</a>, <a href="http://www.nytransit.org/resources/transit-apps-ny">New York</a>, <a href="http://www.transitchicago.com/apps/">Chicago</a>, <a href="http://www.kingcounty.gov/transportation/kcdot/MetroTransit/Developers/AppCenter.aspx">Seattle</a>, and <a href="http://trimet.org/apps/">Portland, Oregon</a>.</p>

<p>In my next posts, I'll list my ideas for new transit apps and explain how platforms could better support location-aware apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarefree.com/2012/04/16/car-free-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fuzzing for consistent rendering</title>
		<link>http://www.squarefree.com/2012/03/03/fuzzing-for-consistent-rendering/</link>
		<comments>http://www.squarefree.com/2012/03/03/fuzzing-for-consistent-rendering/#comments</comments>
		<pubDate>Sun, 04 Mar 2012 04:19:53 +0000</pubDate>
		<dc:creator>Jesse Ruderman</dc:creator>
				<category><![CDATA[Fuzzing]]></category>
		<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://www.squarefree.com/?p=823</guid>
		<description><![CDATA[My DOM fuzzer can now find bugs where the layout of a DOM tree depends on its history. In this example, forcing a re-layout swapped a “1” and ”3” on the screen. My fuzzer didn’t know which rendering was correct, but it could tell that Firefox was being inconsistent. Initial DOM tree DIV &#x062a; SPAN [...]]]></description>
				<content:encoded><![CDATA[<p>My DOM fuzzer can now find bugs where the layout of a DOM tree depends on its history.</p>

<p>In this example, forcing a re-layout swapped a “1” and ”3” on the screen. My fuzzer didn’t know which rendering was correct, but it could tell that Firefox was being inconsistent.</p>

<style>
   .domtree { font-family: monospace; font-size: 130%; margin-top: 0; margin-bottom: 0; }
   .domtree code { color: purple; font-weight: bold; }
</style>

<table cellpadding="4" border="1" style="border-collapse: collapse; margin: auto;">
<tr>
<td>Initial DOM tree</td>
<td>

<ul class="domtree">
<li><code>DIV</code>
  <ul>
    <li>&#x062a;</li>
    <li><code>SPAN</code>
      <ul>
        <li>1</li>
        <li><code>SPAN</code>
        <li>3</li>
      </ul>
    </li>
  </ul>
</li>
</ul>

</td>
<td>31<bdi>&#x062a;</bdi></td>
</tr>
<tr>
<td>Random change:<br/> remove the inner span</td>
<td>

<ul class="domtree">
<li><code>DIV</code>
  <ul>
    <li>&#x062a;</li>
    <li><code>SPAN</code>
      <ul>
        <li>1</li>
        <li>3</li>
      </ul>
    </li>
  </ul>
</li>
</ul>

</td>
<td>31<bdi>&#x062a;</bdi></td>
</tr>
<tr>
<td>Force re-layout</td>
<td>

<ul class="domtree">
<li><code>DIV</code>
  <ul>
    <li>&#x062a;</li>
    <li><code>SPAN</code>
      <ul>
        <li>1</li>
        <li>3</li>
      </ul>
    </li>
  </ul>
</li>
</ul>

</td>
<td>13<bdi>&#x062a;</bdi></td>
</tr>
</table>


<p>Gecko developer <a href="http://smontagu.org/">Simon Montagu</a> quickly <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=718236#c1">determined that <span>13<bdi>&#x062a;</bdi></span> is the correct rendering</a> and attached a patch. Later, when a user <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=730671">reported that the bug affected Persian comments on Facebook</a>, we were able to <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=718236#c12">backport Simon’s fix to Firefox 11</a>.</p>


<h4>How it works</h4>

<p>The fuzzer starts by making random dynamic changes to a page.  Then it compares two snapshots: one taken immediately after the dynamic changes, and another taken after also forcing a relayout.</p>

<p>To force a relayout, it removes the root from the document and then adds it back:</p>

<pre>
  var r = document.documentElement; 
  document.removeChild(r);
  document.appendChild(r);
</pre>

<p>Like <a href="https://developer.mozilla.org/en/Creating_reftest-based_unit_tests">reftest</a>, it uses <a href="https://developer.mozilla.org/en/DOM/CanvasRenderingContext2D#drawWindow%28%29">drawWindow()</a> to take snapshots and <a href="https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMWindowUtils#compareCanvases%28%29">compareCanvases()</a> to compare them.</p>

<p>In theory, I could also look for bugs where dynamic changes do not repaint enough of the window. But I've been told that testing for painting invalidation bugs is tricky, so I'll wait until most of the layout bugs are fixed.</p>


<h4>Exceptions</h4>

<p>Since the testcases are random, I have to be heavy-handed in ignoring known bugs. If I file a rendering bug where the weirdest part of the testcase is floats, I'll have the fuzzer ignore inconsistent rendering in testcases with floats <a href="http://www.squarefree.com/2011/06/10/tracking-after-fix-tasks/">until the bug is fixed</a>.</p>

<p>The <a href="http://pastebin.mozilla.org/1501141">current list of exceptions</a> is fairly large and includes key web technologies:</p>

<ul>
<li>CSS border/padding (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=718452">bug 718452</a>)</li>
<li>CSS position: relative/absolute (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=728100">bug 728100</a>)</li>
<li>CSS float (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=725928">bug 725928</a>)</li>
<li>Non-ASCII text (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=726460">bug 726460</a>)</li>
<li>Right-to-left text (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=730562">bug 730562</a>)</li>
<li>&lt;table&gt; (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=467723">bug 467723</a>)</li>
<li>MathML (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=522393">bug 522393</a>)</li>
<li>SVG (<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=723376">bug 723376</a>, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=475216">bug 475216</a>)</li>
<li>Anything that causes <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=265084">coordinate overflow</a></li>
<li>Anything that causes assertion failures (which are <a href="http://www.squarefree.com/2010/11/21/how-my-dom-fuzzer-ignores-known-bugs/">tracked separately</a>)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.squarefree.com/2012/03/03/fuzzing-for-consistent-rendering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Renting movies is hard</title>
		<link>http://www.squarefree.com/2012/03/01/movie-rental/</link>
		<comments>http://www.squarefree.com/2012/03/01/movie-rental/#comments</comments>
		<pubDate>Fri, 02 Mar 2012 06:05:57 +0000</pubDate>
		<dc:creator>Jesse Ruderman</dc:creator>
				<category><![CDATA[Broken]]></category>

		<guid isPermaLink="false">http://www.squarefree.com/?p=819</guid>
		<description><![CDATA[None of the major video rental systems appeal to me: Redbox is for people who visit the grocery store two days in a row. (Why don't they put kiosks at train stations?) Netflix DVD-by-mail is for people who watch lots of movies and check snail mail daily. Amazon Instant Video is for people who live [...]]]></description>
				<content:encoded><![CDATA[<p>None of the major video rental systems appeal to me:</p>

<ul>
<li><a href="http://www.redbox.com/">Redbox</a> is for people who visit the grocery store two days in a row. (Why don't they put kiosks at train stations?)</li>

<li><a href="https://www.netflix.com/">Netflix DVD-by-mail</a> is for people who watch lots of movies and check snail mail daily.</li>

<li><a href="http://www.amazon.com/gp/feature.html?docId=1000663511">Amazon Instant Video</a> is for people who live online, yet are willing to <a href="http://www.defectivebydesign.org/what_is_drm_digital_restrictions_management">give up control over their computers</a>.</li>
</ul>

<p>The iTunes Store mostly works for my current set of devices, but all the movies I want to watch are either too new or too obscure for them to have rentals available.</p>

<p>Maybe I should sign up for Netflix but use <a href="https://thepiratebay.se/">other means</a> to actually watch movies. At least then Hollywood will have enough money to <del>make good films</del> <a href="http://rootstrikers.org/">buy politicians</a>, print and distribute <a href="http://www.homemediamagazine.com/digital-copy/kevin-tsujihara-discs-key-driving-ultraviolet-adoption-26560">billions</a> of <a href="https://twitter.com/#!/jruderman/status/175455285442379777">optical discs</a>, <a href="https://www.eff.org/issues/drm">prevent paying customers from exercising their fair use rights</a>, and <a href="https://www.eff.org/issues/file-sharing">sue my neighbors</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.squarefree.com/2012/03/01/movie-rental/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I dream of Alpha</title>
		<link>http://www.squarefree.com/2012/02/05/alpha/</link>
		<comments>http://www.squarefree.com/2012/02/05/alpha/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 17:26:06 +0000</pubDate>
		<dc:creator>Jesse Ruderman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.squarefree.com/?p=813</guid>
		<description><![CDATA[This museum’s rooms are empty, waiting to be filled with answers to visitors’ questions. In my search for nutrition, have I overlooked some fruit that I might find convenient and delicious? I start by trying to find out what’s popular throughout the world. What fruits are liked by the most people? Human thoughts are not [...]]]></description>
				<content:encoded><![CDATA[<p>This museum’s rooms are empty, waiting to be filled with answers to visitors’ questions.</p>

<p style="text-align: center"><img src="https://www.squarefree.com/blogimages/WAlogoSmallGreen.png" width="44" height="45" alt="-"></p>

<p>In my search for nutrition, have I overlooked some fruit that I might find convenient and delicious? I start by trying to find out what’s popular throughout the world.</p>

<p><em>What fruits are liked by the most people?</em> <samp>Human thoughts are not my forte.</samp></p>

<p><em>What fruits are eaten the most?</em> I get an answer, but not in the chart form I expected.</p>

<p>A row of fruit appears on the floor. The larger ones are shown both whole and sliced. Does the <a href="http://en.wikipedia.org/wiki/Five-second_rule">five-second rule</a> apply to food that suddenly appeared on the floor, or only to food that has been dropped? Am I looking at holograms?</p>

<p>A bigger problem is that the list is dominated by small fruits like berries. I don’t like berries.</p>

<p><em>What fruits are eaten the most, by weight?</em> <samp>Insufficient data.</samp></p>

<p>I probe, using simpler questions, to figure out what it knows. <em>What’s the weight of an apple?</em> <samp>180 grams.</samp> <em>What’s the total weight of apples eaten in a year?</em> <samp>Insufficient data.</samp></p>

<p>I guess I have to be explicit if I want it to combine its weight and consumption data.</p>

<p><em>For each fruit for which you have sufficient data, chart the number eaten in a year, the average weight, and the product of the two.</em></p>

<p>I don’t get an answer right away. Is it just taking a while? Did I mangle the question, causing it to make a chart that is invisible because it has no entries? Did I confuse it with the phrase “the product of the two”?</p>


<p style="text-align: center"><img src="https://www.squarefree.com/blogimages/banana-from-clker-83002-tiny.png" width="75" height="58"  alt="-"></p>

<p>Two women are debating the merits of bananas. In this place, they aren’t limited to speculation. <em>Can you chart fruit by potassium per Calorie? Vitamin B<sub>6</sub> per dollar?</em> It helpfully highlights the “banana” row in each chart.</p>

<p>They explore the supply side as well. <em>Show me maps of where bananas are grown. Can you add a yearly animation with harvests shown as glowing dots? Draw a chart with axes for temperature and latitude, colored to show how well bananas grow in each condition.</em></p>

<p>I start thinking of my own questions, but I don’t expect it to be able to answer them. How do most people <a href="http://www.youtube.com/watch?v=8Hdajei5i7Q">open bananas</a>? How many bananas are used in recipes rather than eaten directly?</p>

<p><em>How many bananas are used as sex toys?</em> Oops, did I ask that out loud?</p>

<p>It doesn’t even acknowledge my question, but one of the women retorts with a question of her own.</p>

<p><em>What percent of the time are men thinking about sex?</em> <samp>Human thoughts are not my forte.</samp></p>


<p style="text-align: center"><img src="https://www.squarefree.com/blogimages/WAlogoSmall.png" width="44" height="45" alt="-"></p>

<p>When I wake up, it’s still dark outside.</p>

<p>Today, the closest thing to the museum of my dream is a web site called <a href="http://www.wolframalpha.com/">Wolfram Alpha</a>. It can <a href="http://www.wolframalpha.com/input/?i=population+vs+GDP+per+capita+by+country">chart</a> <a href="http://www.wolframalpha.com/input/?i=temperature+in+mountain+view+CA+and+san+francisco+CA+during+2011">many</a> <a href="http://www.wolframalpha.com/input/?i=apple+stock+price+from+1980+to+today">things</a>. But it <a href="http://www.wolframalpha.com/input/?i=vehicles+in+california+%2F+population+of+california">requires</a> <a href="http://www.wolframalpha.com/input/?i=vehicles+per+capita+in+california">us</a> to <a href="http://www.wolframalpha.com/input/?i=languages+by+number+of+native+speakers">phrase</a> <a href="http://www.wolframalpha.com/input/?i=languages+with+the+most+native+speakers">questions</a> carefully, and sometimes it <a href="http://www.wolframalpha.com/input/?i=number+of+prisoners">simply</a> <a href="http://www.wolframalpha.com/input/?i=mass+of+250+gallons+of+gasoline">misinterprets</a> queries.</p>

<p>As for fruit? Wolfram Alpha has <a href="http://www.wolframalpha.com/input/?i=worldwide+fruit+consumption">consumption data for some fruit</a>. But <a href="http://www.wolframalpha.com/input/?i=worldwide+consumption+of+peaches">some fruit is missing</a>, and <a href="http://www.wolframalpha.com/input/?i=worldwide+kiwi+consumption">some</a> <a href="http://www.wolframalpha.com/input/?i=US+consumption+of+kiwis">fruit</a> <a href="http://www.wolframalpha.com/input/?i=%28kiwi+fruit%29+US+consumption">confuses</a> it.</p>

<p>I start writing this post while eating the last two apples from my fridge.</p>

<p>I go back to bed, hoping for additional pleasant dreams.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.squarefree.com/2012/02/05/alpha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lessons from JS engine bugs</title>
		<link>http://www.squarefree.com/2011/09/01/lessons-from-js-engine-bugs/</link>
		<comments>http://www.squarefree.com/2011/09/01/lessons-from-js-engine-bugs/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 00:10:22 +0000</pubDate>
		<dc:creator>Jesse Ruderman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.squarefree.com/?p=791</guid>
		<description><![CDATA[Last week, I asked Luke Wagner to explain some security bugs that he fixed in the past. I hoped to learn from each bug at multiple levels, in ways that could help prevent future security bugs from arising and persisting. Luke is one of the developers working on Firefox's JavaScript engine, which is currently our [...]]]></description>
				<content:encoded><![CDATA[<p>Last week, I asked <a href="http://blog.mozilla.com/luke/">Luke Wagner</a> to explain some security bugs that he fixed in the past. I hoped to <a href="http://en.wikipedia.org/wiki/Root_cause_analysis">learn from each bug at multiple levels</a>, in ways that could help prevent future security bugs from arising and persisting.</p>

<p>Luke is one of the developers working on <a href="https://developer.mozilla.org/en/SpiderMonkey">Firefox's JavaScript engine</a>, which is currently our largest source of <a href="https://wiki.mozilla.org/Security_Severity_Ratings">critical</a> security bugs.</p>

<h4>Method</h4>

<p>I imagined we would recurse in <a href="http://en.wikipedia.org/wiki/Why-Because_analysis">exhaustive breadth</a> and <a href="http://en.wikipedia.org/wiki/5_Whys">exhausting depth</a>. Instead, we recursed only on the most interesting items, and refined a checklist of starting points:</p>

<ul>
<li>What was the bug?</li>
<li>What went wrong in the developer's thinking that caused the bug to be introduced?</li>
<li>What made the bug exploitable?</li>
<li>What caused us to use especially dangerous features of C++?</li>
<li>Could a new abstraction make it possible to do this both fast and safe?</li>
<li>What caused the bug to persist? Could we have caught this earlier with improved regression tests, fuzz testing, dynamic analysis, or static analysis?</li>
</ul>

<p>Luke and I made <strong><a href="http://www.squarefree.com/lessons-from-js-bugs.html">trees for all ten bugs</a></strong>, at first on paper and later using EtherPad. Then I extracted and categorized what I thought were the most useful lessons and recommendations.</p>

<h4>Recommendations for introducing fewer bugs</h4>

<p>Casts</p>

<ul>
<li>Create centralized, type-restricted cast functions. This protects you when you change the representation of one of the types. It also protects against mistakes that cause the input type to be incorrect.</li>
</ul>

<p>Sentinel values</p>

<ul>
<li>Use tagged unions instead.</li>
<li>Use a typed wrapper (a struct containing a single value). When assigning from the underlying numeric type, convert using one of two functions: one that checks for special values, and one that explicitly does not.</li>
<li>Audit existing code paths to ensure they cannot generate the special value.</li>
</ul>

<p>Clarity of invariants</p>

<ul>
<li>Increase use of <a href="http://mxr.mozilla.org/mozilla-central/search?string=AssertInvariants">methods named AssertInvariants</a></li>
<li>Create an alias for JS_ASSERTION called JS_INVARIANT.</li>
</ul>

<p>Interacting with other developers</p>

<ul>
<li>If you're about to do something gross because someone else doesn't expose the right API/helper, maybe you should get it exposed.</li>
</ul>

<p>JS Engine specific</p>

<ul>
<li>Any patch that touches rooting should be reviewed by Igor.</li>
<li>Interpreter could have better abstraction and encapsulation for its stack.</li>
</ul>

<h4>Recommendations for catching bugs earlier</h4>

<p>Static analysis</p>

<ul>
<li>Find all casts (C-style casts, the reinterpret_cast keyword, and casts through unions) for a given type. Could be used to enforce centralization or to find things that should be centralized.</li>
<li>Be suspicious of a function with multiple return statements, all of which return the same primitive value.</li>
<li>Be suspicious of a function returning true/success in an OOM path.</li>
</ul>

<p>Dynamic analysis</p>

<ul>
<li>Ask Valgrind developers what they think of providing (in valgrind.h) a way to tie the addressability of "stacklike memory" to a variable that represents the end of the stack.</li>
</ul>

<p>Fuzzing</p>

<ul>
<li>We should fuzz <a href="https://developer.mozilla.org/En/DOM/Worker">worker threads</a> somehow.
  <ul>
  <li>In browser (slow and messy, but it's what users are running).
  <li>In thread-safe shell (--enable-threadsafe?), which has "toy workers".</li>
  </ul>
</li>
<li>We should fuzz compartments better.
  <ul>
  <li>I should ask Blake and Andreas for help with testing compartments and wrappers.</li>
  <li>I should ask Gary to run jsfunfuzz in xpcshell, where I can test both same-origin and different-origin compartments, and thus get more interesting wrappers.</li>
  </ul>
</li>
<li>We should give JS OOM fuzzing another shot.</li>
</ul>

<h4>Next steps</h4>

<p>I'm curious if others have additional ideas for what could have prevented the ten bugs we looked at. For example, someone like <a href="http://whereswalden.com/">Jeff Walden</a>, who loves to write exhaustive regression tests, might have ideas that Luke and I did not consider.</p>

<p>I'd also like to do this kind of analysis with a other developers on bugs they have fixed.</p>]]></content:encoded>
			<wfw:commentRss>http://www.squarefree.com/2011/09/01/lessons-from-js-engine-bugs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>On the Isle of Rapidity</title>
		<link>http://www.squarefree.com/2011/08/27/on-the-isle-of-rapidity/</link>
		<comments>http://www.squarefree.com/2011/08/27/on-the-isle-of-rapidity/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 23:15:09 +0000</pubDate>
		<dc:creator>Jesse Ruderman</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Rapid release]]></category>

		<guid isPermaLink="false">http://www.squarefree.com/?p=788</guid>
		<description><![CDATA[Not all of our neighbors followed us. Some asked — demanded? — that we send back supplies. We acknowledged their request, but our immediate task was to explore this Isle of Rapidity. What surprises would we discover? What surprises would discover us? To survive in this strange land, we would have to befriend new neighbors. [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://kazhack.org/?post/2011/08/17/A-Bad-Surprise">Not all</a> of our neighbors followed us. Some <a href="http://mike.kaply.com/2011/06/24/why-do-companies-need-time-to-deploy-browsers/">asked</a> — <a href="http://www.squarefree.com/2011/08/27/venturing-from-mount-annum/#comment-11919">demanded?</a> — that we send back supplies.</p>

<p><a href="https://blog.mozilla.com/blog/2011/07/19/announing-mozilla-enterprise-user-working-group/">We</a> <a href="http://mozakai.blogspot.com/2011/06/long-term-support-for-firefox.html">acknowledged</a> <a href="http://blog.mozilla.com/sfink/2011/06/26/firefox-at-work/">their</a> <a href="http://jonoscript.wordpress.com/2011/07/18/its-not-about-the-version-numbers-its-about-extension-compatibility-and-long-term-support/">request</a>, but our immediate task was to explore this Isle of Rapidity. What surprises would we discover? What surprises would discover us?</p>

<p>To survive in this strange land, we would have to befriend new neighbors. Living for so long atop <a href="http://www.squarefree.com/2011/08/27/venturing-from-mount-annum/">Mount Annum</a>, we had <a href="http://aakash.doesthings.com/2011/07/19/a-platform-for-contributor-engagement-at-mozilla-2/">almost forgotten</a> how to <a href="http://www.mozilla.org/contribute/">introduce ourselves</a>.</p>

<p>But we had <a href="http://en.wikipedia.org/wiki/Monkey_patch">brought</a> <a href="https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIDOMGlobalPropertyInitializer">much</a> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=633653" title="Bug 633653 - revamp about:memory">to</a> <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/WeakMap">share</a>. We had barely opened our packs when the wind seemed to whisper:</p>

    <blockquote><p>Here, <a href="https://bugzilla.mozilla.org/buglist.cgi?quicksearch=563262,461634,310165,179006">gifts</a> arrive <a href="http://weblogs.mozillazine.org/asa/archives/2011/08/every_six_weeks.html">almost</a> <a href="http://www.mozilla.org/en-US/firefox/channel/">before</a> you send them.</p></blockquote>

<p>Maybe it wouldn’t be so hard to make friends here.</p>

<p>And there was something inexplicably <a href="http://en.wikipedia.org/wiki/History_of_Mozilla_Application_Suite#Release_history">familiar</a> about this island. Was it the scent of the flowers? The rhythmic waves in the distance? The chattering of wildlife, almost a chorus?</p>

    <blockquote><p>Here, a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=564667" title="Bug 564667 - Allow bootstrapped add-ons to have chrome">gift</a> to your neighbor is equally a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=467520" title="Bug 467520 - Adblock Plus tracking bug">gift</a> to yourself.</p></blockquote>

<p>We felt a sudden shift in perception: the Isle of Rapidity was <em>home</em>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.squarefree.com/2011/08/27/on-the-isle-of-rapidity/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
