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

The logger doesn't show ? in rules with #?# #2475

Closed
8 tasks done
Yuki2718 opened this issue Feb 1, 2023 · 17 comments
Closed
8 tasks done

The logger doesn't show ? in rules with #?# #2475

Yuki2718 opened this issue Feb 1, 2023 · 17 comments
Labels
bug Something isn't working

Comments

@Yuki2718
Copy link

Yuki2718 commented Feb 1, 2023

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

To counter sekai-kabuka.com#?#td[align="center"][class] > table > tbody > tr > td > div[style]:has(> ins.adsbygoogle) in AG Annoyances, sekai-kabuka.com#@#td[align="center"][class] > table > tbody > tr > td > div[style]:has(> ins.adsbygoogle) or even the logger's disabling button (FilterAuthor mode) does not work. The only way to counter seems to be sekai-kabuka.com#@?#td[align="center"][class] > table > tbody > tr > td > div[style]:has(> ins.adsbygoogle) (look ?).

A specific URL where the issue occurs.

https://sekai-kabuka.com/

Steps to Reproduce

  1. Visit the site with AG Annoyances enabled, but the site may be different if accessed from foreign or by VPN.
  2. If the filter is applied, try to counter.

Expected behavior

sekai-kabuka.com#@#td[align="center"][class] > table > tbody > tr > td > div[style]:has(> ins.adsbygoogle) and disalbing via the logger should work.

Actual behavior

Doesn't work.

uBO version

1.46.0

Browser name and version

Chrome 109.0.5414.120

Operating System and version

Windows 10

@gorhill
Copy link
Member

gorhill commented Feb 1, 2023

Did you try with #@?#?


Ok you did. The reason is that ? modifies how uBO compiles the filter, it forces it to be procedural instead of declarative, so if you want to except it, you need to also use the procedural modifier to match the blocking filter.

@Yuki2718
Copy link
Author

Yuki2718 commented Feb 1, 2023

Okay, but the logger doesn't show ?. At least the disabling via the logger needs fix.

@gorhill
Copy link
Member

gorhill commented Feb 1, 2023

By the way, why is AdGuard using ?? The unfortunate side-effect in uBO is that the filter is being compiled as procedural while it would otherwise be a perfectly valid declarative filter, being applied natively by the browser.

@Yuki2718
Copy link
Author

Yuki2718 commented Feb 1, 2023

I don't know TBH but faintly remember there was some compatibility issue and they temporally changed to #?#abp-has(). Maybe @krystian3w knows better.

@Yuki2718 Yuki2718 changed the title Unable to disable cosmetic filter with #?#*:has() by #@# The logger doesn't show ? in rules with #?# Feb 1, 2023
@krystian3w
Copy link

krystian3w commented Feb 1, 2023

AdguardTeam/ExtendedCss#161 - here started IMO.

AdguardTeam/FiltersRegistry#665
AdguardTeam/FiltersRegistry#664 - both don't touching "/ublock/" files on adtidy.org:

wuyong.fun,26g.me,myqqjd.com,poapan.xyz,javboys.com,chpadblock.com,idevicecentral.com,fcportables.com,codehelppro.com##+js(abort-on-property-read, reqServers)
rbs.ta36.com#?#.container > div[id][class]:has(h4.adblock_title)
!

AdguardTeam/ExtendedCss#154 - opened about troubles with check invalid inside has/convert to procedural.

@krystian3w
Copy link

krystian3w commented Feb 1, 2023

PS. ABP engine parser only allow:

#@#td[align="center"][class] > table > tbody > tr > td > div[style]:has(> ins.adsbygoogle)

as exception, so his engine disable use JS and "CSS4" implementation at same time (a little strain on list makers what not to test with AdGuard but continue to use EasyList syntax and rely on uBO).

@Yuki2718
Copy link
Author

Yuki2718 commented Feb 1, 2023

I will suggest to change these #?#*:has rules to ##*:has() when Firefox and Safari CB officially support native :has(), if no others do.

@gorhill
Copy link
Member

gorhill commented Feb 1, 2023

On the other hand this would be a problem for people using older versions of a browsers not supporting native :has() and ? would be the only workaround to force procedural -- think of Firefox vs Firefox ESR.

@gorhill
Copy link
Member

gorhill commented Feb 1, 2023

Simpler repro case I can work with:

example.org#?#div:has(> h1)
example.org#@#div:has(> h1)

@gwarser gwarser added the bug Something isn't working label Feb 1, 2023
@Yuki2718
Copy link
Author

IIRC :contains() was translated into :has-text() in the logger in the older versions, but now displayed as is separately with the same :has-text() rule as if they're different operator?

@krystian3w
Copy link

krystian3w commented Feb 22, 2023

Even the exception must be with an identical operator:

github.com##p:contains(contains)
! no longer disable AdGuard / draft CSS (2010-2012?) syntax:
github.com#@#p:has-text(contains)
github.com#@?#p:-abp-contains(contains)

@Yuki2718
Copy link
Author

Yuki2718 commented Feb 27, 2023

I mistakenly added double spaces in a rule, but the logger only shows single space:

logger

Ofc corresponding exception must be double spaces: uBlockOrigin/uAssets@dc64ec8

@krystian3w
Copy link

krystian3w commented Feb 27, 2023

Spaces are supposedly compressed since the release of the new parser on CSSTree.

But Author mode/DOM inspector remember precompressed version (or copy from precompressed source).

As hack "maybe" works too:

example.org##:not(#mistake, #typo)               td[style^="vertical-align"] div[onclick][target="_blank"]:style(pointer-events: auto !important;)

but this need follow how page stylize elements if override auto/unset/initial/revert (SVG support all/painted/stroke/fill/visible/visibleStroke/visibleFill/visiblePainted if someone create page as big svg image).

@Yuki2718
Copy link
Author

Now opposite is the case - to counter sankei.com#?#.main-items > .col-container > .col-item:has(.story-card-feed > .col-container > article.storycard span.sponsored) in Japanese filters (no more exist as I adjusted), sankei.com#@?#.main-items > .col-container > .col-item:has(.story-card-feed > .col-container > article.storycard span.sponsored) doesn't work and I have to use sankei.com#@#.main-items > .col-container > .col-item:has(> .story-card-feed > .col-container > article.storycard span.sponsored). Is this expected behavior?

@gorhill
Copy link
Member

gorhill commented Jul 15, 2023

This works for me:

example.org#?#body:has(p):style(color: red)
example.org#@?#body:has(p):style(color: red)

Also:

example.org#?#body:has(p):style(color: red)
example.org#@#body:has(p):style(color: red)

Also:

example.org##body:has(p):style(color: red)
example.org#@?#body:has(p):style(color: red)

Your exception filter which you say works is functionally different than the cosmetic filter you wanted to except, :has(> , suggesting the cosmetic filter had :has(> , and thus your first exception wouldn't match in this case.

#?# .main-items > .col-container > .col-item:has(.story-card-feed > .col-container > article.storycard span.sponsored)
#@?#.main-items > .col-container > .col-item:has(.story-card-feed > .col-container > article.storycard span.sponsored)
#@# .main-items > .col-container > .col-item:has(> .story-card-feed > .col-container > article.storycard span.sponsored)

@Yuki2718
Copy link
Author

Oh, sorry! I missed I added > in AdguardTeam/AdguardFilters@ca53d4a

@gorhill
Copy link
Member

gorhill commented Apr 15, 2024

I can't reproduce an issue in latest uBO. Closing.

@gorhill gorhill closed this as completed Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants