<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9010435</id><updated>2011-11-09T20:54:20.576-08:00</updated><title type='text'>Mozilla + Firefox extension development</title><subtitle type='html'>In this blog, I try to accumulate tips from my limited experience in writing extensions for Mozilla and Firefox. The information contained in this blog is not official nor guaranteed by me to be correct.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>12</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9010435.post-110674878738338650</id><published>2005-01-26T06:11:00.000-08:00</published><updated>2006-01-20T02:52:22.870-08:00</updated><title type='text'>Showing Javascript errors in chrome code</title><content type='html'>You can get Firefox to show Javascript errors  in chrome code by turning on the javascript.options.showInConsole  preference.  (Which can be done simply by visiting &lt;a class="moz-txt-link-freetext" href="about:config"&gt;about:config&lt;/a&gt; in the  browser.)&lt;br /&gt;&lt;br /&gt;Another useful preference to turn on is javascript.options.strict, which   sends lots of warnings to the console.&lt;br /&gt;&lt;br /&gt;(Thanks to Rob Miller for these tips!)&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-110674878738338650?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/110674878738338650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=110674878738338650' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110674878738338650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110674878738338650'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2005/01/showing-javascript-errors-in-chrome.html' title='Showing Javascript errors in chrome code'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-110140968700498220</id><published>2004-11-25T11:00:00.000-08:00</published><updated>2004-11-25T11:08:07.003-08:00</updated><title type='text'>Passing objects between a Javascript-based XPCOM component and its client</title><content type='html'>XPCOM IDL allows you to pass parameters of certain types only (e.g., string, integer), in addition to objects with XPCOM interfaces (e.g., nsISupports). In order to pass anything else (e.g., a Javascript array, a Java object) from the client of a Javascript-based XPCOM component into the component, you need to wrap the object to be passed in another XPCOM object implemented using Javascript:&lt;br /&gt;&lt;br /&gt;function WrapperClass(object) {&lt;br /&gt;    this.wrappedJSObject = this;&lt;br /&gt;    this.object = object;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;WrapperClass.prototype = {&lt;br /&gt;    QueryInterface : function(iid) {&lt;br /&gt;        if (!iid.equals(Components.interfaces.nsISupports)) {&lt;br /&gt;            throw Components.results.NS_ERROR_NO_INTERFACE;&lt;br /&gt;        }&lt;br /&gt;        return this;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now you can call the first XPCOM component passing in any kind of object by wrapping it first:&lt;br /&gt;    theComponent.foo(new WrapperClass(theObject))&lt;br /&gt;And inside foo(), the wrapped object can be retrieved as follows:&lt;br /&gt;    foo : function(arg) {&lt;br /&gt;        var theActualObject = arg.wrappedJSObject.object;&lt;br /&gt;    }&lt;br /&gt;In the interface definition of theComponent (in your IDL file), you need to declare that foo() takes an nsISupports parameter.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-110140968700498220?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/110140968700498220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=110140968700498220' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110140968700498220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110140968700498220'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/passing-objects-between-javascript.html' title='Passing objects between a Javascript-based XPCOM component and its client'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-110070173228817571</id><published>2004-11-17T05:53:00.001-08:00</published><updated>2004-11-19T09:45:55.263-08:00</updated><title type='text'>Build your Firefox extension with Ant</title><content type='html'>You need to download 4 things:&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;Ant, from &lt;a href="http://ant.apache.org/"&gt;http://ant.apache.org/&lt;/a&gt;.&lt;/li&gt;   &lt;li&gt;Gecko SDK, from&lt;br /&gt;&lt;a href="ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.3/"&gt;ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.3/&lt;/a&gt;&lt;br /&gt;or whichever is the latest version. Expand it to a directory, say C:\Tools\gecko-sdk.&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;Netscape build tools, from&lt;br /&gt;&lt;a href="http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip"&gt;http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip&lt;/a&gt;.&lt;br /&gt;Expand it to a directory, say C:\Tools\buildtools.&lt;/li&gt;   &lt;li&gt;Ant-contrib tasks (of which we want the "foreach" task), from&lt;br /&gt;&lt;a href="http://ant-contrib.sourceforge.net/"&gt;http://ant-contrib.sourceforge.net/&lt;/a&gt;.&lt;br /&gt;You only need to extract the .jar file from the download and put it in the lib subdirectory of your Ant installation.&lt;br /&gt;&lt;/li&gt; &lt;/ul&gt; Structure your Firefox extension's source directory as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;your-extension-dir/&lt;ul&gt;&lt;li&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;build.xml&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;do.bat&lt;br /&gt;        &lt;/span&gt;&lt;/li&gt;       &lt;li&gt;src/&lt;ul&gt;&lt;li&gt;install.rdf&lt;/li&gt;&lt;li&gt;chrome/&lt;ul&gt;&lt;li&gt;content/&lt;br /&gt;&lt;ul&gt;&lt;li&gt;contents.rdf&lt;/li&gt;&lt;li&gt;*.xul, *.js,&lt;/li&gt; &lt;/ul&gt;&lt;/li&gt;&lt;li&gt;locale/&lt;ul&gt;&lt;li&gt;en-US/&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;skin/&lt;ul&gt;&lt;li&gt;classic/&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;/ul&gt;            &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;components/&lt;ul&gt;&lt;li&gt;*.idl&lt;/li&gt;&lt;li&gt;*.js&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;defaults/&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;       &lt;li&gt;build/ (containing intermediate generated files)&lt;/li&gt;&lt;li&gt;dist/ (containing the final distribution XPI file)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;The build.xml file should look like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;?xml version="1.0" ?&amp;gt;&lt;br /&gt;&amp;lt;project name="&lt;span style="color: rgb(102, 0, 204);"&gt;your-project-name&lt;/span&gt;" default="createDistributionXPI"&amp;gt;&lt;br /&gt;    &amp;lt;!-- Tool directories : *** Make sure you fix these to match your own environment *** --&amp;gt;&lt;br /&gt;    &amp;lt;property name="gecko_sdk_path" location="&lt;span style="color: rgb(102, 0, 204);"&gt;C:\Tools\gecko-sdk&lt;/span&gt;" /&amp;gt;&lt;br /&gt;    &amp;lt;property name="buildtools_path" location="&lt;span style="color: rgb(102, 0, 204);"&gt;C:\Tools\buildtools&lt;/span&gt;" /&amp;gt;&lt;br /&gt;   &lt;br /&gt;    &amp;lt;!-- Derived tool directories --&amp;gt;&lt;br /&gt;    &amp;lt;property name="xpidl_exe" location="${gecko_sdk_path}/bin/xpidl.exe" /&amp;gt;&lt;br /&gt;    &amp;lt;property name="IDLs_path" location="${gecko_sdk_path}/idl" /&amp;gt;&lt;br /&gt;    &amp;lt;property name="libIDL_path" location="${buildtools_path}/windows/bin/x86" /&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;!-- Project directories --&amp;gt;&lt;br /&gt;    &amp;lt;property name="src_dir" location="./src" /&amp;gt;&lt;br /&gt;    &amp;lt;property name="build_dir" location="./build" /&amp;gt;&lt;br /&gt;    &amp;lt;property name="dist_dir" location="./dist" /&amp;gt;&lt;br /&gt;    &amp;lt;property name="components_dir" location="${src_dir}/components" /&amp;gt;&lt;br /&gt;   &lt;br /&gt;    &amp;lt;!-- Custom tasks --&amp;gt;&lt;br /&gt;    &amp;lt;taskdef resource="net/sf/antcontrib/antcontrib.properties"/&amp;gt;&lt;br /&gt;   &lt;br /&gt;    &amp;lt;!-- Targets --&amp;gt;&lt;br /&gt;    &amp;lt;target name="createChromeJAR"&amp;gt;&lt;br /&gt;        &amp;lt;zip destfile="${build_dir}/${ant.project.name}.jar" update="true"&lt;br /&gt;            basedir="${src_dir}/chrome"&lt;br /&gt;            includes="content/**, locale/**, skin/**"&lt;br /&gt;            /&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;target name="createComponentInterfaceXPTs"&amp;gt;&lt;br /&gt;        &amp;lt;foreach target="compileIDL" param="idl_file"&amp;gt;&lt;br /&gt;            &amp;lt;path&amp;gt;&lt;br /&gt;                &amp;lt;fileset dir="${src_dir}/components" includes="*.idl" /&amp;gt;&lt;br /&gt;            &amp;lt;/path&amp;gt;&lt;br /&gt;        &amp;lt;/foreach&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;   &lt;br /&gt;    &amp;lt;target name="compileIDL"&amp;gt;&lt;br /&gt;        &amp;lt;exec executable="${xpidl_exe}" dir="${build_dir}"&amp;gt;&lt;br /&gt;            &amp;lt;env key="Path" path="${env.Path};${libIDL_path}" /&amp;gt;&lt;br /&gt;            &amp;lt;arg line="-m typelib -w -v -I ${IDLs_path} -I ${components_dir} ${idl_file}" /&amp;gt;&lt;br /&gt;        &amp;lt;/exec&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;   &lt;br /&gt;    &amp;lt;target name="createDistributionXPI" depends="createChromeJAR, createComponentInterfaceXPTs"&amp;gt;&lt;br /&gt;        &amp;lt;zip destfile="./dist/${ant.project.name}.xpi" update="true"&amp;gt;&lt;br /&gt;            &amp;lt;zipfileset dir="${build_dir}" includes="${ant.project.name}.jar" prefix="chrome" /&amp;gt;&lt;br /&gt;            &amp;lt;zipfileset dir="${src_dir}/components" includes="*.js" prefix="components" /&amp;gt;&lt;br /&gt;            &amp;lt;zipfileset dir="${build_dir}" includes="*.xpt" prefix="components" /&amp;gt;&lt;br /&gt;            &amp;lt;zipfileset dir="${src_dir}/defaults" includes="**" prefix="defaults" /&amp;gt;&lt;br /&gt;            &amp;lt;zipfileset dir="${src_dir}" includes="install.rdf" /&amp;gt;&lt;br /&gt;        &amp;lt;/zip&amp;gt;&lt;br /&gt;        &amp;lt;copy file="${dist_dir}/${ant.project.name}.xpi" tofile="${dist_dir}/${ant.project.name}.xpi.zip" /&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;&amp;lt;/project&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;property name="buildtools_path" location="&lt;span style="&gt;&lt;property name="xpidl_exe" location="${gecko_sdk_path}/bin/xpidl.exe"&gt;&lt;property name="IDLs_path" location="${gecko_sdk_path}/idl"&gt;&lt;property name="libIDL_path" location="${buildtools_path}/windows/bin/x86"&gt;&lt;property name="src_dir" location="./src"&gt;&lt;property name="build_dir" location="./build"&gt;&lt;property name="dist_dir" location="./dist"&gt;&lt;taskdef resource="net/sf/antcontrib/antcontrib.properties"&gt;&lt;target name="createChromeJAR"&gt;&lt;target name="createComponentInterfaceXPTs"&gt;&lt;target name="compileIDL"&gt;&lt;exec executable="${xpidl_exe}" dir="${build_dir}"&gt;&lt;target name="createDistributionXPI" depends="createChromeJAR, createComponentInterfaceXPTs"&gt;&lt;zip destfile="./dist/${ant.project.name}.xpi" update="true"&gt;&lt;zipfileset includes="${ant.project.name}.jar" prefix="chrome" dir="${build_dir}"&gt;&lt;zipfileset includes="*.js" prefix="components" dir="${src_dir}/components"&gt;&lt;zipfileset includes="*.xpt" prefix="components" dir="${build_dir}"&gt;You need to change the 3 strings in blue toward the beginning of the file to match your project's name and your tool installations. Note that the dist/ directory will contain both an XPI file and a ZIP file. The ZIP file is just a copy of the XPI file with a .ZIP extension so that you can use WinZip to open it up and inspect its content.&lt;br /&gt;&lt;br /&gt;Finally, you should create a batch file in your project's directory that looks something like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;call c:\Tools\apache-ant-1.6.2\bin\ant&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;"C:\Program Files\Mozilla Firefox\firefox.exe"&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;One more note: it's probably convenient to put a link to your project's XPI file on Firefox's toolbar because you will need to reinstall the extension many times:&lt;br /&gt;&lt;/zipfileset&gt;&lt;/zipfileset&gt;&lt;/zipfileset&gt;&lt;/zip&gt;&lt;/target&gt;&lt;/exec&gt;&lt;/target&gt;&lt;/target&gt;&lt;/target&gt;&lt;/taskdef&gt;&lt;/property&gt;&lt;/property&gt;&lt;/property&gt;&lt;/property&gt;&lt;/property&gt;&lt;/property&gt;&lt;/property&gt;&lt;ul&gt;   &lt;li&gt;Navigate Firefox to the dist/ directory containing the XPI (not to the XPI itself)&lt;/li&gt;   &lt;li&gt;Drag the link to the XPI file to the toolbar&lt;/li&gt; &lt;/ul&gt;Oh, if you delete a file in your src directory, it might still be stuck on one of the generated zip files. Make sure to delete all files in the build and dist directory for a clean build.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-110070173228817571?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/110070173228817571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=110070173228817571' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110070173228817571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110070173228817571'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/build-your-firefox-extension-with-ant.html' title='Build your Firefox extension with Ant'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-110069958357439815</id><published>2004-11-17T05:53:00.000-08:00</published><updated>2004-11-17T05:53:03.576-08:00</updated><title type='text'></title><content type='html'>http://ant-contrib.sourceforge.net/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-110069958357439815?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/110069958357439815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=110069958357439815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110069958357439815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110069958357439815'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/httpant-contrib.html' title=''/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-110046506627351573</id><published>2004-11-14T13:42:00.000-08:00</published><updated>2006-07-06T03:28:47.966-07:00</updated><title type='text'>Find xpidl.exe in Gecko SDK for compiling IDL files</title><content type='html'>If you are writing a new XPCOM component and need to use xpidl.exe to compile your IDL files, you can find &lt;span style="color: rgb(51, 0, 153);"&gt;xpidl.exe&lt;/span&gt; in the Gecko SDK, the latest version of which is here:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.3/&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Yes, you can alternatively download the whole freaking mozilla codebase just to build &lt;span style="color: rgb(51, 0, 153);"&gt;xpidl.exe&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;But hold on, it's not done yet. &lt;span style="color: rgb(51, 0, 153);"&gt;xpidl.exe&lt;/span&gt; probably complains that it can't find &lt;span style="color: rgb(51, 0, 153);"&gt;libIDL-0.6.dll&lt;/span&gt; in the path. You need to download the Netscape build tools,&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;unzip them into some temporary folder, say &lt;span style="color: rgb(51, 0, 153);"&gt;C:\buildtools&lt;/span&gt;, and include &lt;span style="color: rgb(51, 0, 153);"&gt;C:\buildtools\windows\bin\x86&lt;/span&gt; in your path.&lt;br /&gt;&lt;br /&gt;And then &lt;span style="color: rgb(51, 0, 153);"&gt;xpidl.exe&lt;/span&gt; will whine some more, e.g., it can't read &lt;span style="color: rgb(51, 0, 153);"&gt;nsISupports.idl&lt;/span&gt; and &lt;span style="color: rgb(51, 0, 153);"&gt;nsrootidl.idl&lt;/span&gt;. Just copy those files from &lt;span style="color: rgb(51, 0, 153);"&gt;gecko-sdk\idl&lt;/span&gt; over to your current directory and try to compile again.&lt;br /&gt;&lt;br /&gt;By the way, this is how I was told to run &lt;span style="color: rgb(51, 0, 153);"&gt;xpidl.exe&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;xpidl.exe -m typelib -w -v -I $XPIDL_INC -o nsIMyInterface nsIMyInterface.idl&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Setting &lt;span style="color: rgb(51, 0, 153);"&gt;XPIDL_INC&lt;/span&gt; to include &lt;span style="color: rgb(51, 0, 153);"&gt;gecko-sdk\idl&lt;/span&gt; doesn't seem to help.&lt;br /&gt;&lt;br /&gt;Isn't Open Source wonderful? All the information you need is out there, all for free. You just need to spend 20 hours to find them, and your life has just been reduced by 40 days due to frustration. By the end of those 20 hours, you can't even remember what you initially set out to do.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-110046506627351573?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/110046506627351573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=110046506627351573' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110046506627351573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110046506627351573'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/find-xpidlexe-in-gecko-sdk-for.html' title='Find xpidl.exe in Gecko SDK for compiling IDL files'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-110046819498218814</id><published>2004-11-14T13:30:00.000-08:00</published><updated>2004-11-15T10:03:47.763-08:00</updated><title type='text'>Resources, tutorials, samples... on developing extensions</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Web:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;http://www.mozilla.org/projects/firefox/extensions/&lt;br /&gt;&lt;br /&gt;How to write Firefox extensions:&lt;br /&gt;http://extensions.roachfiend.com/howto.php&lt;br /&gt;&lt;br /&gt;Writing Firefox/Thunderbird Extensions&lt;br /&gt;http://www.bengoodger.com/software/mb/extensions/howto.html&lt;br /&gt;&lt;br /&gt;From "the law of averages &gt;&gt; Writing Mozilla Extensions":&lt;br /&gt;http://www.yergler.net/blog/archives/2004/05/20/writing-mozilla-extensions&lt;br /&gt;&lt;a href="http://devedge.netscape.com/viewsource/2002/toolbar/"&gt;http://devedge.netscape.com/viewsource/2002/toolbar/&lt;/a&gt;&lt;br /&gt;GUID Generator: &lt;a href="http://extensions.roachfiend.com/cgi-bin/guid.pl"&gt;http://extensions.roachfiend.com/cgi-bin/guid.pl&lt;/a&gt;&lt;br /&gt;Firefox Extension RDF Generator: &lt;a href="http://ted.mielczarek.org%e2%80%a6/"&gt;http://ted.mielczarek.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Books:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;"Creating Applications with Mozilla" by David Boswell, Brian King, Ian Oeschger, Pete Collins &amp; Eric Murphy&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Miscellaneous:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;XUL Tutorial:&lt;br /&gt;http://www.xulplanet.com/tutorials/xultu/&lt;br /&gt;&lt;br /&gt;XUL Reference:&lt;br /&gt;http://www.xulplanet.com/references/&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-110046819498218814?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/110046819498218814/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=110046819498218814' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110046819498218814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/110046819498218814'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/resources-tutorials-samples-on.html' title='Resources, tutorials, samples... on developing extensions'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-109960808505342379</id><published>2004-11-04T14:33:00.000-08:00</published><updated>2004-11-04T14:41:25.053-08:00</updated><title type='text'>Cannot get to elements inside an overlay during load time</title><content type='html'>With Firefox, it seems that elements inside an overlay cannot be referenced (by document.getElementById(...)) while the parent document hasn't been fully loaded. In fact, even inside an onload handler of the parent document, document.getElementById(...) still fails to return elements inside the overlay.&lt;br /&gt;&lt;br /&gt;For initialization code (running at load time of your extension) that needs to reference elements inside an overlay, you need to hook up a load handler inside the overlay, as follows:&lt;br /&gt;&lt;pre&gt;&amp;lt;overlay&amp;gt;&lt;br /&gt;   ...&lt;br /&gt;   &amp;lt;script&amp;gt;&lt;br /&gt;       window.addEventListener("load", foo, false);&lt;br /&gt;   &amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/overlay&amp;gt;&lt;/pre&gt;The function &lt;span style="font-family: courier new;"&gt;&lt;/span&gt;foo now can use document.getElementById(...) to get elements inside the overlay.&lt;br /&gt;&lt;br /&gt;Mozilla doesn't seem to have this problem.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-109960808505342379?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/109960808505342379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=109960808505342379' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109960808505342379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109960808505342379'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/cannot-get-to-elements-inside-overlay.html' title='Cannot get to elements inside an overlay during load time'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-109960749410066370</id><published>2004-11-04T13:42:00.000-08:00</published><updated>2004-11-04T14:31:34.100-08:00</updated><title type='text'>When nothing happens</title><content type='html'>It could be that...&lt;br /&gt;&lt;ol&gt;   &lt;li&gt;Your Javascript code has syntax errors. Do you have an extra or a missing parenthesis somewhere?&lt;br /&gt;  &lt;/li&gt; &lt;/ol&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-109960749410066370?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/109960749410066370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=109960749410066370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109960749410066370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109960749410066370'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/when-nothing-happens.html' title='When nothing happens'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-109960025452037506</id><published>2004-11-04T13:18:00.000-08:00</published><updated>2006-09-25T09:57:10.260-07:00</updated><title type='text'>Reasons for Firefox hanging</title><content type='html'>If you just install some extension and Firefox hangs upon loading, it could be due to some of the following reasons:&lt;br /&gt;&lt;ol&gt;   &lt;li&gt;A file inside the extension package is misnamed. I once gave a XUL file an .RDF extension and Firefox just hung. No error message. It sat at around 14MB of memory and showed no CPU usage.&lt;/li&gt;   &lt;li&gt;Something is wrong with the extension's install.rdf file or the content\contents.rdf file. Maybe the URI of the extension is not parsed properly (see another topic on that).&lt;br /&gt; &lt;/li&gt; &lt;/ol&gt; Well, what can you do? You can delete Firefox's profile on your machine (if you don't miss your usage data) by killing the Firefox subdirectory in:&lt;br /&gt;C:\Documents and Settings\{your user id}\Application Data\Mozilla&lt;br /&gt;if you're using Windows. Perhaps there's something more specific in that directory to kill, but I haven't investigated. Note that reinstalling Firefox doesn't help.&lt;br /&gt;&lt;/your&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-109960025452037506?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/109960025452037506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=109960025452037506' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109960025452037506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109960025452037506'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/reasons-for-firefox-hanging.html' title='Reasons for Firefox hanging'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-109959758236540081</id><published>2004-11-04T11:42:00.000-08:00</published><updated>2004-11-04T12:20:35.126-08:00</updated><title type='text'>onload event only fires on top XUL element in Firefox</title><content type='html'>In Firefox, it seems that you can only hook up onload event handlers for the topmost element of a XUL file. onload event does not fire for the other elements in a XUL file or for any element in an overlay file.&lt;br /&gt;&lt;br /&gt;Instead of,&lt;br /&gt;  &lt;pre&gt;    &amp;lt;someElement onload="..."&amp;gt;&lt;br /&gt;      ...&lt;br /&gt;    &amp;lt;/someElement&amp;gt;&lt;br /&gt;&lt;/pre&gt;use,&lt;br /&gt;  &lt;pre&gt;    &amp;lt;someElement&amp;gt;&lt;br /&gt;      &amp;lt;script&amp;gt;...&amp;lt;/script&amp;gt;&lt;br /&gt;      ...&lt;br /&gt;    &amp;lt;/someElement&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-109959758236540081?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/109959758236540081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=109959758236540081' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109959758236540081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109959758236540081'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/onload-event-only-fires-on-top-xul.html' title='onload event only fires on top XUL element in Firefox'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-109959620853069199</id><published>2004-11-04T11:17:00.000-08:00</published><updated>2006-03-28T08:57:35.283-08:00</updated><title type='text'>Calling Java code in custom JARs from Javascript</title><content type='html'>This is perhaps the easiest way to call Java code in your own custom JAR files from Javascript code in your extension:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   var cl = new Packages.java.net.URLClassLoader(&lt;br /&gt;       [&lt;br /&gt;           new Packages.java.net.URL(&lt;br /&gt;               'http://foo.net/bar.jar')&lt;br /&gt;       ]&lt;br /&gt;   );&lt;br /&gt;&lt;br /&gt;   var aClass = Packages.java.lang.Class.forName("HelloWorld", true, cl);&lt;br /&gt;   var aStaticMethod = aClass.getMethod("getGreeting", []);&lt;br /&gt;   var greeting = aStaticMethod.invoke(null, []);&lt;br /&gt;   alert(greeting);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you would rather include your JAR file in your extension package, you might need to map a chrome URL to a file path, which can be done using jslib.&lt;br /&gt;&lt;br /&gt;Please beware that the code above might freeze the browser for a short while as the JVM loads.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-109959620853069199?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/109959620853069199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=109959620853069199' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109959620853069199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109959620853069199'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/calling-java-code-in-custom-jars-from.html' title='Calling Java code in custom JARs from Javascript'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9010435.post-109959540780955903</id><published>2004-11-04T11:01:00.000-08:00</published><updated>2007-02-01T22:32:50.596-08:00</updated><title type='text'>URIs of extensions</title><content type='html'>Beware that the URI of your extension as specified in the contents.rdf file in the content\ directory of your extension package might cause your extension to fail upon loading.&lt;br /&gt;&lt;br /&gt;Both Mozilla and Firefox seem to have problems dealing with URIs that contain period "." and slashes "/" as well as long URIs. A URI like this one,&lt;br /&gt;    "urn:mozilla:package:edu.mit.csail.haystack.myExtension",&lt;br /&gt;doesn't sit well with Mozilla and Firefox.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9010435-109959540780955903?l=mozilla-firefox-extension-dev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mozilla-firefox-extension-dev.blogspot.com/feeds/109959540780955903/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9010435&amp;postID=109959540780955903' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109959540780955903'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9010435/posts/default/109959540780955903'/><link rel='alternate' type='text/html' href='http://mozilla-firefox-extension-dev.blogspot.com/2004/11/uris-of-extensions.html' title='URIs of extensions'/><author><name>David Huynh</name><uri>http://www.blogger.com/profile/01612047712556657165</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://people.csail.mit.edu/people/dfhuynh/images/david-bw2.jpg'/></author><thr:total>2</thr:total></entry></feed>
