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

':xpath()' syntax unsupported or suppress errors while handling rules #144

Closed
3 tasks done
Birbber opened this issue May 16, 2022 · 1 comment
Closed
3 tasks done

Comments

@Birbber
Copy link

Birbber commented May 16, 2022

@seia-soto commented on Thu Mar 31 2022

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Issue Details

  • AdGuard for Safari version: 1.11.3
  • Environment name and version: 15.4 (17613.1.17.1.6)
  • Operating System: macOS 12.3 (21E230) arm64
  • Filters you use in AdGuard: YousList, List-KR, AdGuard Base, AdGuard Mobile Ads, EasyList, AdGuard Privacy, EasyPrivacy, Fanboy's Facebook List, AdGuard Social Media, AdGuard Annoyance, AdBlock Warning Removal List, I don't care cookies, EasyList Cookies, Spam404, NoCoin, AdGuard DNS, YousList
  • Any other browser extensions you have installed: Bitwarden Password Manager, SponsorBlock

Expected Behavior

AdGuard should run properly without any error and block ads on the website I am visiting.

Or even if the error occurred during the parsing process, AdGuard should execute remaining the proper rules regardless of the error status.

Actual Behavior

AdGuard crashed during its execution of extension content if there is :xpath syntax in the filter list.

Error: CssParser: parse error at position 317

error — extended-css.js:4623
parseCss — extended-css.js:4687
ExtendedCss — extended-css.js:5265
applyExtendedCss — script.js:131
applyAdvancedBlockingData — script.js:180
handleMessage — script.js:213

Screenshots

Screenshot:

Error: CssParser: parse error at position 317

error — extended-css.js:4623
parseCss — extended-css.js:4687
ExtendedCss — extended-css.js:5265
applyExtendedCss — script.js:131
applyAdvancedBlockingData — script.js:180
handleMessage — script.js:213

0 "div:not([class]) > table + .wiki-paragraph:nth-ancestor(1)"
1 "div:not([class]):has(> table + .wiki-paragraph)"
2 "div:not([class]):has(> table + .wiki-paragraph)"
3 ":xpath(//article/h1/following-sibling::div[1]/following-sibling::div//div[count(*)>1][not(ancestor::div[count(*)>1]/ancestor::article)]/div[…"
4 ":xpath(//article/h1/following-sibling::div[1]/following-sibling::div//div[count(*)>1]//div[count(*)>1][not(ancestor::div[count(*)>1]/ancesto…"
5 "div:not([class]):has(> table + .wiki-paragraph)"
6 "#app > div[class]:matches-attr(\"/data-v-/\") > div > div:has(> a[href=\"https://namu.news\"])"
7 "aside > div[class]:matches-attr(\"/data-v-/\"):has(> a[href=\"https://namu.news\"])"

Additional Information

I know that we need more investigation about this but the problematic :xpath rule is working well on Chrome and Firefox with AdGuard browser extension installed.

If I apply following filters into AdGuard Safari Extension, I can see that ad is blocked properly without any error.
Note that YousList includes :xpath rule first and I disabled manually.

namu.wiki#?#div:not([class]):has(> table + .wiki-paragraph)
namu.wiki#@#:xpath(//article/h1/following-sibling::div[1]/following-sibling::div//div[count(*)>1]//div[count(*)>1][not(ancestor::div[count(*)>1]/ancestor::div[count(*)>1]/ancestor::article)]/div[.//ul/li|.//a[contains(@href,'/w/%EB%B6%84%EB%A5%98:')]]/following-sibling::div[.//div[contains(concat(' ',normalize-space(@class),' '),' namuwiki-toc-ad ')]|.//div[contains(concat(' ',normalize-space(@class),' '),' wiki-paragraph ')]]/following-sibling::div[count(.//*[count(img[starts-with(@src,'//w.namu.la/s/')]|img[starts-with(@src,'//ww.namu.la/s/')]|img[starts-with(@src,'data:image/png;base64,')])>1])>1])
namu.wiki#@#:xpath(//article/h1/following-sibling::div[1]/following-sibling::div//div[count(*)>1][not(ancestor::div[count(*)>1]/ancestor::article)]/div[1])

Related

@slavaleleka
Copy link
Contributor

slavaleleka commented May 16, 2022

will be fixed in ExtendedCss v2.0

we use Sizzle for parsing extended selectors and it fails with some xpath expressions. the issue is known and should be fixed after we ditch Sizzle

@adguard-bot adguard-bot changed the title :xpath syntax unsupported or suppress errors while handling rules ':xpath()' syntax unsupported or suppress errors while handling rules Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants