MozillaZine

[solved] Example extension refuses to be installed by FF

Talk about add-ons and extension development.
eternal1
 
Posts: 4
Joined: November 29th, 2017, 6:40 am

Post Posted November 30th, 2017, 2:44 pm

I have done as written in the tutorial and no matter any tweaking (so far), I keep getting "There was an error during installation: Extension is invalid". I have googled and found a few pages (including stackoverflow) but no suggestion works. So why is this failing ?

manifest.json
Code: Select all
{
   "manifest_version": 2,
   "name": "test-0",
   "version": "0.1",
   "description": "Blabla...",
   "applications": {
      "gecko": {
         "id": "test0@mememe.com"
      }
   },
   "icons": {
      "48": "icons/border-48.png"
   },
   "content_scripts": [
      {
         "matches": ["*://*.mozilla.org/*"],
         "js": "borderify.js"
      }
   ]
}


borderify.js
Code: Select all
document.body.style.border = "5px solid red";


And "icons/border-48.png" exists as expected.
Last edited by eternal1 on November 30th, 2017, 4:49 pm, edited 2 times in total.

morat
 
Posts: 2664
Joined: February 3rd, 2009, 6:29 pm

Post Posted November 30th, 2017, 4:08 pm

Are you loading a temporary extension using the about:debugging page?

I got a simple content script extension working.

* manifest.json

Code: Select all
{

  "manifest_version": 2,
  "name": "Tweaks",
  "description": "Personalize Mozilla Firefox.",
  "version": "1.0",
  "applications": {
    "gecko": {
      "id": "tweaks@abracadabra.com"
    }
  },
  "icons": {
    "48": "icons/icon48.png"
  },
  "content_scripts": [
    {
      "matches": [
        "http://forums.mozillazine.org/*"
      ],
      "js": [
        "content/disableSmoothScrolling.js"
      ],
      "run_at": "document_start"
    }
  ]

}

* content\disableSmoothScrolling.js

Code: Select all
var target;
window.addEventListener("mousedown", function (mouseEvent) {
  if (mouseEvent.button != 1) {
    return;
  }
  target = mouseEvent.target;
  mouseEvent.preventDefault();
  mouseEvent.stopPropagation();
}, true);

eternal1
 
Posts: 4
Joined: November 29th, 2017, 6:40 am

Post Posted November 30th, 2017, 4:48 pm

Yes, I'm loading temporary through "about:debugging" page. Anyway, I just realized I misread the "content_scripts.js" property which should be an array and not a single string apparently. Thanks for the reply.

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 2 guests