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!


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 (eg 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:

链接地址: http://www.djcxy.com/p/90788.html

上一篇: R:从栅格对象计算窗台,范围和块

下一篇: 在安装Firefox 42或更新版本的Firefox中安装未签名的XPI