views:

164

answers:

2

My application installs a Firefox add-on (by copying an .xpi to [FF_inst_dir]\extensions).

This application periodically has updates (.xpi with new version).

How it can be installed correct (how do I use update.rdf)?

+1  A: 

Your question is a bit vague for me to give you an exact answer, so the best I can do is point you to the official documentation on this: https://developer.mozilla.org/en/Extension_Versioning,_Update_and_Compatibility

However, I will add that by far the easiest way to get an extension installed and updating automatically is to use addons.mozilla.org. Otherwise, you will have to provide your own update server that uses SSL (which means you'll either have to buy or self-sign an SSL certificate). It is not undoable (I have done it once, but too long ago for me to remember the details), but it is perhaps more trouble than it's worth, considering the existence of this easy alternative.

If you don't want to go through the hassle of having it reviewed by Mozilla, you can still host it on addons.mozilla.org: it will just be marked as experimental and only available for logged-in users to install.

smehmood
Thanks for mentioning AMO, by the time I got done copying the ridiculous sample, I felt like there wasn't any room left for mentioning it, but it is definitely the better way to go.
Anthony
I develop Windows application. This application install FF add-on also and interacts with it over COM and XPCOM. This application periodically download new version of that add-on and have to install it. I have to install and update my add-on manually.
cpp_fanatic
+1  A: 

Have you looked at the Mozilla Developer article "Extension Versioning, Update and Compatibility"?

Basically, your install manifest needs to have an updateURL that points to an update RDF. The update RDF will have a list of each version available and what version of the Mozilla app it is compatible with. Here's a really abridged version of their example:

<?xml version="1.0" encoding="UTF-8"?>

<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:em="http://www.mozilla.org/2004/em-rdf#"&gt;
  <RDF:Description about="urn:mozilla:extension:[email protected]">
    <em:updates>
      <RDF:Seq>
        <RDF:li>
          <RDF:Description>
            <em:version>2.2</em:version>
            <em:targetApplication>
              <RDF:Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.5</em:minVersion>
                <em:maxVersion>2.0.0.*</em:maxVersion>
                <em:updateLink>https://www.mysite.com/foobar2.2.xpi&lt;/em:updateLink&gt;
             <em:updateInfoURL>http://www.mysite.com/updateinfo2.2.xhtml&lt;/em:updateInfoURL&gt;
              </RDF:Description>
            </em:targetApplication>
          </RDF:Description>
        </RDF:li>
        <RDF:li>
          <RDF:Description>
            <em:version>2.5</em:version>
            <em:targetApplication>
              <RDF:Description>
                <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
                <em:minVersion>1.5</em:minVersion>
                <em:maxVersion>2.0.0.*</em:maxVersion>
                <em:updateLink>http://www.mysite.com/foobar2.5.xpi&lt;/em:updateLink&gt;
           <em:updateHash>sha1:78fc1d2887eda35b4ad2e3a0b60120ca271ce6e6</em:updateHash>
              </RDF:Description>
            </em:targetApplication>
          </RDF:Description>
        </RDF:li>
      </RDF:Seq>
    </em:updates>
  </RDF:Description>
</RDF:RDF>

So basically your install manifest points to this file, and when Firefox opens up, it checks that file to see if the version of the add on is the newest version listed in the update RDF. The update RDF is just a list of versions in order of release, with basic info like what version of Firefox it is compatible with and any other details you want to throw in.

Anthony