Reloading subscriptions programmatically

Various discussions related to Adblock Plus development
Post Reply
FatFrumos
Posts: 1
Joined: Wed Oct 12, 2016 2:06 am

Reloading subscriptions programmatically

Post by FatFrumos »

Hi.

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 test.com and user B has mytest.com 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.
Thanks!
Luka
User avatar
greiner
ABP Developer
Posts: 899
Joined: Mon Sep 03, 2012 5:29 pm
Location: Cologne, Germany

Re: Reloading subscriptions programmatically

Post by greiner »

`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).
Post Reply