Opened on 02/14/2019 at 05:21:13 AM

Closed on 02/19/2019 at 04:49:45 AM

Last modified on 07/25/2019 at 01:38:10 PM

#7285 closed change (fixed)

Abstract caching logic

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

Description (last modified by mjethani)


There was a discussion in #7254 about the strategy used for caching the results of filter matching. Even if we make no changes, it would be better to abstract the caching logic into its own module so it is less prone to logical errors. We should also do more caching wherever it makes sense (e.g. checking if a request is third-party).

What to change

Abstract the current caching logic in lib/matcher.js and lib/elemHide.js into its own module.

Hints for testers

Most of this is covered by unit tests, but you could make sure that caches are getting cleared when filters are updated.

For example, use the following document:

<!DOCTYPE html>
    <div id="foo">foo</div>
    <img src="">

And add two filters:


When you load the document, the element displaying "foo" should be hidden and the image should not appear. Then remove the filters and reload the page: now "foo" should be visible and the image should appear.

Attachments (0)

Change History (6)

comment:1 Changed on 02/14/2019 at 05:37:15 AM by mjethani

  • Review URL(s) modified (diff)

comment:2 Changed on 02/18/2019 at 01:40:06 PM by abpbot

A commit referencing this issue has landed:
Issue 7285 - Abstract caching logic

comment:3 Changed on 02/19/2019 at 04:40:56 AM by mjethani

  • Owner set to mjethani
  • Priority changed from Unknown to P4
  • Ready set

comment:4 Changed on 02/19/2019 at 04:49:34 AM by mjethani

  • Description modified (diff)

comment:5 Changed on 02/19/2019 at 04:49:45 AM by mjethani

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

comment:6 Changed on 07/25/2019 at 01:38:10 PM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. Working as described.

Microsoft Edge 44.17763.1.0 / Windows 10 1809

Chrome 49.0.2623.75 / Windows 10 1809
Chrome 75.0.3770.142 / Windows 10 1809
Opera 36.0.2130.65 / Windows 10 1809
Opera 62.0.3331.72 / Windows 10 1809
Firefox 51.0 / Windows 10 1809
Firefox 68.0 / Windows 10 1809
Firefox Mobile 68.0 / Android 7.2.2

Add Comment

Modify Ticket

Change Properties
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from mjethani.
Note: See TracTickets for help on using tickets.