-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-firefox.sh
executable file
·90 lines (78 loc) · 3.45 KB
/
run-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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# run.sh: wrapper script using `web-ext` to develop and test our
# extension
#
FIREFOX_BIN="$HOME/Applications/Firefox Developer Edition.app/Contents/MacOS/firefox-bin"
FIREFOX_DIST="$HOME/Applications/Firefox Developer Edition.app/Contents/Resources/distribution"
OPTS=()
#OPTS+=(--browser-console) # open a browser console
OPTS+=(--start-url www.mozilla.org) # open this tab on start
OPTS+=(--verbose) # verbose output for web-ext
#OPTS+=(--keep-profile-changes) # persist profile across runs
OPTS+=(--pref devtools.webconsole.timestampMessages=true) # timestamp messages in console
OPTS+=(--start-url about:debugging#/runtime/this-firefox) # open debugging tab
OPTS+=(--pref='datareporting.policy.firstRunURL=') # don't load privacy page
OPTS+=(--pref='ui.popup.disable_autohide=true') # popup.html debugging
OPTS+=(--pref='browser.ctrlTab.recentlyUsedOrder=false') # disable thumbanils in tab switcher
# disable telemetry
OPTS+=(--pref='datareporting.healthreport.uploadEnabled=false')
# disable telemetry notifcation
OPTS+=(--pref='datareporting.policy.dataSubmissionPolicyBypassNotification=true')
# disable annoying "door-hanger" notifcation from the hamburger button
OPTS+=(--pref='app.update.doorhanger=false')
OPTS+=(--pref='app.update.silent=true')
OPTS+=(--pref='app.update.disable_button.showUpdateHistory=false')
OPTS+=(--pref='app.update.url=')
OPTS+=(--pref='app.update.url.details=')
OPTS+=(--pref='app.update.url.manual=')
OPTS+=(--pref='app.update.enabled=false')
OPTS+=(--pref='app.update.download.promptMaxAttempts=0')
OPTS+=(--pref='app.update.elevation.promptMaxAttempts=0')
OPTS+=(--pref='app.update.staging.enabled=false')
OPTS+=(--pref='app.update.unsupported.url=')
# disable pocket
OPTS+=(--pref='extensions.pocket.enabled=false')
OPTS+=(--pref='browser.newtabpage.activity-stream.section.highlights.includePocket=false')
OPTS+=(--pref='services.sync.prefs.sync.browser.newtabpage.activity-stream.section.highlights.includePocket=false')
OPTS+=(--pref='extensions.pocket.site=')
OPTS+=(--pref='browser.newtabpage.activity-stream.discoverystream.endpoints=')
OPTS+=(--pref='browser.newtabpage.activity-stream.discoverystream.config=')
OPTS+=(--pref='browser.newtabpage.activity-stream.feeds.section.topstories.options=')
OPTS+=(--pref='extensions.pocket.api=')
OPTS+=(--pref='extensions.pocket.oAuthConsumerKey=')
OPTS+=(--pref='browser.newtabpage.activity-stream.discoverystream.endpointSpocsClear=')
OPTS+=(--pref='browser.newtabpage.activity-stream.pocketCta=')
# disable config warning
OPTS+=(--pref='browser.aboutConfig.showWarning=false')
OPTS+=(--pref='general.warnOnAboutConfig=false')
# check if web-ext is installed
if ! $(type web-ext >/dev/null 2>&1)
then
echo "[run.sh] error: 'web-ext' is not installed, install using your favorite package manager"
exit 1
fi
# check if firefox is installed
if [ -a "${FIREFOX_BIN}" ]; then
# disable updates using policies.json
mkdir -p "${FIREFOX_DIST}"
cat <<-EOF > "${FIREFOX_DIST}/policies.json"
{
"policies": {
"DisableAppUpdate": true
}
}
EOF
# run
web-ext run \
--source-dir="$PWD/src" \
--firefox="${FIREFOX_BIN}" \
${OPTS[@]}
else
echo "[run.sh] firefox not found, running with default firefox"
# run
web-ext run \
--source-dir="$PWD/src" \
${OPTS[@]}
fi