Neither getStateOfSafariExtension nor getStateOfContentBlocker work

Can't get status of my Safari extension and content blocker on macOS Catalina. Both SFSafariExtensionManager.getStateOfSafariExtension and SFContentBlockerManager.getStateOfContentBlocker always return false.


I found few complaints about this behaviour that seem to happen after wake up from sleep. But restarting my Mac didn't help. I found no way to make those call work. But the curious thing is they were working few months ago, on earlier Catalina versions.


Any suggestions why this might be happening?

Replies

Do you use Safari Technology Preview? Or was this on regular Safari?


To help understand more, I'll need a sample app that can reproduce the issue and a sysdiagnose.


Are you testing with unsigned extensions?

Thank you for reaching out.
I found the issue, and it had nothing to with Safari. The problem was me, misusing Combine: I wrapped calls to SFSafariExtensionManager.getStateOfSafariExtension and SFContentBlockerManager.getStateOfContentBlocker in Future<> and didn't keep AnyCancellable which was produced as the result. Thus, the result of the operation never made it to the state.


Curiously, I remember the same code working before. Maybe during Beta times, there might have been a bug when a Combine chain wasn't disposed immediately. So I started looking into it thinking nothing is wrong with my code 🙂 Everything is fixed now.


Thank you.