Trouble Packaging Firefox Extension - firefox

I have followed a couple different links that show how to package Firefox extensions. In cfx, my extension runs exactly how I want it. I made my install.rdf and zipped my files, changing the file type to xpi. When I install it in live Firefox, it shows up in my installed extensions, but nothing happens. I have also tried just using the base install.rdf that they post as a sample, but no luck. What am I missing here?
Here's one guide I've been working off of.

You should be using cfx xpi to package your addons, not the docs you pointed to. As #Noitidart pointed out, there are reasons to unpackage that xpi file and repackage it, and that is mentioned in the above link.
There are three ways to make extensions for Firefox. When you're using the add-on SDK (one of the ways), make sure all the docs you're reading are under the developer.mozilla.org/en-US/Add-ons/SDK/ path.
Note that Firefox is making the move from cfx to jpm, so unless you need your extensions to be available on AMO very soon, you should use jpm.

Related

How do I convert a package.json to install.rdf for a Firefox add-on?

I've got a working add-on for Firefox, which was built using the cfx tool. The tool is being depracated in favor of jpm from Firefox 38 onwards. I followed the instructions to make the switch, but while running, I get the term undefined often, even though the add-on works just fine.
JPM undefined Starting jpm run on Magnetz
Creating XPI
JPM undefined XPI created at C:\Temp\example#add-on-1.0.0.xpi (133ms)
Created XPI at C:\Temp\example#add-on-1.0.0.xpi
JPM undefined Creating a new profile
Someone in the forums suggested that the undefined comes from an install.rdf file, which I don't have. I only have a package.json, which is what the cfx-based process requires.
Looking at the contents of typical install.rdf files, it seems to contain more or less the same data as a package.json. Is there any way to convert the package.json to install.rdf?
I've actually not been able to find a recently updated install.rdf for add-ons, with most links talking about the older XUL-based add-ons.
I'm also confused about why a Python-based tool (cfx) favors a JavaScript-based package.json file, whereas the newer JavaScript-based tool (jpm) favors an arguably deprecated XML-based install.rdf.
There is a guide for transitioning to jpm from cfx here. In short, you do not have to create your own install.rdf file, both cfx and jpm create one for you. Install.rdf is an old crufty xml file, but it is necessary for the extension to work at all in Firefox.
The package.json file has a field 'Title' that you can add in order to provide a 'display name' for your add-on - this replaces the older 'fullName' field.
As for the 'JPM undefined' message you see - I think that's actually a bug in JPM.

How to troubleshoot Firefox Addon: could not be installed because it is not compatible with Firefox <x.x.x.x>

I created a simple extension based on an existing one, but when I try to test it and add to Firefox manually I get this general error message:
<Extension Name> could not be installed because it is not compatible with Firefox <x.x.x.x>
How can I troubleshoot this?
I even tried setting maxVersion to a high value in install.rdf.
<em:maxVersion>150</em:maxVersion>
If you have verified that you have the correct minVersion and maxVersion, the other thing that can cause this is an invalid updateURL.
The Firefox bug about this is https://bugzilla.mozilla.org/show_bug.cgi?id=740378
If you are planning to host your add-on on addons.mozilla.org, you do not need an updateURL and if you are in the process of developing an add-on, there should be no updateURL in your install.rdf at all.
If minVersion and maxVersion are correct but your extension still doesn't install then these values are probably overridden. In addition to the values in install.rdf Firefox will also look up the update URL of your extension and get updated compatibility information from there. This information takes priority over whatever you specify in install.rdf.
If you specify an updateURL explicitly then you should update the information in the file it points to and clear the browser cache. If you don't specify an updateURL then by default it points to addons.mozilla.org. If an extension with the same ID and version number is found on addons.mozilla.org then its compatibility information is taken over. If that's the case then changing the version number in install.rdf to something unknown to addons.mozilla.org should be sufficient (obviously, you should also change extension ID of the extension hosted on addons.mozilla.org isn't yours).
Plus there is the bug mentioned by Mike Kaply of course - bad error message if an insecure updateURL is specified and no updateKey.
Your max version should look something like:
<em:maxVersion>17.*</em:maxVersion>
That indicates the max version of Firefox that supports the extension. Firefox 150 is a long way off! ;-)
Do you have the source code posted anywhere? I'd be glad to take a look. I've written a couple of Firefox extensions now, so I'm sure I can help.
First, check https://support.mozilla.org/en-US/kb/unable-install-add-ons-extensions-or-themes to see if any of those reasons apply.
With the release of Firefox 57 (14 Nov 2017), developers can no longer build "legacy" add-on .xpi files locally and load them in Firefox, only add-ons built using the webextensions API will load.
Hope this helps :)

updateURL and updateLink don't work in my addon

I was reading the cfx tool documentation, about how to create an addon and make it autoupdade automaticaly. Unfortunately when I compile my addon to an xpi file with this line:
cfx xpi --update-link "http://mypage.com/firefox/latest"
--update-url "http://mypage.com/firefox/update_rdf"
I always get complains that the resulting xpi file is incompatible with Firefox 12.0. When I remove the --update-link and --update-url arguments the xpi file works. Am I missing something?
I saw this answer but unfortunately that solutions didn't work for me.
Two things you should do:
Make sure you are using the latest version of the Add-on SDK. Add-on SDK 1.7 declares the add-ons as compatible with Firefox 12 and 13, previous versions didn't.
Make sure to upload the generated update.rdf file to http://mypage.com/firefox/update_rdf, you probably have an older file there. This file also contains compatibility information for the extension and Firefox trusts this information more than install.rdf inside the extension (this is useful to mark an extension as compatible with a newer Firefox version without actually updating the extension package).

firebreath firefox plugin not found MACOSX

I have been following the following firebreath tutorial:
http://www.firebreath.org/display/documentation/Mac+Video+Tutorial
And in the second video, After i have built my plugin and i am including the ScreenTutorialPlugin.plugin file in the /Library/Internet/Plug-ins section, it doesn't show in firefox, when i go check it in about:plugins, it just doesnt show. But in the terminal when i go check /Library/Internet/Plug-ins, it does show.
when i open a plugin file and it opens in the browser, it says that the plugin doesnt work.
i think this has to do with the file linking part ln -s in the /plug-ins section.
or could the reason be that i use 3 different browsers? safari,firefox and chrome.
Thank you
With the information provided it is difficult to be certain what your issue is, but here are a few things to consider / understand:
FireBreath plugins are NPAPI plugins and thus should work on all three of the browsers you mentioned
The path where it should be installed is "/Library/Internet Plugins", not "/Library/Internet/Plugins" and if you have actually placed it in the latter directory as you indicated and that isn't a typo then this is definitely part of your issue
using ln -s should work if you create a symlink to the actual .plugin directory, but if it doesn't you can always try copying the file itself
If everything built correctly you should have a binary called (plugin name).plugin/Contents/MacOS/(plugin name) where (plugin name) is the name of your plugin
Hopefully some of this helps; if it doesn't, please provide more information about what you have tried and we'll try to help some more. What you are doing definitely should work -- I use plugins created by FireBreath on Mac every day.

Turning a browser plugin into an XPI

I have a very old (1992) browser plugin for a mac that works in several different browsers. However, since Firefox restricted its plugins to XPI files in Firefox 3.6, the plugin no longer works.
I haven't been able to find a useful document describing what I need to do to my plugin to make it an XPI, or at least loadable by firefox, can anyone point me at such a document? or just explain to me what I need to do? I'm using Xcode.
Brain; the problem is most likely that in Firefox 3.6 they removed support for XPCOM interfaces on npapi plugins. you need to use npruntime instead.
http://colonelpanic.net/2010/01/firefox-3-6-has-removed-support-for-xpcom-plugins/
You could also consider using FireBreath to rewrite it with, as that abstracts a lot of the details.
So if this is an NPAPI plugin, you can just create a simple XPI (it's a ZIP file):
your-plugin.xpi/
install.rdf
plugins/
your-plugin.dylib
This follows from the https://developer.mozilla.org/en/Bundles page I linked earlier.
You can create the install.rdf by reading and following the install.rdf reference page on MDC or just generate a stub extension using something like
Extension Wizard (here's a "more official" version on addons.mozilla.org, but I haven't used that) and take the install.rdf from it.
You should probably limit the extension to Mac in your install.rdf (for that you'll have to read the install.rdf reference).
[original answer was:] What technology does the plugin use? XPI is a packaging mechanism; the answer to your question depends on whether the technology you use is still supported in Firefox 3.6.
I didn't think there were cross-browser plugin technologies, that worked in 1992 and are still in use now, so it's hard to guess what kind of plugin you're talking about.

Resources