Create installable Firefox XPI for bootstrapped extension - firefox

I downloaded from addons repository a Firefox extension (url shortener), unzipped it and reworked a little bit to use another shortener service - i changed already only a url of shortening service and some names in meta - nothing of vital importance. If i try just to zip all directories and files as they are and try to install - installation fails with an alert
"This addon can't be installed - it could be corrupted"
I guess there are any troubles with zipping of it. I'm even sure, that there is a zipping problem, cause i tried to unzip the original extension, than to zip it without code changes and to install - same error alert.
Also the question is, how to create an installable XPI for the bootstrapped extension (it is:
without .jar-file,
with another directory structure,
installation
withour restart).
The structure of bootstrapped extension (which i have here) is:
/defaults
/locale
/resources
harness-options.json
locales.json
bootstrap.js
install.rdf
options.xul
I use 7-zip, but it is no problem to use any another archiving software.
Thank you for any advice!
Evgeniy

Got it done! Like it describes this answer https://stackoverflow.com/a/18992738/1992004 i zipped a whole folder, what led in error cause of a folder creation inside of archive. After i zipped only included subfolders, i got an installable xpi.

Related

how can I install package from a downloaded zip

I am behind a firewall on MS Windows and setting the proxy in my init file did not work. I can download the zip archive from GitHub, but when the package has many .el files the install-from-file does not work. I tried saving the folder as .tar but it still did not work.
How can I install the downloaded folder? There is a Makefile in the folder, but I have no make or its alternatives on Windows and will not be allowed to install them.
Prior to the migration to GitHub I was able to download a single file from Melpa and that worked fine.
a workaround is to add the package folder to your load-path and then require the package.
This will not take care of any dependencies, so watch in *Warnings* and *Messages* buffers for any problems caused by unmet dependencies.
See the details here.

Converting safari web extension from git repo not successful

I'm trying to convert a chrome web extension to a safari extension.
My environment is a Big Sur VM with XCode 12.5.1.
When I clone the extension's git repo (https://github.com/toobeeh/skribbltypo) and try to convert it with "xcrun safari-web-extension-converter skribbltypo" (from the parent folder), it only spits out the error "Unable to parse manifest at file:///..." (the path points correctly to the repo folder where the manifest lies within).
Web research tells that the issue either may be the folder being a zip (I unsuccessfully tried many ways of downloading the repo as zip, unpacking it, unpacking a signed crx,...) or the path not being correct (I also dragged the folder to the terminal and the file:/// path is correct), with no success.
Does this have to do something with the VM i'm running?
I can't believe I've done it wrong in so many ways.
I'd be glad if someone could try the process.
Thanks in advance.

Firefox Extensions and XPI installer not working

Hello Im attempting to build a Firefox extension but have run into an issue creating the XPI file,
This tutorial says that the XPI is simply a zip folder renamed, Ive taken a previously installed extension (pinterest) renamed to .zip and it will extract - I can see the plugin files no problem.
If I try and zip then rename my extension to .xpi the plugin will not install - Ive tested this with the pinterest plugin mentioned above and if I rename to zip, extract then rezip and rename back to zpi - the same code will not install. I think there is an issue with the zipping method im using (Windows 7 > Sendto > Compressed .zip)
Just to be clear - I'm not sure my plugin works properly yet, still getting a grip on the files required and naming conventions - however a working package will not work with the same zip process.
Can anyone help with this?
Was zipping from the parent location /folder/contents
Instead of from the contents location
Wokring now.

Unzipping and zipping a working .xpi makes it stop working

I downloaded the basic Hello World xpi from Mozilla, and it installed in my Firefox without any problems. Then I unistalled the addon, unzipped the xpi, then, without changing anything inside it, zipped it again using 7zip. I tried to install it, and Firefox gave me a "This addon could not be installed because it appears to be corrupt" error.
Unzipping the .xpi produces a folder with the same name as the .xpi, with its contents. To create a working .xpi, zip the contents of that folder, not the folder itself.
Credit goes to nmaier.

What file permissions are needed in an XPI?

I recently received the following comment from the reviewer of one of my add-ons at the official Mozilla Add-ons website:
The permissions in your XPI are broken. Most files and directories do not have the expected read and execute permissions, or indeed any permissions at all.
I wasn't aware that file permissions were an issue in XPI files. To my knowledge, none of the files in my XPI need the execute bit set (I only package standard stuff: XUL, JavaScript, CSS, etc). I create my XPI in Windows using the Cygwin zip tool, and since Windows knows nothing about file permissions, they aren't stored as they would be in Linux.
What file permissions are expected for file and directory entries in an XPI? The Extension Packaging page at MDN has the following quote, but no associated details on what they should be:
... you must verify that the file system permissions for the directories and files for the extension are set properly. Otherwise, the Extension Manager may not function properly with the extension or the extension itself may not work properly.
This is typically an issue if you create the extension package on Windows but the extension is used on Linux or OS X later - Windows doesn't have any file permissions to be put into a ZIP archive and unpacking on Linux or OS X sometimes creates bogus file permissions (000 rather than the usual 755 or 644). You could try using a different ZIP packer, e.g. Info-ZIP that doesn't cause such issues for me. Better yet, don't require your extension to be unpacked at all - <em:unpack> is often used but rarely really required.

Resources