Opened 12 months ago

Closed 12 months ago

Last modified 8 months ago

#7074 closed change (fixed)

Keep filter objects in ElemHideEmulation and Snippets modules

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

https://codereview.adblockplus.org/29929561/

Description (last modified by mjethani)

Background

In lib/elemHideEmulation.js and lib/snippets.js, the add and remove functions add and remove the text of the filter rather than the filter object itself. It's not clear why this was done originally in lib/elemHideEmulation.js, but it doesn't make any sense to create a new filter object each time the filters are looked up. It never made sense for snippets and was only done to stay consistent with element hiding emulation.

What to change

In lib/elemHideEmulation.js and lib/snippets.js, save filter objects directly instead of saving just the filter text.

Hints for testers

Test that element hiding emulation and snippet filters work correctly.

Here's a test document:

<!DOCTYPE html>
<div id="ad">This is an ad.</div>

The filter localhost#?#div:-abp-contains(This is an ad) should hide the ad. Once the filter is removed and the page is refreshed, the ad should no longer be hidden. Similarly, the filter localhost#$#log 'Hello snippets' should print out Hello snippets to the console. Once the filter is removed and the page is refreshed, Hello snippets should not appear in the console.

Change History (6)

comment:1 Changed 12 months ago by mjethani

  • Summary changed from Save filter objects directly in ElemHideEmulation and Snippets modules to Keep filter objects in ElemHideEmulation and Snippets modules

comment:2 Changed 12 months ago by abpbot

A commit referencing this issue has landed:
Issue 7074 - Keep filter objects instead of text

comment:3 Changed 12 months ago by mjethani

  • Description modified (diff)

comment:4 Changed 12 months ago by mjethani

  • Resolution set to fixed
  • Review URL(s) modified (diff)
  • Status changed from new to closed

comment:5 Changed 9 months ago by abpbot

A commit referencing this issue has landed:
Issue 7074 - Keep filter objects instead of text

comment:6 Changed 8 months ago by ukacar

  • Verified working set
Note: See TracTickets for help on using tickets.