4

I'm new to Firefox extension development. So I've been experimenting a bit. I'm currently trying to create a bootstrapped extension with nothing more but the bare minimum requirements: only an install.rdf and the bootstrap.js. For the moment this extension isn't supposed to actually do anything. I only want to be able to install it without any issues. The functionality can be added later.

The install.rdf and the bootstrap.js have been packed into a .zip-file with 7zip, then the file extension was changed to .xpi. The installation was done through the AddOn Manager and seems to be working perfectly in my Firefox 42.0 (Firefox give me a success message).

But if I have a look at the Error Console after the installation, it is showing several warnings/errors:

1447258032068 addons.xpi WARN Error loading bootstrap.js for Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org: Error opening input stream (invalid filename?): jar:file:///C:/Users/Stefan/AppData/Roaming/Mozilla/Firefox/Profiles/dlgniy94.default/extensions/Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org.xpi!/bootstrap.js

1447258032068 addons.xpi WARN Add-on Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org is missing bootstrap method uninstall

1447258032080 addons.xpi WARN Error loading bootstrap.js for Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org: Error opening input stream (invalid filename?): jar:file:///C:/Users/Stefan/AppData/Roaming/Mozilla/Firefox/Profiles/dlgniy94.default/extensions/Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org.xpi!/bootstrap.js

1447258032080 addons.xpi WARN Add-on Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org is missing bootstrap method install

Zeitstempel: 11.11.2015 17:07:12 Fehler: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIURI.hostPort]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource://gre/modules/PopupNotifications.jsm :: PopupNotifications_refreshPanel/< :: line 579" data: no] Quelldatei: resource://gre/modules/PopupNotifications.jsm Zeile: 583

1447258032112 addons.xpi WARN Add-on Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org is missing bootstrap method startup

I have no idea what is causing these errors/warnings. Especially the supposedly missing bootstrap methods are puzzling.

This is the content of my bootstrap.js:

const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

Cu.import('resource://gre/modules/Services.jsm');

function startup(aData, aReason) {}
function shutdown(aData, aReason) {}
function install(aData, aReason) {}
function uninstall(aData, aReason) {}

It's not much, but it should be everything that is needed, shouldn't it? All four required methods (startup(), shutdown(), install(), uninstall()) are there. (They're empty, because the addon isn't supposed to do anything yet.) So why does my Firefox 42.0 think that three of these are missing? And why doesn't it think so for the fourth (shutdown())?

Why does the installation seem to work (success message from the browser), when there are several errors?

Did I miss something important?

This is the install.rdf:

<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
  <Description about="urn:mozilla:install-manifest">
    <em:id>Test-AddOn--53d9108a-541b-4209-a62e-3809504dfe6e@example.org</em:id>
    <em:type>2</em:type>
    <em:name>Test AddOn</em:name>
    <em:version>1.0</em:version>
    <em:bootstrap>true</em:bootstrap>
    <em:description>This is a test.</em:description>
    <em:creator>Anonymous</em:creator>
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>40.0</em:minVersion>
        <em:maxVersion>45.*</em:maxVersion>
      </Description>
    </em:targetApplication>
  </Description>
</RDF>

According to https://developer.mozilla.org/en-US/Add-ons/Bootstrapped_extensions#chrome.manifest_in_bootstrapped_add-ons a chrome.manifest file "can" be used (which I assume means that it's not required).

In case you're interested in seeing the whole addon .xpi-package, I've uploaded it here: http://www.filedropper.com/testaddon

DeniPa
  • 41
  • 2
  • As a newcomer you should probably investigate jpm addons first: https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_%28jpm%29 You cna create your first addon (the sample addon) within 10 minutes after setup. If you want to know more about bootstrap after that, let me know we can get into the nitty gritty. – Noitidart Nov 11 '15 at 21:32
  • how did you create the xpi file. – Jaromanda X Nov 11 '15 at 21:35
  • The xpi file was created by packing the install.rdf and bootstrap.js into a .zip-file (using 7zip). Then I changes the file extension to .xpi. – DeniPa Nov 14 '15 at 16:34
  • What about the manifest? https://developer.mozilla.org/es/docs/Extensions/Bootstrapped_extensions#chrome.manifest_in_bootstrapped_add-ons – gal007 Feb 14 '17 at 14:46

0 Answers0