Introduce abp-snippets dependency
Background / User story
Since their introduction, we've kept snippets separate from the rest of the Adblock Plus core code in order to allow for independent and faster development as well as getting them out to users quickly. As a continuation of that, we're now splitting off snippets into a separate repository to have a dependency that we can update independently of the core engine. Furthermore, that project is kept private to maximize the effectiveness of snippets against websites that try to force ads onto ad blocking users.
Therefore we need to add a new dependency for including the snippets bundle into the extension, as well as another one for including its source code into the source archive that extension stores require for verifying that the extension is safe.
For that bundle, we need to make sure that its content complies with store policies (see AMO policy) when it comes to minification/obfuscation techniques that are used at build time.
What to change
- Design: N/A
- Research: N/A
- Spec: N/A
- Legal: https://jira.eyeo.com/browse/ABPUI-55
-
Development:
- Add private abp-snippets dependency (in "vendor" subdirectory) for:
- retrieving store policy-compliant snippets bundle for integration into the extension and release to the public
- retrieving snippets source code for private submission to extension stores
Note: We already generate a source archive for submission to extension stores but we also make that one publicly available via downloads.adblockplus.org.
- Adjust code in the following files accordingly, to load snippets library from the new location:
- adblockpluschrome/build/config/base.js
- adblockpluschrome/lib/contentFiltering.js
- Ensure that users without access to private dependency, are still able to generate extension builds, albeit without snippets (optionally, with snippets that are already public).
- Ensure that snippets can be tested prior to an extension release.
- Add private abp-snippets dependency (in "vendor" subdirectory) for:
Hints for testers
Instead of resolving git submodules via git submodule update --init --recursive
, there's now npm run submodules:update
and npm run submodules:update-with-snippets
that should lead to the following results:
With access to abp-snippets repository? | Submodule resolution | Build type | Expected result |
---|---|---|---|
yes | npm run submodules:update |
chrome/firefox/source | respective build without snippets |
yes | npm run submodules:update-with-snippets |
chrome/firefox/source | respective build with snippets |
no | npm run submodules:update |
chrome/firefox/source | respective build without snippets |
no | npm run submodules:update-with-snippets |
chrome/firefox/source | respective build without snippets; failure to resolve abp-snippets submodule |
- Unless mentioned otherwise, no errors should be shown either during build creation or in the extension's background page.
- Using the resulting source archives, it should still be possible to recreate chrome/firefox builds with the same file size as those that were created directly from the source code. More specifically, builds that were created from a source archive that includes snippets, should also include snippets. Builds that were created from a source archive that doesn't include snippets, shouldn't include snippets.
- The extension should work with either build, with the only difference being whether snippets are working or not.
Here are some steps that can be followed for generating the various builds:
npm run submodules:update
# OR: npm run submodules:update-with-snippets
cd adblockpluschrome
npm install
npx gulp build -t chrome
npx gulp build -t firefox
npx gulp source
mkdir ../../source
tar xvf adblockplus-3.10.2.tar.gz -C ../../source
cd ../../source/adblockpluschrome
npm install
npx gulp build -t chrome
npx gulp build -t firefox
Additionally, the builds should be available via GitLab CI artifacts:
- "build" job provides builds without snippets.
- "build:with-snippets" job provides builds with snippets that can/need to be decrypted with the password, as configured via the "SNIPPETS_PASSWORD" GitLab CI variable.
Hints for translators
N/A