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

:watch-attr() stopped working #1392

Closed
8 tasks
gwarser opened this issue Dec 10, 2020 · 7 comments
Closed
8 tasks

:watch-attr() stopped working #1392

gwarser opened this issue Dec 10, 2020 · 7 comments
Labels
bug Something isn't working fixed issue has been addressed

Comments

@gwarser
Copy link

gwarser commented Dec 10, 2020

Details

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

MajkiIT/polish-ads-filter#18147 (comment)

Does not work on test page: https://ameshkov.github.io/web/watchattr.html

A specific URL where the issue occurs

https://ameshkov.github.io/web/watchattr.html

Steps to Reproduce

  1. Add ameshkov.github.io###testdiv:watch-attr(id):has(p)
  2. Visit https://ameshkov.github.io/web/watchattr.html
  3. Click on button

Expected behavior:

Element should appear/disapper after click on button

Actual behavior:

Element does not appear

Your environment

  • uBlock Origin version: bisected
  • Browser Name and version: Firefox Nightly, Chrome 87.0.4280.88
  • Operating System and version: Manjaro KDE

Notes

Broken in 1.29.3.9

[rdk@on uBlock-git]$ git bisect bad && ./tools/make-chromium.sh 
35aefed92616cbfb75f12f37c7ea7fb3a3cc3369 is the first bad commit
commit 35aefed92616cbfb75f12f37c7ea7fb3a3cc3369
Author: Raymond Hill <rhill@raymondhill.net>
Date:   Mon Sep 7 08:28:01 2020 -0400

    Add support to chain `:style()` to procedural operators
    
    Related issue:
    - https://github.com/uBlockOrigin/uBlock-issues/issues/382
    
    Additionally, remnant code for pseudo-user stylesheets
    has been removed. Related commit:
    - https://github.com/gorhill/uBlock/commit/5c68867b92735931a791dfedf4ef9608cc364862

 platform/chromium/vapi-background.js     |  23 ++-
 platform/chromium/vapi-client.js         |   8 +-
 src/js/background.js                     |   4 +-
 src/js/contentscript.js                  | 278 ++++++++++++-------------------
 src/js/cosmetic-filtering.js             | 167 ++++++-------------
 src/js/epicker-ui.js                     |  17 +-
 src/js/scriptlets/cosmetic-logger.js     |   6 +-
 src/js/scriptlets/dom-inspector.js       |  23 ++-
 src/js/scriptlets/dom-survey-elements.js |   4 +-
 src/js/scriptlets/epicker.js             | 180 ++++++--------------
 src/js/static-filtering-parser.js        |  43 +++--
 11 files changed, 281 insertions(+), 472 deletions(-)
*** uBlock0.chromium: Creating web store package
*** uBlock0.chromium: copying common files
*** Packaging assets in dist/build/uBlock0.chromium/assets... rm: cannot remove 'dist/build/uBlock0.chromium/assets/ublock/resources.txt': No such file or directory
done.
*** uBlock0.chromium: Generating meta...
*** uBlock0.chromium: Package done.
[rdk@on uBlock-git]$ 
gorhill added a commit to gorhill/uBlock that referenced this issue Dec 10, 2020
@gorhill
Copy link
Member

gorhill commented Dec 10, 2020

This was causing a regression not only for :watch-attr but also for any case of elements no longer matching any procedural filters.

@gorhill
Copy link
Member

gorhill commented Dec 10, 2020

Now the question: is it a case of emergency fix for a 1.31.4 release?

@gwarser gwarser added bug Something isn't working fixed issue has been addressed and removed fixed issue has been addressed labels Dec 10, 2020
@krystian3w
Copy link

Maybe just disable for few weeks this filter: uBlockOrigin/uAssets@6b78f43

@gwarser
Copy link
Author

gwarser commented Dec 10, 2020

It's surprising it was broken for so long and no one noticed.

Is it still broken for normal "elements" case? https://gwarser.github.io/web/watchattr.html https://ameshkov.github.io/web/watchattr.html (updated)

@gwarser
Copy link
Author

gwarser commented Dec 10, 2020

What the... It works if I click on second test button and then on first test button.

@krystian3w
Copy link

krystian3w commented Dec 10, 2020

Yeah, works as you wrote.

Maybe similar:

goodie.pl and filter:

goodie.pl##body > div[class]:last-of-type:has(a[href="/ochrona-danych"])

  • uBo DOM inspector sometimes lie what element is hidden: goodie.pl MajkiIT/polish-ads-filter#18146 (comment) - on few PC-s procedural filters stock on loaded #body-wrapper (hidding possible detect only by devtools).

  • for few seconds #body-wrapper is :last-child / :last-of-type.

@gorhill
Copy link
Member

gorhill commented Dec 10, 2020

Yeah, I see the filterer is not informed of removed nodes, I will have to figure out why this changed. It seems the DOM watcher's code was modified and this broke reporting of removed DOM nodes.


I will have to find the exact commit for this change but I think my thinking was to avoid firing DOM changes when non-element nodes are removed, for example when just a text node is removed. So when I optimized for this I actually broke reporting DOM changing as a result of elements being removed.


This broke in gorhill/uBlock@6112a68#diff-7c975d431b3d370b6b59f5860b06ddfdfc44eeafc32ef49dd705b13be13446ed, Oct 2017...

gorhill added a commit to gorhill/uBlock that referenced this issue Dec 10, 2020
@gwarser gwarser added the fixed issue has been addressed label Dec 10, 2020
@gwarser gwarser closed this as completed Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

3 participants