4 all: whatdoesitdo tests
8 @
# generate the README "What does it do?" section
11 # To decrease tests verbosity, comment out unneeded targets
13 tests
: sourceprefs.js checkdeprecated stats acorn bash_syntax shellcheck
17 acorn
--silent user.js
19 locked_user.js
: user.js
20 sed
's/^user_pref/lockPref/' $< >|
$@
22 systemwide_user.js
: user.js
23 sed
's/^user_pref/pref/' $< >|
$@
25 debian_locked.js
: user.js
26 sed
's/^user_pref(\("[^"]\+"\),\s\+\([^)]\+\));\(\s*\/\/.*\)\?$$/pref(\1, \2, locked);/' $< >|
$@
28 # https://github.com/mozilla/policy-templates/blob/master/README.md
30 jq
-n
-M
"{\"policies\": {\"OfferToSaveLogins\": false, \"DisableBuiltinPDFViewer\": true, \"DisablePocket\": true, \"DisableFormHistory\": true, \"SanitizeOnShutdown\": true, \"SearchBar\": \"separate\", \"DisableTelemetry\": true, \"Cookies\": {\"AcceptThirdParty\": \"never\", \"ExpireAtSessionEnd\": true}, \"EnableTrackingProtection\": {\"Value\": true}, \"PopupBlocking\": {\"Default\": true}, \"FlashPlugin\": {\"Default\": false}, \"DisableFirefoxStudies\": true}}" >|
$@
34 $(foreach i
,$(wildcard *.sh
),bash
-n
$(i
);)
40 # download and sort all known preferences files from Firefox (mozilla-central) source
41 # specify wanted Firefox version/revision below (eg. "tip", "FIREFOX_AURORA_45_BASE", "9577ddeaafd85554c2a855f385a87472a089d5c0"). See https://hg.mozilla.org/mozilla-central/tags
43 FIREFOX_SOURCE_PREFS
= \
44 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/toolkit
/components
/telemetry
/datareporting-prefs.js \
45 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/toolkit
/components
/telemetry
/healthreport-prefs.js \
46 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/security
/manager
/ssl
/security-prefs.js \
47 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/modules
/libpref
/init
/all.js \
48 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/testing
/profiles
/common
/user.js \
49 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/testing
/profiles
/reftest
/user.js \
50 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/js
/src
/tests
/user.js \
51 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/browser
/app
/profile
/firefox.js \
52 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/preferences
/debugger.js \
53 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/preferences
/devtools-client.js \
54 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/unofficial
/pref
/firefox-branding.js \
55 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/official
/pref
/firefox-branding.js \
56 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/nightly
/pref
/firefox-branding.js \
57 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/aurora
/pref
/firefox-branding.js \
58 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/locales
/en-US
/firefox-l10n.js \
59 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/webide
/preferences
/webide.js \
60 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/app
/profile
/channel-prefs.js
62 @for SOURCEFILE in
$(FIREFOX_SOURCE_PREFS
); do wget
-nv
"$$SOURCEFILE" -O
- ; done | egrep
"(^pref|^user_pref)" |
sort --unique
>|
$@
64 TBBBRANCH
=tor-browser-68.8
.0esr-9.5
-1
66 wget
-nv
"https://gitweb.torproject.org/tor-browser.git/plain/browser/app/profile/firefox.js?h=$(TBBBRANCH)" -O
$@
68 regex
= ^\
(user_\
)\?pref
/s
/^.
*pref
("\([^"]\
+\
)",\s*\([^)]\+\).*$$
70 tbb-diff: 000-tor-browser.js
71 diff <(sed -n '/$(regex)/\1 = \2/p' user.js | sort) <(sed -n '/$(regex)/\1 = \2/p' $< | sort)
74 tbb-diff-2: 000-tor-browser.js
75 for setting in $$( comm -12 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)); do diff <(grep "^\
(user_\
)\?pref
(\"$${setting}\"" user.js | sed -n '/$(regex)/\1 = \2/p' | sort) <(grep "^\
(user_\
)\?pref
(\"$${setting}\"" $< | sed -n '/$(regex)/\1 = \2/p' | sort); done
77 .PHONY: tbb-missing-from-user.js
78 tbb-missing-from-user.js: 000-tor-browser.js
79 comm -13 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)
81 ######################
83 .PHONY: checknotcovered
84 checknotcovered: sourceprefs.js
85 @# check for preferences present in firefox source but not covered by user.js
86 @# configure ignored preferences in ignore.list
87 @SOURCE_PREFS=$$(egrep '(^pref|^user_pref)' $< | awk -F'"' '{print $$2}'); \
88 for SOURCE_PREF in $$SOURCE_PREFS; do \
89 grep "\"$$SOURCE_PREF\"" user.js ignore.list >/dev/null || echo "Not covered by user.js : $$SOURCE_PREF"; \
92 .PHONY: checkdeprecated
93 checkdeprecated: sourceprefs.js
94 @# check for preferences in hardened user.js that are no longer present in firefox source
95 @HARDENED_PREFS=$$(egrep "^user_pref" user.js | cut -d'"' -f2); \
96 for HARDENED_PREF in $$HARDENED_PREFS; do \
97 grep "\"$$HARDENED_PREF\"" $< >/dev/null || echo "Deprecated
: $$HARDENED_PREF"; \
101 stats: sourceprefs.js
102 @# count preferences number, various stats
103 @echo "$$(egrep
"^user_pref" user.js | wc
-l | cut
-f1
) preferences in user.js
"
104 @echo "$$(wc
-l
$< | cut
-d
" " -f1
) preferences in Firefox source
"
108 @# remove temporary files
109 @# please comment this out when not needed, to minimize load on Mozilla servers
110 @rm -f sourceprefs.js AUTHORS
113 @# generate an AUTHORS file, ordered by number of commits
114 @# to add extra authors/credits, git commit --allow-empty --author="A U Thor
<author@example.com
>"
115 @git shortlog -sne | cut -f1 --complement >| $@
119 @l2headers=$$(egrep "^
## " README.md |cut -d" " -f1 --complement ); \
120 echo
"$$l2headers" | while read line
; do \
121 anchor
=$$(echo
"$$line" | tr
'[:upper:]' '[:lower:]' | sed
's/ /-/g' | sed
's/\?//g'); \
122 echo
"* [$$line](#$$anchor)"; \