Problem on deploying new WebExtension scriptly

朱旻 minmin3772 at gmail.com
Thu Nov 16 08:26:48 UTC 2017


Hi, guys from Firefox team:
      I'm a developer of FF Addon on OS X.
      Recently I've just ported my legacy Addon to new WebExtension and got
a problem.
      My addon is self-host, that is instead of uploading on AMO, I deploy
it with my own app. I used to copy signed XPI file to user's profile
folder, and it can be automatically recognized and installed by FF. Yet the
new WebExtension XPI doesn't work like that. Every time I copied it to
profile/extension folder, the XPI just disappeared after FF restart.
      I did some test on FF 52, 55, 57 and Dev 58, and found that the
old-format XPI (based on Addon SDK) can work on 52 and 55 at least. New
WebExtension even fails to install on 52 and 55, nevertheless 57 and Dev 58.
      Also, the `firefox` command does not exist after installing FF by
default, so I cannot use something like `firefox --install` either. I
wonder how can I install new WebExtension scriptly. Could anyone please
help me figure this out? Thanks a lot.

Regards, Kevin


BTW, my app runs in root privilege. I used to call a shell script like
below in my app to deploy FF Addon:


TOOLBAR_SRC="/Library/Application Support/TrendMicro/TmToolbar/extensions"
FIREFOX_IDENTIFIER="'org.mozilla.firefox'"
FIREFOX_EXT_PATH="/Library/Application
Support/Mozilla/Extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
FIREFOX_EXT_DB="/Library/Application
Support/TrendMicro/TmToolbar/Setup/extensions.sqlite"

FF_TOOLBAR_ID="iTISToolbar at trendmicro.com.xpi"
FF_TOOLBAR_PATH="$FIREFOX_EXT_PATH"/"$FF_TOOLBAR_ID"

echo "==> start installing firefox toolbar"

uninstall_firefox_toolbar

mkdir -pv "$FIREFOX_EXT_PATH"
#mkdir -pv "$FF_TOOLBAR_PATH"
cp -rf "$TOOLBAR_SRC/$FF_TOOLBAR_ID" "$FF_TOOLBAR_PATH"
chmod -R a+r "$FIREFOX_EXT_PATH"

USER_LIST=`dscacheutil -q user | grep -A2 -B2 -e uid:\ 5'[0-9][0-9]' | grep
-v -w "password"`
COUNTER=0
VALUE="-1"

OLD_IFS=$IFS
IFS=$'\n'
for line in $USER_LIST;do
    if [[ $line == "--" ]]; then
        COUNTER=$(($COUNTER + 1))
    else
        KEY="$(echo $line| cut -d":" -f1 | tr -d " ")"
        VALUE="$(echo $line | cut -d":" -f2 | tr -d " ")"
        #echo $KEY:$VALUE
        eval ARRAY_"$COUNTER"_$KEY=$VALUE
        eval export ARRAY_"$COUNTER"_$KEY
    fi
done
IFS=$OLD_IFS

COUNTERB=0;
while [ $COUNTERB -le $COUNTER ] ; do
    USER_NAME=$(eval echo '$'ARRAY_"$COUNTERB"_name)
    USER_HOME=$(eval echo '$'ARRAY_"$COUNTERB"_dir)
    USER_UID=$(eval echo '$'ARRAY_"$COUNTERB"_uid)
    USER_GID=$(eval echo '$'ARRAY_"$COUNTERB"_gid)
    COUNTERB=$(($COUNTERB + 1))

    if [ -z $USER_NAME ]; then
        continue
    fi

    #skip sharing only user
    if [ "$USER_HOME" = "/dev/null" ]; then
        continue
    fi

    USER_FIREFOX_BASE="$USER_HOME/Library/Application Support/Firefox"
    USER_PROFILE_PATH="$USER_HOME/Library/Application
Support/Firefox/Profiles/axkhqz5b.default"
    USER_PROFILE_INI="$USER_HOME/Library/Application
Support/Firefox/profiles.ini"

    echo "check if need to add default profile for $USER_NAME"
    if [ -e "$USER_HOME/Library/Application Support/Firefox/profiles.ini"
];then
        echo "firefox profiles existed. just skip"
    else
        echo "add default profile for $USER_NAME"

        INI_FILE=$(cat <<EOF
[General]
StartWithLastProfile=1

[Profile0]
Name=default
IsRelative=1
Path=Profiles/axkhqz5b.default
Default=1
EOF)
    mkdir -pv "$USER_PROFILE_PATH"

    echo "$INI_FILE" > "$USER_PROFILE_INI"
    cp "$FIREFOX_EXT_DB" "$USER_PROFILE_PATH"

    chmod 644 "$USER_PROFILE_INI"
    chmod 644 "$USER_PROFILE_PATH/extensions.sqlite"
    chown -R "$USER_UID":"$USER_GID" "$USER_FIREFOX_BASE" 2>&1 >>$DBGLOG

    fi
done
IFS=$OLD_IFS

echo "check firefox installation"
FIRFOXS=$(mdfind "kMDItemCFBundleIdentifier == $FIREFOX_IDENTIFIER")
if [ "$FIRFOXS" == "" ]; then
    echo "firefox is not installed"
fi
echo "firefox is installed"


if [ $? != 0 ]; then
    echo "install failed"
    echo "<== end installing firefox toolbar"
else
    echo "install successfully"
    echo "<== end installing firefox toolbar"
fi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/dev-addons/attachments/20171116/93229653/attachment-0001.html>


More information about the Dev-addons mailing list