[Project_owners] Packaging JAR into XPI

Sudhakar Chandra thaths at openscroll.org
Thu Sep 9 10:49:10 EDT 2004


Hi,

My extension Habari Xenu is currently packaged into the XPI as a non-jar 
(i.e. in the form of files and directories).  In order to begin porting 
my extension to work with Mozilla and Firefox I am moving to jar-ing my 
extension and including this in the XPI.  I have facing a very 
frustrating problem where my XPI install fails on Mozilla (I have not 
even started testing on Firefox yet).

I would really appreciate any help.  I am sure I am making some stupid 
mistake somewhere but repeated audits of my install.js does not show me 
anything wrong.

I have placed a copy of my XPI at 
http://openscroll.org/habarixenu-0.9.0.xpi (right click, save as).  You 
could download it, unjar it and take a peek if you want.

Here is how my extension is laid out:

1. My XPI contains the following tree:

.
|-- chrome
|   `-- habarixenu.jar
|-- install.js
`-- install.rdf

2. My install.js is as follows:

const APP_NAME                          = "Habari Xenu News Aggregator";
const APP_CHROME_NAME                   = "habarixenu";
const APP_VERSION                       = "0.9.0";
const APP_FILE                          = "habarixenu.jar";
const APP_CONTENT_PATH          = "content/";
const APP_SKIN_CLASSIC_PATH     = "skin/";
const APP_LOCALE_ENUS_PATH      = "locale/en-US/";

logComment( "Installation started ..." );

var err = initInstall(APP_NAME, APP_CHROME_NAME, APP_VERSION);
logComment("initInstall: " + err);


var chromeFolder = getFolder("Current User", "chrome");
logComment("getFolder() returned: " + chromeFolder);
setPackageFolder(chromeFolder);

addFile(APP_NAME, "chrome/" + APP_FILE, chromeFolder, "");

var jarFolder = getFolder(chromeFolder,APP_FILE);
logComment("jarFolder is " + jarFolder);

logComment("Beginning registration");
registerChrome(CONTENT | PROFILE_CHROME, jarFolder, APP_CONTENT_PATH);
logComment("Registered content");

registerChrome(SKIN | PROFILE_CHROME, jarFolder, APP_SKIN_CLASSIC_PATH);
logComment("Registered Skin");

registerChrome(LOCALE | PROFILE_CHROME, jarFolder, APP_LOCALE_ENUS_PATH);
logComment("Registered Locale");

var result = getLastError();
if(result == SUCCESS) {
     performInstall();
     alert("Finished Installation.  Please restart Mozilla and\nlaunch 
Habari Xenu from 'Tools -> Habari Xenu'.");
}else{
     alert("There was an error in installation:" + err);
     cancelInstall(result);
}

3. When I try to install, the following is what gets logged in install.log:

      ** Installation started ...
      Habari Xenu News Aggregator (version 0.9.0)
      ---------------------------

      ** initInstall: 0
      ** getFolder() returned: 
/home/thaths/.mozilla/default/h3vuta92.slt/chrome/
      ** jarFolder is 
/home/thaths/.mozilla/default/h3vuta92.slt/chrome/habarixenu.jar
      ** Beginning registration
      ** Registered content
      ** Registered Skin
      ** Registered Locale
      [1/4]      Installing: 
/home/thaths/.mozilla/default/h3vuta92.slt/chrome/habarixenu.jar
      [2/4]      Register Content: 
jar:file:///home/thaths/.mozilla/default/h3vuta92.slt/chrome/habarixenu.jar!/content/
      ** InstallPackage() failed. - nsresult code: 0x80004005
      ** Failed to register chrome. - nsresult code: 0x80004005

      Install **FAILED** with error -239  --  2004-09-08 22:55:34



4. My habarixenu.jar contains the following tree:

habarixenu
|-- content
|   |-- contents.rdf
|   |-- debug
|   |   `-- debug.js
|   |-- display.js
|   |-- extuninstall
|   |   |-- contents.rdf
|   |   |-- extuninstall_api.js
|   |   |-- extuninstallapi.rdf
|   |   |-- log_dialog.js
|   |   |-- log_dialog.xul
|   |   |-- logger.js
|   |   `-- overlay.xul
|   |-- extuninstallapi.rdf
|   |-- feedparser
|   |   |-- feedparser.js
|   |   `-- test.htm
|   |-- habarixenu.js
|   |-- habarixenu.xul
|   |-- habarixenumenuoverlay.xul
|   |-- io
|   |   |-- dir.js
|   |   |-- dirUtils.js
|   |   |-- file.js
|   |   |-- fileUtils.js
|   |   |-- filesystem.js
|   |   |-- io.js
|   |   `-- rdf.js
|   |-- jslib.js
|   |-- md5
|   |   `-- md5.js
|   |-- modules.js
|   |-- settingseditor.js
|   |-- settingseditor.xul
|   `-- xhtml
|       `-- habarixenu.xhtml
|-- locale
|   `-- en-US
|       |-- MPL-1_1.txt
|       |-- about.html
|       |-- contents.rdf
|       |-- habarixenu.dtd
|       |-- samplesources.html
|       |-- settingseditor.dtd
|       `-- strings.properties
`-- skin
     |-- about.css
     |-- contents.rdf
     |-- display.css
     |-- feededitor.css
     |-- habarixenu.css
     |-- habarixenumenuoverlay.css
     |-- images
     |   |-- hx16blue.gif
     |   |-- hx16blue.png
     |   |-- logo.gif
     |   `-- xml.gif
     `-- settingseditor.css

Thanks.

Thaths
-- 
Woman: A new and better life awaits you on our distant home planet,
        Blisstonia.
Homer: Hmmm, makes sense!
Slacker Without Borders                        http://openscroll.org/
Key fingerprint = 8A 84 2E 67 10 9A 64 03  24 38 B6 AB 1B 6E 8C E4


More information about the Project_owners mailing list