Closed troysjanda closed 2 years ago
The new CSSTree is screwing up filters my yahoo list https://raw.githubusercontent.com/troysjanda/MyBlockLists/master/yahoocomplete.txt is not showing any invalid filters but yahoo is completely screwed up cant scroll, all the hidden/blocked stuff is not, empty placeholders are not hidden
only when I add your list I get empty PH (FF, 1.44.5b1
)
@gorhill
The front page looks fine to me with your list. I need to know how to reproduce.
Never mind, I can reproduce with Firefox, but not Chromium.
Some help to find the filter causing this would be appreciated.
I think it's filters with ...:nth-of-type(...)
I have tried everything fix my list and I am reverting to 1.44.5b0 and it seems to fix everything I guess ill stop updating and stay at 1.44.5b0 CSSTree is really messing up my filters and since I use the picker to make the filters. this is my list https://raw.githubusercontent.com/troysjanda/MyBlockLists/master/yahoocomplete.txt I dislike the new CSSTree to be honesty Im at this point going to stay on 1.44.5b0
with the new 1.44.5b1 if using the picker to block or hide something it reappears even with purging cache I really at this point giving up trying to fix my filters. the empty place holders stay here is what Yahoo looks like https://i.postimg.cc/c1Yp2DFs/error.png I even starting a new yahoo list and still having issues with making filters and them staying hidden or blocked.
To be clear I use the picker to make filters and not an expert on looking for and making filter any other way.
Yes, only those 2 :nth-of-type
filters
www.yahoo.com##li.stream-grid-view_Fxg\(2\).stream-grid-view_Flxb\(1\/3\).My\(12px\).Pos\(r\).Bgc\(t\).js-stream-content.stream-item > .stream-grid-view_Fld\(c\).D\(f\).Pos\(r\).userintent-hidestrmitem_D\(n\) > .End\(0\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) www.yahoo.com##.End\(12px\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) > .has-wafer-click.has-fetch-click.C\(--pebble\).D\(b\).Td\(n\).Td\(n\)\:h.fetch-with-session-retry.wafer-fetch.Fill\(--dolphin\).userintent-panelbtn.userintentmgmt-panel\:h\>Fill\(\$streamBrandHoverClass\).Py\(0\).Pend\(0\).Pstart\(4px\).O\(n\)\:f.Bd\(n\).Pos\(r\) www.yahoo.com##.finance-ticker-fetch-success.stream-grid-view_Flxb\(1\/3\).My\(12px\).Pos\(r\).Bgc\(t\).js-stream-content.stream-item > .stream-grid-view_Fld\(c\).D\(f\).Pos\(r\).userintent-hidestrmitem_D\(n\) > .End\(0\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) > .has-wafer-click.has-fetch-click.C\(--pebble\).D\(b\).Td\(n\).Td\(n\)\:h.fetch-with-session-retry.wafer-fetch.Fill\(--dolphin\).userintent-panelbtn.userintentmgmt-panel\:h\>Fill\(\$streamBrandHoverClass\).Py\(0\).Pend\(0\).Pstart\(4px\).O\(n\)\:f.Bd\(n\).Pos\(r\) www.yahoo.com##.End\(0\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\)
Are not working after a page refresh they appear back
www.yahoo.com##li.stream-grid-view_Fxg\(2\).stream-grid-view_Flxb\(1\/3\).My\(12px\).Pos\(r\).Bgc\(t\).js-stream-content.stream-item > .stream-grid-view_Fld\(c\).D\(f\).Pos\(r\).userintent-hidestrmitem_D\(n\) > .End\(0\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) www.yahoo.com##.End\(12px\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) > .has-wafer-click.has-fetch-click.C\(--pebble\).D\(b\).Td\(n\).Td\(n\)\:h.fetch-with-session-retry.wafer-fetch.Fill\(--dolphin\).userintent-panelbtn.userintentmgmt-panel\:h\>Fill\(\$streamBrandHoverClass\).Py\(0\).Pend\(0\).Pstart\(4px\).O\(n\)\:f.Bd\(n\).Pos\(r\) www.yahoo.com##.finance-ticker-fetch-success.stream-grid-view_Flxb\(1\/3\).My\(12px\).Pos\(r\).Bgc\(t\).js-stream-content.stream-item > .stream-grid-view_Fld\(c\).D\(f\).Pos\(r\).userintent-hidestrmitem_D\(n\) > .End\(0\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) > .has-wafer-click.has-fetch-click.C\(--pebble\).D\(b\).Td\(n\).Td\(n\)\:h.fetch-with-session-retry.wafer-fetch.Fill\(--dolphin\).userintent-panelbtn.userintentmgmt-panel\:h\>Fill\(\$streamBrandHoverClass\).Py\(0\).Pend\(0\).Pstart\(4px\).O\(n\)\:f.Bd\(n\).Pos\(r\) www.yahoo.com##.End\(0\).user-intent-options.T\(0\).Pos\(a\) > div > .has-wafer-click.has-toggle-click.wafer-toggle.userintentmgmt-panel.Ta\(c\) www.yahoo.com##.wafer-destroyed.Va\(t\).D\(f\).Td\(n\).rapidnofollow.js-content-viewer www.yahoo.com##.W\(1\/4\)--maw1024.W\(1\/3\)
Also apprear to not work
https://user-images.githubusercontent.com/24624945/192118854-dc802d63-9100-4c93-a203-adee0a62e46e.PNG https://user-images.githubusercontent.com/24624945/192118856-b921b891-4f33-4d92-b300-8fde149b02eb.PNG
stuff not blocked, empty placeholders, pointed out with the yellow highlight
The issue is nth
, fixing, no need to add more information.
other non working filters listed above are not of the nth type, and seem to work under 1.44.1b0 and not the 1.44.1b1 with the new CSSTree.
maybe a toggle in advanced settings to switch between the CSSTree parser and the prior parser until such time as the bugs can be worked out.
stuff not blocked, empty placeholders
I can't make anything of this without knowing the exact URL I have to visit to see the issue for myself.
on another note there are only 2 filters with the nth type in my list
and there is way more breakage that just those 2 filters as listed above
stuff not blocked, empty placeholders
I can't make anything of this without knowing the exact URL I have to visit to see the issue for myself.
YAHOO.COM
An empty :nth-of-type()
-- which is the issue I am fixing -- is not a valid selector, so it's going to cause other cosmetic filters in the same stylesheet to also break.
here is how Yahoo.com appears on FF 105.0.1 with Ubo 1.44.5b0 with deafult filters and my yahoocomplete list.
here is it under same browser with ubo 1.44.5b1
I confirm fixed, and closing
Side Note: I was not trying to be difficult was just trying to give you all the information i could to help. Sorry if I was posting too much
On my side often cosmetic filters down on company page after open 2-3 categories with offering products.
Tested on Firefox 105.0.1 (No reproduce on Nightly 107) with uBo 1.44.5b9.
I don't open page in row or inactive tabs.
In logs I don't see any errors and crash add-on (with failed tries inject CSS to hide elements).
I have error but cut by "...": cosmetic-logger.js:88
SyntaxError: Document.querySelector: '.popmake[data-popmake*="cookie"],
.pum[data-popmake*="cookies-policy"],
.pum[data-popmake*="cookies-politique"],
.pum[data-popmake*="cookie-consent"],
.pum[data-popmake*="aviso-de-cookies"],
.pum[data-popmake*="cookies-datenschutz"],
.pum[data-popmake*=""slug":"cookie"],
.pum[data-popmake*="cookie-warning"],
.pum[data-popmake*="privacy"],
.pum[data-popmake*="gdpr"],
.pum[data-popmake*="pravila-privatnosti"],
.pum[data-popmake*="cookies-kakor"],
.pum[data-popmake*="cookie-policy"],
.widget.cookies,
.container[data-testid*="cookiePopup"],
.container[data-js*="cookie-message"],
.container.CookieConfirmation,
.container.cookies__base--open,
.container.UseCookie:not(body):not(html),
.row[data-test-selector*="cookie-banner"],
.row[class*="src-components-CookiePolicy"],
.row.allow-cookies:not(body):not(html),
#cookie-notice,
.cookie-notice-container,
.lightbox.cookie-optin-layer,
[class*="AdSlotPlaceholder"],
.slide-rss-out-div,
.google-news,
.google-news…
// line in file
(node.querySelector(simpleDeclarativeStr) === null)
Possible guilty malform:
.pum[data-popmake*="\"slug\":\"cookie"]
into: .pum[data-popmake*=""slug":"cookie"]
(error with "
).
to reporduce possible use page like: https://katowice.fonpizza.pl/kontakt/ with this setting list:
(Block something on page by cosmetic filter and fresh as element back to visible)
No help purge all cache.
Definitely these filters break cosmetic filtering on pizza page and company shop:
##.foo[bar*="\"one\":\"two"]
##.foo[bar*='"one":"two']
But on Firefox 105 no warn SyntaxError
. It may help disable all filters with "
as value for attributes by #@#.foo...
.
Interest is fact breakage no longer exists with Firefox 107 (big changes in JavaScript API?).
Thanks for narrowing this down, it's probably behind vague cases of things not working properly.
Hi,
Now will be broken use :nth-child(odd)
and/or :nth-child(even)
— malformed into empty :nth-child()
.
Still helps use #@#
— cosmetic filtering back to work.
By the way I use this tool to investigate what the csstree parser generates as a result of parsing a selector: https://astexplorer.net/#/gist/244e2fb4da940df52bf0f4b94277db44/e79aff44611020b22cfd9708f3a99ce09b7d67a8. Paste a selector with {}
to ensure the tool works properly. The result of the parsing is under prelude
property.
For me the tool is not readable so I hunted for several hours for a readable SyntaxError.
What do you mean "not readable"?
What do you mean "not readable"?
Could you proved an example on how to use https://astexplorer.net/#/gist/244e2fb4da940df52bf0f4b94277db44/e79aff44611020b22cfd9708f3a99ce09b7d67a8 not sure I am using it correctly
Well using the recent issue, paste this in the editor:
:nth-child(odd)
{}
The first line is the CSS selector to parse, the second is just an empty block the tool expects (normally filled with style properties.
If a valid CSS selector is used, the parser will fill the prelude
property with the details of the parsing. If an invalid CSS selector is used, let's say :nth-child(od)
, the parser will end up using Raw
entries.
However, the nice thing with the csstree parser is that it will parse uBO pseudo-operators as pseudo-classes, thus providing free parsing for these:
:has-text(...)
{}
The only "issue" which is the actual debt incurred in uBO is that I never requested that the arguments to pseudo-operators be properly quoted or escaped (except for parentheses), and sometimes this trips the parser:
:has-text(')
{}
:has-text(")
{}
Some characters have special meaning in CSS, and the single quote above trips the parser. Solution, use quotes:
:has-text("'")
{}
:has-text('"')
{}
uBO will remove the quotes in such case before using the argument.
Currently the cosmetic filters found as invalid because of the special characters can be seen in https://github.com/gorhill/uBlock/blob/master/dist/mv3/log.txt, search for Invalid filter:
. There are not that many of them considering all the cosmetic filters being processed, and these will be rejected at compile time, and we can fix them through reports or just remove them if they are found to be obsolete.
Thank you Now I understand. Much appreciated.
Well using the recent issue, paste this in the editor:
:nth-child(odd) {}
The first line is the CSS selector to parse, the second is just an empty block the tool expects (normally filled with style properties.
If a valid CSS selector is used, the parser will fill the
prelude
property with the details of the parsing. If an invalid CSS selector is used, let's say:nth-child(od)
, the parser will end up usingRaw
entries.However, the nice thing with the csstree parser is that it will parse uBO pseudo-operators as pseudo-classes, thus providing free parsing for these:
:has-text(...) {}
The only "issue" which is the actual debt incurred in uBO is that I never requested that the arguments to pseudo-operators be properly quoted or escaped (except for parentheses), and sometimes this trips the parser:
:has-text(') {} :has-text(") {}
Some characters have special meaning in CSS, and the single quote above trips the parser. Solution, use quotes:
:has-text("'") {} :has-text('"') {}
uBO will remove the quotes in such case before using the argument.
Currently the cosmetic filters found as invalid because of the special characters can be seen in https://github.com/gorhill/uBlock/blob/master/dist/mv3/log.txt, search for
Invalid filter:
. There are not that many of them considering all the cosmetic filters being processed, and these will be rejected at compile time, and we can fix them through reports or just remove them if they are found to be obsolete.
Is there a script that I could run on my lists to see if there are invalid cosmetic filters, just curious if that can be done. Also is there a way Ubo can auto correct those , or does that create too much overhead. reason i ask, as being a beginner filter creator I use picker to make the majority of my filters and this would be handy tool to parse my lists to see if I have CSSTree type invalid filters. hope that makes since.
If script show malfromation of nth-
, attributes [a="\""]
then maybe worth rewrite to webpage like:
https://www.reddragonwebdesign.com/projects/adblock-filter-analyzer/
These is important due can disable hide ads on YouTube and Reddit.
https://astexplorer.net/#/gist/244e2fb4da940df52bf0f4b94277db44/8d78949ba0fc0410b017316318105b3ebd4c7cd9 - many unknown but ad end detect "nth-".
These now works similar to ##*
.
But rare chance of exist filter in list with support Safari 9 - 16 e.g. by AdGuard environment.
Prerequisites
URL address of the web page
https://www.yahoo.com/
Category
ads
Describe the issue
steps to reproduce, 1) upate to latest dev version 2) add https://raw.githubusercontent.com/troysjanda/MyBlockLists/master/yahoocomplete.txt filterlist 3) purge and update filters 4) load yahoo.com
items blocked are no longer blocker, empty place holders. if using picker and selecting item to block on page refresh it reappears
Screenshot(s)
https://i.postimg.cc/c1Yp2DFs/error.png
Screenshot(s)
Configuration