Reloading subscriptions programmatically

Various discussions related to Adblock Plus development

Reloading subscriptions programmatically

Postby FatFrumos » Wed Oct 12, 2016 2:19 am


I'm developing a Firefox-based app that loads different whitelists for different users in addition to the EasyList. For example, user A has domain and user B has in their personal whitelist. When the app starts up, I use OS.File.write to write this information at the bottom of patterns.ini.
Sometimes, it works just fine, but sometimes, the changes don't seem to be noticed, even though, if I go to patterns.ini, the personal domain is present there.
However, when I look at the filter list in about:addons, the personal domain is missing.

I was wondering if there's a way I can programmatically trigger a rescan of subscriptions to pick the changes up. I was trying different events dispatched by FilterNotifier.emit(), such as filter.added and removed, subscription.updated, but it doesn't seem to work.

Any suggestions are very appreciated.
Posts: 1
Joined: Wed Oct 12, 2016 2:06 am

Re: Reloading subscriptions programmatically

Postby greiner » Thu Oct 20, 2016 9:51 pm

`FilterNotifier` is only notifying you of changes to the filter storage, not changes to the patterns.ini file. I'd have to check but as far as I remember the file is merely a representation of what's in memory and is usually only read on startup.

So you should look into Firefox' file system API to react to changes to the file (see also Bugzilla 958280).
User avatar
ABP Developer
Posts: 673
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Return to Adblock Plus development

Who is online

Users browsing this forum: No registered users and 2 guests