is there possibility to add extension to firefox in developer mode? - firefox-addon

I mean without compressing it to *.xpi. Other browsers like chrome or opera understand when I drag a folder with extension files from system explorer to therirs addon-manager tab, but firefox, when I unpack *.xpi and try to install it as a folder shows : "This addon could not be installed because it appears corrupt" message.
Reason for this that when I try to change the code I must every time to pack my source files to xpi and then refresh the extension. Other way, like in chrome, the browser automatically updates extension when files were changed.

You need to create an extension proxy file. The file is placed in your extensions directory in your profile. It should be named as the id field of your addon. Inside this file you put a single line with the actual path of the source.
Before copying the proxy file you should uninstall the corresponding xpi addon you may have installed.
Check this page for more resources on setting up your dev environment.

Related

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?
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
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
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.

Cross platform way to get icon of firefox exe

I'm trying to get the path to the default firefox executable cross platform.
I tried the way recommended here:
https://stackoverflow.com/a/24056586/1828637
However its not working on mac os or linux
on mac it shows this: http://i.imgur.com/xu5GrF8.png
on linux (tested on ubuntu 14) it shows this: http://i.imgur.com/QxWKxbH.png
I was hoping to get the .xpm on linux and the .icns on mac os and the .ico on windows which is the container file, meaning like not just .ico of the single 64x64 image but contain all files please.
Thanks
Your title and question ask two different things, which is a bit confusing. I am not clear on if you want just a way to find the Firefox executable, or a way to extract the currently used (or default?) icon from Firefox.
Icon files:
If you are just looking for a URL to use within Firefox, they should be located at:
chrome://branding/content/icon128.png
chrome://branding/content/icon64.png
chrome://branding/content/icon32.png
chrome://branding/content/icon16.png
They do not appear to exist in .ico files within the Firefox distribution. In fact there are only 4 .ico files in the entire distribution. They are all within the browser/omni.ja file at (windows assumed as primary based on your statements in prior questions):
chrome\browser\skin\classic\browser\customizableui\customizeFavicon.ico
chrome\browser\skin\classic\aero\browser\customizableui\customizeFavicon.ico
chrome\browser\skin\classic\browser\preferences\in-content\favicon.ico
chrome\browser\skin\classic\aero\browser\preferences\in-content\favicon.ico
omni.ja files are just zip format files with the extension changed to .ja instead of .zip. You can change the file extension back to .zip and read it with any appropriate archive handler.
The chrome:// URLs are:
chrome://skin/customizableui/customizeFavicon.ico
chrome://skin/preferences/favicon.ico
I think you can only get access to two of them at a time through chrome://skin/ depending on if you are using aero. If you really need access to both you could use nsiZipReader to open the actual omni.ja file.
Executable file:
You already had a batter way to get the executable file. From your comment it is:
FileUtils.getFile('XREExeF', []);

Anchor for Firefox extensions?

I have a Firefox addon available for my website. I add the download link of the addon to a simple , but when an user click it, it prompts him to download the .XPI file of the addon - Is there any way so I can pop-up the normal EXTENSION INSTALL window for my addon? Is there any special thing to do that or this is available only in addons.mozilla.org?
You can use the InstallTrigger object. Also, you should be using application/x-xpinstall MIME type for your extension file, this will trigger installation even if InstallTrigger isn't used (e.g. JavaScript disabled).

Running a packaged exe in the same folder as the installed firefox add-on

I have read this thread, and some other
How to run a local exe in my firefox extension
The problem is, at deployment and using firefox 4.0.1, if I install the .xpi extension, the xpi is put inside the \Profiles...\extensions as ****.xpi, which is a compressed format
All the solutions assume that the the extension is put in a folder, thus they are accessing the folder as is, which I cannot do
for example this guy says
//**** get profile folder path ****
var dsprops = Components.classes['#mozilla.org/file/directory_service;1']
.getService(Components.interfaces.nsIProperties);
var ProfilePath = dsprops.get("ProfD", Components.interfaces.nsIFile).path;
//**** initialize file ****
var file = Components.classes["#mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(ProfilePath);
//**** append each step in the path ****
file.append("extensions");
file.append("guid");
file.append("sample.exe");
guid in my case is installed as {f13b157f-b174-47e7-a34d-4815ddfdfeb8}.xpi which cannot be accessible this way
First of all, please do not locate files like this - you are making lots of assumptions about the directory structure of the Firefox profile, any of those could turn out false in a future Firefox version (or even in uncommon extension setup scenarios). See Reference a binary-component to js-ctypes instead for code to locate a file in your extension install directory, simply replace components/linux/myLib.so by sample.exe and execute uri.file.
Second: that's a scenario where packed XPI installation won't work unless you want to extract your executable into a temporary file before running it (which will be complicated). Windows doesn't support running executables from ZIP archives. So you need to add <em:unpack>true</em:unpack> to your extension's install.rdf to ensure that it is installed as an unpacked directory.
The best answer is to get flashgot Firefox addon , which contanins already executable inside , and is open source , and , study it , this is great way to observe how this actually works. Based on this , You can make as much as You wish addons with executable inside , or add entire program as FF addon. I hope this helps , even if this answer is rather than outdated.

Firefox extension development - reference to extension path

I develop a firefox extension for configuration printer automatically. I want to create a configuration file at where extension was installed. can anybody help me?
You do not actually want to store it where your add-on is installed because if you ever need to update the add-on, the configuration file will be overwritten. What you really want to do is to place the configuration file in the profile directory or in a folder you create inside the profile directory.

Resources