[iOS] Improve cosmetic filtering performance with mutated elements on iOS #32060
Merged
StephenHeaps merged 1 commit intomasterfrom Nov 18, 2025
Merged
[iOS] Improve cosmetic filtering performance with mutated elements on iOS #32060StephenHeaps merged 1 commit intomasterfrom
StephenHeaps merged 1 commit intomasterfrom
Conversation
3225f50 to
a656cf4
Compare
a656cf4 to
2686a0d
Compare
atuchin-m
approved these changes
Nov 14, 2025
kylehickinson
approved these changes
Nov 18, 2025
Collaborator
|
Released in v1.86.90 |
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.
iOS currently debounces sending selectors & classes added via mutations, so if a site mutates frequently it will delay sending the selectors to the adblock engine to determine if we should hide them. This PR updates it so we throttle instead of debounce, so they will be sent at most 200ms after detecting them via mutation observation.
Desktop's
ShouldThrottleFetchNewClassIdsRulesis similar to iOS'ssendPendingSelectorsThrottled.However, the difference is that desktop does this in
ShouldThrottleFetchNewClassIdsRules:brave-core/components/cosmetic_filters/resources/data/content_cosmetic.ts
Lines 139 to 141 in 40a9761
Which is a correct throttle. Where iOS currently does this in
sendPendingSelectorsThrottled:brave-core/components/cosmetic_filters/resources/data/content_cosmetic_ios.js
Lines 205 to 208 in 40a9761
which is a debounce. This PR updates iOS to align with a proper throttle, instead of a debounce.
Resolves brave/brave-browser#48517