在Android版本42或更新版本的Firefox中安装未签名的XPI [英] Installing unsigned XPIs in Firefox for Android version 42 or newer

查看:377
本文介绍了在Android版本42或更新版本的Firefox中安装未签名的XPI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试重新开发一个旧的项目,一个针对Android的Firefox的扩展,我正在开发。我有两部电话,一部是个人电话,一部是我的工作。在我的我有一个老版本的Firefox(40)。它的工作原理与之前一样。但是,在我工作电话的升级版本(Firefox 46)中,我无法安装 .xpi 。我总是看到阻止的插件弹出式窗口,文本为Firefox阻止在您的设备上安装插件:

[

点击/选择您的 .xpi 在这种情况下,这是 view-source.xpi



将显示Blocked Add-on对话框。这个对话框可以选择允许安装。 [你可以通过在中设置 xpinstall.whitelist.required false 来跳过这个对话框。配置。但是,这仍然不会让你通过直接导航到使用意图的文件安装,或者将其输入到Firefox UI]:



然后,询问您是否要安装未经验证的附加组件的对话框:



之后,执行安装:


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

这篇关于在Android版本42或更新版本的Firefox中安装未签名的XPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆