Skip to content

Commit a4aced6

Browse files
committed
Reorganize platform directory to avoid Chromium-centric appearance
Though Firefox shares a lot of WebExtensions code with Chromium, these platforms have their own specific code paths, for various reasons. The reorganization here makes it clear that Chromium platform is just one flavor of WebExtensions, and as such all Chromium-specific code paths should no longer be automatically pulled by other platforms where these code paths are not needed. Given that the filepath of many files changed, here is the parent commit to quickly browse back to the previous directory layout: ec7db30
1 parent ec7db30 commit a4aced6

16 files changed

+33
-132
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

platform/webext/README.md

-3
This file was deleted.

platform/webext/manifest.json

-113
This file was deleted.

src/background.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<script src="js/vapi.js"></script>
1515
<script src="js/vapi-common.js"></script>
1616
<script src="js/vapi-background.js"></script>
17-
<script src="js/vapi-webrequest.js"></script><!-- Forks can pick the webext, chromium, or their own implementation -->
17+
<script src="js/vapi-background-ext.js"></script><!-- platform-specific to extend common code paths -->
1818
<script src="js/background.js"></script>
1919
<script src="js/traffic.js"></script>
2020
<script src="js/hntrie.js"></script>

tools/copy-common-files.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ cp -R src/web_accessible_resources $DES/
1414
cp -R src/_locales $DES/
1515

1616
cp src/*.html $DES/
17-
cp platform/chromium/*.js $DES/js/
18-
cp platform/chromium/*.html $DES/
19-
cp platform/chromium/*.json $DES/
17+
cp platform/common/*.js $DES/js/
18+
cp platform/common/*.json $DES/
2019
cp LICENSE.txt $DES/

tools/make-chromium.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ DES=dist/build/uBlock0.chromium
88
rm -rf $DES
99
mkdir -p $DES
1010

11-
echo "*** uBlock0.chromium: copying common files"
11+
echo "*** uBlock0.chromium: Copying common files"
1212
bash ./tools/copy-common-files.sh $DES
1313

14+
# Chromium-specific
15+
echo "*** uBlock0.chromium: Copying chromium-specific files"
16+
cp platform/chromium/*.js $DES/js/
17+
cp platform/chromium/*.html $DES/
18+
cp platform/chromium/*.json $DES/
19+
1420
# Chrome store-specific
1521
cp -R $DES/_locales/nb $DES/_locales/no
1622

tools/make-firefox.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ DES="$BLDIR"/uBlock0.firefox
99
rm -rf $DES
1010
mkdir -p $DES
1111

12-
echo "*** uBlock0.firefox: copying common files"
12+
echo "*** uBlock0.firefox: Copying common files"
1313
bash ./tools/copy-common-files.sh $DES
1414

15-
cp -R $DES/_locales/nb $DES/_locales/no
15+
# Firefox-specific
16+
echo "*** uBlock0.firefox: Copying firefox-specific files"
17+
cp platform/firefox/*.json $DES/
18+
cp platform/firefox/*.js $DES/js/
1619

17-
cp platform/firefox/manifest.json $DES/
18-
cp platform/firefox/webext.js $DES/js/
19-
cp platform/firefox/vapi-webrequest.js $DES/js/
20+
# Firefox store-specific
21+
cp -R $DES/_locales/nb $DES/_locales/no
2022

2123
# Firefox/webext-specific
2224
rm $DES/img/icon_128.png

tools/make-opera.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ DES=dist/build/uBlock0.opera
88
rm -rf $DES
99
mkdir -p $DES
1010

11-
echo "*** uBlock0.opera: copying common files"
11+
echo "*** uBlock0.opera: Copying common files"
1212
bash ./tools/copy-common-files.sh $DES
1313

14+
# Chromium-specific
15+
echo "*** uBlock0.opera: Copying chromium-specific files"
16+
cp platform/chromium/*.js $DES/js/
17+
cp platform/chromium/*.html $DES/
18+
1419
# Opera-specific
15-
cp platform/opera/manifest.json $DES/
20+
echo "*** uBlock0.opera: Copying opera-specific files"
21+
cp platform/opera/manifest.json $DES/
22+
1623
rm -r $DES/_locales/az
1724
rm -r $DES/_locales/cv
1825
rm -r $DES/_locales/hi

tools/make-thunderbird.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ mkdir -p $DES
1212
echo "*** uBlock0.thunderbird: copying common files"
1313
bash ./tools/copy-common-files.sh $DES
1414

15-
cp -R $DES/_locales/nb $DES/_locales/no
15+
echo "*** uBlock0.firefox: Copying firefox-specific files"
16+
cp platform/firefox/*.js $DES/js/
1617

17-
cp platform/thunderbird/manifest.json $DES/
18-
cp platform/firefox/webext.js $DES/js/
19-
cp platform/firefox/vapi-webrequest.js $DES/js/
18+
echo "*** uBlock0.firefox: Copying thunderbird-specific files"
19+
cp platform/thunderbird/manifest.json $DES/
20+
21+
# Firefox store-specific
22+
cp -R $DES/_locales/nb $DES/_locales/no
2023

2124
# Firefox/webext-specific
2225
rm $DES/img/icon_128.png

0 commit comments

Comments
 (0)