In Standard Shields, significant text
check should happen before partiness check
#40967
Labels
feature/shields/adblock
Blocking ads & trackers with Shields
OS/iOS
Fixes related to iOS browser functionality
privacy
QA Pass - iPad
QA Pass - iPhone
QA/Test-All-Platforms
QA/Yes
release-notes/include
Milestone
Description
On iOS, in Standard mode, cosmetically filtered content is hidden as soon as possible by hiding their element subtree, then after the content is hidden, we do another pass to check the subtree of the all these hidden elements to see if there is a 1st party or if they contain significant text](https://github.com/brave/brave-core/blob/master/ios/brave-ios/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Sandboxed/SelectorsPollerScript.js#L446-L470). Hidden elements with 1st party URLs are unhidden, and so is content with significant text. iOS has a logic bug that differs from desktop here, where if a hidden element contains a 3rd party resource, we fail to check for significant text.
Desktop logic for this 'should unhide hidden element' check checks if the hidden subtree is first party or shows significant text is here: https://github.com/brave/brave-core/blob/ed5f49a24e74176420a40263075ad3580a10f7a8/components/cosmetic_filters/resources/data/content_cosmetic.ts#L559-L569
On iOS the logic for this same 'should unhide hidden element' check is here:
https://github.com/brave/brave-core/blob/ed5f49a24e74176420a40263075ad3580a10f7a8/ios/brave-ios/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Sandboxed/SelectorsPollerScript.js#L560-L581
The bug on iOS occurs when the hidden element contains a 3rd party resource AND significant text. In this case,
queryResults.foundThirdPartyResource
is true so we enter that if block first and never check for significant text:https://github.com/brave/brave-core/blob/ed5f49a24e74176420a40263075ad3580a10f7a8/ios/brave-ios/Sources/Brave/Frontend/UserContent/UserScripts/Scripts_Dynamic/Scripts/Sandboxed/SelectorsPollerScript.js#L567-L574
This is where iOS differs in the 'should unhide hidden element' check. See https://github.com/brave/internal/issues/1188 for STR.
The text was updated successfully, but these errors were encountered: