Opened 4 months ago

Closed 5 weeks ago

Last modified 3 weeks ago

#5094 closed change (fixed)

Hide elements with :has() filter in adblockpluschrome

Reported by: hfiguiere Assignee: hfiguiere
Priority: Unknown Milestone: Adblock-Plus-1.13.3-for-Chrome-Opera
Module: Platform Keywords:
Cc: fhd, sebastian, kzar, arthur Blocked By: #3143, #5220
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29401596/

Description (last modified by hfiguiere)

Background

With issue #3143 we added a callback to hide elements for handling the :has() pseudo class selector filter. So this need to be implemented in the addon side.

What to change

  • Update dependencies to have the patch for issue #3143. The following changes will be brought in:
    • Issue #4796 - Use a modern JS engine in the browser tests and convert all files to ECMAScript 6
    • Noissue - Updated list of recommended subscriptions
    • Issue #5287 - Change syntax for element hiding emulation filters and remove simplified element hiding syntax
    • Issue #5314 - Allow using element hiding emulation filters to hide elements with plain selectors
  • Add the callback when constructing ElemHideEmulation
  • Make sure the filter validation doesn't reject these filters. It currently does since it do a querySelector() and that triggers a DOM exception.

Note

It is not certain we'd need a callback, we could possibly perform hiding the elements directly in the content script. I assumed we do since we do the same thing to add the selectors.

Hints for testers

Things to look out for testing:

  • old domain.com##[-abp-properties="..."] filters must still work. We convert them on the fly. Checking that the equivalent with the new syntax works is a good idea.
  • Adding the new type of filters with the options page in the add-on work: they should not be rejected. Use the new selector with ## should be rejected.
  • Checking that filters with syntax error get rejected when the page is loaded: the JavaScript console display the error.
  • Checking that a #?# filter with a regular selector work and that the actual element have an inline style to hide it.

Change History (17)

comment:1 Changed 4 months ago by fhd

  • Cc fhd added

comment:2 Changed 4 months ago by hfiguiere

  • Description modified (diff)

comment:3 Changed 4 months ago by hfiguiere

  • Blocked By 3143 added

comment:4 Changed 4 months ago by hfiguiere

  • Review URL(s) modified (diff)

comment:5 Changed 4 months ago by hfiguiere

  • Owner set to hfiguiere

comment:6 Changed 4 months ago by hfiguiere

  • Status changed from new to reviewing

comment:7 Changed 4 months ago by fhd

  • Cc sebastian kzar added
  • Component changed from Unknown to Platform

comment:8 Changed 3 months ago by hfiguiere

  • Blocked By 5220 added

comment:9 Changed 6 weeks ago by hfiguiere

  • Description modified (diff)

comment:10 Changed 6 weeks ago by kzar

  • Description modified (diff)

comment:11 Changed 5 weeks ago by hfiguiere

  • Description modified (diff)

comment:12 Changed 5 weeks ago by abpbot

A commit referencing this issue has landed:
Issue 5094 - Implement support for :-abp-has() in chrome extension

comment:13 Changed 5 weeks ago by hfiguiere

  • Milestone set to Adblock-Plus-for-Chrome-Opera-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:14 Changed 5 weeks ago by arthur

  • Cc arthur added

comment:15 Changed 5 weeks ago by hfiguiere

  • Description modified (diff)

comment:16 Changed 5 weeks ago by abpbot

A commit referencing this issue has landed:
Issue 5094 - The MutationObserver callback was wrong

comment:17 Changed 3 weeks ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. The old format is converted on the fly. Can be added to the options page. Invalid selectors are reported in the log. Regular selectors work for hiding. The filters I was given on IRC using :has() had the desired effect.

ABP 1.13.2.1785
Chrome 49 / 59 / Windows 7
Opera 36 / 45 / Windows 7

Note: See TracTickets for help on using tickets.