<?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>Web 3.0, 6 Bladed Razors, 7 Minute Abs &#187; Firefox</title>
	<atom:link href="http://www.zachleat.com/web/tag/firefox/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zachleat.com/web</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 17:09:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Minor Annoyances with Firefox Development</title>
		<link>http://www.zachleat.com/web/minor-annoyances-with-firefox-development/</link>
		<comments>http://www.zachleat.com/web/minor-annoyances-with-firefox-development/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 20:39:40 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[Web Browsers]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2008/03/23/minor-annoyances-with-firefox-development/</guid>
		<description><![CDATA[When you&#8217;re developing web applications in Firefox, do you find yourself constantly clearing your cache? Cache is a useful facet of web browsing for everything but the continuous testing environment of web development. Here&#8217;s a nice alternative so that you don&#8217;t have to disable your cache entirely: Use the Firefox Plug-In called (humorously enough) JohnnyCache. [...]]]></description>
			<content:encoded><![CDATA[<p>When you&#8217;re developing web applications in Firefox, do you find yourself constantly clearing your cache?  Cache is a useful facet of web browsing for everything but the continuous testing environment of web development.  Here&#8217;s a nice alternative so that you don&#8217;t have to disable your cache entirely:</p>
<p>Use the Firefox Plug-In called (humorously enough) <a href="https://addons.mozilla.org/en-US/firefox/addon/3817"><strong>JohnnyCache</strong></a>.  I added the pattern &#8216;http://localhost/&#8217; to my preferences and now I don&#8217;t have to worry about cache on my local machine anymore.  Simple, easy, effective.</p>
<p>Now only if I knew how to disable the Firefox preference that autopopulates form fields with default values when F5 is hit to refresh the page.  Try creating a page with a single text field, type a value into the form, and then hit F5 to refresh the page.  Your value will be prefilled into the form.</p>
<p>I find myself always hitting &#8220;CTRL+L&#8221; (goes to the Location Bar) and &#8220;Enter&#8221; to avoid that one.  I looked through about:config, but only found: signon.prefillForms (related to usernames and passwords), and browser.formfill.enable (related to autocomplete dropdowns for forms, not default values).</p>
<p>Anyone know an easier method?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/minor-annoyances-with-firefox-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with Looping through window.setInterval</title>
		<link>http://www.zachleat.com/web/problems-with-looping-through-windowsetinterval/</link>
		<comments>http://www.zachleat.com/web/problems-with-looping-through-windowsetinterval/#comments</comments>
		<pubDate>Mon, 24 Dec 2007 03:46:24 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Browsers]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Timers]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/12/23/problems-with-looping-through-windowsetinterval/</guid>
		<description><![CDATA[Look at this code. What do you expect to be the outcome? var d = new Date&#40;&#41;; var r = &#91;&#93;; for&#40;var j=0,k=2;j&#60;k ;j++&#41; &#123; window.setInterval&#40;function&#40;&#41; &#123; var next = new Date&#40;&#41;; r.push&#40;next.getTime&#40;&#41; - d.getTime&#40;&#41;&#41;; &#125;,1000&#41;; &#125; Every 1000 milliseconds (1 second), the r array should have three delta timestamps added into it (one for [...]]]></description>
			<content:encoded><![CDATA[<p>Look at this code.  What do you expect to be the outcome?</p>
<p><span id="more-104"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> r <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>k<span style="color: #339933;">=</span><span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>j<span style="color: #339933;">&lt;</span>k <span style="color: #339933;">;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    window.<span style="color: #660066;">setInterval</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> next <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        r.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span>next.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> d.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Every 1000 milliseconds (1 second), the <code>r array should have three delta timestamps added into it (one for each interval set in the for loop).  In FireFox, however, there are exactly nine delta timestamps added per second.  If you set <code>k=10</code>, the result is one hundred delta timestamps per second.  If anyone has the answer, I am curious, even if the result is that I'm an idiot.  It seems to work correctly in Internet Explorer 7.  Thanks for your help, internet.</k></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/problems-with-looping-through-windowsetinterval/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Cross Domain XHR with Firefox 2</title>
		<link>http://www.zachleat.com/web/cross-domain-xhr-with-firefox/</link>
		<comments>http://www.zachleat.com/web/cross-domain-xhr-with-firefox/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 23:40:20 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Browsers]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Firefox]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/08/30/cross-domain-xhr-with-firefox/</guid>
		<description><![CDATA[By now know you know that trying to do an XMLHttpRequest (XHR or AJAX) call to a domain that is different from the domain of the hosted JavaScript in Firefox will throw an exception. Error: uncaught exception: Permission denied to call method XMLHttpRequest.open If you don&#8217;t want a history of the past solutions, page down [...]]]></description>
			<content:encoded><![CDATA[<p>By now know you know that trying to do an XMLHttpRequest (XHR or AJAX) call to a domain that is different from the domain of the hosted JavaScript in Firefox will throw an exception.</p>
<p><code>Error: uncaught exception: Permission denied to call method XMLHttpRequest.open</code></p>
<p>If you don&#8217;t want a history of the past solutions, page down to see the final solution.</p>
<p>The web has solutions to this problem, but most of them involve changing your JavaScript code, which I thought to be less than ideal.  A common solution involves setting the UniversalBrowserRead security property in your JavaScript code [<a href="http://almaer.com/blog/archives/000794.html">Dion Almaer</a>, of Ajaxian fame]:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">netscape.<span style="color: #660066;">security</span>.<span style="color: #660066;">PrivilegeManager</span>.<span style="color: #660066;">enablePrivilege</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'UniversalBrowserRead'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The problem with that solution (obviously) lies in single browser proprietary JavaScript polluting your code.  And you have to set this property inside the scope of any usage (ie: inside your library file that does your AJAX calls and inside your callbacks, etc).</p>
<p>Why can&#8217;t it just be as easy as Internet Explorer?  They just pop-up a little security dialog asking you if you want to allow this access (which is also what the <code>enablePrivilege</code> function does as well).</p>
<p>Another solution involves setting the <code>capability.policy.default.XMLHttpRequest.open</code> preference inside your prefs.js Firefox preference file [<a href="http://blog.dirolf.com/2007/06/enabling-cross-domain-ajax-in-firefox.html">Mike Dirolf</a>].  This worked as desired and allowed the AJAX call, but anytime you attempt to access the resulting XML you received a nice exception as well.  It turns out this is the solution we wanted, it&#8217;s just incomplete.</p>
<h2><a name="solution">The Final Solution</a></h2>
<ol>
<li>Close Firefox.  It will overwrite your changes to the prefs.js file if you have it open.</li>
<li><em>Optional step</em>: This approach will open up your Firefox security quite a bit, so I&#8217;d recommend setting up a separate profile in Firefox to use when testing.  It will <strong>not </strong>pop up a security dialog when a cross-domain AJAX call is made.</li>
<li>Find your prefs.js file.  In Windows, it is typically located in the <code>C:\Documents and Settings\{YOUR_USERNAME}\ApplicationData\Mozilla\Firefox\Profiles\{YOUR_TEST_USER_PROFILE_ID}\prefs.js</code></li>
<li>Open it up and add the following lines:

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.open&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.CDATASection.nodeValue&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.Element.attributes&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.Element.childNodes&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.Element.firstChild&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.Element.getElementsByTagName&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.Element.tagName&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.HTMLCollection.length&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.HTMLCollection.item&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.Text.nodeValue&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLDocument.documentElement&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLDocument.getElementsByTagName&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.channel&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.open&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.responseText&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.responseXML&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.send&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
user_pref<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;capability.policy.default.XMLHttpRequest.setRequestHeader&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;allAccess&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

</li>
</ol>
<p>This code was copied (with the exception of 1 line) from a source repository at [<a href="http://svn.kryogenix.org/filedetails.php?repname=kryogenix.org&#038;path=%2Fjackfield%2Ftrunk%2Fhtmlui%2Fprefs.js&#038;rev=0&#038;sc=0">kryogenix.org</a>]<br />
used in jackfield.  It wasn&#8217;t intended to be used for this purpose, but it works.</p>
<p>If you still get <code>Error: uncaught exception: Permission denied to call method _________</code> errors, you can add the method to your prefs.js.  I would appreciate a comment with any commonly used methods not included above.  Thanks.</p>
<p><strong>Update:</strong> Because this article is deprecated (applies to an older version of Firefox), I&#8217;m updating the blog title in the interest of minimizing the number of disappointed users.  Some might think this is a stupid thing to do, since it&#8217;s the most popular page on my blog, but I&#8217;m more interested in helping people than getting traffic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/cross-domain-xhr-with-firefox/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>JavaScript Code Coverage Tool for Firebug</title>
		<link>http://www.zachleat.com/web/javascript-code-coverage-tool-for-firebug/</link>
		<comments>http://www.zachleat.com/web/javascript-code-coverage-tool-for-firebug/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 20:08:06 +0000</pubDate>
		<dc:creator>Zach Leatherman</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Web Browsers]]></category>
		<category><![CDATA[Code Coverage]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Selenium]]></category>

		<guid isPermaLink="false">http://www.zachleat.com/web/2007/04/18/javascript-code-coverage-tool-for-firebug/</guid>
		<description><![CDATA[Download FirebugCodeCoverage-0.1.xpi Recently, I&#8217;ve become interested in client side automated testing tools. When I found the Selenium plug-in for Firefox, I was blown away. I can record actions in my browser and play them back! No more manual testing of JavaScript code! Researching a little bit more about automated testing tools led to the discovery [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zachleat.com/Projects/firebugCodeCoverage/FirebugCodeCoverage-0.1.xpi"><strong>Download FirebugCodeCoverage-0.1.xpi</strong></a></p>
<p>Recently, I&#8217;ve become interested in client side automated testing tools.  When I found the <a href="http://www.openqa.org/selenium-ide/">Selenium</a> plug-in for Firefox, I was blown away.  I can record actions in my browser and play them back!  No more manual testing of JavaScript code!</p>
<p>Researching a little bit more about automated testing tools led to the discovery of a metric called &#8216;Code Coverage&#8217;, a statistic that gives you a percentage of how much of your code executed during a certain period of time (usually while your automated test was executing).</p>
<p>Of course, I immediately thought of <a href="http://www.getfirebug.com/">Joe Hewitt&#8217;s Firebug</a> extension for Firefox, which includes a feature for JavaScript Profiling.  The Profile feature of Firebug was similar to a Function Entry Code Coverage report, so I decided to modify the feature and release an add-on for Firefox that showed (at a file level) a list of which functions executed and which functions did not.</p>
<p><img src='http://www.zachleat.com/web/wp-content/uploads/2007/04/coverage.gif' alt='coverage.gif' /></p>
<p>So, now, to test my JavaScript code coverage, I will write automated tests using the Selenium IDE plug-in for Firefox, hit the Code Coverage button in Firebug, and try to get my Code Coverage statistics in the upper 90%&#8217;s.</p>
<p>Screenshot Example of running the tool at yahoo.com<br />
<img src='http://www.zachleat.com/web/wp-content/uploads/2007/04/coverage2.gif' alt='Code Coverage' /></p>
<p><a href="http://www.zachleat.com/Projects/firebugCodeCoverage/FirebugCodeCoverage-0.1.xpi"><strong>Download FirebugCodeCoverage-0.1.xpi</strong></a>.</p>
<p><strong>Requirements (obviously)</strong></p>
<ul>
<li>Mozilla Firefox</li>
<li>Firebug Extension for Mozilla Firefox</li>
</ul>
<p><strong>Limitations</strong>:</p>
<ul>
<li>Does not include statistics on anonymous functions.</li>
<li>Is limited to function (entry) code coverage, does not include other forms such as exit, statement, condition, or path code coverage. (Description: <a href="http://en.wikipedia.org/wiki/Code_coverage">Wikipedia</a>)</li>
<li>Is my first Firefox add-on, so there was a learning curve involved.</li>
</ul>
<p><strong>Future Improvements</strong>:</p>
<ul>
<li>Automated integration with Selenium IDE (one button to run tests and do code coverage)</li>
<li>Better display of results, instead of a big kludge of function names</li>
<li>Additional types of coverage, depending on what options are available from <a href="http://www.xulplanet.com/references/xpcomref/ifaces/jsdIDebuggerService.html">jsdIDebuggerService</a></li>
</ul>
<p><strong>Update:</strong> After many requests and much self deliberation, I have decided not to update the plugin to work with newer versions of Firefox.  Code Coverage doesn&#8217;t belong in the browser, it&#8217;s just the wrong place in the tool chain to have something like this.  Code Coverage results need to be exportable, and the utility must be executable from the command line to use with unit tests and continuous integration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zachleat.com/web/javascript-code-coverage-tool-for-firebug/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>

