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 # https://github.com/mozilla/policy-templates/blob/master/README.md
27 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}}" >|
$@
31 $(foreach i
,$(wildcard *.sh
),bash
-n
$(i
);)
37 # download and sort all known preferences files from Firefox (mozilla-central) source
38 # specify wanted Firefox version/revision below (eg. "tip", "FIREFOX_AURORA_45_BASE", "9577ddeaafd85554c2a855f385a87472a089d5c0"). See https://hg.mozilla.org/mozilla-central/tags
40 FIREFOX_SOURCE_PREFS
= \
41 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/toolkit
/components
/telemetry
/datareporting-prefs.js \
42 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/toolkit
/components
/telemetry
/healthreport-prefs.js \
43 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/security
/manager
/ssl
/security-prefs.js \
44 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/modules
/libpref
/init
/all.js \
45 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/testing
/profiles
/common
/user.js \
46 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/testing
/profiles
/reftest
/user.js \
47 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/js
/src
/tests
/user.js \
48 https
://hg.mozilla.org
/mozilla-central
/raw-file
/$(SOURCEVERSION
)/browser
/app
/profile
/firefox.js \
49 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/preferences
/debugger.js \
50 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/preferences
/devtools-client.js \
51 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/unofficial
/pref
/firefox-branding.js \
52 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/official
/pref
/firefox-branding.js \
53 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/nightly
/pref
/firefox-branding.js \
54 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/branding
/aurora
/pref
/firefox-branding.js \
55 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/locales
/en-US
/firefox-l10n.js \
56 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/devtools
/client
/webide
/preferences
/webide.js \
57 https
://hg.mozilla.org
/mozilla-central
/raw-file
/tip
/browser
/app
/profile
/channel-prefs.js
59 @for SOURCEFILE in
$(FIREFOX_SOURCE_PREFS
); do wget
-nv
"$$SOURCEFILE" -O
- ; done | egrep
"(^pref|^user_pref)" |
sort --unique
>|
$@
61 TBBBRANCH
=tor-browser-52.6
.2esr-7.5
-2
63 wget
-nv
"https://gitweb.torproject.org/tor-browser.git/plain/browser/app/profile/$@?h=$(TBBBRANCH)" -O
$@
65 regex
= ^\
(user_\
)\?pref
/s
/^.
*pref
("\([^"]\
+\
)",\s*\([^)]\+\).*$$
67 tbb-diff: 000-tor-browser.js
68 diff <(sed -n '/$(regex)/\1 = \2/p' user.js | sort) <(sed -n '/$(regex)/\1 = \2/p' $< | sort)
71 tbb-diff-2: 000-tor-browser.js
72 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
74 .PHONY: tbb-missing-from-user.js
75 tbb-missing-from-user.js: 000-tor-browser.js
76 comm -13 <(sed -n '/$(regex)/\1/p' user.js | sort) <(sed -n '/$(regex)/\1/p' $< | sort)
78 ######################
80 .PHONY: checknotcovered
81 checknotcovered: sourceprefs.js
82 @# check for preferences present in firefox source but not covered by user.js
83 @# configure ignored preferences in ignore.list
84 @SOURCE_PREFS=$$(egrep '(^pref|^user_pref)' $< | awk -F'"' '{print $$2}'); \
85 for SOURCE_PREF in $$SOURCE_PREFS; do \
86 grep "\"$$SOURCE_PREF\"" user.js ignore.list >/dev/null || echo "Not covered by user.js : $$SOURCE_PREF"; \
89 .PHONY: checkdeprecated
90 checkdeprecated: sourceprefs.js
91 @# check for preferences in hardened user.js that are no longer present in firefox source
92 @HARDENED_PREFS=$$(egrep "^user_pref" user.js | cut -d'"' -f2); \
93 for HARDENED_PREF in $$HARDENED_PREFS; do \
94 grep "\"$$HARDENED_PREF\"" $< >/dev/null || echo "Deprecated
: $$HARDENED_PREF"; \
99 @# count preferences number, various stats
100 @echo "$$(egrep
"^user_pref" user.js | wc
-l | cut
-f1
) preferences in user.js
"
101 @echo "$$(wc
-l
$< | cut
-d
" " -f1
) preferences in Firefox source
"
105 @# remove temporary files
106 @# please comment this out when not needed, to minimize load on Mozilla servers
107 @rm -f sourceprefs.js AUTHORS
110 @# generate an AUTHORS file, ordered by number of commits
111 @# to add extra authors/credits, git commit --allow-empty --author="A U Thor
<author@example.com
>"
112 @git shortlog -sne | cut -f1 --complement >| $@
116 @l2headers=$$(egrep "^
## " README.md |cut -d" " -f1 --complement ); \
117 echo
"$$l2headers" | while read line
; do \
118 anchor
=$$(echo
"$$line" | tr
'[:upper:]' '[:lower:]' | sed
's/ /-/g' | sed
's/\?//g'); \
119 echo
"* [$$line](#$$anchor)"; \