Opened on 03/23/2016 at 02:30:13 PM

Closed on 03/24/2016 at 03:26:18 PM

Last modified on 04/25/2016 at 03:07:36 AM

#3862 closed change (fixed)

Implement FilterNotifier.on(action, callback) and FilterNotifier.off(action, callback)

Reported by: sebastian Assignee: sebastian
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: trev, kzar Blocked By:
Blocking: #3868 Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29338969
https://codereview.adblockplus.org/29339038
https://codereview.adblockplus.org/29338973
https://codereview.adblockplus.org/29338976

Description

Background

Currently, there is only FilterNotifier.addListener() which adds a single-dispatch listener which is called for ever single filter event. That is inconvenient when you are only interested in particular events, inconsistent with newer APIs we recently added (#3499 and #3826), and inefficient.

What to change

Add folowing methods to the FilterStorage object:

  • FilterStorage.on(action, listener)
    • Adds a listener function that is only called for the specified filter action.
  • FilterStorage.off(action, listener)
    • Removes a listener function for the specified filter action.
  • FilterStorage.emit(action[, arg1[, arg2[, ...]]])
    • Calls all listeners for the specified filter action with the given arguments.

Adapt lib/filterListener.js and lib/antiadblockInit.js to use the new API, and mark the old API (i.e. addListener, removeListener and triggerFilters) as deprecated but make sure that they still work as before for backwards compatibility.

Attachments (0)

Change History (7)

comment:1 Changed on 03/23/2016 at 02:35:27 PM by sebastian

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed on 03/23/2016 at 05:10:58 PM by abpbot

A commit referencing this issue has landed:
https://hg.adblockplus.org/adblockpluscore/rev/047d73bc52f3

comment:3 Changed on 03/24/2016 at 11:03:50 AM by sebastian

  • Review URL(s) modified (diff)

comment:4 Changed on 03/24/2016 at 11:18:15 AM by sebastian

  • Blocking 3868 added

comment:6 Changed on 03/24/2016 at 03:26:18 PM by sebastian

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

comment:7 Changed on 04/25/2016 at 03:07:36 AM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Subscriptions are working as expected with no obvious regressions. State stays consistent between the preferences window and the first-run page.

ABP 2.7.2.4166
Firefox 38 / 44 / Windows 8
Nightly 48.0a1 (2016-04-19) / Windows 8
Firefox 38 / 44 / OS X 10.11
Firefox 45.01 / Ubuntu 14.04
Nightly 48.0a1 (2016-04-19) / Ubuntu 14.04

Add Comment

Modify Ticket

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