Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing unsigned XPIs in Firefox for Android version 42 or newer

I'm trying to retake an old project, an extension for Firefox for Android, I was developing. I have 2 phones, a personal one and the one of my work. In mine I have an old version of Firefox (40). It works exactly the same as it used to be. But, in the upgraded version of my work's phone (Firefox 46), I can't install the .xpi. I always see the "Blocked addon" popup with the text "Firefox prevented an add-on from installing on your device":

[1

I have the preference xpinstall.signatures.required = false. But, it seems not to work. I also have Android Debug enabled. I'm doing this:

#4 - This will copy the XPI to the phone SD card.
adb push $OUTPUT_DIR/$APP_NAME.xpi /sdcard/$APP_NAME.xpi;

#5 - This will start the Firefox App with the XPI to install
adb shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -d file:///mnt/sdcard/$APP_NAME.xpi -n $ANDROID_APP_ID/.App;

In the older version of Firefox it works; in the new one, doesn't. The reason is the following:

Our first one aims to make add-on signing a little easier for developers. This API enables you to upload an XPI and get back the signed add-on if it passes all the validation checks.

And:

Firefox 48: (Pushed from Firefox 46). Release and Beta versions of Firefox for Desktop will not allow unsigned extensions to be installed, with no override. Firefox for Android will enforce add-on signing, and will retain a preference — which will be removed in a future release — to allow the user to disable signing enforcement.

But I need to be able to program with no validation: It is very stressful having to sign an extension every single time I introduce a little change (even just for checking if something works).

I already tried to install the nightly version, because it is intended for developers. I changed xpinstall.signatures.required to false. But, the behaviour is the same message.

So, how are we supposed to develop in this way? This is so impractical!

like image 958
gal007 Avatar asked Mar 16 '16 23:03

gal007


People also ask

How do I install Firefox plugins on Android?

You can install add-ons on Android in two ways. The first one is by using the Add-ons Manager inside the app. You can find these add-ons by tapping the vertical three-dot menu on the bottom left or bottom right, depending on where your toolbar is positioned. Then, select Add-ons from the pop-up menu.

How do I open an XPI file in Firefox for Android?

How do I install an XPI file in the mobile version of Firefox? On Android devices, you can install the add-on an XPI file contains by locating the file in an Android file manager (such as File Viewer Plus or ES File Explorer), tapping it, and opening it with Firefox.

Where are my Firefox Add-ons?

Click the menu button. and choose Add-ons and Themes. The Add-ons Manager tab will open. Select the panel for the type of add-on you wish to view or manage, such as the Extensions or Themes panel.

How do I open an unsigned XPI file in Firefox?

You can load an unsigned extension by navigating in Firefox to the directory containing the .xpi file (e.g. file:///mnt/sdcard/ ), then clicking/touching the file. Thus, for adb you will want it to open the directory, not try to have Firefox open the file directly.

Why can't I install unsigned extensions in Firefox 42?

Starting with Firefox 42, Stable and Beta users won't be able to override this anymore which means that unsigned extensions cannot be installed in those browsers anymore. Nightly users of Firefox may have noticed that the browser blocks the installation of unsigned extensions as well currently.

Does Mozilla Firefox support add-on signing?

Mozilla did not make it clear previously that it would enforce add-on signing for Dev and Nightly versions of Firefox as well but this appears to be the case as the installation of unsigned add-ons is currently blocked in Firefox Nightly (currently at version 42).

How to open XPI files on Android?

If you're working with an existing addon from you PC, get the xpi onto your Android device (email it to yourself if you have no other method). Using Root Explorer (even though I'm not rooted on this tablet) or Explorer, the free version (sorry, they won't let me put more than 2 links), long-press on the xpi file and choose Open With.


1 Answers

I tested this with the Walkthrough example from MDN. I was running Firefox 48.0, release version. This answer assumes that xpinstall.signatures.required is set to false in about:config.

Add-on does not install if navigate directly to file:/// URL:
It appears that Firefox has disabled installing unsigned extensions by directly navigating to a file:/// link (I have not yet tested signed extensions.). Thus, using the adb shell am start -a android.intent.action.VIEW method of using an intent to cause Firefox to navigate to the file:///mnt/sdcard/extentionFile.xpi URL will only bring up the "Blocked Add-on" dialog, without the option to allow, of which you have included a screenshot in your question. This dialog is the same if you manually type in the URL.

You can install the add-on without it being signed:

You can load an unsigned extension by navigating in Firefox to the directory containing the .xpi file (e.g. file:///mnt/sdcard/), then clicking/touching the file.

Thus, for adb you will want it to open the directory, not try to have Firefox open the file directly. The adb command you will want to use, based on what is in your question, would be:

adb shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -d file:///mnt/sdcard/ -n $ANDROID_APP_ID/.App;

On your phone, you will then need to select the file that is $APP_NAME.xpi. You will be presented one, or more, screens through which you can click to install your add-on.

These are the screens I captured when testing this. To have an otherwise empty directory, I used /mnt/sdcard/testing/ instead of /mnt/sdcard/.

First, I used adb to navigate to the directory in Firefox (this is for convenience, you could navigate to it via the phone's user interface) using the command:

adb" shell am start -a android.intent.action.VIEW -c android.intent.category.DEFAULT -d file:///mnt/sdcard/testing/ -n org.mozilla.firefox/.App

This causes Firefox to open the directory (file:///mnt/sdcard/testing/):

Click/select your .xpi file. In this case, that is view-source.xpi.

The "Blocked Add-on" Dialog will be displayed. This dialog will have the option to "Allow" the installation. [You can skip this dialog by setting xpinstall.whitelist.required to false in about:config. But, that still won't let you install by direct navigation to the file using an intent, or typing it into the Firefox UI]:

Then, a dialog asking if you want to install an unverified add-on:

After which, the installation is performed:

like image 141
Makyen Avatar answered Sep 25 '22 21:09

Makyen