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:

ec7db30b2f
This commit is contained in:
Raymond Hill 2021-07-16 10:06:58 -04:00
parent ec7db30b2f
commit a4aced69dc
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
16 changed files with 33 additions and 132 deletions

View File

@ -1,3 +0,0 @@
The purpose of the `webext` target is to create a single package which
can be used for both Chromium and Firefox. Such package is a requirement
to have uBlock Origin shipped in Debian.

View File

@ -1,113 +0,0 @@
{
"applications": {
"gecko": {
"id": "uBlock0@raymondhill.net",
"strict_min_version": "55.0"
}
},
"author": "Raymond Hill & contributors",
"background": {
"page": "background.html"
},
"browser_action": {
"browser_style": false,
"default_icon": {
"16": "img/icon_16.png",
"32": "img/icon_32.png"
},
"default_title": "uBlock Origin",
"default_popup": "popup.html"
},
"commands": {
"launch-element-zapper": {
"description": "__MSG_popupTipZapper__"
},
"launch-element-picker": {
"description": "__MSG_popupTipPicker__"
},
"launch-logger": {
"description": "__MSG_popupTipLog__"
},
"relax-blocking-mode": {
"description": "__MSG_relaxBlockingMode__"
}
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*",
"file://*/*"
],
"js": [
"/js/vapi.js",
"/js/vapi-client.js",
"/js/contentscript.js"
],
"run_at": "document_start",
"all_frames": true
},
{
"matches": [
"https://easylist.to/*",
"https://*.fanboy.co.nz/*",
"https://filterlists.com/*",
"https://forums.lanik.us/*",
"https://github.com/*",
"https://*.github.io/*"
],
"js": [
"/js/scriptlets/subscriber.js"
],
"run_at": "document_idle",
"all_frames": false
}
],
"default_locale": "en",
"description": "__MSG_extShortDesc__",
"icons": {
"16": "img/icon_16.png",
"32": "img/icon_32.png",
"64": "img/icon_64.png",
"128": "img/icon_128.png"
},
"incognito": "split",
"manifest_version": 2,
"minimum_chrome_version": "51.0",
"name": "uBlock Origin",
"optional_permissions": [
"file:///*"
],
"options_ui": {
"page": "dashboard.html",
"open_in_tab": true
},
"permissions": [
"contextMenus",
"privacy",
"storage",
"tabs",
"unlimitedStorage",
"webNavigation",
"webRequest",
"webRequestBlocking",
"<all_urls>"
],
"short_name": "uBlock₀",
"sidebar_action": {
"default_title": "__MSG_statsPageName__",
"default_panel": "logger-ui.html",
"default_icon": {
"16": "img/ublock.svg",
"48": "img/ublock.svg"
},
"open_at_install": false
},
"storage": {
"managed_schema": "managed_storage.json"
},
"version": "1.9.15.101",
"web_accessible_resources": [
"/web_accessible_resources/*"
]
}

View File

@ -14,7 +14,7 @@
<script src="js/vapi.js"></script>
<script src="js/vapi-common.js"></script>
<script src="js/vapi-background.js"></script>
<script src="js/vapi-webrequest.js"></script><!-- Forks can pick the webext, chromium, or their own implementation -->
<script src="js/vapi-background-ext.js"></script><!-- platform-specific to extend common code paths -->
<script src="js/background.js"></script>
<script src="js/traffic.js"></script>
<script src="js/hntrie.js"></script>

View File

@ -14,7 +14,6 @@ cp -R src/web_accessible_resources $DES/
cp -R src/_locales $DES/
cp src/*.html $DES/
cp platform/chromium/*.js $DES/js/
cp platform/chromium/*.html $DES/
cp platform/chromium/*.json $DES/
cp platform/common/*.js $DES/js/
cp platform/common/*.json $DES/
cp LICENSE.txt $DES/

View File

@ -8,9 +8,15 @@ DES=dist/build/uBlock0.chromium
rm -rf $DES
mkdir -p $DES
echo "*** uBlock0.chromium: copying common files"
echo "*** uBlock0.chromium: Copying common files"
bash ./tools/copy-common-files.sh $DES
# Chromium-specific
echo "*** uBlock0.chromium: Copying chromium-specific files"
cp platform/chromium/*.js $DES/js/
cp platform/chromium/*.html $DES/
cp platform/chromium/*.json $DES/
# Chrome store-specific
cp -R $DES/_locales/nb $DES/_locales/no

View File

@ -9,14 +9,16 @@ DES="$BLDIR"/uBlock0.firefox
rm -rf $DES
mkdir -p $DES
echo "*** uBlock0.firefox: copying common files"
echo "*** uBlock0.firefox: Copying common files"
bash ./tools/copy-common-files.sh $DES
cp -R $DES/_locales/nb $DES/_locales/no
# Firefox-specific
echo "*** uBlock0.firefox: Copying firefox-specific files"
cp platform/firefox/*.json $DES/
cp platform/firefox/*.js $DES/js/
cp platform/firefox/manifest.json $DES/
cp platform/firefox/webext.js $DES/js/
cp platform/firefox/vapi-webrequest.js $DES/js/
# Firefox store-specific
cp -R $DES/_locales/nb $DES/_locales/no
# Firefox/webext-specific
rm $DES/img/icon_128.png

View File

@ -8,11 +8,18 @@ DES=dist/build/uBlock0.opera
rm -rf $DES
mkdir -p $DES
echo "*** uBlock0.opera: copying common files"
echo "*** uBlock0.opera: Copying common files"
bash ./tools/copy-common-files.sh $DES
# Chromium-specific
echo "*** uBlock0.opera: Copying chromium-specific files"
cp platform/chromium/*.js $DES/js/
cp platform/chromium/*.html $DES/
# Opera-specific
cp platform/opera/manifest.json $DES/
echo "*** uBlock0.opera: Copying opera-specific files"
cp platform/opera/manifest.json $DES/
rm -r $DES/_locales/az
rm -r $DES/_locales/cv
rm -r $DES/_locales/hi

View File

@ -12,11 +12,14 @@ mkdir -p $DES
echo "*** uBlock0.thunderbird: copying common files"
bash ./tools/copy-common-files.sh $DES
cp -R $DES/_locales/nb $DES/_locales/no
echo "*** uBlock0.firefox: Copying firefox-specific files"
cp platform/firefox/*.js $DES/js/
cp platform/thunderbird/manifest.json $DES/
cp platform/firefox/webext.js $DES/js/
cp platform/firefox/vapi-webrequest.js $DES/js/
echo "*** uBlock0.firefox: Copying thunderbird-specific files"
cp platform/thunderbird/manifest.json $DES/
# Firefox store-specific
cp -R $DES/_locales/nb $DES/_locales/no
# Firefox/webext-specific
rm $DES/img/icon_128.png