ABP does not unhide nodes no longer matching with :-abp-has(...)
Environment
- Windows 10 x64
- Chrome 81 x64
- AdBlock Plus 3.8.4 with tested filters:
e-forma.pl,homeoapteka.pl#?##colorbox:-abp-has(#newsletter_colorbox)
e-forma.pl,homeoapteka.pl###cboxOverlay
How to reproduce
-
Go to:
https://www.e-forma.pl/1938,cocoa-migdaly-w-surowej-czekoladzie-bio-70g.html
or
http://homeoapteka.pl/2049,biokap-10-0-zloty-bardzo-jasny-blond-140-ml.html
-
try block newsletter with that filters:
e-forma.pl,homeoapteka.pl#?##colorbox:-abp-has(#newsletter_colorbox)
e-forma.pl,homeoapteka.pl###cboxOverlay
Newsletter should be active after second visit in shop.
-
try click on chocolate / hairs image:
-
Gallery of image can't be opened...
Observed behavior
Gallery of image can't be opened
Expected behavior
Gallery of image should be opened, pop-up after click of image no have longer HTML element with ID #newsletter_colorbox
First should solve the problem with nodes, then how will there be time and opportunity to analyze whether the classes / id / unique attributes disappear from html elements and the filter should stop hiding above element.
Similar bug fixed in uBlock Origin: https://github.com/uBlockOrigin/uBlock-issues/issues/341
Integration Notes
With the changes to fix this issue, the ElemHideEmulation constructor takes an additional parameter: unhideElemsFunc
. This should be a function which takes a list of elements that were previously hidden and unhides them.
For example, a new use of ElemHideEmulation could look like this:
let elemHideEmulation = new ElemHideEmulation(
elems => {
for (let elem of elems) {
if (elem.style.display !== "none")
elem.style.display = "none";
}
},
elems => {
for (let elem of elems) {
if (elem.style.display === "none")
elem.style.display = "";
}
}
);
Testing Notes
Unhiding will only work in the browser extension after the users of core (eg WebExt SDK) add the appropriate unhiding browser code, so until then this change will not do anything different in end to end testing.