Installing unsigned XPIs in Firefox for Android version 42 or newer

前端 未结 1 1911
梦如初夏
梦如初夏 2021-01-05 06:40

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 v

相关标签:
1条回答
  • 2021-01-05 07:36

    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:

    0 讨论(0)
提交回复
热议问题