Repository navigation
fix(adblocker): inject scriptlets of a frame in one scope - #3687
Merged
Merged
Conversation
smalluban
requested changes
Oct 6, 2026
smalluban
left a comment
Collaborator
There was a problem hiding this comment.
I know it's draft, but I have only one ask to separate fix with e2e - it can just help others before we merge this PR.
smalluban
reviewed
Oct 6, 2026
Comment on lines
+131
to
+132
| const registered = | ||
| useRegistry && (!filter.hasSubframeConstraint() || filter.match(hostname, domain)); |
Member
There was a problem hiding this comment.
Needs to be discussed. But intended to address a possible regression with 217e02b
Suggested change
| const registered = | |
| useRegistry && (!filter.hasSubframeConstraint() || filter.match(hostname, domain)); | |
| // filter.match() reads a negation-only list (`a.com>>,~b.com`) as "every hostname but b.com", | |
| // so only a positive hostname or entity entry counts as a direct match. | |
| const { domains } = filter; | |
| const matchesDirectly = | |
| domains !== undefined && | |
| (domains.hostnames !== undefined || domains.entities !== undefined) && | |
| filter.match(hostname, domain); | |
| const registered = useRegistry && (!filter.hasSubframeConstraint() || matchesDirectly); |
Member
There was a problem hiding this comment.
Okay, as discussed, let's keep it out. (If it is a real problem, we should address it in a follow-up.)
Member
There was a problem hiding this comment.
Turns out this diff is only a workaround for an adblocker bug: ghostery/adblocker#5850
That means, the original line is good. The real fix is in the adblocker, not here.
chrmod
force-pushed
the
scriptlets-shared-scope
branch
from
October 6, 2026 14:27
522d08b to
2fd9284
Compare
philipp-classen
approved these changes
Oct 6, 2026
chrmod
force-pushed
the
scriptlets-shared-scope
branch
from
October 6, 2026 15:09
7fcc090 to
3e8dd80
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scriptlets of a world are injected once, in one scope, so
safeSelf()and its cache exist once per frame instead of once per scriptlet (refs #3672). TheSymbol.formarker onwindowfrom ghostery/scriptlets#63 is gone.Every path runs the package's
run()with the frame's calls: serialized as code for registered scripts (FirefoxcontentScripts, ChromeuserScripts), and as a function with JSON arguments forchrome.scripting.executeScript. A filter that matched the frame directly is registered even when it also carries a>>domain.Requires ghostery/scriptlets#64 (merged); the lockfile resolves
@ghostery/scriptletsto its merge commit.