8

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!

Makyen
  • 31,849
  • 12
  • 86
  • 121
gal007
  • 6,911
  • 8
  • 47
  • 70
  • 1
    Without code, this question may be off-topic: Questions seeking debugging help ("**why isn't this code working the way I want?**") must include: A) the desired behavior; B) a specific problem or error *and* C) **the shortest code necessary to reproduce it** all ***in the question itself***. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable Example](http://stackoverflow.com/help/mcve), [What topics can I ask about here?](http://stackoverflow.com/help/on-topic), and [ask]. – Makyen Mar 17 '16 at 04:03
  • Have you tried other add-ons? Other known-working add-ons from which you have removed the signatures? Have you looked at the browser error console to see what it says? If so, what does it say? – Makyen Mar 17 '16 at 04:07
  • It is happening with all my old extensions in all the versions up to Firefox for Android 42 – gal007 Jul 30 '16 at 13:39
  • Do you have an *.xpi* of your add-on, or a simple "hello world" example (i.e. a [mcve]) which you could give us a pointer to for download in order to test (e.g. a GitHub repository with the files and *.xpi*). The first step in helping to solve your problem is to be able to duplicate it. Without such a download, there is a considerably higher amount of effort to begin looking for a solution. – Makyen Jul 30 '16 at 18:28
  • Hmm... Regarding, your last comment (and the title of your question): You comment says it is happening in FF versions *up to* FF42. Yet, in your question, you state that on FF40 it is working as you expect. The problem in your question is stated to be on FF46 and FF48. However, your question title states FF42, but FF42 is not mentioned in the question. This has left me a bit confused as to on what versions of FF you are having a problem. In addition, you do not specify which version(s?) of Android you are using to test (different for the two devices???). Knowing that may be helpful. – Makyen Jul 30 '16 at 18:57
  • @Makyen I will update an example project tomorrow, but it is something that you can replicate with any not signed xpi, even a hello world. The problem is not the operating system, in fact, when I change the versions of Firefox in my device, it works on 42 but not onwards – gal007 Jul 30 '16 at 22:02
  • 1
    In the desktop browser there is the `about:debugging` site which allows temporary addon loading, but this is not available in FF Beta/Nightly for Android as it seems. – mxlse Aug 06 '16 at 00:28
  • @gal007, If my answer solves your problem, please accept it, and/or manually award the bounty. If you do not, the bounty will merely disappear. – Makyen Aug 07 '16 at 09:54

1 Answers1

5

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:

Makyen
  • 31,849
  • 12
  • 86
  • 121
  • There's a simpler solution to install unsigned XPI: https://superuser.com/a/1191271/141314 – Noam Manos Mar 22 '17 at 15:47
  • 1
    @NoamManos, Thanks for the pointer. [I'm aware of that method, as I have an answer detailing it](http://stackoverflow.com/questions/31952727/how-can-i-disable-signature-checking-for-firefox-add-ons/42403531#42403531). This question and answer are specifically about Firefox for Android. Have you tested that method on Android, or are you just assuming that it will work? – Makyen Mar 22 '17 at 15:56