<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Steven Tseng &#187; Open Source</title>
	<atom:link href="http://steventseng.wordpress.com/category/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://steventseng.wordpress.com</link>
	<description>There is nothing so permanent as a temporary solution</description>
	<lastBuildDate>Tue, 24 Apr 2012 20:32:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='steventseng.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Steven Tseng &#187; Open Source</title>
		<link>http://steventseng.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://steventseng.wordpress.com/osd.xml" title="Steven Tseng" />
	<atom:link rel='hub' href='http://steventseng.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Working on Mozilla Bug 601535 [0.3 Release]</title>
		<link>http://steventseng.wordpress.com/2012/02/23/working-on-mozilla-bug-601535-0-3-release/</link>
		<comments>http://steventseng.wordpress.com/2012/02/23/working-on-mozilla-bug-601535-0-3-release/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 18:16:18 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Firefox Bug]]></category>
		<category><![CDATA[open source code]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=342</guid>
		<description><![CDATA[So I had somehow disappeared from the blogging space for a while now. More likely, I didn&#8217;t disappear, but the Pointer Lock API test took so much of my time that I literally stopped on my other courses. Hence I took some time off from open source to bring my other course up to speed. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=342&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So I had somehow disappeared from the blogging space for a while now. More likely, I didn&#8217;t disappear, but the Pointer Lock API test took so much of my time that I literally stopped on my other courses. Hence I took some time off from open source to bring my other course up to speed.</p>
<p>For reader that is not in my open source class and is wondering what 0.3 Release means, you can ignore them. It is used so that my professor can track my progress and grade me. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>For this blog, I will be discussing my troubles with <a title="Bug 601535" href="https://bugzilla.mozilla.org/show_bug.cgi?id=601535" target="_blank">Bug 601535</a>, which I mentioned a little bit in one of my earlier blog.</p>
<p><span id="more-342"></span></p>
<p><strong>Background on the Bug</strong></p>
<p>The bug involves changing all instance of MulOverflow and AddOverflow in the content/media folders. In place, I am supposed to use the <a title="CheckedInt.h" href="http://mxr.mozilla.org/mozilla-central/source/xpcom/ds/CheckedInt.h" target="_blank">CheckedInt utility class</a>. This class checks whether the number is valid or not, that is to say, it is this super awesome cyborg that takes in number and tells me if the number is too big or not. <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I was a little big lucky off with working on this bug because it was partially worked on by someone else. There is a both pros and cons with regard to having a bug partially worked on. The pro is that I get a decent amount of examples to look through and someone already reviewed the older patch and I get the feedback right away. The cons are I need to understand the bug first, what files it affects and what the earlier person did.</p>
<p><strong>Working on the Bug</strong></p>
<div>Okay, I know, the sub-heading is the exact as the blog heading. (It&#8217;s been a long week, don&#8217;t ask).</div>
<p>This bug was worked on by someone two years ago, and two years in computer code is ten lifetime and the current code is in the tenth generation. This translates to numerous differences in code. As such, my job involved (after I understood the bug properly):</p>
<ul>
<li>Get the old patch and put it in my code.</li>
<li>Put in the suggestions put up by the reviewer.</li>
</ul>
<p>This may sound simple, but it is not.</p>
<p><strong>Adding the Patch</strong></p>
<p>After I was satisfied with the bug, I began preparing a diff to be uploaded and this took me two days. TWO DAYS TO GET A DIFF!!!! Somehow github was giving me a lot of trouble when trying to rebase. I am going to sit with Jon Buckley, who is pretty good at github and shall see what went wrong.</p>
<p>In short, the code is landed and the diff issue I had to re-do from a different branch. I will soon post a blog once I figured out what went wrong and maybe help someone (me) in need.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/342/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/342/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/342/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=342&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/02/23/working-on-mozilla-bug-601535-0-3-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>Pointer Lock [Mouse Lock] API &#8211; Adding a Patch and the Troubles we got (0.2 Release)</title>
		<link>http://steventseng.wordpress.com/2012/02/12/pointer-lock-mouse-lock-api-adding-a-patch-and-the-troubles-we-got/</link>
		<comments>http://steventseng.wordpress.com/2012/02/12/pointer-lock-mouse-lock-api-adding-a-patch-and-the-troubles-we-got/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 00:05:35 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[MouseLock]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[open source code]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=334</guid>
		<description><![CDATA[This blog the Pointer Lock patch came out a little bit late, mainly, because I got sick the other weekend and I went to class to find out that I have this paper to write. The paper talks (or is going to, since I am almost halfway through it) about the internet sharing of research [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=334&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This blog the Pointer Lock patch came out a little bit late, mainly, because I got sick the other weekend and I went to class to find out that I have this paper to write. The paper talks (or is going to, since I am almost halfway through it) about the internet sharing of research journals and the ethical and financial issues at stake.</p>
<p>So approximately two week ago, the people working on the Pointer Lock API [<a title="Dave" href="http://vocamus.net/dave" target="_blank">Dave</a>, <a title="Diogo" href="http://diogogmt.wordpress.com/" target="_blank">Diogo</a>, <a title="Raymond" href="http://raymondhung.wordpress.com/" target="_blank">Raymond</a> and Me] decided to update the bug with a patch. The path to this patch had been a huge challenge to the team.</p>
<p>In short did we manage to finish of this API, the answer is &#8220;NO!&#8221;. However, are we close to finishing it? I feel we are close. However, it was not an easy task. Over the past few weeks, we were being slaughtered by the code from all directions. It seems like after we fix one problem, five more emerges from different locations. The more we tried to tackle an issue the more overwhelmed we felt. It is like a never ending uphill battle.</p>
<p>In this blog, I will talk about what we managed to accomplish and what else is left.</p>
<p><span id="more-334"></span></p>
<p>In <a title="PointerLock [MouseLock] API Test – Part 2: Crashing the Test" href="http://steventseng.wordpress.com/2012/01/30/pointerlock-mouselock-api-test-part-2/" target="_blank">my previous blog</a>, I talked about how we managed to crash the test suite when trying to run it on a Mac. Well, it seem that the Mac environment seem to pick up more problems that would otherwise be impossible on a Windows or Linux machine. For example, in one of the test, it executes some code that does deep down into the Mac machine layer code. If you are interested in looking at this bug and think you can contribute to the solution, take a look at the <a title="Bug 723201" href="http://bugzilla.mozilla.org/show_bug.cgi?id=723201" target="_blank">bug problem filed here</a>.</p>
<p>Most of the test cases crashes on areas of code we have never seen. We had issues due to different platforms, issues related with memory leaks when we try to synthesize some mouse events, occasional failures causes by unreliable mouse position values. All these problems were driving the team insane. IT IS FRUSTRATING!!! For example, when Dave tries to run the test suite on a Mac, he get five additional test case than me (on Linux) or Raymond (on Windows). So what did I do then? I shut my machine down, called some friends out to the bar and ordered myself something strong. I need that!</p>
<p>Fast forward a few days, Dave decided to add a patch to the Mochitest environment to try to fix the problem of different number of test. He added an optional parameter when a user is coding the test using the SimpleTest.waitForExplicitFinish function. This parameter tells the test the expected number of test to be run and matches that with the result number of test to see if they all run. If not, it shows a fails assertion. I tried to find this bug so you can read about it on Bugzilla, but was unlucky.</p>
<p><strong>So What is Next?</strong></p>
<p>Well 3-5 days after we added a patch, guess what? They updated the API specification as well. With the new update, they are removing the use of callbacks and are using events. What does part of our code is affected with the change? Well, everything. Now all of our test needs to be re-written, as well as the API code itself.</p>
<p>I guess we start from square one again, sort of.</p>
<p>During the past few weeks, most of the possible test we could think of were working, I think. However, the test had opened up a huge can of &#8220;bugs&#8221;.</p>
<p><strong>[Updated: Considering the trouble we had on these test, I am calling this as my 0.2 milestone for my open source class]</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/334/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=334&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/02/12/pointer-lock-mouse-lock-api-adding-a-patch-and-the-troubles-we-got/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>PointerLock [MouseLock] API Test &#8211; Part 2: Crashing the Test</title>
		<link>http://steventseng.wordpress.com/2012/01/30/pointerlock-mouselock-api-test-part-2/</link>
		<comments>http://steventseng.wordpress.com/2012/01/30/pointerlock-mouselock-api-test-part-2/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 03:29:46 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[MouseLock]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Mochitest]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=313</guid>
		<description><![CDATA[This blog is a continuation of my previous blog on the PointerLock Tests and I initially didn&#8217;t even planned for a two part blog. This happened due to a failure of the test which caused it to crash. The Crash Overall, the crash was caused when a HTML element tag have CSS styling for the &#8220;display&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=313&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This blog is a continuation of <a title="MouseLock API Test Update [0.1 Release]" href="http://steventseng.wordpress.com/2012/01/30/mouselock-api-test-update-0-1-release/">my previous blog on the PointerLock Tests</a> and I initially didn&#8217;t even planned for a two part blog. This happened due to a failure of the test which caused it to crash.</p>
<h2><strong>The Crash</strong></h2>
<p>Overall, the crash was caused when a HTML element tag have CSS styling for the &#8220;display&#8221; attribute. In some of our test cases, we had CSS styles that looked like this:</p>
<blockquote><p>&lt;div id=&#8221;content&#8221; style=&#8221;display: none&#8221;&gt;</p></blockquote>
<p>The problem with having the &#8220;display&#8221; attribute set to none is that when trying to lock the mouse, the underlying code tries to get the element &#8220;rectangle&#8221;. This causes a problem when the &#8220;display&#8221; attribute is set to &#8220;none&#8221;, as there is no &#8220;rectangle&#8221; to be obtained. Thus the crash occurs. If the display is left in it&#8217;s default value, that is, the &#8220;display&#8221; attribute is set to &#8220;block&#8221; then the rectangle exists and the test does not break.</p>
<p><span id="more-313"></span></p>
<p>You may ask why I didn&#8217;t go through this crash issue before? Well, the crash seem to occur on isolated incidents on both Windows Build and Linux Build (where <a title="Raymond Hung" href="http://raymondhung.wordpress.com/" target="_blank">Raymond</a> and I have our build on, respectively). For example, I had only two such occurrence that is is impossible for me to recreate to scenario to find a fix and the same happened to Raymond. However, when <a title="Dave" href="http://vocamus.net/dave/" target="_blank">Dave</a> pull the test from me and ran them, he gets the crash EVERYTIME!!! He was practically unable to run any of the test cases even once.</p>
<h2><strong>The Fix</strong></h2>
<p>Why is this crash odd? I do not have the answer and hopefully will get one soon from other developers (Dave is asking people involved with the API for feedback).</p>
<p>Until we get further feedback, we are working with a fix where when the element being locked have their &#8220;display&#8221; CSS attribute set to &#8220;none&#8221;, then the pointer will not lock. A test is also available to check for this, it is the <a title="file_pointerLockCSSDisplay.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_pointerLockCSSDisplay.html" target="_blank">file_pointerLockCSSDisplay.html</a> file.</p>
<p>For a view on what was changed to incorporate this fix, <a title="Diff for Style Check" href="https://github.com/humphd/mozilla-central/commit/b871c13a7e5d29bcad4dd0bed405fdf10b84c255" target="_blank">look at the Diff on my Github account</a>.</p>
<h2><strong>Outcome?</strong></h2>
<p>A crash like this brings up many questions. Questions like what other problems would the API run into. If someone didn&#8217;t put in the styling tag, we would not have known this problem at all. Another question, which is being discussed with people involved with the API specification, should we allow lock to occur when constraints like the &#8220;display: none&#8221; are present? Would it open up other problems with security? Who can answer these questions?</p>
<p>I wish I knew&#8230;.</p>
<p><strong>Note: Dave have <a title="How to crash like you mean it" href="http://vocamus.net/dave/?p=1442" target="_blank">this blog</a> that explains the problem further</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/313/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/313/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/313/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=313&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/01/30/pointerlock-mouselock-api-test-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>MouseLock API Test Update [0.1 Release]</title>
		<link>http://steventseng.wordpress.com/2012/01/30/mouselock-api-test-update-0-1-release/</link>
		<comments>http://steventseng.wordpress.com/2012/01/30/mouselock-api-test-update-0-1-release/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 02:45:06 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[MouseLock]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Mochitest]]></category>
		<category><![CDATA[Test Framework]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=286</guid>
		<description><![CDATA[Over the past week, I had been pushing myself to get the test for the MouseLock API up for review over the weekend or early next week. At the time of writing this blog, almost all the test are good to go. Like I just said, ALMOST!! I was working with Raymond Hung to get these test [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=286&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Over the past week, I had been pushing myself to get the test for the MouseLock API up for review over the weekend or early next week. At the time of writing this blog, almost all the test are good to go. Like I just said, ALMOST!!</p>
<p>I was working with <strong><a title="Raymond Hung" href="http://raymondhung.wordpress.com/" target="_blank">Raymond Hung</a> </strong>to get these test completed. I mentioned in <strong><a title="Mouselock API Test – Fixing and Reviewing" href="http://steventseng.wordpress.com/2012/01/22/mouselock-api-test-fixing-and-reviewing/" target="_blank">my previous blog</a></strong> about how I was struggling while trying to read other people&#8217;s code and make sure they work properly. Well, I am still fighting that war. It will be a war (with numerous battles, of course) that will not end until the day I retire. While reading other people&#8217;s code block, it does not just becomes a matter of getting the code to work. I involves a lot more work like making it readable so other people who will review my code will not have to go through what I went and also if they don&#8217;t understand, they&#8217;ll just throw my code back. It also involved ensuring that all the test follow a consistent format.</p>
<p>In this blog, I will talk about almost all the test we have worked with.</p>
<p><strong>**Note: All the test being linked in this blog is on <a title="Anachid" href="https://github.com/Anachid" target="_blank">my GitHub account</a> and as such, the files will be updated from time to time and some of them may even be taken down. It is also good to note that the MouseLock API Draft Specification had changed it&#8217;s name to PointerLock and I will be referring to PointerLock throughout this blog and any that may follow.</strong></p>
<p><span id="more-286"></span></p>
<p>For those of you who have not been reading and have the time, you may follow up on what have been happening with this test suite through <strong><a title="MouseLock API Test" href="http://steventseng.wordpress.com/category/open-source/mouselock/" target="_blank">my blog section on the PointerLock API test</a></strong>.</p>
<p>For the impatient, well the test are to ensure that the PointerLock API does not crash for any possible edge cases we could think of. These test must work on <strong><a title="Mochitest" href="https://developer.mozilla.org/en/Mochitest" target="_blank">Mochitest</a></strong>, Mozilla&#8217;s automated regression test framework.</p>
<h1>Tests, the gritty details</h1>
<p>First in the queue is the <strong><a title="file_DOMtree.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_DOMtree.html" target="_blank">file_DOMtree.html</a></strong>. This test is used to check that the mouse can be locked only when the target element is in the current DOM tree. It also checks that if the target is &#8220;ripped&#8221; out of the current DOM tree while the element is in FullScreen and in locked mode, the mouse loses the lock.</p>
<p>Next up is the <strong><a title="file_nestedFullScreen.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html" target="_blank">file_nestedFullScreen.html</a></strong>, where it test to ensure that when there is a nested HTML tag, lock is not allowed to the child element when the parent is in lock. Why would we do this? Well, ask yourself how many cross-hairs do you want to use when playing a first person shooter? The main reason for this is mainly be allowing lock on child element, it may open up security issues which we definitely don&#8217;t want.</p>
<p>Next (on the chopping block) is <strong><a title="file_differentDOM.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_differentDOM.html" target="_blank">file_differentDOM.html</a></strong>, wherein we had to check that when there is an iframe element (my Nemesis while using Mochitest), any attempt to gain PointerLock from the content inside the iframe is denied as the requesting element belongs to another DOM which is different from the current active DOM (the parent of the iframe). I think if the child element within the iframe is allowed to lock the pointer, it may allow cross-site scripting which is BAD for the good guys and GOOD for the bad guys.</p>
<div>Now we have the <strong><a title="file_fullscreen.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_fullscreen.html" target="_blank">file_fullscreen.html</a></strong>. This test validate checks for multiple scenario, such as:</div>
<ul>
<li>pointer.isLocked, which is a validation checker, returns true if mouse is locked, false otherwise.</li>
<li>the pointer.lock() takes in three argument, namely, a DOM element, a success callback and a failure callback. <em><strong>[this method of operating is currently being debated and the folks are looking at using events instead of callback, which translates to (yup!) "more work"]</strong></em></li>
<li>When the element is locked, it fires the appropriate callback immediately. This way depending on the result, the user can execute different actions accordingly. In my honest, I think callbacks are decent to work with, once you get the hang of it.</li>
<li>Finally, the pointer.unlock() method cancels the pointer lock and returns the pointer (known as a mouse now as it is no longer locked) to it original state and position.</li>
</ul>
<p>Next up is <strong><a title="file_doubleLockCallBack.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_doubleLockCallBack.html" target="_blank">file_doubleLockCallBack.html</a></strong>. This test is to check that when a pointer is locked, another instance of pointer.lock() still fires the success callback as the the element is still in FullScreen and pointer is still locked (DUH~!).</p>
<p>Now we have <strong><a title="file_unlockOnUnload.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_unlockOnUnload.html" target="_blank">file_unlockOnUnload.html</a></strong>, where the pointer must lose it&#8217;s locked state when the window unloads. In a nut shell, a window is the first thing that gets loaded in a browser before the document gets loaded (this is properly <a title="window vs. document" href="http://eligeske.com/jquery/what-is-the-difference-between-document-and-window-objects-2/" target="_blank">explained here</a>).</p>
<p>We then have <strong><a title="file_exitMouseLockOnLoseFocus.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_exitMouseLockOnLoseFocus.html" target="_blank">file_extiMouseLockOnLoseFocus.html</a></strong>. As the name suggest, this test check to ensure that the pointer loses its lock state when the current window/document loses focus. A scenario of losing focus is when the user switches between tabs either through alt+tab or mouse clicks, then the window/document loses focus and pointer gets unlocked.</p>
<p><strong><a title="file_pointerLockLost.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_pointerLockLost.html" target="_blank">file_pointerLockLost.html</a></strong> is a test that is used to check that when the mouselocklost event fires, the bubble attributes are set to true, and the target attribute is the element that initiated the lock. (For details on what is an event bubbles, <a title="Event Bubbles" href="http://www.w3schools.com/jsref/event_bubbles.asp" target="_blank">refer to this page</a>).</p>
<p>The <strong><a title="file_defaultUnlock.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_defaultUnlock.html" target="_blank">file_defaultUnlock.html</a></strong> file is used to check only when default keys are pressed with the element lose it&#8217;s locked state. For example, when a user press the letter &#8220;a&#8221;, the element should not lose it&#8217;s locked state. However, if they press the &#8220;ESC&#8221; key (which is set as the default), then the element loses its locked state.</p>
<p>In the <strong><a title="file_userPref.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_userPref.html" target="_blank">file_userPref.html</a></strong> test, we check that there is a user preference available to allow users to enable the browser to lock the pointer/mouse. It would drive a lot of people mad if this option isn&#8217;t available, right?</p>
<p>Next up is <strong><a title="file_constantXY.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_constantXY.html" target="_blank">file_constantXY.html</a></strong> (we a nearly done), where we test that when the mouse is unlocked, the movement between a point (X1, Y2) to another (X2, Y2) is different. However, when the pointer is locked, all the values should equal to zero.</p>
<p>Finally, <strong><a title="file_targetOutOfFocus.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html" target="_blank">file_targetOutOfFocus.html</a></strong>, is used to check that an element can be locked even when it is not in focus. For example, in a page with two div element, and div1 should be able to lock the pointer even though div2 maybe the element in focus. This is not similar to <strong><a title="file_exitMouseLockOnLoseFocus.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_exitMouseLockOnLoseFocus.html" target="_blank">file_exitMouseLockOnLoseFocus.html</a></strong>, where focus is shifted entirely to another document.</p>
<p>Whew!!! That was a long test, as of now, I made a pull request to be merged with <a title="Dave" href="http://vocamus.net/dave/" target="_blank">Dave Humphrey</a> and he will post a patch on Bugzilla.</p>
<p><strong>[Updated] More tests!!!</strong></p>
<p>The <strong><a title="file_cursorPosEvents.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_cursorPosEvents.html" target="_blank">file_cursorPosEvents.html</a></strong> is a test to check that the &#8220;mouseover&#8221;, &#8220;mouseout&#8221;, &#8220;mouseenter&#8221; and &#8220;mouseleave&#8221; events can be executed prior and after pointerlock.</p>
<div>The <strong><a title="file_movementXY.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_movementXY.html" target="_blank">file_movementXY.html</a></strong> checks for multiple scenario:</div>
<ul>
<li>They check that mozMovementX and mozMovementY are present in a mouse event object.</li>
<li>It also checks that value of mozMovementXY and it should be equal to the current screenXY minus the last screenXY.</li>
</ul>
<h1>What&#8217;s Left?</h1>
<p>Well we currently have one test that is commented out as it is throwing a bunch of weird errors. It is the <strong><a title="file_MouseEvents.html" href="https://github.com/Anachid/mozilla-central/blob/mouselock/dom/tests/mochitest/pointerlock/file_MouseEvents.html" target="_blank">file_MouseEvents.html</a></strong>. A possible problem that we can think of is that we cannot pin point the exact location of the mouse before the lock to synthesize it properly.</p>
<h1>What&#8217;s Next?</h1>
<p>What&#8217;s next? I will be most likely be making small changes that may have formatting issues from Dave and other such little problem. I will also be waiting for a review on the next patch. Until then, I can return to my attention on the bug that I worked on partially (<strong><a title="Bug 601535" href="https://bugzilla.mozilla.org/show_bug.cgi?id=601535" target="_blank">Bug 601535</a></strong>)</p>
<p><strong>**Updated: There is a weird crash that caused the test to fail. <a title="PointerLock [MouseLock] API Test – Part 2: Crashing the Test" href="http://steventseng.wordpress.com/2012/01/30/pointerlock-mouselock-api-test-part-2/" target="_blank">Read my blog about it here</a>.</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/286/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/286/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/286/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=286&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/01/30/mouselock-api-test-update-0-1-release/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>Mouselock API Test &#8211; Fixing and Reviewing</title>
		<link>http://steventseng.wordpress.com/2012/01/22/mouselock-api-test-fixing-and-reviewing/</link>
		<comments>http://steventseng.wordpress.com/2012/01/22/mouselock-api-test-fixing-and-reviewing/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 20:55:03 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[MouseLock]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Seneca College]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=264</guid>
		<description><![CDATA[This blog is a continuation of a series of blog on the test suite for the MouseLock API (For those new to this API, please refer to the API specifications). Sometime last week, Dave (Professor at Seneca College) posted a new patch to the MouseLock bug that had all the changes (I think) that was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=264&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This blog is a continuation of a <a title="MouseLock API Test" href="http://steventseng.wordpress.com/category/open-source/mouselock/" target="_blank">series of blog</a> on the test suite for the MouseLock API (For those new to this API, please refer to the <a title="MouseLock API" href="http://dvcs.w3.org/hg/webevents/raw-file/default/mouse-lock.html" target="_blank">API specifications</a>). Sometime last week, <a title="Dave Humphrey" href="http://vocamus.net/Dave" target="_blank">Dave</a> (Professor at Seneca College) posted a <a title="Patch v3" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602#c74" target="_blank">new patch to the MouseLock bug</a> that had all the changes (I think) that was suggested by the reviewers. Now for the bad part, the new patch caused all our test cases to fail. This reminds me of the small note Dave suggested (the following were not his exact words, but somewhere on those lines):</p>
<blockquote><p>The longer you linger on a bug with no patch, the more changes you have to make as other people post their patch.</p></blockquote>
<p>This made a lot of sense as other code patch may cause crashes on the section where I am working at. It feels like the &#8220;survival of the fittest code&#8221;.</p>
<p><span id="more-264"></span></p>
<p><strong>Fixing the Code</strong></p>
<p><a title="Software Developer vs. Programmer: Which category are you?" href="http://steventseng.wordpress.com/2012/01/22/software-developer-vs-programmer/" target="_blank">Every developer (NOT programmer)</a> have their own coding style. Something that is highly evident while reviewing other people&#8217;s code. This causes a problem with code readability and review and is one of the reason why all contributors to code for Mozilla must stick to a specific coding style. It is also the same reason why it took me a long time to figure out some of the test suite coded by other people.</p>
<p>I felt like someone threw the &#8220;painsaw&#8221; at me (a term I learned from <a title="Ed's Blog" href="http://edghardest1.wordpress.com/" target="_blank">Ed</a> which is a combination of pain and chainsaw). The code have weird indentation and the flow does not seem right. It may pass or fail the test, depending on when the code was executed by the machine.</p>
<p>I was working with Raymond on the test suite. Let&#8217;s hope he is having a better time than me. While I continue to fix more of these problems.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/264/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/264/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/264/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=264&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/01/22/mouselock-api-test-fixing-and-reviewing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>Pros and Cons of Working with Multiple Bug</title>
		<link>http://steventseng.wordpress.com/2012/01/18/pros-and-cons-of-working-with-multiple-bug/</link>
		<comments>http://steventseng.wordpress.com/2012/01/18/pros-and-cons-of-working-with-multiple-bug/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 03:01:35 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=255</guid>
		<description><![CDATA[Having picked up two bugs simultaneously, I am now kinda swamped with a lot of work. I have the test suite for Bug 633602 and the re-factoring of the content/media code in Bug 601535. All this in addition to four other courses for my current semester and working at two places. Now the question arises, &#8220;why in the heck [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=255&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Having picked up two bugs simultaneously, I am now kinda swamped with a lot of work. I have the test suite for <a title="Bug 633602" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602" target="_blank">Bug 633602</a> and the re-factoring of the content/media code in <a title="Bug 601535" href="https://bugzilla.mozilla.org/show_bug.cgi?id=601535" target="_blank">Bug 601535</a>. All this in addition to four other courses for my current semester and working at two places. Now the question arises, &#8220;why in the heck do I have so much on my plate?&#8221;</p>
<p><span id="more-255"></span></p>
<p>Well for it&#8217;s obvious <strong>advantages</strong>.</p>
<ul>
<li>By working with more than one bug, I can divert my attention to another bug when waiting on one. It also helps me re-think and come to a possible solution when working on something else. Something like a <a title="Eureka!" href="http://en.wikipedia.org/wiki/Aha!_effect" target="_blank">Eureka! effect</a>.</li>
<li>I get to keep myself busy. I can often be quite restless and want to do random things. All these work keeps me busy.</li>
<li>I can keep myself on the edge and help also improve myself.</li>
<li>The little pay from the work helps pay for my bills at the bar and keeps me sane from all the stress. <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </li>
<li>It is kinda fun doing it.</li>
</ul>
<p>All these work also have their own <strong>disadvantages</strong>.</p>
<ul>
<li>It can be over-whelming at times. This means that it can affect my social life.</li>
<li>You never know how much or big of a task is in front of you until you hit the snags. This applies to picking up more than you bargained for. (I don&#8217;t think I had hit that part of being over-whelmed yet; fingers-crossed)</li>
<li>Very often you&#8217;ll be cursing and saying &#8220;I need 30 hour/day, 8 day/week to get this done!&#8221;. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=255&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/01/18/pros-and-cons-of-working-with-multiple-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>Working on Bugs for Mozilla</title>
		<link>http://steventseng.wordpress.com/2012/01/17/working-on-bugs-for-mozilla/</link>
		<comments>http://steventseng.wordpress.com/2012/01/17/working-on-bugs-for-mozilla/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 04:35:28 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[MouseLock]]></category>
		<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=246</guid>
		<description><![CDATA[If you read my previous blog post, I wanted to pick up bug 716107, which involved the suppression of warnings when users hit different keys when the browser is on fullscreen mode from a specific element. However, this bug proved too complicated for me to tackle. It does not only involve fixing code, it also [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=246&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you read my <a title="Hacking on Mozilla: Take Two, Year 2012" href="http://steventseng.wordpress.com/2012/01/12/hacking-on-mozilla-take-two-year-2012/" target="_blank">previous blog post</a>, I wanted to pick up <a title="Bug 716107" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716107" target="_blank">bug 716107</a>, which involved the suppression of warnings when users hit different keys when the browser is on fullscreen mode from a specific element. However, this bug proved too complicated for me to tackle. It does not only involve fixing code, it also involved haggling with folks from security as enabling new key strokes may open up other security bugs. (I <em>DID</em> cc myself on this bug and would like to see how they proceed, <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  ).</p>
<p>So for the past few weeks I picked two bugs on bugzilla.</p>
<ol>
<li><a title="Bug 601535" href="https://bugzilla.mozilla.org/show_bug.cgi?id=601535" target="_blank">Bug 601535</a> - This is a refactoring bug, where I had to go through all the code in the content/media folder for cases where arithmetic operations can cause overflow and make use of a &#8220;<em>helper class</em>&#8221; called CheckedInt.h to check the overflow. (This bug was partly finished by Kyle Huey)</li>
<li><a title="Bug 633602" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602" target="_blank">Bug 633602</a> &#8211; This is more of a continuation of what I did in the last four month. I will be continuing to contribute to the test suite (once a new patch on the mouselock core is reasonably done).</li>
</ol>
<div><span id="more-246"></span></div>
<p><strong>Building Firefox on Rome</strong></p>
<p>On another topic, I just got my account on &#8220;Rome&#8221;. Rome is this <em>really</em> fast machine sitting in Seneca College that can truncate the time taken to build Firefox immensely. However, there is a problem when building on the Rome server ( big surprise there, NOT!!! ). This was caused mainly due to a missing pre-requisite for building Firefox on Linux.</p>
<p>Updated: The missing library is now fixed. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a title="Rome" href="http://orbitalstation.wordpress.com/2011/11/15/rome/">Here is a blog post</a> for those who want to set up a ssh session to run builds. Note that the instructions applies to any user who wishes to build Firefox on some remote server of their own as long they have access to the server. Highly plausible scenario: users with slow Windows machine, ssh-ing to a fast Linux box to build Firefox.</p>
<p>So, I had started working on applying the patch that was landed by Kyle and I will be taking over the driver seat from there.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=246&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/01/17/working-on-bugs-for-mozilla/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>Hacking on Mozilla: Take Two, Year 2012</title>
		<link>http://steventseng.wordpress.com/2012/01/12/hacking-on-mozilla-take-two-year-2012/</link>
		<comments>http://steventseng.wordpress.com/2012/01/12/hacking-on-mozilla-take-two-year-2012/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 03:27:32 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[open source code]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=238</guid>
		<description><![CDATA[So here we are in 2012, hopefully another exciting year, and no; I will not be put back by some ancient Mayan prophecy regard 2012 to spoil it. The last four months of 2011 had been really exciting while hacking on real open source code (this does not mean the first half was boring). I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=238&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So here we are in 2012, hopefully another exciting year, and no; I will not be put back by some ancient Mayan prophecy regard 2012 to spoil it.</p>
<p>The last four months of 2011 had been really exciting while hacking on real open source code (this does not mean the first half was boring). I had actively <a title="MouseLock API" href="http://steventseng.wordpress.com/category/open-source/mouselock/" target="_blank">contributed to the MouseLock API on Firefox</a>, which is still a work in progress and I will continue further in polishing them out. However, that will be one of the project that I will be working on this semester. I hope to be able to spread out my scope and try to pick up other bugs as time pass.</p>
<p><span id="more-238"></span></p>
<p><strong>More Possible Bugs</strong></p>
<p>I do have this bug (<a title="Bug# 716107" href="https://bugzilla.mozilla.org/show_bug.cgi?id=716107" target="_blank">Bug# 716107</a>) that I got myself assigned to and I wish to work on it. I involved adding more keys to the fullscreen API such that there is no &#8220;Press ESC to Exit&#8221; warning whenever a user is interacting when the browser is in fullscreen mode. More to come on what I think about this bug.</p>
<p>I may be picking others bugs too. But, who knows. We shall see.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=238&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2012/01/12/hacking-on-mozilla-take-two-year-2012/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>
	</item>
		<item>
		<title>Optimizing CubicVR Performance Test &#8211; 0.4</title>
		<link>http://steventseng.wordpress.com/2011/12/10/optimizing-cubicvr-performance-test-0-4/</link>
		<comments>http://steventseng.wordpress.com/2011/12/10/optimizing-cubicvr-performance-test-0-4/#comments</comments>
		<pubDate>Sat, 10 Dec 2011 18:21:23 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[CubicVR 3D Engine]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=223</guid>
		<description><![CDATA[It have been a while since I got back to optimizing the Performance Test in CubicVR, as I was tied down with working on the MouseLock Implementation on Firefox (bug 633602) which is up for review with Mozilla at the moment (further blog will be made available on their status). As part of my optimization, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=223&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It have been a while since I got back to optimizing the Performance Test in CubicVR, as I was tied down with working on the MouseLock Implementation on Firefox (<a title="MouseLock Implementation on Firefox" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">bug 633602</a>) which is up for review with Mozilla at the moment (further blog will be made available on their status).</p>
<p>As part of my optimization, I was trying to recycle the canvas tag as running numerous test with their own canvas tag and scene object would demand high system resource. Additional technical details can be found on <a title="CubicVR issue 21 " href="https://github.com/cjcliffe/CubicVR.js/issues/21">issue 21 of the issue tracker for CubicVR</a>.</p>
<p><span id="more-223"></span></p>
<p>By recycling the canvas tag the code currently involves creating a new tag and initialising the CubicVR GLCore only once and every time a new test is to be executed, the scene object is recycled as well. As such, I was able to reduce the loading time that would occur between two test cases. [I also noticed that in Firefox 8, the webGL context seem to be performing faster than the older version]</p>
<p>Thus, every time when a test case finishes, the content of the canvas is copied as a DataURI source for an image tag. This means that the page becomes lighter and performs much faster.</p>
<p>I had attached the screenshot below and note that the test area is where the canvas lives now and the images below are img tag and not a canvas element:</p>
<p><a href="http://steventseng.files.wordpress.com/2011/12/cubicvr.jpg"><img class="aligncenter size-full wp-image-225" title="Recycling the canvas tag" src="http://steventseng.files.wordpress.com/2011/12/cubicvr.jpg?w=645&h=713" alt="" width="645" height="713" /></a></p>
<p><strong>Closing the Ticket</strong></p>
<p>So what&#8217;s next? I feel this ticket is mature enough to be closed unless additional problems come up. I will be pushing up the code for review and once it is satisfied, the performance test should be ready for use. Now users could start timing their test on the Performance Test. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><strong>My code here</strong> (most of the changes are on the index.html):</p>
<p><a href="https://github.com/Anachid/CubicVR.js/tree/issue21/tests/perf">https://github.com/Anachid/CubicVR.js/tree/issue21/tests/perf</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=223&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2011/12/10/optimizing-cubicvr-performance-test-0-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>

		<media:content url="http://steventseng.files.wordpress.com/2011/12/cubicvr.jpg" medium="image">
			<media:title type="html">Recycling the canvas tag</media:title>
		</media:content>
	</item>
		<item>
		<title>Running FullScreen on Mochitest</title>
		<link>http://steventseng.wordpress.com/2011/12/08/running-fullscreen-on-mochitest/</link>
		<comments>http://steventseng.wordpress.com/2011/12/08/running-fullscreen-on-mochitest/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 16:28:52 +0000</pubDate>
		<dc:creator>Steven Tseng</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[MouseLock]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://steventseng.wordpress.com/?p=216</guid>
		<description><![CDATA[After finishing the test for my bug, our professor plugged all the test together and he crashed almost all the test in the mouselock directory (not surprising to me). So, for the last two days, I was struggling to get my MouseLock test working along with other test cases with Mochitest. In my earlier post, I mentioned [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=216&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After finishing the test for my bug, our professor plugged all the test together and he crashed almost all the test in the mouselock directory (not surprising to me).</p>
<p>So, for the last two days, I was struggling to get my MouseLock test working along with other test cases with Mochitest. In my earlier post, I mentioned how I managed to get the test running using Mochitest when I am running a stand-alone file. But the problem that I am facing now is that the test must run along with other file in test suite. It seem that the enable full screen through an iframe will cause the test to time out without running any test.</p>
<p>To summarize this blog, &#8220;I GOT IT WORKING!!&#8221;. Now, let me describe how I went about doing it. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><span id="more-216"></span></p>
<p>When running all the test in a directory using mochitest, the test suite plugs them inside an iFrame (which is html frame tag), which holds each test files and executes them. iFrame does not support the full screen capability as such:</p>
<p><a href="http://steventseng.files.wordpress.com/2011/12/iframe.jpg"><img class="aligncenter size-full wp-image-217" title="iFrame fails" src="http://steventseng.files.wordpress.com/2011/12/iframe.jpg?w=645&h=139" alt="" width="645" height="139" /></a></p>
<p>After some digging around, I found this <a title="MDN - iFrame" href="https://developer.mozilla.org/en/HTML/Element/iframe">Mozilla Developer Network document that explains that iFrames</a> does not support the full screen as a standard feature.</p>
<p>However, with a lot of digging around I found that there was some other test that was done to solve this little obstacle with regard to full screen and took his code example (full credit to whoever coded those functions).</p>
<p>I had uploaded my code on github and note that this code is poorly formatted (worked on this late at night) and may be improved over time:</p>
<p>Github: <a href="https://github.com/Anachid/mozilla-central/tree/mouselock/dom/tests/mochitest/mouselock">https://github.com/Anachid/mozilla-central/tree/mouselock/dom/tests/mochitest/mouselock</a> (look for the test_DOMtree.html and file_DOMtree.html file) <strong>[EDIT: look for the test_FullScreenHarness.html, moouselock_util.js and file_DOMtree.html]</strong></p>
<p>The screenshot below shows my test working&#8230;.YEEEE!!!! (sorry for &#8220;my test&#8221;, suck at MS Paint)</p>
<p><a href="http://steventseng.files.wordpress.com/2011/12/passed.jpg"><img class="aligncenter size-full wp-image-218" title="Mochitest - Passed" src="http://steventseng.files.wordpress.com/2011/12/passed.jpg?w=645&h=465" alt="" width="645" height="465" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/steventseng.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/steventseng.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/steventseng.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/steventseng.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/steventseng.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/steventseng.wordpress.com/216/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/steventseng.wordpress.com/216/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/steventseng.wordpress.com/216/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=steventseng.wordpress.com&#038;blog=27057459&#038;post=216&#038;subd=steventseng&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://steventseng.wordpress.com/2011/12/08/running-fullscreen-on-mochitest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/916d74e6caefbddd9bdbfac50d1f2448?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">steventseng</media:title>
		</media:content>

		<media:content url="http://steventseng.files.wordpress.com/2011/12/iframe.jpg" medium="image">
			<media:title type="html">iFrame fails</media:title>
		</media:content>

		<media:content url="http://steventseng.files.wordpress.com/2011/12/passed.jpg" medium="image">
			<media:title type="html">Mochitest - Passed</media:title>
		</media:content>
	</item>
	</channel>
</rss>
