From 34aab95107e1cf17d287e02185c0aa404efcc3b1 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 15 Sep 2022 13:14:08 -0400 Subject: [PATCH] [mv3] Add support for specific cosmetic filtering Specific plain CSS cosmetic filters are now supported. Cosmetic filtering will occur only after the user explicitly grant uBO extended permissions for a given site, so that it can inject CSS on the site. A new button in the popup panel allows a user to grant/revoke extended permissions to/from uBO Lite for the current site. More capabilities will be carefully added for when extended permissions are granted on a site, so specific cosmetic filtering through plain CSS is the first implemented capability. Generic and procedural cosmetic filtering is not implemented. The current implementation for plain CSS cosmetic filters is through declarative content injection, which does not require the service worker to be alive, the browser takes care to inject the cosmetic filters. However declarative CSS injection does not support user styles, so the injected cosmetic filters are "weak". I consider this is a browser issue, since user styles are supported by Chromium, there is just no way in the API to specify user styles for the injected content. Also: - Fixed dark theme issues - Added Steven Black's hosts file Keep in mind all this is very experimental and implementation details in this release may (will) greatly change in the future. --- platform/mv3/extension/3p-filters.html | 2 +- platform/mv3/extension/css/3p-filters.css | 5 + platform/mv3/extension/css/popup.css | 35 ++- platform/mv3/extension/js/3p-filters.js | 60 ++---- platform/mv3/extension/js/background-css.js | 156 ++++++++++++++ platform/mv3/extension/js/background.js | 176 ++++++++------- platform/mv3/extension/js/dom.js | 75 +++++-- platform/mv3/extension/js/fetch.js | 38 ++++ platform/mv3/extension/js/popup.js | 224 ++++++++++++-------- platform/mv3/extension/manifest.json | 6 +- platform/mv3/extension/popup.html | 22 +- platform/mv3/make-rulesets.js | 156 ++++++++++---- src/css/fa-icons.css | 7 + src/js/fa-icons.js | 3 + src/js/messaging.js | 19 +- src/js/static-dnr-filtering.js | 98 ++++++++- tools/make-mv3.sh | 2 +- 17 files changed, 797 insertions(+), 287 deletions(-) create mode 100644 platform/mv3/extension/js/background-css.js create mode 100644 platform/mv3/extension/js/fetch.js diff --git a/platform/mv3/extension/3p-filters.html b/platform/mv3/extension/3p-filters.html index fbd0545d1..b1a11d9e9 100644 --- a/platform/mv3/extension/3p-filters.html +++ b/platform/mv3/extension/3p-filters.html @@ -26,7 +26,7 @@ -