1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 15:32:28 +02:00
Commit Graph

30 Commits

Author SHA1 Message Date
Raymond Hill
764a1772ba
[mv3] Add option to disable toolbar icon badge
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/119
2024-03-21 13:57:50 -04:00
Raymond Hill
a969a672e0
Change official description in source code top comment 2023-12-04 12:10:34 -05:00
Raymond Hill
a77c23c74f
[mv3] Improve and cleanup options page
Additionally, ensure the options page stay in sync with the
internal state of the extension.
2023-11-29 16:11:22 -05:00
Raymond Hill
d7acad6c90
[mv3] Add textarea to list/edit trusted sites
Related issue:
https://github.com/uBlockOrigin/uBOL-home/issues/29
2023-11-28 21:13:44 -05:00
Raymond Hill
4feb59435a
Typo 2023-08-13 13:28:02 -04:00
Raymond Hill
b9f3523c95
[mv3] Add managed setting to disable first-run page
Related discussion:
- https://github.com/uBlockOrigin/uBOL-issues/discussions/61

Example of usage (chromium/linux):

    {
      "3rdparty": {
        "extensions": {
          "ddkjiahejlhfcafbddmgiahcphecmpfh": {
            "disableFirstRunPage": true
          }
        }
      }
    }
2023-07-29 09:34:24 -04:00
Raymond Hill
634fdde465
[mv3] Prevent enabling more filter lists than allowed
Related issue:
- https://github.com/uBlockOrigin/uBOL-issues/issues/56#issuecomment-1627692213
2023-07-09 09:25:38 -04:00
Raymond Hill
bec4dea155
Minor code review 2023-06-23 20:44:44 -04:00
Raymond Hill
d19e62a595
[mv3] Add support for admin configurations
See `managed_storage.json` for available settings. Currently
only `noFiltering` setting is availale.

`noFiltering` is an array of strings, each being a domain for
which no filtering should occur.

Related discussion:
- https://github.com/uBlockOrigin/uBOL-issues/discussions/35
2023-06-13 11:40:41 -04:00
Raymond Hill
1ad7410077
[mv3] Fine tune various portions of code 2023-06-06 13:42:22 -04:00
Raymond Hill
6d9bef28ff
[mv3] Fix issue with updateContentScripts API and other fixes
Avoid using updateContentScripts() as it suffers from an unexpected
behavior, causing injected content scripts to lose proper order
at injection time. The order in which content scripts are injected
is key for uBOL content scripts. Potential out of order injection
was causing cosmetic filtering to be broken.

Use actual storage API to persist data across service worker
wake-ups and browser launches. uBOL was trying to avoid using
storage API, at the cost of somewhat hacky code (using DNR API
to persist settings).

Make use of session storage if available, to speed up
initialization of waking up the service worker (which at this
point is necessary to properly implement cosmetic filtering).
2023-06-05 09:15:59 -04:00
Raymond Hill
6dbbb95b04
[mv3] Mitigation: Inject CSS user styles to enforce cosmetic filtering
Related issues:
- https://github.com/uBlockOrigin/uBOL-issues/issues/5#issuecomment-1575425913
- https://github.com/w3c/webextensions/issues/403

Currently, there is no other way to inject CSS user styles than to
wake up the service worker, so that it can inject the CSS styles
itself using the `scripting.insertCSS()` method.

If ever the MV3 API supports injecting CSS user styles directly
from a content script, uBOL will be back to be fully declarative.

At this point the service worker is very lightweight since the
filtering is completely  declarative, so this is not too much of
an issue performance-wise except for the fact that waking up the
service worker for the sole purpose of injecting CSS user styles
and nothing else introduces a pointless overhead.

Hopefully the MV3 API will mature to address such inefficiency.
2023-06-04 11:32:55 -04:00
Raymond Hill
cbfd2ad942
Create a MVP version of uBOLite for Firefox
What does not work at the time of commit:

Cosmetic filtering does not work:

The content scripts responsible for cosmetic filtering fail when
trying to inject the stylesheets through document.adoptedStyleSheets,
with the following error message:

  XrayWrapper denied access to property Symbol.iterator
  (reason: object is not safely Xrayable).
  See https://developer.mozilla.org/en-US/docs/Xray_vision for more
  information. ... css-declarative.js:106:8

A possible solution is to inject those content scripts in the
MAIN world. However Firefox scripting API does not support MAIN
world injection at the moment.

Scriptlet-filtering does not work:

Because scriptlet code needs to be injected in the MAIN world,
and this is currently not supported by Firefox's scripting API,
see https://bugzilla.mozilla.org/show_bug.cgi?id=1736575

There is no count badge on the toolbar icon in Firefox, as it
currently does not support the `DNR.setExtensionActionOptions`
method.

Other than the above issues, it does appear uBO is blocking
properly with no error reported in the dev console.

The adoptedStyleSheets issue though is worrisome, as the
cosmetic filtering content scripts were designed with ISOLATED
world injection in mind. Being forced to inject in MAIN world
(when available) make things a bit more complicated as uBO
has to ensure it's global variables do not leak into the page.
2023-04-07 10:19:43 -04:00
Raymond Hill
b4c63f6ae5
[mv3] Handle permissions being revoked while uBOL is disabled 2022-10-18 08:48:31 -04:00
Raymond Hill
1db3748ab1
[mv3] General code review
Re-arranged resources in a more tidy way. General code review of
various code paths.
2022-10-15 13:05:20 -04:00
Raymond Hill
8eb28a446c
[mv3] Introduce per-site filtering modes in lieu of per-site toggle switch 2022-10-10 12:28:24 -04:00
Raymond Hill
1a9a19a91f
[mv3] Open options page at first install
To be sure first time users are properly informed about the
possibility to enable broad permissions for better filtering.
2022-09-30 09:18:52 -04:00
Raymond Hill
28aee736a5
[mv3] Add support for removeparam= filter option
Consequently, AdGuard URL Tracking Protection (AUTP) has been
added to the set of available filter lists.

However, removeparam= equivalent DNR rules can only be enforced
when granting uBOL broad permissions. If broad permissions are
not granted, removeparam= equivalent DNR rules are ignored.

Exception removeparam= filters are not supported, and these are
present in AUTP and meant to unbreak some websites which are
known to break as a result of removing query parameters.

This is issue might be mitigated in the future by making the
conversion from filters to DNR rules more complicated but this
can never replace the accuracy of uBO's filtering engine being
able to fully enforce arbitrary exception removeparam= filters.

Also, it is not possible to translate regex-based removeparam=
values to DNR rules, so these are dropped at conversion time.

As with other filters to DNR rules conversion, the converter
coallesce many distinct removeparam= filters into fewer DNR
rules.
2022-09-29 19:51:33 -04:00
Raymond Hill
a20273c582
[mv3] Don't wait on fullfilled promise when registring scriptlets
This can interfere with user interface responsiveness when
registring all scriptlets in broad-permissions mode.
2022-09-28 10:20:57 -04:00
Raymond Hill
f652cc9855
[mv3] Add ability to grant/revoke permissions on all sites 2022-09-27 19:51:38 -04:00
Raymond Hill
51c2e22c7a
[mv3] Fix procedural operator matches-media()
The failure was caused by the fact that there is no
window.matchMedia() API available in Nodejs. The validation
is now done using cssTree.
2022-09-27 07:46:24 -04:00
Raymond Hill
70a0de9d00
[mv3] Mind trusted-site directives when registering content scripts 2022-09-20 08:24:01 -04:00
Raymond Hill
5ddd3aaac6
[mv3] More work toward improving declarative css/js injection 2022-09-18 09:31:44 -04:00
Raymond Hill
e1b54514cc
[mv3] Add badge reflecting number of injectable content on current site
Additonally, general code review.
2022-09-17 08:26:41 -04:00
Raymond Hill
232c44eeb2
[mv3] Add scriptlet support; improve reliability of cosmetic filtering
First iteration of adding scriptlet support. As with cosmetic
filtering, scriptlet niijection occurs only on sites for which
uBO Lite was granted extended permissions.

At the moment, only three scriptlets are supported:
- abort-current-script
- json-prune
- set-constant

More will be added in the future.
2022-09-16 15:56:35 -04:00
Raymond Hill
34aab95107
[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.
2022-09-15 13:14:08 -04:00
Raymond Hill
e31637af78
[mv3] Add ability to enable/disable filter lists 2022-09-13 17:44:24 -04:00
Raymond Hill
1258414f37
Report ruleset stats in popup panel 2022-09-08 10:04:08 -04:00
Raymond Hill
41d66a78ba
Report per-ruleset stats for filters-to-rules conversion 2022-09-07 13:45:55 -04:00
Raymond Hill
224410a6f5
Add per-site on/off switch to mv3 experimental version 2022-09-07 10:15:36 -04:00