DeniPa
DeniPa

Reputation: 41

Why does my bootstrapped Firefox extension cause errors?

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 [email protected]: Error opening input stream (invalid filename?): jar:file:///C:/Users/Stefan/AppData/Roaming/Mozilla/Firefox/Profiles/dlgniy94.default/extensions/[email protected]!/bootstrap.js

1447258032068 addons.xpi WARN Add-on [email protected] is missing bootstrap method uninstall

1447258032080 addons.xpi WARN Error loading bootstrap.js for [email protected]: Error opening input stream (invalid filename?): jar:file:///C:/Users/Stefan/AppData/Roaming/Mozilla/Firefox/Profiles/dlgniy94.default/extensions/[email protected]!/bootstrap.js

1447258032080 addons.xpi WARN Add-on [email protected] 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 [email protected] 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>[email protected]</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

Upvotes: 4

Views: 784

Answers (0)

Related Questions