Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$replace modifier #1842

Merged
merged 11 commits into from
Sep 6, 2024
Merged

$replace modifier #1842

merged 11 commits into from
Sep 6, 2024

Conversation

chrmod
Copy link
Member

@chrmod chrmod commented Aug 26, 2024

requires ghostery/adblocker#4241

To test basic use-case, try this custom filter example.com$replace=/Example Domain/Hello from Ghostery/g at example.com
Screenshot 2024-08-26 at 18 29 47
Notice that both <title> and <h1> got updated.

This have to be carefully tested on youtube.com once the $replace filters are enabled.

@chrmod chrmod marked this pull request as ready for review August 29, 2024 16:25
@chrmod chrmod added Ad-Blocking Issues releated to Ad Blocking Firefox package CI: create extension packages labels Aug 29, 2024
Co-authored-by: Philipp Claßen <philipp@ghostery.com>
@philipp-classen
Copy link
Member

Update: For YouTube, we found a problems with the new adblocker version (replace regular expression can corrupt JSON requests). That needs to be addressed before we can merge.

@chrmod chrmod marked this pull request as draft September 3, 2024 10:21
@chrmod chrmod marked this pull request as ready for review September 4, 2024 14:08
@GRadziejewski
Copy link
Contributor

Smoke tests Iteration no 1:

Tests of: #1842 (comment)


Checked features:

  • Enable/Disable Ad-blocking
  • Enable/Disable Anti-tracking
    • URL / Trackers blocked on UI
  • Enable/Disable Never Consent
  • Pause Ghostery
  • Regional filters
    • Check YT
    • Check YT Kids
Browser: Chrome 128.0.6613.120
OS: Windows 10
GBE 10.4.3

Browser: Firefox 130.0
OS: Windows 11
GBE 10.4.3

Browser: Firefox 130.0
OS: macOS 14.6.1
GBE 10.4.3

Issues:

Fixed:

Cannot reproduce:

Will not be fixed:

GRadziejewski
GRadziejewski previously approved these changes Sep 5, 2024
Copy link
Contributor

@GRadziejewski GRadziejewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

},
{ urls: ['<all_urls>'], types: ['main_frame'] },
{ urls: ['http://*/*', 'https://*/*'] },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add the same constraint on other even listeners? I found a case where we have a callback for our own background page in Firefox (Navigation API) when Dev Tools are opened.
Sometimes I have an error in Chrome, that shows that page from chrome:// can't be accessed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, and it is unclear if onBeforeRequest should process <all_urls> or only http* and ws*.

@chrmod chrmod merged commit 61ef429 into main Sep 6, 2024
2 checks passed
@chrmod chrmod deleted the firefox-$replace branch September 6, 2024 09:48
@smalluban smalluban mentioned this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ad-Blocking Issues releated to Ad Blocking Firefox package CI: create extension packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants