Opened 6 weeks ago

Closed 3 weeks ago

Last modified 9 days ago

#7088 closed change (fixed)

Implement hide-if-contains-image snippet

Reported by: mjethani Assignee: agiammarchi
Priority: P2 Milestone:
Module: Core Keywords: circumvention
Cc: agiammarchi, hfiguiere, Ross, BrentM, weissmar Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29914555/
https://gitlab.com/eyeo/adblockplus/adblockpluscore/merge_requests/9

Description (last modified by mjethani)

Background

Sometimes ads are clearly labeled, but the label is an image loaded over the network. In such cases, it would help to be able to examine the image data to determine whether it is an ad label.

What to change

Implement a snippet called hide-if-contains-image with the following signature:

function hideIfContainsImage(search, selector, searchSelector)

Similar to hide-if-contains (#6809, #6847, and #6848), it should take a search "string" (in this case hexadecimal or Base64), a CSS selector to hide, and a CSS selector to search. It should examine the background-image computed style of the element matching searchSelector. If the background-image data (downloaded using fetch) matches the search string, it should hide the ancestor matching selector.

Hints for testers

Try this:

<!-- test.html -->
<div id="lbiddvhck3">
  Lorem ipsum dolor sit amet, consectetur
  adipiscing elit, sed do eiusmod tempor
  incididunt ut labore et dolore magna aliqua.
  <div style="margin: 10px auto; display: inline-block; width: 728px; height: 90px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtgAAABaBAIAAAANVraoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAW5ElEQVR42u3deXQUVb4H8F9v6SULZCcJkB0EAkFIQISggMoeGISwPVCEcRlFXJ94jr4n8xhEHRUB0afC0UERUTMIiIASlghRgwGT8AAJnRBIQjbI0kmn09v7o5teqqu6Q5KiK8n39wen6t7a+n5uzvlRy72iAwVniSPMeuOmHdmu5XNS41wLVxROoVPORc8SEcX6aOfnZbpuHzFmnNao5zq1vyqYiI7t+PTE+AGutc/9NslxtTL5XG5QmW015mipbXn2PcPTJ93tuPEPeQXlRWVc583MVVOnxsz/eMj9BgaDgbOq4Gh8TISTiNHg5lC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LF96/PjP/P2YOxWcI59c9bRv8Twla3mI6rvRKQWqPS9w7Xil7ngotX9ov/ISjjuEA/sJNreFL3zhC1/4wte7vqJlr75vW/FVyCffc6frRsZm7cbdOR6vPjpYtXDRfbbVi9pQzi1NV9/ZdpBR2NxQx7X9ipnj+sREMApnFCez5rE+m7+xLHyXOvLPSuatvIPffm9ZmL5ooUHXwHq6sqvXS3496lo+5+atP41Wl5nbpgeT+rf+ZlloXPLKfz83X+LHjpS171fb8rixSZLQAMfaohr2vVZu77O49PK4NSFPfOvLdQHLaAt84Qtf+MIXvoL1xee7tykmL1qqr7tu1Js6/chff/RBbMaTnNWH0fbwRcAXAV/hhodExGwwEFFxWc28R59gbWKvXLRJpyeitaeulTxf4Vr7rw4fv39MVGzioywVpb+1+5ghYeGXCs7Fu+SV3g34whe+8IUvfL3r26ZEZNfRvJyoWa61E72K9GP268d+3ehaPuPoccuCuEWXb2BOYLhyUZpl4a0tm2ctX8p6ZI2uQdPS5Fou0+psywoV825bS3NTl8tD4Qtf+MIXvvD1rq+01d/+5XFlVaWbiX+6SjyutD7Au1JQsvWpKYza7ZutMzTumjfx8i0e+ZO91veDRBLJgsceZtQezPyh3ddsGejXEmONJmnnDfcLX/jCF77wha+QfaV0IsW2knUk97EptzDHYMqESY6r2ft2G1t0bdy3d4jTqzR1NdXzJ6XaVhOT4pi5od5A3TdKr9nnhja36juzO8IXvvCFL3zhK2DfDr2s+mYvp1d8py2PPnbEnnX2u7evm30nzU53XD28e88/gx0upqLUsXZrbGyrVkeI2xvwhS984Qtf+PLti69mOi0mz5nqWrjqU+tC+lC0EHwR8EXAF4FEpAsG15iAGxcPefpw9MQytBB8EfBFwBeJiEtcbNJw1vn2RdO3PWbeEcBaLhFdP5De+KZ3vuGCL3wR8EXAtxPi/wFAdj2IipchAgAAAABJRU5ErkJggg==)"></div>
</div>
<script src="script.js"></script>
/* script.js */
setTimeout(() =>
{
  let ad = document.createElement("div");
  ad.id = Math.random().toString(36).substring(2);
  ad.innerHTML = "<div style='margin: 10px auto; display: inline-block; width: 728px; height: 90px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtgAAABaCAIAAAANVraoAAAACXBIWXMAAAsTAAALEwEAmpwYAAAW5ElEQVR42u3deXQUVb4H8F9v6SULZCcJkB0EAkFIQISggMoeGISwPVCEcRlFXJ94jr4n8xhEHRUB0afC0UERUTMIiIASlghRgwGT8AAJnRBIQjbI0kmn09v7o5teqqu6Q5KiK8n39wen6t7a+n5uzvlRy72iAwVniSPMeuOmHdmu5XNS41wLVxROoVPORc8SEcX6aOfnZbpuHzFmnNao5zq1vyqYiI7t+PTE+AGutc/9NslxtTL5XG5QmW015mipbXn2PcPTJ93tuPEPeQXlRWVc583MVVOnxsz/eMj9BgaDgbOq4Gh8TISTiNHg5lCSXv5ShaTt1wZf+MIXvvCFr9d9peSlWLU/OmRiK1ftGmri6bybv8x+amEaZ3Vnd/QeG/CFL3zhC1/4tsWXx0RkuE8jEQ0Qa4/mnWOpjnW3r7FVQ0RhQ1I+juztWnsO/UgAAV/4whe+8IVvx4PHROSpyhNEdCj33C+1a2+1If6uDSeiGmW/zetYat8e3NKjutQf5603u5IH9iWxmFltdlg0GBmVIqkEvvCFL3zhC1/B+nYoEam4rrEtP3x+V+H1H5zr53ulW0jC7Y/Qdh87o3R+RtUVo0mru9ltxSwdnaPTdzzgC1/4whe+8OXbt9PuiJzK/yJ+8pPOZSaefurLE30cVxcfyXl5yQO21YIjfW3Laz5qKrl3n+PGSkLAFwFf+MIXvkLx9ZCIrFxyD8tvPunlh4CZ/k5f+pgmppSeLnIo6NvuI7O+R3Mh390bUvHxUW5qD32/07IwZPoCAXZf+MIXvvCFL3y96+shERGJRUg2/VVyt03k7l6cn1JhWfj6ow9ca9NmpIf3CSciM1v2ejjvAt8/Db7whS984Qtf74YU/fj2xKiECNfCMrU6rE8o1y41Nxoqb2jQdPBFwBcB3+6ciJj1Rq46s5mQb3f1gC98EfBFwFfIIVr9zud335nIVS2L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ddsGejXEmONJmnnDfcLX/jCF77wha+QfaV0IsW2knUk97EptzDHYMqESY6r2ft2G1t0bdy3d4jTqzR1NdXzJ6XaVhOT4pi5od5A3TdKr9nnhja36juzO8IXvvCFL3zhK2DfDr2s+mYvp1d8py2PPnbEnnX2u7evm30nzU53XD28e88/gx0upqLUsXZrbGyrVkeI2xvwhS984Qtf+PLti69mOi0mz5nqWrjqU+tC+lC0EHwR8EXAF4FEpAsG15iAGxcPefpw9MQytBB8EfBFwBeJiEtcbNJw1vn2RdO3PWbeEcBaLhFdP5De+KZ3vuGCL3wR8EXAtxPi/wFAdj2IipchAgAAAABJRU5ErkJggg==)'></div>";
  if (Math.random() < .5)
    document.body.insertBefore(ad, document.body.firstElementChild);
  else
    document.body.appendChild(ad);
},
500);

The filter example.com#$#hide-if-contains-image /^89504e470d0a1a0a0000000d49484452000002d80000005a08/ div[id] div should hide the ad but not the content.

Attachments (2)

ad.png (5.8 KB) - added by mjethani 3 weeks ago.
Ad
decoy.png (5.8 KB) - added by mjethani 3 weeks ago.
Decoy

Download all attachments as: .zip

Change History (16)

comment:1 Changed 3 weeks ago by mjethani

  • Ready set
  • Status changed from new to reviewing

comment:2 Changed 3 weeks ago by mjethani

  • Cc agiammarchi hfiguiere Ross added

comment:3 Changed 3 weeks ago by mjethani

  • Description modified (diff)

comment:4 Changed 3 weeks ago by mjethani

  • Description modified (diff)

Changed 3 weeks ago by mjethani

Ad

Changed 3 weeks ago by mjethani

Decoy

comment:5 Changed 3 weeks ago by mjethani

I have also attached the ad and decoy images so you can load them remotely over HTTP.

comment:6 Changed 3 weeks ago by abpbot

A commit referencing this issue has landed:
Issue 7088 - Implement hide-if-contains-image snippet

comment:7 Changed 3 weeks ago by mjethani

  • Review URL(s) modified (diff)

comment:8 Changed 3 weeks ago by mjethani

  • Owner changed from mjethani to agiammarchi

comment:9 Changed 3 weeks ago by abpbot

A commit referencing this issue has landed:
Issue 7088 - Implement a fetchContent smart cache/utility

comment:10 Changed 3 weeks ago by mjethani

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:12 Changed 2 weeks ago by kzar

  • Cc BrentM weissmar added

comment:13 Changed 12 days ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. This snippet seems to be working as described.

ABP 3.4.1.2204
Chrome 70 / 49 / Windows 10
Firefox 63 / 51 / Windows 10

comment:14 Changed 9 days ago by mjethani

  • Sensitive unset
Note: See TracTickets for help on using tickets.