AdguardTeam / CoreLibs

Core Adguard libraries
https://adguard.com/
Apache License 2.0
40 stars 7 forks source link

imi-online.de - element hiding/javascript rules do not work #1671

Closed AdamWr closed 2 years ago

AdamWr commented 2 years ago

Steps to reproduce:

  1. Add these rules:
    imi-online.de##body
    imi-online.de#%#alert(1);
  2. Go to - https://www.imi-online.de/2022/09/09/neue-grossoffensive-in-nordsyrien/

Website should be "blank" and there should be an alert. For some reason element hiding and javascript rules do not work.

AdGuard for Windows version 7.11 nightly 10 (build 4039, CL 1.10.80)

Alex-302 commented 2 years ago

Which browser? Chrome? I can't reproduce with the same build. But after the first visit witout the app, I had to press the buttons on this page to close old connections: chrome://net-internals/#sockets

AdamWr commented 2 years ago

Yes, Chrome. I have checked it out few times in incognito mode and result was always the same - JavaScript and element hiding rules didn't work, but $$ rules work fine. I have the same problem on Android.

AdamWr commented 2 years ago

I guess that it's caused by not closed html tag.

Screenshot ![image](https://user-images.githubusercontent.com/29142494/195088356-b0c47dee-ae57-41cf-95c0-49937a86df04.png)

If I add a $replace rule, for example like this:

||imi-online.de^$replace=/(<html xmlns="http:.*?" lang=".*?")/\$1>/

to close this tag, then rules work correctly.

grumaxxx commented 2 years ago

@AdamWr You are absolutely right, cause html tag doesn't close, next tag <script ...> is considering like html tag content. We will try to prevent this behavior.

grumaxxx commented 2 years ago

Actually, this is very rare issue, so it is difficult to prevent all possible errors in html. We have decided to don't change our behavior with problems like this.

In this case adding rule to fix html page is the best solution.

AdamWr commented 2 years ago

Okay, I have added this rule. Thank you for your reply.