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

Fix 'prevent-element-src-loading' — broken website #264

Closed
1 task done
AdamWr opened this issue Dec 3, 2022 · 3 comments
Closed
1 task done

Fix 'prevent-element-src-loading' — broken website #264

AdamWr opened this issue Dec 3, 2022 · 3 comments

Comments

@AdamWr
Copy link
Member

AdamWr commented Dec 3, 2022

  • Fix issue with broken websites (I think that's the most important and I guess that other issues could be fixed later)

Related issue - AdguardTeam/AdguardFilters#136501

It looks like that scriptlet doesn't work correctly and it breaks website.

Screenshot

image

Uncaught TypeError: thisArg.getAttribute is not a function

As far as I understand, the problem is in this line:

const isMatched = thisArg.getAttribute(source.name) === 'matched'

thisArg sometimes doesn't have getAttribute method and it throws error.
So, I guess that checking if getAttribute is a function, for example, by something like this:

thisArg.getAttribute?.(source.name)

should fixes this issue.

By the way, it looks like that this issue - #228 is not fixed or I'm doing something wrong.
I have checked it here - https://jsfiddle.net/ofzmtek3/


Additional notes.
It seems that it happens only with latest nightly build for Windows (7.12 nightly 1 (build 4121, CL 1.10.154)), because (if I'm not wrong) other versions do not use latest scriptlets library yet.

@AdamWr
Copy link
Member Author

AdamWr commented Dec 3, 2022

moned to #276

@stanislav-atr stanislav-atr self-assigned this Dec 6, 2022
adguard pushed a commit that referenced this issue Dec 6, 2022
…G-18039

Merge in ADGUARD-FILTERS/scriptlets from fix/AG-18039 to master

Squashed commit of the following:

commit 96727f7
Merge: c95c2eb 5e74b91
Author: Stanislav A <[email protected]>
Date:   Tue Dec 6 17:13:56 2022 +0300

    Merge branch 'master' into fix/AG-18039

commit c95c2eb
Merge: 30649fd bb4c801
Author: Stanislav A <[email protected]>
Date:   Tue Dec 6 17:06:33 2022 +0300

    Merge branch 'master' into fix/AG-18039

commit 30649fd
Merge: abb1f95 c98787f
Author: Stanislav A <[email protected]>
Date:   Tue Dec 6 16:51:24 2022 +0300

    Merge branch 'master' into fix/AG-18039

commit abb1f95
Author: Stanislav A <[email protected]>
Date:   Tue Dec 6 16:05:28 2022 +0300

    fix prevent-element-src-loading thisArg.getAttribute TypeError
@AdamWr
Copy link
Member Author

AdamWr commented Dec 13, 2022

If I understand correctly issue with incorrect blocking has been fixed.
It's nice, but if I'm not wrong other issues are not fixed and I guess this issue was closed by bot automatically, so I'm reopening it.
Please close it if all those issues are already fixed and I was wrong.

@slavaleleka
Copy link
Contributor

yes, only incorrect blocking is fixed. the issue should be opened due to other tasks. so better to create separate issues for different problems in future

@slavaleleka slavaleleka changed the title Fix prevent-element-src-loading Fix 'prevent-element-src-loading' — broken website Jan 9, 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

4 participants