Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install my own firefox extension

I am new to FF extensions development. I work on Windows OS. I am using web extensions. I started my first extension. I created a directory in My Documents which contains my extension files. The files are based on the example in: Your First WebExtension which are: manifest.json, icons/myicon.png, myextension.js. Like the example, all what the extension does is a border aroud mozilla page. This is the js code: document.body.style.border = "5px solid red";

When I come to installing the extension in my browser, I navigated to:about:debugging then I clicked in the Load Temprary Addon button and I selected the the .js file. I get this error: There was an error during installation: Extension is invalid. Can you point what the problem is?

like image 656
user7945230 Avatar asked May 01 '17 08:05

user7945230


People also ask

How do I install a custom Firefox extension?

Press Alt + f > o > browse to the extension > double click the extension (or select Open) > Install Now. Method: Drag the extension to the instance of Firefox on the taskbar > wait for Firefox to appear > drop onto the browser window > Install Now.

How do I add an XPI file to Firefox?

Drag that XPI into the Firefox browser to install it. Or use File > Open File to install it. Windows doesn't recognize that file type, but Firefox does. Drag that XPI into the Firefox browser to install it.

Where does Firefox install extensions?

Most add-on data is stored in a folder in the Firefox user profile. However, some information is stored in the profile folder also. It's possible that there is a problem with the file(s) that store the extensions registry. Type about:support in the address bar and press enter.


3 Answers

Most likely an error in the manifest.json file. Double-check that code; if it all looks good, try temporarily removing optional things from it, then removing-and-reloading your addon in the debugger until it works. Then you can narrow down what's up (hard to say exactly, without seeing your code). The most minor error in the JSON will result in the addon failing to load (such as an out-of-place bracket, etc).

See also: Anatomy of a WebExtension

like image 126
Beejor Avatar answered Nov 15 '22 13:11

Beejor


Problem with my setup was incorrect use of content_scripts.matches, correct solution for a "match-all" is

"matches": ["*://*/"],

Attribution : https://discourse.mozilla.org/t/web-extensions-noob-getting-there-was-an-error-during-installation-extension-is-invalid/12828/3

like image 42
shad0w_wa1k3r Avatar answered Nov 15 '22 12:11

shad0w_wa1k3r


The problem was that extensions must be saved in specific directory. In winows, the directory is: C:\Users\"YourUser"\AppData\Roaming\Mozilla\Firefox\Profiles\"YourFireFoxProfile"\extensions After that, try the steps I mentioned in the original post and you should find the extension added.

like image 38
user7945230 Avatar answered Nov 15 '22 13:11

user7945230