How to use firefox "hello world" sample extension? - firefox

I downloaded this Firefox sample extension from mozilla.org, I modified the file install.rdf and changed maxVersion value to 3.6.10 (also tried 3.6.*, 100 and *) and I added a new string with name "hello world" and the value is the path where the folder of the sample extension is to HKCU (also tried HKLM)/Software/Mozilla/Firefox/Extensions/ into the registry.
I start Firefox, go to Tools > Addons, and it says it needs to restart, I restart and go there again and the plugin appears but says "Not compatible with Firefox 3.6.10", and every button appears disabled. Also removing the registry key and folder doesn't uninstall it.
Is there something else I have to change to use the hello world sample in Firefox 3.6.10?

Update 2018
This sample extension was created in 2000s and Firefox switched to a radically different extension system called "Web Extensions" in 2017. The old extensions will not work in the current versions of Firefox and have to be rewritten completely.
The easiest way to start developing an extension is putting a "pointer" file in the extensions folder in the profile directory. I wouldn't touch the registry method until the deployment moment.
Thanks for reminding me to update the example extension. Updated it now.

Basically, the best way to use an extension is to package the addon in .xpi format. Then you just have to open this addon with Firefox. Note:To make an .xpi , take all the contents of helloworld like content,locale,skin,install.rdf,chrome.manifest etc and try to zip it but change the extension to .xpi instead of .zip. Otherwise u can just rename ur helloworld folder to helloworld#xyz.com and then copy this folder into C:\Users\"OS user name"\AppData\Roaming\Mozilla\Firefox\Profiles\h31hcfq9.default\extensions and then restart ur browser. Also, it would be best to learn about addon development with this Basic tutorial on addon development

The procedure to create sample firefox extension can be found on this link. This tutorial explains how to create a Firefox extension to find all links in the current web page, highlight those which have a target attribute and alert you how many links it found.

Related

How to change Chromium browser logo and name?

I've built the Chromium browser on my Windows from its source code (Github) by following this documentation. After doing this successfully, I've a chrome.exe file which is able to launch the browser (see screenshot).
The next thing I want to implement is to change the logo and name of Chromium (say, MyBrowser) everywhere on the browser. I'm stuck at this step. Is there any way to achieve this by modifying the code or replacing the icon?
You will have to make lots of changes. Before replacing these files, please make sure the files that you are replacing with matches the resolution and format too.
If you want to change the logo of Chromium then replace these files with yours
src/chrome/app/theme/chromium/product_logo_22_mono.png
src/chrome/app/theme/chromium/product_logo_24.png
src/chrome/app/theme/chromium/product_logo_48.png
src/chrome/app/theme/chromium/product_logo_64.png
src/chrome/app/theme/chromium/product_logo_128.png
src/chrome/app/theme/chromium/product_logo_256.png
src/chrome/app/theme/default_100_percent/chromium/product_logo_16.png
src/chrome/app/theme/default_100_percent/chromium/product_logo_32.png
src/chrome/app/theme/default_100_percent/chromium/product_logo_name_22.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_16.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_32.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_name_22.png
src/chrome/app/theme/default_200_percent/chromium/product_logo_name_48.png
src/chrome/app/theme/chromium/win/tiles/Logo.png
src/chrome/app/theme/chromium/win/tiles/SmallLogo.png
Then replace this icon file:
For Windows:
src/chrome/app/theme/chromium/win/chromium.ico
For macOS:
src/chrome/app/theme/chromium/mac/app.icns
To change the name of the browser and messages displayed in Chromium, open and modify these files
src/chrome/app/theme/chromium/BRANDING
src/chrome/app/generated_resources.grd
src/chrome/app/chromium_strings.grd
You should replace Chromium or Chrome references from the above files with your brand

Automated Addon, Settings Installation for Firefox with Ansible

I am currently trying to install firefox addons with Ansible.
I found a role for ansible on ansible galaxy, I fixed to work with the latest ansible version (minor python2/3 issue):
Fixed version:
https://github.com/cyborg-x1/ansible-firefox
The Ansible role downloads the xpi file and puts it in the extension folder.
But two issues:
1. Issue
If the .mozilla/firefox/randomString.default-release folder does not exist, it creates it, but then Firefox on the first start creates another directory .mozilla/firefox/randomString.default-release-1 and does not use the directory except selected by profile manager.
2. Issue
The addons are placed in the extension folder, but when starting up they are disabled.
Anoying to do that for > 6 addons.
I tried to to see what changes when I enable the addons by putting a git repo over the ~/.mozilla folder. Multiple files are created the main responsible is a json one where it puts the rights. If I copy that file and just put that in later, it seems NoScript works, but not uMatrix which does not work at all: button with no icon, no reaction when pressing the button.
I also found the way to use /usr/share/mozilla to install addons globally. Problem is, this way, according to documentation, requires to have the addon uid, but that file mentioned (don't recall the name atm) is not present in latest addons of Firefox. So I can not put the appropriate folder name for the addon. Just placing the xpi files there, does nothing at all.
Also on the mozilla docs there is a way mentioned with -install-addon-globally which I tried with firefox executable and the addon file -- no success.
Any Ideas how to solve those issues?
Something that I just need to write in there and they run their installation stuff, what actually seems to be missing when just placing that file.
The first issue could be solved, if I just could run firefox once and close it, then the folder would be there and I can write into it but there is no command line option which terminates firefox after starting, so for Ansible I would need timeout to kill it if it does not return - (I think that's an ugly solution btw)
Any ideas or suggestions?
Thanks for any help!
You can create a firefox installer bundled with the extensions:
https://support.mozilla.org/en-US/kb/deploying-firefox-with-extensions

Best way to install a firefox extension on the shell

I want to create a new profile with an addon preinstalled.
What works:
run firefox a first time.
add the addon.xpi to profile/extensions/addon.xpi.
edit profile profile/extensions.ini and add Extension0=/full/path/to/extension.xpi.
start firefox again.
What i need:
add the addon to profile/extensions/addon.xpi.
edit extensions.ini or something similiar.
use only relative paths, if possible (seems not to be implemented for extensions.ini)
Finally i want to create a zip file with some firefox preferences/addons, which can be unziped into a profilefolder to create a fresh profile with some preinstalled stuff. For this, it would be important, that everything works with relative paths. If it is definitely not possible, i can add some script to it. But i would prefer some "just unzip" solution.
I think it may be a bit harder, because mozilla wanted to prevent other software from adding toolbars and similiar to firefox by making external addon installation harder. What i already found is the key extensions.autoDisableScopes=0.
What you can do is open firefox with command line options. And pass the file path to your xpi file, so you don't have to mess with all this internals you are over there.
So do this:
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "C:\my.xpi"
and on launch it will open a tab and prompt to install your addon.
In the prefs.js:
pref("extensions.autoDisableScopes", 14); // 0x1 not set
See https://developer.mozilla.org/en-US/Add-ons/Installing_extensions#Disabling_install_locations
Then put the addons into extensions/myaddonid.xpi, making sure the filename is the id given in the install.rdf file inside the addon.xpi (zip-)file as <em:id>addon_id</em:id> tag.
On the next start the addons will be silently installed. Some addons needed one restart to work, at least the toolbar buttons were not added on the first start.
Not sure, if this will still work, when firefox decides to allow only addons signed by addons.mozilla.org. On the other hand, they will allow self-hosting addons, as soon as they are signed by AMO, so preinstalling addons downloaded from there will have a good chance.

Is it necessary to pack firefox extension files into an xpi even on development?

I am developing an extension for Mozilla Firefox. Is there any way in which I can develop without packing the files into an xpi for every change I make (like in Chrome)?
Yes. To do this, first close Firefox.
Then create a file in your profiles extensions directory that has the same ID as your extension.
In that file, you should place the fully qualified path to where you are developing your extension. In particular, to the same directory as the install.rdf.
When Firefox is restarted, it should ask you if you want to install the extension. Once you've done that, the extension will run from the local copy. After you make changes, you just need to close and restart the browser.
For more information, check this page out:
https://developer.mozilla.org/en-US/docs/Setting_up_extension_development_environment
I also recommend you install the Developer Assistant - https://addons.mozilla.org/en-US/firefox/addon/extension-developer/ - which will set some prefs that make it easier to create Firefox extensions.

Quick and easy question for Firefox add-on devs

I am following the instructions here to make my development environment for firefox:
https://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/
and everything is working great.
On the page as you can see there is one instruction:
Point your Firefox extensions directory to your extension
Instead of constantly preparing and
reinstalling your extension, there’s a
simple way to add a pointer from your
Firefox extensions directory to your
code location. To do this, you must
first find your profile directory: ...
And that too is working great!
My question is:
When I make changes to the JS file in the dev directory, do I have to keep restarting FF for the changes to take effect? Because when I create an extension in Chrome there is a simple link that says "reload" and clicking that reloads the extension without me needing to restart the browser... does any such functionality exist for FF?
Thanks!
R
Extension Developer extension has an option to reload chrome. Doing that should reload your extension without restarting Firefox.
It really depends on the JavaScript files. XPCOM components and JavaScript modules load only once, there you unavoidably need to restart when you change them. JavaScript files loaded via <script> tags are only valid for the window that loaded them - opening a new window will do to load a fresh copy of the script. All that will only work correctly if -purgecaches command line option is specified as other people noted already.

Resources