Unable to install my own extension


(Schobbeschorle9) #1

can’t install my own Extension on Firefox 64. I tested it succesfully in debug mode. Now I have big problems while installing: Corrupted! I don’t know what to do. Studied all documentation. No success. I zipped the whole folder with all files and renamed it into *.xpi!

File structure

icons/cancel.png 
close.js 
install.rdf 
install.xpi 
manifest.json

close.js

function sleep(milliseconds) {
    var start = new Date().getTime();
    for (var i = 0; i < 1e7; i++) {
      if ((new Date().getTime() - start) > milliseconds){
        break;
      }
    }
  }

sleep(1000);
if (
    (
      document.documentElement.textContent || document.documentElement.innerText
    ).indexOf('Live your life') > -1
  ) {
    window.close(); 
}

Run code snippet

Expand snippet

manifest.json

    {
    "manifest_version": 2,
    "name": "pm",
    "version": "1.0",
    "description": "Schließt nach 121 Sekunden",
    "content_scripts": [
      {
        "matches": ["*://*/"],
        "js": ["close.js"]
      }
    ],
    "icons": 
        {
            "64": "icons/cancel.png"
        }
    }

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>xyz@gmx.de</em:id>
    <em:version>1.0</em:version>
    <em:type>2</em:type>

    <!-- Angaben zu unterstützten Anwendungsversionen --> 
    <em:targetApplication>
      <Description>
        <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        <em:minVersion>1.5</em:minVersion>
        <em:maxVersion>64.*</em:maxVersion>
      </Description>
    </em:targetApplication>

    <!-- Sichtbare Daten -->
    <em:name>sample</em:name>
    <em:description>A test extension</em:description>
    <em:creator>Your Name Here</em:creator>
    <em:homepageURL>http://www.example.com/</em:homepageURL>
  </Description>      
</RDF>

(Martin Giger) #2

An install.rdf is unused in Firefox these days. You do not need it.

Further, all XPIs have to be signed on addons.mozilla.org in release and beta versions of Firefox. In non-release versions a preference has to be toggled to allow installation of unsigned extensions.

As https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Testing_persistent_and_restart_features notes, you may also need to set an ID in your manifest.json.

Lastly, ensure that all your files are in the top level directory of the zip.


(Schobbeschorle9) #3

Helped!!! Thank you so much… AddOn is in review. :smiling_face_with_three_hearts::smiling_face_with_three_hearts::smiling_face_with_three_hearts::smiling_face_with_three_hearts: