forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirefox.sh
executable file
·65 lines (54 loc) · 1.92 KB
/
firefox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash -ex
# Run Firefox tests for HTTPS Everywhere
# Get to the repo root directory, even when we're symlinked as a hook.
if [ -n "$GIT_DIR" ]
then
# $GIT_DIR is set, so we're running as a hook.
cd $GIT_DIR
else
# Git command exists? Cool, let's CD to the right place.
git rev-parse && cd "$(git rev-parse --show-toplevel)"
fi
source utils/mktemp.sh
# We'll create a Firefox profile here and install HTTPS Everywhere into it.
PROFILE_DIRECTORY="$(mktemp -d)"
trap 'rm -r "$PROFILE_DIRECTORY"' EXIT
HTTPSE_INSTALL_FILE=$PROFILE_DIRECTORY/extensions/[email protected]
# Build the XPI to run all the validations in make.sh, and to ensure that
# we test what is actually getting built.
./make.sh
XPI_NAME="`ls -tr pkg/https-everywhere-20*.xpi | tail -1`"
# Set up a skeleton profile and then install into it.
# The skeleton contains a few files required to trick Firefox into thinking
# that the extension was fully installed rather than just unpacked.
cp -a test/firefox/test_profile_skeleton/* $PROFILE_DIRECTORY
cp $XPI_NAME $HTTPSE_INSTALL_FILE
die() {
echo "$@"
exit 1
}
if [ ! -f "$HTTPSE_INSTALL_FILE" ]; then
die "Firefox profile does not have HTTPS Everywhere installed"
fi
# Make sure we have xvfb-run and it's not already set.
if [ -z "$XVFB_RUN" -a -n "$(which xvfb-run)" ]; then
XVFB_RUN=xvfb-run
fi
# If you just want to run Firefox with the latest code:
if [ "$1" == "--justrun" ]; then
echo "running firefox"
shift
if [ $(uname) == Darwin ]; then
open /Applications/Firefox.app --wait-apps --new --args -no-remote -profile "$PROFILE_DIRECTORY" "$@"
else
${FIREFOX:-firefox} -no-remote -profile "$PROFILE_DIRECTORY" "$@"
fi
else
echo "running tests"
PATH=/home/user/geckodriver:$PATH
if [ -n "$FIREFOX" ]; then
$XVFB_RUN python3.6 test/script.py Firefox "$PROFILE_DIRECTORY" $FIREFOX
else
$XVFB_RUN python3.6 test/script.py Firefox "$PROFILE_DIRECTORY"
fi
fi